offsite 0.0.94 → 0.0.96
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/apps/client/dist/assets/{XIcon-CDJz0EhT.js → XIcon-sNE7wlGT.js} +4 -4
- package/apps/client/dist/assets/{audio-player-CEvt4CVB.js → audio-player-DosgEDBw.js} +1 -1
- package/apps/client/dist/assets/{button-CWFREsRn.js → button-BnzxfmO3.js} +1 -1
- package/apps/client/dist/assets/diff-panel-D9sGyf1Y.js +260 -0
- package/apps/client/dist/assets/{dist-C_Y10kCd.js → dist-DNx_j6Py.js} +1 -1
- package/apps/client/dist/assets/{editor-dialog-CEMtEtdH.js → editor-dialog-De_ijtFY.js} +7 -7
- package/apps/client/dist/assets/{image-viewer-3S4rNjFt.js → image-viewer-DuyADV75.js} +1 -1
- package/apps/client/dist/assets/index-9ox1jth4.js +72 -0
- package/apps/client/dist/assets/index-dtN3QMc8.css +2 -0
- package/apps/client/dist/assets/panel-close-button-yIEA8ujQ.js +1 -0
- package/apps/client/dist/assets/{preview-dialog-BuSSuMeQ.js → preview-dialog-CPV2cjGd.js} +2 -2
- package/apps/client/dist/assets/{react-BgpkckXP.js → react-aDzERmfM.js} +1 -1
- package/apps/client/dist/assets/{tooltip-CKPboHje.js → tooltip-CU6Gh-yj.js} +1 -1
- package/apps/client/dist/assets/{use-editor-shortcut-auobREOP.js → use-editor-shortcut-BoixVvhO.js} +26 -26
- package/apps/client/dist/assets/{utils-U6QfaJBO.js → utils-Cih_T9uV.js} +1 -1
- package/apps/client/dist/assets/{video-viewer-gcKzQe3N.js → video-viewer-DbYvGHLh.js} +1 -1
- package/apps/client/dist/assets/zoomable-image-D0X1OvmT.js +1 -0
- package/apps/client/dist/assets/{zoomable-image-BD-kkiyn.js → zoomable-image-D6TeXYQ9.js} +1 -1
- package/apps/client/dist/index.html +10 -10
- package/apps/client/dist/sw.js +1 -1
- package/apps/server/dist/main.mjs +582 -150
- package/apps/server/dist/main.mjs.map +1 -1
- package/apps/server/drizzle/20261108212949_last_efforts/migration.sql +6 -0
- package/apps/server/drizzle/20261108212949_last_efforts/snapshot.json +495 -0
- package/package.json +1 -1
- package/apps/client/dist/assets/diff-panel-CeJqpNi8.js +0 -260
- package/apps/client/dist/assets/index-B7o5cqzG.js +0 -72
- package/apps/client/dist/assets/index-BwL3keyv.css +0 -2
- package/apps/client/dist/assets/panel-close-button-Bf-0TdmN.js +0 -1
- package/apps/client/dist/assets/zoomable-image-_HGrW8wW.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{c as n,l as r,r as i}from"./utils-U6QfaJBO.js";function a(e){return e[e.length-1]}function o(e,t){return typeof e==`function`?e(t):e}var s=Object.prototype.hasOwnProperty;function c(e){for(let t in e)if(s.call(e,t))return!0;return!1}var l=()=>Object.create(null),u=(e,t)=>d(e,t,!0);function d(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(f(e)&&f(t)))return t;let o=Object.keys(e),c=o.length,u=Object.keys(t),p=u.length;if(i?c!==e.length||p!==t.length||c&&a(o)!==`${c-1}`||p&&a(u)!==`${p-1}`:c!==Object.getOwnPropertyNames(e).length||p!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let m=0,h,g,_;if(i){for(;m<p&&(_=m,g=e[_],h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h,h===g);m++);if(m===p&&c===p)return e}else{let i=c===p,a=!0;for(;m<p;m++){_=u[m],g=e[_];let c=t[_];h=g===c?g:typeof g==`object`?d(g,c,n,r):c,i&&=h===g&&(o[m]===_||s.call(e,_)),a&&=Object.is(h,c),o[m]=h}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(a)return t}let v=i?u.fill(0):n?l():{};for(let a=0;a<p;a++)_=i?a:u[a],i?(g=e[_],a>m&&(h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h),v[_]=a<m?g:h):v[_]=o[a];return v}function f(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function p(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!p(a,o,n,r))return!1}return!0}if(f(e)&&f(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!p(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!p(e[a],t[a],n,r)))return!1;return i===0}return!1}var m=/[\x00-\x1f\x7f"<>`{}]/g;function h(e){return e.replace(m,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function g(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return h(t)}var _=[`http:`,`https:`,`mailto:`,`tel:`];function v(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var y=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function b(e,t){if(!e)return!1;if(y.test(e))return!0;let n=v(e);return n?!t.has(n):!1}function x(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=g(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=g(r?e.slice(r):e)}return t}function S(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function C(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function w(){throw Error(`Invariant failed`)}function T(e){return e.replace(/\/{2,}/g,`/`)}function E(e){return e===`/`?e:e.replace(/^\/+/,``)}function D(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function ee(e){return D(E(e))}function te(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ne(e,t,n=`never`,r){if(t.includes(`//`)&&(t=T(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,o;if(r){o=i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else{for(e.includes(`//`)&&(e=T(e)),s=e.split(`/`);s.length>1&&a(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(a(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=s.join(`/`),l=(i?T(c):c)||`/`;return o&&r&&r.set(o,l),l}function re(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function ie(e){return e==null||e===``}function ae(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function oe(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&ie(f)){if(c===`/`&&!d)continue;f=``}o+=c+ae(s,f,r)+(d||``)}}return o+a||`/`}function O(e){return e?.isNotFound===!0}function se(){try{return sessionStorage}catch{return}}var ce=`tsr-scroll-restoration-v1_3`,le=se();function ue(){try{return JSON.parse(le?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var de=ue(),fe=`data-scroll-restoration-id`,pe=e=>e.state.__TSR_key||e.href;function me(e){let t=e.getAttribute(fe);if(t)return`[${fe}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var he=!1,ge=`window`;function _e(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function ve(e){let t=new Set;for(let n of e){if(n===ge)continue;let e=_e(n);e&&t.add(e)}return t}function ye(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||pe,a=new Set,o=e=>{let t=de[e]||={};for(let e of a)e===document?t[ge]={scrollX,scrollY}:e.isConnected&&(t[me(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,he=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{he||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{le?.setItem(ce,JSON.stringify(de))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),r.r||(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=de[d];if(e){let t=de[u];for(let n in e){if(n===ge){if(s)continue}else{let e=_e(n);if(!e||s&&o&&(l??=ve(o),l.has(e)))continue}t||=de[u]={},t[n]??=e[n]}}}he=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=ve(o));let t=e&&i&&c,s=r.e?de[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===ge){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=_e(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{he=!1}}))}function be(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function xe(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Se(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=xe(r):Array.isArray(t)?t.push(xe(r)):n[e]=[t,xe(r)]}return n}var Ce=/^(?:\s|["[{\d-]|fa|nu|tr)/,we=Ee(JSON.parse),Te=De(JSON.stringify,JSON.parse);function Ee(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=Se(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!Ce.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function De(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!Ce.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=be(e,r);return t?`?${t}`:``}}var Oe=`__root__`;function ke(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ae(e){return e instanceof Response&&!!e.options}function je(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var Me=4,Ne=5;function Pe(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function Fe(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function Ie(e,t,n,r,i,o){let s=n,c=t.fullPath??t.from,l=t.options,u=c.length,d=c.endsWith(`/`)?u-1:u,f=l?.caseSensitive??e,p=l?.params?.parse??l?.parseParams,m,h=o?n-1:0;if(!r||c.includes(`$`)){m=o?.slice()??[];let e=a(m);e&&typeof e!=`string`&&e[0]===2&&(m[m.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+c.substring(n-(c[n-2]===`/`?2:1),d)],h=u)}for(;s<u;){let e=s,t=c.indexOf(`/`,e),n=t===-1?u:t,a=Fe(c,e,n);s=n+1;let o;if(typeof a==`string`){if(!r)continue;let e=a,t;f?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)o=n;else{let n=Re(r);o=n,t.set(e,n)}}else{let t=a[0],l=a[2],g=a[3]??``;if(t===2&&(n=u,s=n+1),m&&h<n&&(h<e-1&&m.push(c.slice(h,e-1)),a[2]=`/`+l,t===2&&a[3]!==void 0&&d<u&&(a[3]=g.slice(0,-1)),m.push(a),h=n),!r)continue;let _=f&&!!(l||g);f||(l=l.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!p&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===l&&e.suffix===g);if(y)o=y;else{let e=Re(r,t,_,l,g);o=e,v.push(e),v.length===2&&i?.push(v)}}r=o}m&&h<d&&m.push(c.slice(h,d));let g=m?.slice();if(!r)return g;if(p&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Re(r,Ne);(r.pathless??=[]).push(e),r=e}let _=(t.path||!t.children)&&!t.isRoot;if(_&&d<u){let e=Re(r,Me);r.index=e,r=e}return r.parse=p??null,r.priority=l?.params?.priority??0,r.route||(r.data=g,_&&(r.route=t)),[r,s,g]}function Le(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Re(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function ze(e,t){let n=Re(),r=[];function i(e,t,n,a){let[o,s,c]=Ie(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Le);t.masksTree=n,t.flatCache=je(1e3)}function Be(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=We(e,t.masksTree);return t.flatCache.set(e,r),r}function Ve(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Re(),Ie(t,{from:e},1,o),i.singleCache.set(a,o)),We(r,o,n)}function He(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=We(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Ke(a.route)),t.matchCache.set(r,a),a}function Ue(e,t=!1){let n=Re(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&w(),i[e.id]=e,o!==0&&e.path){let t=D(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Ie(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Le);return{processedTree:{segmentTree:n,singleCache:je(1e3),matchCache:je(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function We(e,t,n=!1){let r=e.split(`/`),i=Je(e,r,t,n);if(!i)return null;let[a]=Ge(e,r,i);return{route:i.node.route,rawParams:a}}function Ge(e,t,n){let r=qe(n.node),i=n.node.data&&Pe(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===Me)break;if(u.kind===Ne){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Ke(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Je(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!a(t),o=i&&e!==`/`,s=t.length-+!!i,c=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;c.length;){let n=c.pop(),{node:i,index:a,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!Qe(u,n))continue;if(i.parse){if(!Ze(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Me&&Qe(l,n)&&(l=n);let _=a===s;if(_&&(i.route&&(!o||i.kind===Me||i.kind===2)&&Qe(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[a],y;if(_&&i.index){let n={node:i.index,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Ze(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Xe(f,s))return n;Qe(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:o}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(o){if(_)continue;let e=t.slice(a).join(`/`),i=e.slice(-o.length);if((n.caseSensitive?i:i.toLowerCase())!==o||e.length-o.length<r.length)continue}c.push({node:n,index:s,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];c.push({node:n,index:a,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p,optionals:m+Ye(s,a),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p+Ye(s,a),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ye(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ye(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];c.push({node:t,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function Ye(e,t){return 2**(e-t-1)}function Xe(e,t){return e===2**(t-1)-1}function Ze(e,t,n){let r,i;try{[r,i]=Ge(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Qe(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Me)>(e.node.kind===Me)||t.node.kind===Me==(e.node.kind===Me)&&t.node.depth>e.node.depth)))}function $e(e,t,n){let r=ee(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=T(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>et(n,s.input({url:e})),output:({url:e})=>s.output({url:tt(n,e)})}:s}function et(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function tt(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function nt(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{C(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var rt=`__TSR_index`,it=`popstate`,at=`beforeunload`,ot=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function st(e){let t=ot.exec(e);return t?`/`+e.slice(t[0].length):e}function ct(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
2
|
-
\r`.includes(e)?``:encodeURIComponent(e))),st(e)}function lt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=ft(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[rt];i=ut(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[rt];i=ut(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[rt]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function ut(e,t){let n=pt();return{...t,key:n,__TSR_key:n,[rt]:e}}function dt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>ct(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>ft(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=pt();t.history.replaceState({[rt]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=ft(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[rt]-l.state[rt],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=lt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(at,x,{capture:!0}),t.removeEventListener(it,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(at,x,{capture:!0}),t.addEventListener(it,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function ft(e,t){let n=ct(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=pt();t={[rt]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function pt(){return(Math.random()+1).toString(36).slice(7)}function mt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function ht(e){return e.pathname+e.search+e.hash}function gt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function _t(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function vt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function yt(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function bt(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var xt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:dt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&ee(n)?$e(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=nt(this.latestLocation,e),ye(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Ue(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&ze(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:je(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:x(e),external:!1,searchStr:o,search:u(t?.search,i),hash:x(r.slice(1)),state:d(t?.state,a)}}let o=et(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:x(st(o.pathname)),external:!!this.rewrite&&mt(o,this.origin),searchStr:c,search:u(t?.search,s),hash:x(o.hash.slice(1)),state:d(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=He(D(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=ft(n.href,{});n={...n,to:et(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,u=ne(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),d=this.routesByPath[D(u)],f=u.includes(`$`),p;if(d)p=d._branch??=Ke(d);else if(f)p=[];else{let[e,t,n]=this.getMatchedRoutes(u);p=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(p=[...p,this.options.notFoundRoute])}let m=f?d?._interpolation??Ie(!1,{fullPath:u},0):void 0,h;for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(h??=Et(n.params,e),!c(h))break;h===e&&(h=Object.assign(l(),h));try{Object.assign(h,t(h))}catch{}}}h??=Et(n.params,Dt(n.params,m)?o()[3]:Ot);let g=e.leaveParams?u:st(x(m?oe(u,m,h,this.pathParamsDecoder):u)),_=kt(p,e._includeValidateSearch),v=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,Tt(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},y=_.length?At(_,v(),n):n.search===!0?v():typeof n.search==`function`?n.search(v()):n.search||Ot,b=this.options.stringifySearch(y),C=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,w=C?`#${C}`:``,T=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:Ot,E=`${g}${b}${w}`,ee,te,re=!1;if(this.rewrite){let e=new URL(E,this.origin),t=e.origin,n=tt(this.rewrite,e);ee=ht(e),mt(n,t)?(te=n.href,re=!0):te=st(ht(n))}else ee=S(E),te=ee;return{publicHref:te,href:ee,pathname:g,search:y,searchStr:b,state:T,hash:C??``,external:re,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Be(r.pathname,this.processedTree);if(t){let i=Object.assign(l(),t.rawParams),{from:a,params:o,...s}=t.route,c=Et(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return St(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=D(this.latestLocation.href)===D(n.href)&&p(vt(n.state),vt(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?v(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return St(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Sn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(_t(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&>(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(y.test(n)||(r=v(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:mt(e,this.origin)||(n=ht(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Ft,this.preloadRoute=e=>Cn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?ne(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ve(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!p(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?p(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=re(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Te,parseSearch:e.parseSearch??we,protocolAllowlist:e.protocolAllowlist??_}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=Ie(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:D(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?jt(this.options.notFoundMode,a):void 0,c=Array(a.length),f=this._committed,p=(e,t)=>{let n=f[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?f.find(t=>t.routeId===e.id):void 0},m;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],f,h,g;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=Tt(i.options.validateSearch,{...n})??void 0;f={...n,...e},h={...r,...e}}catch(e){let r=e;if(e instanceof Ct||(r=new Ct(e.message,{cause:e})),t?.throwOnError)throw r;f=n,h={},g=r}}let _=``,v=``;try{_=i.options.loaderDeps?.({search:f})??``,v=_&&JSON.stringify(_)||``}catch(e){if(t?.throwOnError)throw e;g??=e}let y=l(),b=i._interpolation?oe(i.fullPath,i._interpolation,r,this.pathParamsDecoder,y):i.fullPath,x=i.id+b+v,S=p(i,n),C=this._cache.get(x)??(S?.id===x?S:void 0);m=C?._strictParams??Object.assign(y,m);let w;if(!C)try{Mt(i,m)}catch(e){if(w=O(e)||Ae(e)?e:new wt(e.message,{cause:e}),t?.throwOnError)throw w}let T=S?`stay`:`enter`,E;if(C)E={...C,cause:T,search:u(S?S.search:C.search,f),_strictSearch:h,searchError:g};else{let e=gt(i)?`pending`:`success`;E={id:x,ssr:i.options.ssr,index:n,routeId:i.id,params:S?.params??m,_strictParams:m,pathname:b,updatedAt:Date.now(),search:S?u(S.search,f):f,_strictSearch:h,searchError:g,status:e,isFetching:!1,error:void 0,paramsError:w,context:{},abortController:t?._controller??new AbortController,cause:T,loaderDeps:S?d(S.loaderDeps,_):_,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let D=s===i.id;E._notFound&&!D&&(E.error=void 0),E._notFound=D,c[n]=E}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?u(n.params,m):m,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=a(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[o,s]=this.getMatchedRoutes(e.pathname),c=a(o),l={...e.search};for(let e of o)try{Object.assign(l,Tt(e.options.validateSearch,l))}catch{}let u=n&&n.routeId===c.id&&n.pathname===e.pathname,d;if(u)d=n.params;else{let e=s;for(let t of o)try{Mt(t,e)}catch{}d=e}let f=[o,c.fullPath,l,d];return this.lightweightCache.set(e,[r,f]),f}};async function St(e,t,{replace:n,ignoreBlocker:r}){if(!b(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Ct=class extends Error{},wt=class extends Error{};function Tt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ct(`Async validation not supported`);if(n.issues)throw new Ct(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Et(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function Dt(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!s.call(e,t[1]))}var Ot=Object.freeze({});function kt(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=Tt(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function At(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=o(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function jt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Oe}function Mt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Nt(e,t){return e.options[t]?.preload?.()}function Pt(e,t){let n=Nt(e,`component`),r=Nt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Ft(e,t,n){let r=()=>t===!1?void 0:t?Nt(e,t):Pt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function It(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function Lt(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var Rt=0,zt=1,Bt=2,k=3,Vt=[4];function Ht(e){return typeof e[0]==`number`}function Ut(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Wt(e,t){return e.routesById[t.routeId]}function Gt(e,t,n){return Ae(e)?[k,e]:O(e)?(e.routeId||=n,[Bt,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[zt,e]):[Rt,e]}function Kt(e,t){let n=Gt(t,!0,e.id);if(n[0]!==zt)return n;try{e.options.onError?.(n[1])}catch(t){n=Gt(t,!0,e.id)}return n}function qt(e,t,n,r,i){return i[0].signal.aborted?Vt:ln(e,t,n,Kt(n,r),i)}async function Jt(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Wt(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Xt(e,r),[i,qt(e,t,u,a,n)]}if(c.aborted)return[i,Vt];let p=r.paramsError??r.searchError;if(p!==void 0)return Xt(e,r),[i,qt(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Qt(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Ut(a,c):a);if(c.aborted)return[i,Vt];let s=ln(e,t,u,Gt(o,!1,u.id),n);if(s[0]!==Rt)return Xt(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Xt(e,r),[i,qt(e,t,u,a,n)]}finally{r.status=h,Qt(e,r,!1,n[0])}}i()}function Yt(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Xt(e,t){let n=t._flight;t._flight=void 0,Yt(e,t,n)?.abort()}function A(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Yt(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Zt(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Qt(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function $t(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function en(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Vt;if(!i)return[Rt,void 0];let l=n._flight;Qt(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i($t(e,t,n,r,s,a,!!o[3]))).then(e=>Gt(e,!1,r.id),e=>Gt(e,!0,r.id)).then(t=>(t[0]!==Rt&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===zt&&l[2]?Kt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],ln(e,t,r,await Ut(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Xt(e,n),Vt}finally{Qt(e,n,!1,s)}}function tn(e,t,n){t[0]!==k&&(e.status=`success`,e.error=void 0,t[0]===Rt?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function nn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Xt(e,r)}function rn(e,t){return t[0]===zt||t[0]===Bt?{...e,status:t[0]===zt?`error`:`notFound`,error:t[1],_flight:void 0}:e}function an(e,t,n,r,i,a,o){let s=t[1][n],c=Wt(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d($t(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Vt)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Xt(e,s),p=qt(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Yt(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?en(e,t,s,c,g,i,a).then(t=>(tn(s,t,l),t[0]===Rt&&(m&&!a[0].signal.aborted&&nn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Rt,s.loaderData]),T=(async()=>{try{let e=Ft(c,void 0,C);e&&await Ut(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,qt(e,t,c,r,a)]}let r=await w;x&&r[0]===Rt&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>rn(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=en(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,tn(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>rn(E,e))}async function on(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Wt(e,t[n]);try{let e=Ft(i,!1);e&&await Ut(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function sn(e,t){t[2]&&=(A(e,t[2].map(e=>e[3])),void 0)}async function cn(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=k)throw[a,t];!i&&t[0]!==Rt&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===k)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function ln(e,t,n,r,i,a){for(;r[0]===k;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[k,t]:[k,t,a]}return[k,o,n]}catch(e){r=a?[zt,e]:Kt(n,e),a=!0}}return r}async function un(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===Bt?on(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=k)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Rt&&t[0]<k&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=k){let n=s[1];if(n[0]!==k||n[1].options.reloadDocument||n[2])return sn(e,t),n;c=!0,s=[0,[zt,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===zt?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Wt(e,u);try{await Ut(i?Promise.resolve().then(()=>Ft(m,l===zt?`errorComponent`:`notFoundComponent`)):Promise.all([Ft(m),Ft(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return sn(e,t),Vt}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),sn(e,t),A(e,o),p()):u.status=`success`}return t}async function dn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Wt(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Ut(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function fn(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await on(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=an(e,i,t,u,f,r,l)},m=await Jt(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Bt){let t=await on(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=k&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=un(e,i,u,r[0],cn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=cn(i[2],void 0,void 0,h.then(e=>Ht(e)?0:It(n).length,()=>0))),o=await h}catch(t){if(sn(e,i),t===a&&a.aborted)return Vt;throw t}return Ht(o)?o:dn(e,o,a,r[6]===n.length?r[6]:0)}function pn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Wt(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>pn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function mn(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function hn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!It(t[3]).some(e=>e.id===n[1]))return;let i;try{await Ut(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function gn(e,t){e._committed=t,e.stores.setMatches(t)}function _n(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=It(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Wt(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=yt(n);gn(e,n),A(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),bt(e,i,n,a,l,t)}async function vn(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function yn(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function bn(e,t,n,r,i){let a=n.map(e=>({...e}));Zt(a);for(let t of r)Xt(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await un(e,o,r,t[0],i)}catch(t){throw A(e,a),t}if(Ht(s))A(e,a),s[0]===k&&e._tx===t&&e._committed===n&&await yn(e,t,s);else if(await dn(e,s,t[0].signal),e._tx!==t||e._committed!==n)A(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Xt(e,n))}gn(e,a),A(e,n,a)}}async function xn(e,t,n,r,i,a){let o=await fn(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Ht(o)){let n=o[0]===k&&e._tx===t;if((!n||o[1].options.reloadDocument)&&mn(e,t),A(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){mn(e,t);return}await yn(e,t,o);return}let s=o[1];if(e._tx===t&&await hn(e,t),e._tx!==t){mn(e,t),A(e,s),sn(e,o);return}let c=t[2],l=_t(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await hn(e,t),e._tx!==t){mn(e,t),A(e,s),sn(e,o);return}let n=await e.startTransition(()=>{mn(e,t),_n(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&bn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):sn(e,o)})}async function Sn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=_t(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await vn(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Zt(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){A(e,m),await vn(e,n);return}e._preflight=void 0;let g,_=()=>xn(e,y,f,()=>pn(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>vn(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Qt(e,t,!1)}n[0].abort(),A(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&pn(e,y),g?.(_()),await y[5]):(A(e,y[3]),y[3]=[],g?.(),await vn(e,y))}async function Cn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Zt(a),o=(e._preloads??=new Map).set(i,a),s=await fn(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),A(e,a)),i.abort()}if(!Ht(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){O(e)||console.error(e);return}}}var wn=`Error preloading route! ☝️`,Tn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Oe:this.parentRoute||w();let r=n?Oe:t?.path;r&&r!==`/`&&(r=E(r));let i=t?.id||r,a=n?Oe:T((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:T(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=D(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>ke({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},En=class extends Tn{constructor(e){super(e)}},j=e(r(),1),Dn=j.createContext(null);function On(e){return j.useContext(Dn)}function kn(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{Lt(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var An=j.createContext(void 0),jn=j.createContext(void 0);function Mn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Nn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Pn=[],Fn=0,{link:In,unlink:Ln,propagate:Rn,checkDirty:zn,shallowPropagate:Bn}=Mn({update(e){return e._update()},notify(e){Pn[Hn++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Kn(e))}}),Vn=0,Hn=0,Un,Wn=0;function Gn(e){try{++Wn,e()}finally{--Wn||qn()}}function Kn(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ln(n,e)}function qn(){if(!(Wn>0)){for(;Vn<Hn;){let e=Pn[Vn];Pn[Vn++]=void 0,e.notify()}Vn=0,Hn=0}}function Jn(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Un!==void 0&&In(i,Un,Fn),i._snapshot},subscribe(e){let t=Nn(e),n={current:!1},r=Yn(()=>{i.get(),n.current?(Un=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Un,o=t?.compare??Object.is;if(n)Un=i,++Fn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Un=a,n&&(i.flags&=-5),Kn(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&zn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Bn(e)}}else e&32&&(i.flags=e&-33);return Un!==void 0&&In(i,Un,Fn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Rn(e),Bn(e),qn())}},i}function Yn(e){let t=()=>{let t=Un;Un=n,++Fn,n.depsTail=void 0,n.flags=6;try{return e()}finally{Un=t,n.flags&=-5,Kn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&zn(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Kn(this)}};return t(),n}var Xn=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Zn=t(((e,t)=>{t.exports=Xn()})),Qn=t((e=>{var t=r(),n=Zn();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),$n=t(((e,t)=>{t.exports=Qn()}))();function er(e,t){return e===t}function tr(e,t=e=>e,n){let r=n?.compare??er,i=(0,j.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,j.useCallback)(()=>e.get(),[e]);return(0,$n.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var nr={};function rr(e,t){let n=j.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=d(n.current,i):i}}function ir(e){let t=On(),n=j.useContext(e.from?jn:An),r=e.from??n,i=t.stores.getMatchStore(r),a=rr(e,t),o=tr(i,e=>e?a(e):nr);if(o!==nr)return o;(e.shouldThrow??!0)&&w()}function ar(e){return ir({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function or(e){let{select:t,...n}=e;return ir({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function sr(e){return ir({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function cr(e){return ir({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function lr(e){let t=On();return j.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ur(e){return ir({...e,select:t=>e.select?e.select(t.context):t.context})}var dr=n();function fr(...e){let t=j.useRef(e),n=t.current;return e.forEach((e,t)=>{p(n[t],e,!1,!0)||(n[t]=e)}),t.current}function pr(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(wn)})}function mr(e,t){let n=typeof e==`string`&&v(e);if(n)return t.has(n)?e:null}function hr(e,t,n,r){let i=te(e.pathname,r),a=te(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!p(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function gr(e,t,n){let r=On(),i=j.useRef(null),a=j.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[y,b,x]=fr(e.search,e.params,o),S=j.useContext(An),C=(r.stores._linkScopes??={})[S]??=kn(r,S),[w,T,E]=j.useMemo(()=>{let t=mr(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=C[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=wr(t,r,u),s=u||o&&!v(o)?hr(e,t,x,r.basepath):void 0;a&&a[0]===o&&a[1]===s||(a=[o,s]),i=e}return a};return[n,c,x?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,C,e.from,e.hash,e.href,s,y,b,e.state,e.mask,e.unsafeRelative,x,u]),[D,ee]=j.useSyncExternalStore(C[1],T,E||T),te=ee===void 0&&D,ne=u||D===void 0,re=j.useRef(!1),ie=e.reloadDocument||te||ne?!1:c??r.options.defaultPreload,ae=l??r.options.defaultPreloadDelay??0,oe=j.useCallback(e=>{let t=e?.isIntersecting;t??ie===`intent`?ae?i.t??=setTimeout(()=>{i.t=void 0,pr(r,w)},ae):pr(r,w):t===!1&&Sr(i)},[r,w,i,ie,ae]);j.useEffect(()=>{if(!ie)return;ie===`render`&&!re.current&&(re.current=!0,pr(r,w));let e=!0,t;return ie===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&oe(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Sr(i)}},[r,w,ie,oe,i]);let O=br(e,n);if(O.ref=t?a:i,te)return O.href=te,O;let se=t=>{let n=d??t.currentTarget.getAttribute(`target`);ne||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||n&&n!==`_self`||t.button!==0||(t.preventDefault(),Sr(i),r.navigate({...e,_fromLocation:w._fromLocation}))},ce=()=>{ie===`intent`&&pr(r,w)},le=()=>{ie===`intent`&&Sr(i)};return O.onClick=Cr(f,se),O.onBlur=Cr(p,le),O.onFocus=Cr(m,oe),O.onMouseEnter=Cr(h,oe),O.onMouseLeave=Cr(g,le),O.onTouchStart=Cr(_,ce),xr(O,e,ee,D,ne,n)}var _r={},vr={className:`active`},yr=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function br(e,t){let n={};for(let r in e)yr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function xr(e,t,n,r,i,a){let{activeProps:s,inactiveProps:c,className:l,style:u,target:d}=t,f=o(n?s:c,{})??(n?vr:_r);Object.assign(e,f),e.href=r,a!==`a`&&(e.disabled=i),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var Sr=e=>{clearTimeout(e.t),e.t=void 0},Cr=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function wr(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!b(i,t.protocolAllowlist))return i}var Tr=j.memo(j.forwardRef((e,t)=>{let n=e._asChild||`a`,r=gr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return j.createElement(n,r,i)}),Er);function Er(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!yr.has(r)||!p(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var Dr=class extends Tn{constructor(e){super(e),this.useMatch=e=>ir({...e,from:this.id}),this.useRouteContext=e=>ur({...e,from:this.id}),this.useSearch=e=>cr({...e,from:this.id}),this.useParams=e=>sr({...e,from:this.id}),this.useLoaderDeps=e=>or({...e,from:this.id}),this.useLoaderData=e=>ar({...e,from:this.id}),this.useNavigate=()=>lr({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,dr.jsx)(Tr,{ref:t,from:this.fullPath,...e}))}};function Or(e){return new Dr(e)}var kr=class extends En{constructor(e){super(e),this.useMatch=e=>ir({...e,from:this.id}),this.useRouteContext=e=>ur({...e,from:this.id}),this.useSearch=e=>cr({...e,from:this.id}),this.useParams=e=>sr({...e,from:this.id}),this.useLoaderDeps=e=>or({...e,from:this.id}),this.useLoaderData=e=>ar({...e,from:this.id}),this.useNavigate=()=>lr({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,dr.jsx)(Tr,{ref:t,from:this.fullPath,...e}))}};function Ar(e){return new kr(e)}var jr=e=>({createMutableStore:Jn,createReadonlyStore:Jn,batch:Gn}),Mr=e=>new Nr(e),Nr=class extends xt{constructor(e){super(e,jr)}},Pr=`global`;function Fr(e,t,n){let r=new Uint8Array(5+n.length);return r[0]=e,new DataView(r.buffer).setUint32(1,t),r.set(n,5),r}function Ir(e){if(e.length<5)throw Error(`terminal frame is too short`);return{kind:e[0],id:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(1),data:e.subarray(5)}}var M={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},Lr={silent:{level:-1},fatal:{level:M.fatal},error:{level:M.error},warn:{level:M.warn},log:{level:M.log},info:{level:M.info},success:{level:M.success},fail:{level:M.fail},ready:{level:M.info},start:{level:M.info},box:{level:M.info},debug:{level:M.debug},trace:{level:M.trace},verbose:{level:M.verbose}};function Rr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function zr(e,t,n=`.`,r){if(!Rr(t))return zr(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:Rr(a)&&Rr(i[t])?zr(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function Br(e){return(...t)=>t.reduce((t,n)=>zr(t,n,``,e),{})}var Vr=Br();function Hr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ur(e){return!(!Hr(e)||!e.message&&!e.args||e.stack)}var Wr=!1,Gr=[],N=class e{options;_lastLog;_mockFn;constructor(e={}){let t=e.types||Lr;this.options=Vr({...e,defaults:{...e.defaults},level:Kr(e.level,t),reporters:[...e.reporters||[]]},{types:Lr,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let e in t){let n={type:e,...this.options.defaults,...t[e]};this[e]=this._wrapLogFn(n),this[e].raw=this._wrapLogFn(n,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=Kr(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){Wr=!0}resumeLogs(){Wr=!1;let e=Gr.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(Wr)Gr.push([this,e,n,t]);else return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:new Date,args:[],...e,level:Kr(e.level,this.options.types)};!n&&t.length===1&&Ur(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{l as n,r,u as i}from"./utils-Cih_T9uV.js";function a(e){return e[e.length-1]}function o(e,t){return typeof e==`function`?e(t):e}var s=Object.prototype.hasOwnProperty;function c(e){for(let t in e)if(s.call(e,t))return!0;return!1}var l=()=>Object.create(null),u=(e,t)=>d(e,t,!0);function d(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(f(e)&&f(t)))return t;let o=Object.keys(e),c=o.length,u=Object.keys(t),p=u.length;if(i?c!==e.length||p!==t.length||c&&a(o)!==`${c-1}`||p&&a(u)!==`${p-1}`:c!==Object.getOwnPropertyNames(e).length||p!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let m=0,h,g,_;if(i){for(;m<p&&(_=m,g=e[_],h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h,h===g);m++);if(m===p&&c===p)return e}else{let i=c===p,a=!0;for(;m<p;m++){_=u[m],g=e[_];let c=t[_];h=g===c?g:typeof g==`object`?d(g,c,n,r):c,i&&=h===g&&(o[m]===_||s.call(e,_)),a&&=Object.is(h,c),o[m]=h}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(a)return t}let v=i?u.fill(0):n?l():{};for(let a=0;a<p;a++)_=i?a:u[a],i?(g=e[_],a>m&&(h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h),v[_]=a<m?g:h):v[_]=o[a];return v}function f(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function p(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!p(a,o,n,r))return!1}return!0}if(f(e)&&f(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!p(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!p(e[a],t[a],n,r)))return!1;return i===0}return!1}var m=/[\x00-\x1f\x7f"<>`{}]/g;function h(e){return e.replace(m,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function g(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return h(t)}var _=[`http:`,`https:`,`mailto:`,`tel:`];function v(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var y=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function b(e,t){if(!e)return!1;if(y.test(e))return!0;let n=v(e);return n?!t.has(n):!1}function x(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=g(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=g(r?e.slice(r):e)}return t}function S(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function C(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function w(){throw Error(`Invariant failed`)}function T(e){return e.replace(/\/{2,}/g,`/`)}function E(e){return e===`/`?e:e.replace(/^\/+/,``)}function D(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function ee(e){return D(E(e))}function te(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ne(e,t,n=`never`,r){if(t.includes(`//`)&&(t=T(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,o;if(r){o=i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else{for(e.includes(`//`)&&(e=T(e)),s=e.split(`/`);s.length>1&&a(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(a(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=s.join(`/`),l=(i?T(c):c)||`/`;return o&&r&&r.set(o,l),l}function re(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function ie(e){return e==null||e===``}function ae(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function oe(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&ie(f)){if(c===`/`&&!d)continue;f=``}o+=c+ae(s,f,r)+(d||``)}}return o+a||`/`}function O(e){return e?.isNotFound===!0}function se(){try{return sessionStorage}catch{return}}var ce=`tsr-scroll-restoration-v1_3`,le=se();function ue(){try{return JSON.parse(le?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var de=ue(),fe=`data-scroll-restoration-id`,pe=e=>e.state.__TSR_key||e.href;function me(e){let t=e.getAttribute(fe);if(t)return`[${fe}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var he=!1,ge=`window`;function _e(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function ve(e){let t=new Set;for(let n of e){if(n===ge)continue;let e=_e(n);e&&t.add(e)}return t}function ye(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||pe,a=new Set,o=e=>{let t=de[e]||={};for(let e of a)e===document?t[ge]={scrollX,scrollY}:e.isConnected&&(t[me(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,he=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{he||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{le?.setItem(ce,JSON.stringify(de))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),r.r||(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=de[d];if(e){let t=de[u];for(let n in e){if(n===ge){if(s)continue}else{let e=_e(n);if(!e||s&&o&&(l??=ve(o),l.has(e)))continue}t||=de[u]={},t[n]??=e[n]}}}he=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=ve(o));let t=e&&i&&c,s=r.e?de[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===ge){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=_e(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{he=!1}}))}function be(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function xe(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Se(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=xe(r):Array.isArray(t)?t.push(xe(r)):n[e]=[t,xe(r)]}return n}var Ce=/^(?:\s|["[{\d-]|fa|nu|tr)/,we=Ee(JSON.parse),Te=De(JSON.stringify,JSON.parse);function Ee(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=Se(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!Ce.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function De(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!Ce.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=be(e,r);return t?`?${t}`:``}}var Oe=`__root__`;function ke(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ae(e){return e instanceof Response&&!!e.options}function je(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var Me=4,Ne=5;function Pe(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function Fe(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function Ie(e,t,n,r,i,o){let s=n,c=t.fullPath??t.from,l=t.options,u=c.length,d=c.endsWith(`/`)?u-1:u,f=l?.caseSensitive??e,p=l?.params?.parse??l?.parseParams,m,h=o?n-1:0;if(!r||c.includes(`$`)){m=o?.slice()??[];let e=a(m);e&&typeof e!=`string`&&e[0]===2&&(m[m.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+c.substring(n-(c[n-2]===`/`?2:1),d)],h=u)}for(;s<u;){let e=s,t=c.indexOf(`/`,e),n=t===-1?u:t,a=Fe(c,e,n);s=n+1;let o;if(typeof a==`string`){if(!r)continue;let e=a,t;f?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)o=n;else{let n=Re(r);o=n,t.set(e,n)}}else{let t=a[0],l=a[2],g=a[3]??``;if(t===2&&(n=u,s=n+1),m&&h<n&&(h<e-1&&m.push(c.slice(h,e-1)),a[2]=`/`+l,t===2&&a[3]!==void 0&&d<u&&(a[3]=g.slice(0,-1)),m.push(a),h=n),!r)continue;let _=f&&!!(l||g);f||(l=l.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!p&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===l&&e.suffix===g);if(y)o=y;else{let e=Re(r,t,_,l,g);o=e,v.push(e),v.length===2&&i?.push(v)}}r=o}m&&h<d&&m.push(c.slice(h,d));let g=m?.slice();if(!r)return g;if(p&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Re(r,Ne);(r.pathless??=[]).push(e),r=e}let _=(t.path||!t.children)&&!t.isRoot;if(_&&d<u){let e=Re(r,Me);r.index=e,r=e}return r.parse=p??null,r.priority=l?.params?.priority??0,r.route||(r.data=g,_&&(r.route=t)),[r,s,g]}function Le(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Re(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function ze(e,t){let n=Re(),r=[];function i(e,t,n,a){let[o,s,c]=Ie(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Le);t.masksTree=n,t.flatCache=je(1e3)}function Be(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=We(e,t.masksTree);return t.flatCache.set(e,r),r}function Ve(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Re(),Ie(t,{from:e},1,o),i.singleCache.set(a,o)),We(r,o,n)}function He(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=We(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Ke(a.route)),t.matchCache.set(r,a),a}function Ue(e,t=!1){let n=Re(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&w(),i[e.id]=e,o!==0&&e.path){let t=D(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Ie(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Le);return{processedTree:{segmentTree:n,singleCache:je(1e3),matchCache:je(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function We(e,t,n=!1){let r=e.split(`/`),i=Je(e,r,t,n);if(!i)return null;let[a]=Ge(e,r,i);return{route:i.node.route,rawParams:a}}function Ge(e,t,n){let r=qe(n.node),i=n.node.data&&Pe(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===Me)break;if(u.kind===Ne){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Ke(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Je(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!a(t),o=i&&e!==`/`,s=t.length-+!!i,c=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;c.length;){let n=c.pop(),{node:i,index:a,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!Qe(u,n))continue;if(i.parse){if(!Ze(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Me&&Qe(l,n)&&(l=n);let _=a===s;if(_&&(i.route&&(!o||i.kind===Me||i.kind===2)&&Qe(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[a],y;if(_&&i.index){let n={node:i.index,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Ze(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Xe(f,s))return n;Qe(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:o}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(o){if(_)continue;let e=t.slice(a).join(`/`),i=e.slice(-o.length);if((n.caseSensitive?i:i.toLowerCase())!==o||e.length-o.length<r.length)continue}c.push({node:n,index:s,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];c.push({node:n,index:a,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p,optionals:m+Ye(s,a),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p+Ye(s,a),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ye(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ye(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];c.push({node:t,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function Ye(e,t){return 2**(e-t-1)}function Xe(e,t){return e===2**(t-1)-1}function Ze(e,t,n){let r,i;try{[r,i]=Ge(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Qe(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Me)>(e.node.kind===Me)||t.node.kind===Me==(e.node.kind===Me)&&t.node.depth>e.node.depth)))}function $e(e,t,n){let r=ee(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=T(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>et(n,s.input({url:e})),output:({url:e})=>s.output({url:tt(n,e)})}:s}function et(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function tt(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function nt(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{C(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var rt=`__TSR_index`,it=`popstate`,at=`beforeunload`,ot=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function st(e){let t=ot.exec(e);return t?`/`+e.slice(t[0].length):e}function ct(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
2
|
+
\r`.includes(e)?``:encodeURIComponent(e))),st(e)}function lt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=ft(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[rt];i=ut(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[rt];i=ut(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[rt]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function ut(e,t){let n=pt();return{...t,key:n,__TSR_key:n,[rt]:e}}function dt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>ct(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>ft(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=pt();t.history.replaceState({[rt]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=ft(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[rt]-l.state[rt],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=lt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(at,x,{capture:!0}),t.removeEventListener(it,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(at,x,{capture:!0}),t.addEventListener(it,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function ft(e,t){let n=ct(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=pt();t={[rt]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function pt(){return(Math.random()+1).toString(36).slice(7)}function mt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function ht(e){return e.pathname+e.search+e.hash}function gt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function _t(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function vt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function yt(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function bt(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var xt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:dt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&ee(n)?$e(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=nt(this.latestLocation,e),ye(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Ue(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&ze(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:je(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:x(e),external:!1,searchStr:o,search:u(t?.search,i),hash:x(r.slice(1)),state:d(t?.state,a)}}let o=et(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:x(st(o.pathname)),external:!!this.rewrite&&mt(o,this.origin),searchStr:c,search:u(t?.search,s),hash:x(o.hash.slice(1)),state:d(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=He(D(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=ft(n.href,{});n={...n,to:et(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,u=ne(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),d=this.routesByPath[D(u)],f=u.includes(`$`),p;if(d)p=d._branch??=Ke(d);else if(f)p=[];else{let[e,t,n]=this.getMatchedRoutes(u);p=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(p=[...p,this.options.notFoundRoute])}let m=f?d?._interpolation??Ie(!1,{fullPath:u},0):void 0,h;for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(h??=Et(n.params,e),!c(h))break;h===e&&(h=Object.assign(l(),h));try{Object.assign(h,t(h))}catch{}}}h??=Et(n.params,Dt(n.params,m)?o()[3]:Ot);let g=e.leaveParams?u:st(x(m?oe(u,m,h,this.pathParamsDecoder):u)),_=kt(p,e._includeValidateSearch),v=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,Tt(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},y=_.length?At(_,v(),n):n.search===!0?v():typeof n.search==`function`?n.search(v()):n.search||Ot,b=this.options.stringifySearch(y),C=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,w=C?`#${C}`:``,T=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:Ot,E=`${g}${b}${w}`,ee,te,re=!1;if(this.rewrite){let e=new URL(E,this.origin),t=e.origin,n=tt(this.rewrite,e);ee=ht(e),mt(n,t)?(te=n.href,re=!0):te=st(ht(n))}else ee=S(E),te=ee;return{publicHref:te,href:ee,pathname:g,search:y,searchStr:b,state:T,hash:C??``,external:re,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Be(r.pathname,this.processedTree);if(t){let i=Object.assign(l(),t.rawParams),{from:a,params:o,...s}=t.route,c=Et(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return St(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=D(this.latestLocation.href)===D(n.href)&&p(vt(n.state),vt(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?v(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return St(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Sn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(_t(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&>(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(y.test(n)||(r=v(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:mt(e,this.origin)||(n=ht(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Ft,this.preloadRoute=e=>Cn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?ne(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ve(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!p(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?p(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=re(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Te,parseSearch:e.parseSearch??we,protocolAllowlist:e.protocolAllowlist??_}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=Ie(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:D(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?jt(this.options.notFoundMode,a):void 0,c=Array(a.length),f=this._committed,p=(e,t)=>{let n=f[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?f.find(t=>t.routeId===e.id):void 0},m;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],f,h,g;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=Tt(i.options.validateSearch,{...n})??void 0;f={...n,...e},h={...r,...e}}catch(e){let r=e;if(e instanceof Ct||(r=new Ct(e.message,{cause:e})),t?.throwOnError)throw r;f=n,h={},g=r}}let _=``,v=``;try{_=i.options.loaderDeps?.({search:f})??``,v=_&&JSON.stringify(_)||``}catch(e){if(t?.throwOnError)throw e;g??=e}let y=l(),b=i._interpolation?oe(i.fullPath,i._interpolation,r,this.pathParamsDecoder,y):i.fullPath,x=i.id+b+v,S=p(i,n),C=this._cache.get(x)??(S?.id===x?S:void 0);m=C?._strictParams??Object.assign(y,m);let w;if(!C)try{Mt(i,m)}catch(e){if(w=O(e)||Ae(e)?e:new wt(e.message,{cause:e}),t?.throwOnError)throw w}let T=S?`stay`:`enter`,E;if(C)E={...C,cause:T,search:u(S?S.search:C.search,f),_strictSearch:h,searchError:g};else{let e=gt(i)?`pending`:`success`;E={id:x,ssr:i.options.ssr,index:n,routeId:i.id,params:S?.params??m,_strictParams:m,pathname:b,updatedAt:Date.now(),search:S?u(S.search,f):f,_strictSearch:h,searchError:g,status:e,isFetching:!1,error:void 0,paramsError:w,context:{},abortController:t?._controller??new AbortController,cause:T,loaderDeps:S?d(S.loaderDeps,_):_,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let D=s===i.id;E._notFound&&!D&&(E.error=void 0),E._notFound=D,c[n]=E}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?u(n.params,m):m,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=a(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[o,s]=this.getMatchedRoutes(e.pathname),c=a(o),l={...e.search};for(let e of o)try{Object.assign(l,Tt(e.options.validateSearch,l))}catch{}let u=n&&n.routeId===c.id&&n.pathname===e.pathname,d;if(u)d=n.params;else{let e=s;for(let t of o)try{Mt(t,e)}catch{}d=e}let f=[o,c.fullPath,l,d];return this.lightweightCache.set(e,[r,f]),f}};async function St(e,t,{replace:n,ignoreBlocker:r}){if(!b(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Ct=class extends Error{},wt=class extends Error{};function Tt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ct(`Async validation not supported`);if(n.issues)throw new Ct(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Et(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function Dt(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!s.call(e,t[1]))}var Ot=Object.freeze({});function kt(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=Tt(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function At(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=o(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function jt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Oe}function Mt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Nt(e,t){return e.options[t]?.preload?.()}function Pt(e,t){let n=Nt(e,`component`),r=Nt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Ft(e,t,n){let r=()=>t===!1?void 0:t?Nt(e,t):Pt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function It(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function Lt(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var Rt=0,zt=1,Bt=2,k=3,Vt=[4];function Ht(e){return typeof e[0]==`number`}function Ut(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Wt(e,t){return e.routesById[t.routeId]}function Gt(e,t,n){return Ae(e)?[k,e]:O(e)?(e.routeId||=n,[Bt,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[zt,e]):[Rt,e]}function Kt(e,t){let n=Gt(t,!0,e.id);if(n[0]!==zt)return n;try{e.options.onError?.(n[1])}catch(t){n=Gt(t,!0,e.id)}return n}function qt(e,t,n,r,i){return i[0].signal.aborted?Vt:ln(e,t,n,Kt(n,r),i)}async function Jt(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Wt(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Xt(e,r),[i,qt(e,t,u,a,n)]}if(c.aborted)return[i,Vt];let p=r.paramsError??r.searchError;if(p!==void 0)return Xt(e,r),[i,qt(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Qt(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Ut(a,c):a);if(c.aborted)return[i,Vt];let s=ln(e,t,u,Gt(o,!1,u.id),n);if(s[0]!==Rt)return Xt(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Xt(e,r),[i,qt(e,t,u,a,n)]}finally{r.status=h,Qt(e,r,!1,n[0])}}i()}function Yt(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Xt(e,t){let n=t._flight;t._flight=void 0,Yt(e,t,n)?.abort()}function A(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Yt(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Zt(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Qt(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function $t(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function en(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Vt;if(!i)return[Rt,void 0];let l=n._flight;Qt(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i($t(e,t,n,r,s,a,!!o[3]))).then(e=>Gt(e,!1,r.id),e=>Gt(e,!0,r.id)).then(t=>(t[0]!==Rt&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===zt&&l[2]?Kt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],ln(e,t,r,await Ut(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Xt(e,n),Vt}finally{Qt(e,n,!1,s)}}function tn(e,t,n){t[0]!==k&&(e.status=`success`,e.error=void 0,t[0]===Rt?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function nn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Xt(e,r)}function rn(e,t){return t[0]===zt||t[0]===Bt?{...e,status:t[0]===zt?`error`:`notFound`,error:t[1],_flight:void 0}:e}function an(e,t,n,r,i,a,o){let s=t[1][n],c=Wt(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d($t(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Vt)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Xt(e,s),p=qt(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Yt(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?en(e,t,s,c,g,i,a).then(t=>(tn(s,t,l),t[0]===Rt&&(m&&!a[0].signal.aborted&&nn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Rt,s.loaderData]),T=(async()=>{try{let e=Ft(c,void 0,C);e&&await Ut(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,qt(e,t,c,r,a)]}let r=await w;x&&r[0]===Rt&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>rn(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=en(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,tn(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>rn(E,e))}async function on(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Wt(e,t[n]);try{let e=Ft(i,!1);e&&await Ut(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function sn(e,t){t[2]&&=(A(e,t[2].map(e=>e[3])),void 0)}async function cn(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=k)throw[a,t];!i&&t[0]!==Rt&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===k)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function ln(e,t,n,r,i,a){for(;r[0]===k;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[k,t]:[k,t,a]}return[k,o,n]}catch(e){r=a?[zt,e]:Kt(n,e),a=!0}}return r}async function un(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===Bt?on(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=k)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Rt&&t[0]<k&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=k){let n=s[1];if(n[0]!==k||n[1].options.reloadDocument||n[2])return sn(e,t),n;c=!0,s=[0,[zt,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===zt?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Wt(e,u);try{await Ut(i?Promise.resolve().then(()=>Ft(m,l===zt?`errorComponent`:`notFoundComponent`)):Promise.all([Ft(m),Ft(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return sn(e,t),Vt}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),sn(e,t),A(e,o),p()):u.status=`success`}return t}async function dn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Wt(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Ut(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function fn(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await on(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=an(e,i,t,u,f,r,l)},m=await Jt(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Bt){let t=await on(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=k&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=un(e,i,u,r[0],cn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=cn(i[2],void 0,void 0,h.then(e=>Ht(e)?0:It(n).length,()=>0))),o=await h}catch(t){if(sn(e,i),t===a&&a.aborted)return Vt;throw t}return Ht(o)?o:dn(e,o,a,r[6]===n.length?r[6]:0)}function pn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Wt(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>pn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function mn(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function hn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!It(t[3]).some(e=>e.id===n[1]))return;let i;try{await Ut(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function gn(e,t){e._committed=t,e.stores.setMatches(t)}function _n(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=It(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Wt(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=yt(n);gn(e,n),A(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),bt(e,i,n,a,l,t)}async function vn(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function yn(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function bn(e,t,n,r,i){let a=n.map(e=>({...e}));Zt(a);for(let t of r)Xt(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await un(e,o,r,t[0],i)}catch(t){throw A(e,a),t}if(Ht(s))A(e,a),s[0]===k&&e._tx===t&&e._committed===n&&await yn(e,t,s);else if(await dn(e,s,t[0].signal),e._tx!==t||e._committed!==n)A(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Xt(e,n))}gn(e,a),A(e,n,a)}}async function xn(e,t,n,r,i,a){let o=await fn(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Ht(o)){let n=o[0]===k&&e._tx===t;if((!n||o[1].options.reloadDocument)&&mn(e,t),A(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){mn(e,t);return}await yn(e,t,o);return}let s=o[1];if(e._tx===t&&await hn(e,t),e._tx!==t){mn(e,t),A(e,s),sn(e,o);return}let c=t[2],l=_t(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await hn(e,t),e._tx!==t){mn(e,t),A(e,s),sn(e,o);return}let n=await e.startTransition(()=>{mn(e,t),_n(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&bn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):sn(e,o)})}async function Sn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=_t(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await vn(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Zt(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){A(e,m),await vn(e,n);return}e._preflight=void 0;let g,_=()=>xn(e,y,f,()=>pn(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>vn(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Qt(e,t,!1)}n[0].abort(),A(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&pn(e,y),g?.(_()),await y[5]):(A(e,y[3]),y[3]=[],g?.(),await vn(e,y))}async function Cn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Zt(a),o=(e._preloads??=new Map).set(i,a),s=await fn(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),A(e,a)),i.abort()}if(!Ht(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){O(e)||console.error(e);return}}}var wn=`Error preloading route! ☝️`,Tn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Oe:this.parentRoute||w();let r=n?Oe:t?.path;r&&r!==`/`&&(r=E(r));let i=t?.id||r,a=n?Oe:T((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:T(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=D(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>ke({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},En=class extends Tn{constructor(e){super(e)}},j=e(i(),1),Dn=j.createContext(null);function On(e){return j.useContext(Dn)}function kn(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{Lt(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var An=j.createContext(void 0),jn=j.createContext(void 0);function Mn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Nn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Pn=[],Fn=0,{link:In,unlink:Ln,propagate:Rn,checkDirty:zn,shallowPropagate:Bn}=Mn({update(e){return e._update()},notify(e){Pn[Hn++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Kn(e))}}),Vn=0,Hn=0,Un,Wn=0;function Gn(e){try{++Wn,e()}finally{--Wn||qn()}}function Kn(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ln(n,e)}function qn(){if(!(Wn>0)){for(;Vn<Hn;){let e=Pn[Vn];Pn[Vn++]=void 0,e.notify()}Vn=0,Hn=0}}function Jn(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Un!==void 0&&In(i,Un,Fn),i._snapshot},subscribe(e){let t=Nn(e),n={current:!1},r=Yn(()=>{i.get(),n.current?(Un=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Un,o=t?.compare??Object.is;if(n)Un=i,++Fn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Un=a,n&&(i.flags&=-5),Kn(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&zn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Bn(e)}}else e&32&&(i.flags=e&-33);return Un!==void 0&&In(i,Un,Fn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Rn(e),Bn(e),qn())}},i}function Yn(e){let t=()=>{let t=Un;Un=n,++Fn,n.depsTail=void 0,n.flags=6;try{return e()}finally{Un=t,n.flags&=-5,Kn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&zn(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Kn(this)}};return t(),n}var Xn=t((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Zn=t(((e,t)=>{t.exports=Xn()})),Qn=t((e=>{var t=i(),n=Zn();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),$n=t(((e,t)=>{t.exports=Qn()}))();function er(e,t){return e===t}function tr(e,t=e=>e,n){let r=n?.compare??er,i=(0,j.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,j.useCallback)(()=>e.get(),[e]);return(0,$n.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var nr={};function rr(e,t){let n=j.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=d(n.current,i):i}}function ir(e){let t=On(),n=j.useContext(e.from?jn:An),r=e.from??n,i=t.stores.getMatchStore(r),a=rr(e,t),o=tr(i,e=>e?a(e):nr);if(o!==nr)return o;(e.shouldThrow??!0)&&w()}function ar(e){return ir({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function or(e){let{select:t,...n}=e;return ir({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function sr(e){return ir({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function cr(e){return ir({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function lr(e){let t=On();return j.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ur(e){return ir({...e,select:t=>e.select?e.select(t.context):t.context})}var dr=n();function fr(...e){let t=j.useRef(e),n=t.current;return e.forEach((e,t)=>{p(n[t],e,!1,!0)||(n[t]=e)}),t.current}function pr(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(wn)})}function mr(e,t){let n=typeof e==`string`&&v(e);if(n)return t.has(n)?e:null}function hr(e,t,n,r){let i=te(e.pathname,r),a=te(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!p(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function gr(e,t,n){let r=On(),i=j.useRef(null),a=j.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[y,b,x]=fr(e.search,e.params,o),S=j.useContext(An),C=(r.stores._linkScopes??={})[S]??=kn(r,S),[w,T,E]=j.useMemo(()=>{let t=mr(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=C[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=wr(t,r,u),s=u||o&&!v(o)?hr(e,t,x,r.basepath):void 0;a&&a[0]===o&&a[1]===s||(a=[o,s]),i=e}return a};return[n,c,x?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,C,e.from,e.hash,e.href,s,y,b,e.state,e.mask,e.unsafeRelative,x,u]),[D,ee]=j.useSyncExternalStore(C[1],T,E||T),te=ee===void 0&&D,ne=u||D===void 0,re=j.useRef(!1),ie=e.reloadDocument||te||ne?!1:c??r.options.defaultPreload,ae=l??r.options.defaultPreloadDelay??0,oe=j.useCallback(e=>{let t=e?.isIntersecting;t??ie===`intent`?ae?i.t??=setTimeout(()=>{i.t=void 0,pr(r,w)},ae):pr(r,w):t===!1&&Sr(i)},[r,w,i,ie,ae]);j.useEffect(()=>{if(!ie)return;ie===`render`&&!re.current&&(re.current=!0,pr(r,w));let e=!0,t;return ie===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&oe(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Sr(i)}},[r,w,ie,oe,i]);let O=br(e,n);if(O.ref=t?a:i,te)return O.href=te,O;let se=t=>{let n=d??t.currentTarget.getAttribute(`target`);ne||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||n&&n!==`_self`||t.button!==0||(t.preventDefault(),Sr(i),r.navigate({...e,_fromLocation:w._fromLocation}))},ce=()=>{ie===`intent`&&pr(r,w)},le=()=>{ie===`intent`&&Sr(i)};return O.onClick=Cr(f,se),O.onBlur=Cr(p,le),O.onFocus=Cr(m,oe),O.onMouseEnter=Cr(h,oe),O.onMouseLeave=Cr(g,le),O.onTouchStart=Cr(_,ce),xr(O,e,ee,D,ne,n)}var _r={},vr={className:`active`},yr=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function br(e,t){let n={};for(let r in e)yr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function xr(e,t,n,r,i,a){let{activeProps:s,inactiveProps:c,className:l,style:u,target:d}=t,f=o(n?s:c,{})??(n?vr:_r);Object.assign(e,f),e.href=r,a!==`a`&&(e.disabled=i),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var Sr=e=>{clearTimeout(e.t),e.t=void 0},Cr=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function wr(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!b(i,t.protocolAllowlist))return i}var Tr=j.memo(j.forwardRef((e,t)=>{let n=e._asChild||`a`,r=gr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return j.createElement(n,r,i)}),Er);function Er(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!yr.has(r)||!p(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var Dr=class extends Tn{constructor(e){super(e),this.useMatch=e=>ir({...e,from:this.id}),this.useRouteContext=e=>ur({...e,from:this.id}),this.useSearch=e=>cr({...e,from:this.id}),this.useParams=e=>sr({...e,from:this.id}),this.useLoaderDeps=e=>or({...e,from:this.id}),this.useLoaderData=e=>ar({...e,from:this.id}),this.useNavigate=()=>lr({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,dr.jsx)(Tr,{ref:t,from:this.fullPath,...e}))}};function Or(e){return new Dr(e)}var kr=class extends En{constructor(e){super(e),this.useMatch=e=>ir({...e,from:this.id}),this.useRouteContext=e=>ur({...e,from:this.id}),this.useSearch=e=>cr({...e,from:this.id}),this.useParams=e=>sr({...e,from:this.id}),this.useLoaderDeps=e=>or({...e,from:this.id}),this.useLoaderData=e=>ar({...e,from:this.id}),this.useNavigate=()=>lr({from:this.fullPath}),this.Link=j.forwardRef((e,t)=>(0,dr.jsx)(Tr,{ref:t,from:this.fullPath,...e}))}};function Ar(e){return new kr(e)}var jr=e=>({createMutableStore:Jn,createReadonlyStore:Jn,batch:Gn}),Mr=e=>new Nr(e),Nr=class extends xt{constructor(e){super(e,jr)}},Pr=`global`;function Fr(e,t,n){let r=new Uint8Array(5+n.length);return r[0]=e,new DataView(r.buffer).setUint32(1,t),r.set(n,5),r}function Ir(e){if(e.length<5)throw Error(`terminal frame is too short`);return{kind:e[0],id:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(1),data:e.subarray(5)}}var M={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},Lr={silent:{level:-1},fatal:{level:M.fatal},error:{level:M.error},warn:{level:M.warn},log:{level:M.log},info:{level:M.info},success:{level:M.success},fail:{level:M.fail},ready:{level:M.info},start:{level:M.info},box:{level:M.info},debug:{level:M.debug},trace:{level:M.trace},verbose:{level:M.verbose}};function Rr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function zr(e,t,n=`.`,r){if(!Rr(t))return zr(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:Rr(a)&&Rr(i[t])?zr(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function Br(e){return(...t)=>t.reduce((t,n)=>zr(t,n,``,e),{})}var Vr=Br();function Hr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ur(e){return!(!Hr(e)||!e.message&&!e.args||e.stack)}var Wr=!1,Gr=[],N=class e{options;_lastLog;_mockFn;constructor(e={}){let t=e.types||Lr;this.options=Vr({...e,defaults:{...e.defaults},level:Kr(e.level,t),reporters:[...e.reporters||[]]},{types:Lr,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let e in t){let n={type:e,...this.options.defaults,...t[e]};this[e]=this._wrapLogFn(n),this[e].raw=this._wrapLogFn(n,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=Kr(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){Wr=!0}resumeLogs(){Wr=!1;let e=Gr.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(Wr)Gr.push([this,e,n,t]);else return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:new Date,args:[],...e,level:Kr(e.level,this.options.types)};!n&&t.length===1&&Ur(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
|
|
3
3
|
`)),r.args.push(`
|
|
4
4
|
`+r.additional.join(`
|
|
5
5
|
`)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}};function Kr(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}N.prototype.add=N.prototype.addReporter,N.prototype.remove=N.prototype.removeReporter,N.prototype.clear=N.prototype.removeReporter,N.prototype.withScope=N.prototype.withTag,N.prototype.mock=N.prototype.mockTypes,N.prototype.pause=N.prototype.pauseLogs,N.prototype.resume=N.prototype.resumeLogs;function qr(e={}){return new N(e)}var Jr=class{options;defaultColor;levelColorMap;typeColorMap;constructor(e){this.options={...e},this.defaultColor=`#7f8c8d`,this.levelColorMap={0:`#c0392b`,1:`#f39c12`,3:`#00BCD4`},this.typeColorMap={success:`#2ecc71`}}_getLogFn(e){return e<1?console.__error||console.error:e===1?console.__warn||console.warn:console.__log||console.log}log(e){let t=this._getLogFn(e.level),n=e.type===`log`?``:e.type,r=e.tag||``,i=`
|
|
@@ -9,7 +9,7 @@ import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{c as n,l as r,r as i
|
|
|
9
9
|
font-weight: bold;
|
|
10
10
|
padding: 2px 0.5em;
|
|
11
11
|
`,a=`%c${[r,n].filter(Boolean).join(`:`)}`;typeof e.args[0]==`string`?t(`${a}%c ${e.args[0]}`,i,``,...e.args.slice(1)):t(a,i,...e.args)}};function Yr(e={}){return qr({reporters:e.reporters||[new Jr({})],prompt(e,t={}){return t.type===`confirm`?Promise.resolve(confirm(e)):Promise.resolve(prompt(e))},...e})}Yr();function Xr(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Zr(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=Xr(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var Qr;function $r(){return Qr||=Zr(`keyval-store`,`keyval`),Qr}function ei(e,t=$r()){return t(`readonly`,t=>Xr(t.get(e)))}function ti(e,t,n=$r()){return n(`readwrite`,n=>(n.put(t,e),Xr(n.transaction)))}function ni(e,t=$r()){return t(`readwrite`,t=>(t.delete(e),Xr(t.transaction)))}var ri=Zr(`offsite`,`tokens`);function ii(e){return ei(e,ri)}function ai(e,t){return ti(e,t,ri)}function oi(e){return ni(e,ri)}var si=1e3,ci=5e3,li=1e3,ui=[],di,fi=Yr({level:M.verbose,throttle:0});fi.addReporter({log:hi});var pi=fi.withTag(`app`);function mi(){window.addEventListener(`error`,e=>pi.error(`uncaught error:`,e.error??e.message)),window.addEventListener(`unhandledrejection`,e=>pi.error(`unhandled rejection:`,e.reason)),pi.info(`started on ${location.origin} in ${navigator.userAgent}`)}function hi(e){ui.push({time:e.date.getTime(),type:e.type,tag:e.tag,message:e.args.map(yi).join(` `)}),ui.length>li&&ui.splice(0,ui.length-li),gi(si)}function gi(e){di??=window.setTimeout(()=>void _i(),e)}async function _i(){let e=ui.splice(0),t;try{let n=JSON.parse(localStorage.getItem(`machines`)??`[]`).find(e=>e.addresses.includes(location.origin)),r=n===void 0?void 0:await ii(n.id);t=await fetch(`/api/logs`,{method:`POST`,headers:r===void 0?{}:{authorization:`Bearer ${r}`},body:JSON.stringify(e)})}catch{vi(e);return}t.status>=500?vi(e):(di=void 0,t.ok||console.warn(`the server refused ${e.length} log entries: ${await t.text()}`),ui.length>0&&gi(si))}function vi(e){ui.unshift(...e),ui.length>li&&ui.splice(0,ui.length-li),di=void 0,gi(ci)}function yi(e){if(typeof e==`string`)return e;if(e instanceof Error)return e.stack!==void 0&&e.stack.startsWith(String(e))?e.stack:[String(e),e.stack].join(`
|
|
12
|
-
`);try{return JSON.stringify(e)??String(e)}catch{return String(e)}}var bi=1e3,xi=3e4,Si=1e4,Ci=1e4,wi=3e3,Ti=3e4,Ei=3e5,Di=[`sessions.send`,`sessions.rewind`,`sessions.fork`,`git.commit`,`git.push`,`git.pullRequest`,`git.createPullRequest`,`dictation.transcribe`],Oi=fi.withTag(`connection`),ki=new Set,P=new Map,Ai=0;function ji(){window.setInterval(()=>{for(let e of P.keys())zi(e)},Si),document.addEventListener(`visibilitychange`,()=>{document.hidden||Mi()}),window.addEventListener(`online`,Mi)}function Mi(){for(let[e,t]of P)t.connected?zi(e):t.timer!==void 0&&(window.clearTimeout(t.timer),t.timer=void 0,t.failures=0,Bi(e,t,0))}function Ni(e,t){if(P.has(e))return;let n={urls:t,url:t[0],socket:null,connected:!1,ping:null,timer:void 0,failures:0,pending:new Map};P.set(e,n),Bi(e,n,0)}function Pi(e){let t=P.get(e);t!==void 0&&(P.delete(e),window.clearTimeout(t.timer),t.socket!==null&&(t.socket.onclose=null,t.socket.close()),Wi(e,t))}function Fi(e){ki.add(e)}function Ii(e){return P.get(e)?.connected===!0}function Li(e){let t=P.get(e);if(t===void 0)throw Error(`This machine is not connected`);return t.url}function F(e,t,n){let r=P.get(e);if(r===void 0||r.socket===null||!r.connected)return Promise.reject(Error(r===void 0?`That machine was removed`:`Not connected to ${new URL(r.url).host}; reconnecting`));Ai+=1;let i=Ai;r.socket.send(JSON.stringify({id:i,method:t,params:n}));let a=Di.includes(t)?Ei:Ti;return new Promise((e,n)=>{let o=window.setTimeout(()=>{r.pending.delete(i),n(Error(`${new URL(r.url).host} did not answer ${t} within ${a/1e3} seconds`))},a);r.pending.set(i,{resolve:t=>{window.clearTimeout(o),e(t)},reject:e=>{window.clearTimeout(o),n(e)}})})}function Ri(e,t,n,r){let i=P.get(e);i!==void 0&&i.socket!==null&&i.connected&&i.socket.send(Fr(t,n,r))}async function zi(e){let t=P.get(e);return t!==void 0&&(t.ping??=Gi(e,t).finally(()=>{t.ping=null}),await t.ping)}async function Bi(e,t,n){let r=t.urls[n%t.urls.length];t.url=r,Oi.debug(`connecting to ${r}, attempt ${n+1}`);let i=await Vi(e,r).catch(e=>{Oi.warn(`could not get a ticket from ${r}:`,e)});if(P.get(e)!==t)return;if(i===`unpaired`){Oi.warn(`${r} says this browser is not paired`);for(let t of ki)t.unpaired?.(e);return}if(i===void 0){Hi(e,t,n);return}let a=i===null?``:`?${new URLSearchParams({ticket:i})}`,o=new WebSocket(`${r.replace(/^http/,`ws`)}/ws${a}`);o.binaryType=`arraybuffer`;let s=window.setTimeout(()=>o.close(),wi);o.onopen=()=>{if(window.clearTimeout(s),t.socket!==o)o.close();else{t.connected=!0,t.failures=0,Oi.info(`connected to ${r}`);for(let t of ki)t.open?.(e,r)}},o.onmessage=n=>{t.socket===o&&Ki(e,t,n.data)},o.onclose=i=>{window.clearTimeout(s),t.socket===o&&(Oi.info(`the connection to ${r} closed (code ${i.code})`),t.connected?(Wi(e,t),Ui(e,t,0)):Hi(e,t,n))},t.socket=o}async function Vi(e,t){let n=await ii(e),r=await fetch(`${t}/api/ticket`,{method:`POST`,headers:n===void 0?{}:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(wi)});if(r.status===401)return`unpaired`;if(!r.ok)throw Error(await r.text());return(await r.json()).ticket}function Hi(e,t,n){if((n+1)%t.urls.length!==0)Bi(e,t,n+1);else{for(let t of ki)t.close?.(e);Ui(e,t,n+1)}}function Ui(e,t,n){let r=Math.min(xi,bi*2**t.failures)*(.8+Math.random()*.4);t.failures+=1,Oi.debug(`reconnecting to ${new URL(t.url).host} in ${Math.round(r/1e3)}s`),t.timer=window.setTimeout(()=>{t.timer=void 0,Bi(e,t,n)},r)}function Wi(e,t){for(let e of t.pending.values())e.reject(Error(`Disconnected from ${new URL(t.url).host}`));t.pending.clear(),t.connected=!1;for(let t of ki)t.close?.(e)}async function Gi(e,t){let n=t.socket;if(n===null||!t.connected)return!1;let r=await Promise.race([F(e,`ping`,void 0).then(()=>!0,()=>!1),new Promise(e=>window.setTimeout(()=>e(!1),Ci))]);return r||t.socket!==n||!t.connected?r:(Oi.warn(`${t.url} did not answer a ping, reconnecting`),n.onclose=null,n.close(),Wi(e,t),P.get(e)===t&&Ui(e,t,0),!1)}function Ki(e,t,n){if(n instanceof ArrayBuffer){let t=Ir(new Uint8Array(n));for(let n of ki)n.frame?.(e,t);return}let r=JSON.parse(String(n));if(r.type===`reply`)qi(t,r);else if(r.type===`terminal`)for(let t of ki)t.terminal?.(e,r.event);else for(let t of ki)t.event?.(e,r)}function qi(e,t){let n=e.pending.get(t.id);n!==void 0&&(e.pending.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.result))}var Ji=`claude`,Yi=`bypassPermissions`,Xi=`full-access`;function Zi(e,t){if(e.length===0)return;let n=e[0],r=-1/0;for(let i=0;i<e.length;i++){let a=e[i],o=t(a,i,e);if(Number.isNaN(o))return a;o>r&&(r=o,n=a)}return n}function Qi(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}var $i=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ea=(e=>e?$i(e):$i),ta=e=>e;function na(e,t=ta){let n=j.useSyncExternalStore(e.subscribe,j.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return j.useDebugValue(n),n}var ra=e=>{let t=ea(e),n=e=>na(t,e);return Object.assign(n,t),n},ia=(e=>e?ra(e):ra);function aa(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var oa=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return oa(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return oa(t)(e)}}}},sa=(e,t)=>(n,r,i)=>{let a={storage:aa(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return oa(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},ca=`composerDrafts`,la={text:``,images:[],files:[],settings:null},ua=Zr(`offsite-drafts`,`drafts`),da=Zr(`offsite-draft-files`,`files`),fa=Qi(e=>void ti(ca,e,ua),300),pa={getItem:async e=>await ei(e,ua)??null,setItem:(e,t)=>fa(t),removeItem:e=>ni(e,ua)},ma={drafts:{},stash:[]},I=ia()(sa(()=>ma,{name:ca,storage:pa,skipHydration:!0,version:1,migrate:()=>ma}));window.addEventListener(`pagehide`,fa.flush);function ha(){return I.persist.rehydrate()}function ga(e){return I(t=>t.drafts[e]??la)}function _a(e,t){let n=xa(e),r=t(n),i=I.getState().stash;for(let e of n.files)!r.files.some(t=>t.id===e.id)&&!i.some(t=>t.files.some(t=>t.id===e.id))&&ni(e.id,da);I.setState(t=>{let n={...t.drafts,[e]:r};return r.text===``&&r.images.length===0&&r.files.length===0&&r.settings===null&&delete n[e],{drafts:n}})}async function va(e){let t=crypto.randomUUID();return await ti(t,e,da),t}async function ya(e){return await ei(e,da)}function ba(e){_a(e,()=>la)}function xa(e){return I.getState().drafts[e]??la}function Sa(e){return I.getState().drafts[e]?.settings??null}function Ca(e,t){_a(e,e=>({...e,settings:t}))}function wa(){return I(e=>e.stash)}function Ta(){return I.getState().stash}function Ea(e){return e.text.trim()!==``||e.images.length>0||e.files.length>0}function Da(e){let t=xa(e);I.setState(e=>({stash:[{id:crypto.randomUUID(),createdAt:Date.now(),text:t.text,images:t.images,files:t.files},...e.stash]})),_a(e,e=>({...e,text:``,images:[],files:[]}))}function Oa(e,t,n){let r=I.getState().stash.find(e=>e.id===t);if(r===void 0)throw Error(`This stashed prompt no longer exists`);Ea(xa(e))&&Da(e),I.setState(e=>({stash:e.stash.filter(e=>e.id!==t)}));let i=r.text.replace(/\[Image #(\d+)\]/g,(e,t)=>{let i=r.images.findIndex(e=>e.number===Number(t));return i===-1?e:`[Image #${n+i+1}]`});return _a(e,e=>({...e,text:i,images:r.images.map((e,t)=>({...e,number:n+t+1})),files:r.files})),i}function ka(e){let t=I.getState().stash.find(t=>t.id===e);if(t!==void 0){I.setState(t=>({stash:t.stash.filter(t=>t.id!==e)}));for(let e of t.files)ni(e.id,da)}}function Aa(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 ja(e,t=`|`){return e.map(e=>to(e)).join(t)}function Ma(e,t){return typeof t==`bigint`?t.toString():t}var Na=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Pa(e){return new Na(e)}function Fa(e){return e==null}function Ia(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function La(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Ra(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function za(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Ba(e){return za(e._zod.def)??e._zod.def.shape}function Va(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Ra(this,t,e),e},enumerable:!0,configurable:!0})}function Ha(e,t,n){t in e?Ra(e,t,n):e[t]=n}function Ua(e,t,n,r){let i=Ba(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Va(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Ha(e,a,r?r(n.value,a):n.value))}}function Wa(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Va(e,n,()=>t[n]):Ha(e,n,r.value))}}function L(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ga(e){return JSON.stringify(e)}function Ka(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var qa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ja(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ya=Pa(()=>{if(Go.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Xa(e){if(Ja(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ja(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Za(e){return Xa(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Qa=new Set([`string`,`number`,`symbol`]);function $a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function R(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 to(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function no(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ro={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},io={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ao(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ua(i,e,oo(e,t)),eo(e,L(n,{shape:i,checks:[]}))}function oo(e,t){let n=Ba(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function so(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(oo(e,t)),a={};return Ua(a,e,Reflect.ownKeys(Ba(e)).filter(e=>!i.has(e))),eo(e,L(n,{shape:a,checks:[]}))}function co(e,t){if(!Xa(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Ba(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eo(e,L(e._zod.def,{shape:lo(e,t)}))}function lo(e,t){let n={};return Ua(n,e,Reflect.ownKeys(Ba(e))),Wa(n,t),n}function uo(e,t){if(!Xa(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return eo(e,L(e._zod.def,{shape:lo(e,t)}))}function fo(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ua(n,e,Reflect.ownKeys(Ba(e))),Ua(n,t,Reflect.ownKeys(Ba(t))),eo(e,L(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function po(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(oo(t,n)):void 0,o={};return Ua(o,t,Reflect.ownKeys(Ba(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),eo(t,L(t._zod.def,{shape:o,checks:[]}))}function mo(e,t,n){let r=n?new Set(oo(t,n)):void 0,i={};return Ua(i,t,Reflect.ownKeys(Ba(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),eo(t,L(t._zod.def,{shape:i}))}function ho(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 go(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _o(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function vo(e){return typeof e==`string`?e:e?.message}function yo(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function bo(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function xo(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:vo(e.inst?._zod.def?.error?.(e))??vo(a?.(e))??vo(t?.error?.(e))??vo(n.customError?.(e))??vo(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var So=/[\uD800-\uDBFF]/;function Co(e){let t=e.length;if(!So.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function wo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function To(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Eo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Do(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):jo(e,n,r.value)}}function Oo(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ko(e,t,n){return Oo(e,t,n,!1)}function Ao(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Oo(this,n,r(this))},set(e){Oo(this,n,e)}})}return t}function jo(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Oo(this,t,n.bind(this))},set(e){Oo(this,t,e)}})}function Mo(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var No,Po=!1,Fo={configurable:!0,get(){Po=!0}};function z(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&No!==e._zod?No=void 0:(No=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Fo);let e=Po;Po=!1;try{let r=n(this);return Po?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Po||=e,r}catch(n){throw delete this[t],Po||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Io(e,t,n,r){let i=Mo(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Lo=`~constantCatch`;function Ro(e){let t=()=>e;return t[Lo]=!0,t}var zo,Bo={value:void 0,enumerable:!1},Vo=`captureStackTrace`in Error?Error:null;function Ho(e){let t=Vo;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Vo=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function B(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Bo.value=new a(r);try{Object.defineProperty(n,"_zod",Bo)}finally{Bo.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Do(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ho(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Uo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Wo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(zo=globalThis).__zod_globalConfig??(zo.__zod_globalConfig={});var Go=globalThis.__zod_globalConfig;function Ko(e){return e&&Object.assign(Go,e),Go}function qo(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ma,2),e.message}function Jo(e){this._zod.message=e}var Yo={get:qo,set:Jo,enumerable:!0,configurable:!0},Xo={value:void 0,enumerable:!1},Zo=new WeakSet([Object.prototype,Error.prototype]),Qo=B(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Xo.value=t,Object.defineProperty(e,"issues",Xo),Xo.value=void 0,Object.defineProperty(e,"message",Yo);let n=Object.getPrototypeOf(e);Zo.has(n)||(Zo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function $o(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function es(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?$o(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ts(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ns(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function rs(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${ns(e.path)}`);return t.join(`
|
|
12
|
+
`);try{return JSON.stringify(e)??String(e)}catch{return String(e)}}var bi=1e3,xi=3e4,Si=1e4,Ci=1e4,wi=3e3,Ti=3e4,Ei=3e5,Di=[`accounts.link`,`sessions.send`,`sessions.rewind`,`sessions.fork`,`git.commit`,`git.push`,`git.pullRequest`,`git.createPullRequest`,`dictation.transcribe`],Oi=fi.withTag(`connection`),ki=new Set,P=new Map,Ai=0;function ji(){window.setInterval(()=>{for(let e of P.keys())zi(e)},Si),document.addEventListener(`visibilitychange`,()=>{document.hidden||Mi()}),window.addEventListener(`online`,Mi)}function Mi(){for(let[e,t]of P)t.connected?zi(e):t.timer!==void 0&&(window.clearTimeout(t.timer),t.timer=void 0,t.failures=0,Bi(e,t,0))}function Ni(e,t){if(P.has(e))return;let n={urls:t,url:t[0],socket:null,connected:!1,ping:null,timer:void 0,failures:0,pending:new Map};P.set(e,n),Bi(e,n,0)}function Pi(e){let t=P.get(e);t!==void 0&&(P.delete(e),window.clearTimeout(t.timer),t.socket!==null&&(t.socket.onclose=null,t.socket.close()),Wi(e,t))}function Fi(e){ki.add(e)}function Ii(e){return P.get(e)?.connected===!0}function Li(e){let t=P.get(e);if(t===void 0)throw Error(`This machine is not connected`);return t.url}function F(e,t,n){let r=P.get(e);if(r===void 0||r.socket===null||!r.connected)return Promise.reject(Error(r===void 0?`That machine was removed`:`Not connected to ${new URL(r.url).host}; reconnecting`));Ai+=1;let i=Ai;r.socket.send(JSON.stringify({id:i,method:t,params:n}));let a=Di.includes(t)?Ei:Ti;return new Promise((e,n)=>{let o=window.setTimeout(()=>{r.pending.delete(i),n(Error(`${new URL(r.url).host} did not answer ${t} within ${a/1e3} seconds`))},a);r.pending.set(i,{resolve:t=>{window.clearTimeout(o),e(t)},reject:e=>{window.clearTimeout(o),n(e)}})})}function Ri(e,t,n,r){let i=P.get(e);i!==void 0&&i.socket!==null&&i.connected&&i.socket.send(Fr(t,n,r))}async function zi(e){let t=P.get(e);return t!==void 0&&(t.ping??=Gi(e,t).finally(()=>{t.ping=null}),await t.ping)}async function Bi(e,t,n){let r=t.urls[n%t.urls.length];t.url=r,Oi.debug(`connecting to ${r}, attempt ${n+1}`);let i=await Vi(e,r).catch(e=>{Oi.warn(`could not get a ticket from ${r}:`,e)});if(P.get(e)!==t)return;if(i===`unpaired`){Oi.warn(`${r} says this browser is not paired`);for(let t of ki)t.unpaired?.(e);return}if(i===void 0){Hi(e,t,n);return}let a=i===null?``:`?${new URLSearchParams({ticket:i})}`,o=new WebSocket(`${r.replace(/^http/,`ws`)}/ws${a}`);o.binaryType=`arraybuffer`;let s=window.setTimeout(()=>o.close(),wi);o.onopen=()=>{if(window.clearTimeout(s),t.socket!==o)o.close();else{t.connected=!0,t.failures=0,Oi.info(`connected to ${r}`);for(let t of ki)t.open?.(e,r)}},o.onmessage=n=>{t.socket===o&&Ki(e,t,n.data)},o.onclose=i=>{window.clearTimeout(s),t.socket===o&&(Oi.info(`the connection to ${r} closed (code ${i.code})`),t.connected?(Wi(e,t),Ui(e,t,0)):Hi(e,t,n))},t.socket=o}async function Vi(e,t){let n=await ii(e),r=await fetch(`${t}/api/ticket`,{method:`POST`,headers:n===void 0?{}:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(wi)});if(r.status===401)return`unpaired`;if(!r.ok)throw Error(await r.text());return(await r.json()).ticket}function Hi(e,t,n){if((n+1)%t.urls.length!==0)Bi(e,t,n+1);else{for(let t of ki)t.close?.(e);Ui(e,t,n+1)}}function Ui(e,t,n){let r=Math.min(xi,bi*2**t.failures)*(.8+Math.random()*.4);t.failures+=1,Oi.debug(`reconnecting to ${new URL(t.url).host} in ${Math.round(r/1e3)}s`),t.timer=window.setTimeout(()=>{t.timer=void 0,Bi(e,t,n)},r)}function Wi(e,t){for(let e of t.pending.values())e.reject(Error(`Disconnected from ${new URL(t.url).host}`));t.pending.clear(),t.connected=!1;for(let t of ki)t.close?.(e)}async function Gi(e,t){let n=t.socket;if(n===null||!t.connected)return!1;let r=await Promise.race([F(e,`ping`,void 0).then(()=>!0,()=>!1),new Promise(e=>window.setTimeout(()=>e(!1),Ci))]);return r||t.socket!==n||!t.connected?r:(Oi.warn(`${t.url} did not answer a ping, reconnecting`),n.onclose=null,n.close(),Wi(e,t),P.get(e)===t&&Ui(e,t,0),!1)}function Ki(e,t,n){if(n instanceof ArrayBuffer){let t=Ir(new Uint8Array(n));for(let n of ki)n.frame?.(e,t);return}let r=JSON.parse(String(n));if(r.type===`reply`)qi(t,r);else if(r.type===`terminal`)for(let t of ki)t.terminal?.(e,r.event);else for(let t of ki)t.event?.(e,r)}function qi(e,t){let n=e.pending.get(t.id);n!==void 0&&(e.pending.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.result))}var Ji=`claude`,Yi=`bypassPermissions`,Xi=`full-access`;function Zi(e,t){if(e.length===0)return;let n=e[0],r=-1/0;for(let i=0;i<e.length;i++){let a=e[i],o=t(a,i,e);if(Number.isNaN(o))return a;o>r&&(r=o,n=a)}return n}function Qi(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}var $i=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ea=(e=>e?$i(e):$i),ta=e=>e;function na(e,t=ta){let n=j.useSyncExternalStore(e.subscribe,j.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return j.useDebugValue(n),n}var ra=e=>{let t=ea(e),n=e=>na(t,e);return Object.assign(n,t),n},ia=(e=>e?ra(e):ra);function aa(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var oa=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return oa(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return oa(t)(e)}}}},sa=(e,t)=>(n,r,i)=>{let a={storage:aa(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return oa(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},ca=`composerDrafts`,la={text:``,images:[],files:[],settings:null},ua=Zr(`offsite-drafts`,`drafts`),da=Zr(`offsite-draft-files`,`files`),fa=Qi(e=>void ti(ca,e,ua),300),pa={getItem:async e=>await ei(e,ua)??null,setItem:(e,t)=>fa(t),removeItem:e=>ni(e,ua)},ma={drafts:{},stash:[]},I=ia()(sa(()=>ma,{name:ca,storage:pa,skipHydration:!0,version:1,migrate:()=>ma}));window.addEventListener(`pagehide`,fa.flush);function ha(){return I.persist.rehydrate()}function ga(e){return I(t=>t.drafts[e]??la)}function _a(e,t){let n=xa(e),r=t(n),i=I.getState().stash;for(let e of n.files)!r.files.some(t=>t.id===e.id)&&!i.some(t=>t.files.some(t=>t.id===e.id))&&ni(e.id,da);I.setState(t=>{let n={...t.drafts,[e]:r};return r.text===``&&r.images.length===0&&r.files.length===0&&r.settings===null&&delete n[e],{drafts:n}})}async function va(e){let t=crypto.randomUUID();return await ti(t,e,da),t}async function ya(e){return await ei(e,da)}function ba(e){_a(e,()=>la)}function xa(e){return I.getState().drafts[e]??la}function Sa(e){return I.getState().drafts[e]?.settings??null}function Ca(e,t){_a(e,e=>({...e,settings:t}))}function wa(){return I(e=>e.stash)}function Ta(){return I.getState().stash}function Ea(e){return e.text.trim()!==``||e.images.length>0||e.files.length>0}function Da(e){let t=xa(e);I.setState(e=>({stash:[{id:crypto.randomUUID(),createdAt:Date.now(),text:t.text,images:t.images,files:t.files},...e.stash]})),_a(e,e=>({...e,text:``,images:[],files:[]}))}function Oa(e,t,n){let r=I.getState().stash.find(e=>e.id===t);if(r===void 0)throw Error(`This stashed prompt no longer exists`);Ea(xa(e))&&Da(e),I.setState(e=>({stash:e.stash.filter(e=>e.id!==t)}));let i=r.text.replace(/\[Image #(\d+)\]/g,(e,t)=>{let i=r.images.findIndex(e=>e.number===Number(t));return i===-1?e:`[Image #${n+i+1}]`});return _a(e,e=>({...e,text:i,images:r.images.map((e,t)=>({...e,number:n+t+1})),files:r.files})),i}function ka(e){let t=I.getState().stash.find(t=>t.id===e);if(t!==void 0){I.setState(t=>({stash:t.stash.filter(t=>t.id!==e)}));for(let e of t.files)ni(e.id,da)}}function Aa(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 ja(e,t=`|`){return e.map(e=>to(e)).join(t)}function Ma(e,t){return typeof t==`bigint`?t.toString():t}var Na=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Pa(e){return new Na(e)}function Fa(e){return e==null}function Ia(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function La(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Ra(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function za(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Ba(e){return za(e._zod.def)??e._zod.def.shape}function Va(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Ra(this,t,e),e},enumerable:!0,configurable:!0})}function Ha(e,t,n){t in e?Ra(e,t,n):e[t]=n}function Ua(e,t,n,r){let i=Ba(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Va(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Ha(e,a,r?r(n.value,a):n.value))}}function Wa(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Va(e,n,()=>t[n]):Ha(e,n,r.value))}}function L(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ga(e){return JSON.stringify(e)}function Ka(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var qa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ja(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ya=Pa(()=>{if(Go.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Xa(e){if(Ja(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ja(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Za(e){return Xa(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Qa=new Set([`string`,`number`,`symbol`]);function $a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function R(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 to(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function no(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ro={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},io={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ao(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ua(i,e,oo(e,t)),eo(e,L(n,{shape:i,checks:[]}))}function oo(e,t){let n=Ba(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function so(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(oo(e,t)),a={};return Ua(a,e,Reflect.ownKeys(Ba(e)).filter(e=>!i.has(e))),eo(e,L(n,{shape:a,checks:[]}))}function co(e,t){if(!Xa(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Ba(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return eo(e,L(e._zod.def,{shape:lo(e,t)}))}function lo(e,t){let n={};return Ua(n,e,Reflect.ownKeys(Ba(e))),Wa(n,t),n}function uo(e,t){if(!Xa(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return eo(e,L(e._zod.def,{shape:lo(e,t)}))}function fo(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ua(n,e,Reflect.ownKeys(Ba(e))),Ua(n,t,Reflect.ownKeys(Ba(t))),eo(e,L(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function po(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(oo(t,n)):void 0,o={};return Ua(o,t,Reflect.ownKeys(Ba(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),eo(t,L(t._zod.def,{shape:o,checks:[]}))}function mo(e,t,n){let r=n?new Set(oo(t,n)):void 0,i={};return Ua(i,t,Reflect.ownKeys(Ba(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),eo(t,L(t._zod.def,{shape:i}))}function ho(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 go(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _o(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function vo(e){return typeof e==`string`?e:e?.message}function yo(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function bo(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function xo(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:vo(e.inst?._zod.def?.error?.(e))??vo(a?.(e))??vo(t?.error?.(e))??vo(n.customError?.(e))??vo(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var So=/[\uD800-\uDBFF]/;function Co(e){let t=e.length;if(!So.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function wo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function To(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Eo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Do(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):jo(e,n,r.value)}}function Oo(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ko(e,t,n){return Oo(e,t,n,!1)}function Ao(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Oo(this,n,r(this))},set(e){Oo(this,n,e)}})}return t}function jo(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Oo(this,t,n.bind(this))},set(e){Oo(this,t,e)}})}function Mo(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var No,Po=!1,Fo={configurable:!0,get(){Po=!0}};function z(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&No!==e._zod?No=void 0:(No=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Fo);let e=Po;Po=!1;try{let r=n(this);return Po?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Po||=e,r}catch(n){throw delete this[t],Po||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Io(e,t,n,r){let i=Mo(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Lo=`~constantCatch`;function Ro(e){let t=()=>e;return t[Lo]=!0,t}var zo,Bo={value:void 0,enumerable:!1},Vo=`captureStackTrace`in Error?Error:null;function Ho(e){let t=Vo;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Vo=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function B(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Bo.value=new a(r);try{Object.defineProperty(n,"_zod",Bo)}finally{Bo.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Do(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ho(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Uo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Wo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(zo=globalThis).__zod_globalConfig??(zo.__zod_globalConfig={});var Go=globalThis.__zod_globalConfig;function Ko(e){return e&&Object.assign(Go,e),Go}function qo(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ma,2),e.message}function Jo(e){this._zod.message=e}var Yo={get:qo,set:Jo,enumerable:!0,configurable:!0},Xo={value:void 0,enumerable:!1},Zo=new WeakSet([Object.prototype,Error.prototype]),Qo=B(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Xo.value=t,Object.defineProperty(e,"issues",Xo),Xo.value=void 0,Object.defineProperty(e,"message",Yo);let n=Object.getPrototypeOf(e);Zo.has(n)||(Zo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function $o(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function es(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?$o(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ts(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ns(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function rs(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${ns(e.path)}`);return t.join(`
|
|
13
13
|
`)}function is(e,t){return{callee:t?.callee??e,Err:t?.Err}}var as=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Uo;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>xo(e,o,Ko())));throw qa(n,a?.callee??t),n}return s.value};return t},os=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>xo(e,o,Ko())));throw qa(n,a?.callee??t),n}return s.value};return t},ss=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 Uo;return a.issues.length?cs(e,a.issues,i):{success:!0,data:a.value}};function cs(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>xo(e,n,Ko()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ls=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?cs(e,a.issues,i):{success:!0,data:a.value}},us=Symbol.for(`zod.compile.invalid`),ds=Symbol.for(`zod.compile.fallback`),fs=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==us)return!0;if(r.definite===!0&&n===void 0)return!1}return ps(e,t,n)});function ps(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ds]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Uo;return a.issues.length===0}var ms=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},hs=e=>{let t=as(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,is(n,a))};return n},gs=e=>{let t=as(e),n=(e,r,i,a)=>t(e,r,i,is(n,a));return n},_s=e=>{let t=os(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,is(n,a))};return n},vs=e=>{let t=os(e),n=async(e,r,i,a)=>await t(e,r,i,is(n,a));return n},ys=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ss(e)(t,n,i)},bs=e=>(t,n,r)=>ss(e)(t,n,r),xs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ls(e)(t,n,i)},Ss=e=>async(t,n,r)=>ls(e)(t,n,r),Cs=/^[cC][0-9a-z]{6,}$/,ws=/^[0-9a-z]+$/,Ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Es=/^[0-9a-vA-V]{20}$/,Ds=/^[A-Za-z0-9]{27}$/,Os=/^[a-zA-Z0-9_-]{21}$/;function ks(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var As=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,js=/^([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})$/,Ms=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)$/,Ns=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ps=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Fs(){return new RegExp(Ps,`u`)}var Is=/^(?:(?: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])$/,Ls=/^(([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}|:))$/,Rs=/^((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])$/,zs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hs=/^https?$/,Us=/^\+[1-9]\d{6,14}$/,Ws=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Gs(e){return RegExp(`^${e}$`)}var Ks=Gs(Ws);function qs(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Js(e){return RegExp(`^${qs(e)}$`)}function Ys(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${qs({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${qs({precision:e.precision})}`:n;return RegExp(`^${Ws}T(?:${r})$`)}var Xs=/^[\s\S]{0,}$/,Zs=/^-?\d+(?:\.\d+)?$/,Qs=/^(?:true|false)$/i,$s=/^[^A-Z]*$/,ec=/^[^a-z]*$/,V=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tc=e=>{let t=e.value;return!Fa(t)&&t.length!==void 0},nc={number:`number`,bigint:`bigint`,object:`date`},rc=B(`$ZodCheckLessThan`,(e,t)=>{V.init(e,t);let n=nc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:nc[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ic=B(`$ZodCheckGreaterThan`,(e,t)=>{V.init(e,t);let n=nc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:nc[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=B(`$ZodCheckMultipleOf`,(e,t)=>{V.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):La(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})}}),oc=B(`$ZodCheckNumberFormat`,(e,t)=>{V.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ro[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),sc=B(`$ZodCheckMaxLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=tc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Co(r):i)<=t.maximum)return;let a=wo(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cc=B(`$ZodCheckMinLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=tc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Co(r):i)>=t.minimum)return;let a=wo(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lc=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=tc),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Co(r):i;if(a===t.length)return;let o=wo(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),uc=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;V.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dc=B(`$ZodCheckRegex`,(e,t)=>{uc.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})}}),fc=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$s,uc.init(e,t)}),pc=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ec,uc.init(e,t)}),mc=B(`$ZodCheckIncludes`,(e,t)=>{V.init(e,t);let n=$a(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hc=B(`$ZodCheckStartsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`^${$a(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gc=B(`$ZodCheckEndsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`.*${$a(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_c=B(`$ZodCheckOverwrite`,(e,t)=>{V.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),vc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
14
14
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
15
15
|
`)}\n};`)(...Object.values(this.closed))}},yc={major:4,minor:6,patch:7},H=B(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yc;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ho(t),a;for(let o of n){if(o._zod.def.when){if(go(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Uo;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(bo(t.issues,n,e),i||=ho(t,n))});else{if(t.issues.length===n)continue;bo(t.issues,n,e),i||=ho(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ho(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Uo;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Uo;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ko(this,`~standard`,Sc(this))},set"~standard"(e){Oo(this,`~standard`,e)}}),bc=(e,t)=>e.issues.length?{issues:e.issues.map(e=>xo(e,t,Ko()))}:{value:e.value};async function xc(e,t){let n={async:!0};return bc(await e._zod.run({value:t,issues:[]},n),n)}function Sc(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return bc(r,n)}catch{}return xc(e,t)},vendor:`zod`,version:1}}var Cc=B(`$ZodString`,(e,t)=>{H.init(e,t),e._zod.pattern=t.pattern??Xs,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}}),U=B(`$ZodStringFormat`,(e,t)=>{uc.init(e,t),Cc.init(e,t)}),wc=B(`$ZodGUID`,(e,t)=>{t.pattern??=js,U.init(e,t)}),Tc=B(`$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??=Ms(e)}else t.pattern??=Ms();U.init(e,t)}),Ec=B(`$ZodEmail`,(e,t)=>{t.pattern??=Ns,U.init(e,t)});function Dc(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Oc(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Dc(e)||2:kc(e,t)}function kc(e,t){if(!t.normalize&&t.protocol?.source===Hs.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Ac=/[\t\n\r]/g;function jc(e){return e.replace(Ac,``)}function Mc(e,t){return t.lastIndex=0,t.test(e.hostname)}function Nc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Pc=B(`$ZodURL`,(e,t)=>{U.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Oc(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=jc(r);return}t.hostname&&!Mc(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Nc(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:jc(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Fc=B(`$ZodEmoji`,(e,t)=>{t.pattern??=Fs(),U.init(e,t)}),Ic=B(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Os:ks(t.length),U.init(e,t)}),Lc=B(`$ZodCUID`,(e,t)=>{t.pattern??=Cs,U.init(e,t)}),Rc=B(`$ZodCUID2`,(e,t)=>{t.pattern??=ws,U.init(e,t)}),zc=B(`$ZodULID`,(e,t)=>{t.pattern??=Ts,U.init(e,t)}),Bc=B(`$ZodXID`,(e,t)=>{t.pattern??=Es,U.init(e,t)}),Vc=B(`$ZodKSUID`,(e,t)=>{t.pattern??=Ds,U.init(e,t)}),Hc=B(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ys(t),U.init(e,t)}),Uc=B(`$ZodISODate`,(e,t)=>{t.pattern??=Ks,U.init(e,t)}),Wc=B(`$ZodISOTime`,(e,t)=>{t.pattern??=Js(t),U.init(e,t)}),Gc=B(`$ZodISODuration`,(e,t)=>{t.pattern??=As,U.init(e,t)}),Kc=B(`$ZodIPv4`,(e,t)=>{t.pattern??=Is,U.init(e,t)}),qc=/^[0-9a-fA-F:.]+$/;function Jc(e){return qc.test(e)?Dc(`http://[${e}]`):!1}var Yc=B(`$ZodIPv6`,(e,t)=>{t.pattern??=Ls,U.init(e,t),e._zod.check=n=>{Jc(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Xc=B(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rs,U.init(e,t)});function Zc(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Jc(n)}var Qc=B(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zs,U.init(e,t),e._zod.check=n=>{Zc(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function $c(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var el=/^[0-9a-zA-Z+/]*={0,2}$/,tl=B(`$ZodBase64`,(e,t)=>{t.pattern??=el,U.init(e,t),e._zod.check=n=>{$c(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),nl=/^[A-Za-z0-9_-]*$/;function rl(e){if(!nl.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $c(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var il=B(`$ZodBase64URL`,(e,t)=>{t.pattern??=nl,U.init(e,t),e._zod.check=n=>{rl(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),al=B(`$ZodE164`,(e,t)=>{t.pattern??=Us,U.init(e,t)});function ol(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 sl=B(`$ZodJWT`,(e,t)=>{U.init(e,t),e._zod.check=n=>{ol(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),cl=B(`$ZodNumber`,(e,t)=>{H.init(e,t),e._zod.pattern=Zs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ll=B(`$ZodNumberFormat`,(e,t)=>{oc.init(e,t),cl.init(e,t)}),ul=B(`$ZodBoolean`,(e,t)=>{H.init(e,t),e._zod.pattern=Qs,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}}),dl=B(`$ZodUnknown`,(e,t)=>{H.init(e,t),e._zod.parse=e=>e}),fl=B(`$ZodNever`,(e,t)=>{H.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function pl(e,t){let n=yo(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of yo(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,bo(n.issues,t,e),n}}return i(n,a)}}var ml=e=>Array.isArray(e)?e.length:-1;function hl(e,t,n){e.issues.length&&t.issues.push(..._o(n,e.issues)),t.value[n]=e.value}var gl=B(`$ZodArray`,(e,t)=>{H.init(e,t);let n=Go.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>hl(t,r,e)));else if(hl(c,r,e),s&&c.issues.length!==0&&ho(c))break}return o.length?Promise.all(o).then(()=>r):r},pl(e,ml)});function _l(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(..._o(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var vl=[];function yl(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:vl,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=no(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function bl(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ho(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>_l(e,n,i,t,d,f))):_l(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var xl=B(`$ZodObject`,(e,t)=>{H.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Pa(()=>yl(t));z(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Ra(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ja,o=t.catchall,s,c=Go.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ho(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>_l(n,t,e,r,a,o))):_l(s,t,e,r,a,o)}return o?bl(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Sl=B(`$ZodObjectJIT`,(e,t)=>{xl.init(e,t);let n=e._zod.parse,r=Pa(()=>yl(t)),i=Go.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new vc([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
@@ -64,4 +64,4 @@ import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{c as n,l as r,r as i
|
|
|
64
64
|
|
|
65
65
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ja,c=!Go.jitless,l=c&&Ya.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?bl([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Cl(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=>!ho(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=>xo(e,r,Ko())))}),t)}var wl=B(`$ZodUnion`,(e,t)=>{H.init(e,t),z(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),z(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),z(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),z(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Ia(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Cl(t,r,e,i)):Cl(o,r,e,i)}});function Tl(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var El=B(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,wl.init(e,t);let n=e._zod.parse;z(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Ra(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=za(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Pa(()=>Tl(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Ja(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Dl=B(`$ZodIntersection`,(e,t)=>{H.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])=>kl(e,t,n)):kl(e,i,a)}});function Ol(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Xa(e)&&Xa(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ol(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=Ol(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 kl(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ol(t.value,n.value);if(!c.valid){if(ho(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Al=B(`$ZodEnum`,(e,t)=>{H.init(e,t);let n=Aa(t.entries),r=new Set(n);e._zod.values=r,z(e,`pattern`,e=>{let t=Aa(e.def.entries).filter(e=>Qa.has(typeof e));return RegExp(t.length?`^(${t.map(e=>$a(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),jl=B(`$ZodLiteral`,(e,t)=>{H.init(e,t);let n=new Set(t.values);e._zod.values=n,z(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?$a(e):e?$a(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ml=B(`$ZodTransform`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,Go.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Wo(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 Uo;return n.value=i,n}});function Nl(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pl=B(`$ZodOptional`,(e,t)=>{H.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,z(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),z(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ia(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Nl(e,t)):Nl(e,r)}return t.innerType._zod.run(e,n)}}),Fl=B(`$ZodExactOptional`,(e,t)=>{Pl.init(e,t),z(e,`values`,e=>e.def.innerType._zod.values),z(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Il=B(`$ZodNullable`,(e,t)=>{H.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin),z(e,`optout`,e=>e.def.innerType._zod.optout),z(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ia(t.source)}|null)$`):void 0}),z(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ll=B(`$ZodDefault`,(e,t)=>{H.init(e,t),e._zod.optin=`defaulted`,z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Rl(e,t)):Rl(r,t)}});function Rl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var zl=B(`$ZodPrefault`,(e,t)=>{H.init(e,t),e._zod.optin=`defaulted`,z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Bl=B(`$ZodNonOptional`,(e,t)=>{H.init(e,t),z(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Vl(t,e)):Vl(i,e)}});function Vl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Hl(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>xo(e,r,Ko()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ul=B(`$ZodCatch`,(e,t)=>{H.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),z(e,`optout`,e=>e.def.innerType._zod.optout),z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Hl(e,r,t,n)):Hl(e,r,t,n)}}),Wl=B(`$ZodPipe`,(e,t)=>{H.init(e,t),z(e,`values`,e=>e.def.in._zod.values),z(e,`optin`,e=>e.def.in._zod.optin),z(e,`optout`,e=>e.def.out._zod.optout),z(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gl(e,t.in,n)):Gl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gl(e,t.out,n)):Gl(r,t.out,n)}});function Gl(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Kl=B(`$ZodReadonly`,(e,t)=>{H.init(e,t),z(e,`propValues`,e=>e.def.innerType._zod.propValues),z(e,`values`,e=>e.def.innerType._zod.values),z(e,`optin`,e=>e.def.innerType?._zod?.optin),z(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ql):ql(r)}});function ql(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Jl=B(`$ZodCustom`,(e,t)=>{V.init(e,t),H.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=>Yl(t,n,r,e));Yl(i,n,r,e)}});function Yl(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(Eo(e))}}var Xl=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Zl=`~memo`,Ql=[];function $l(e){return typeof e==`object`&&!!e}function eu(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var tu=new WeakMap,nu=0,ru=1,iu=2;function au(e,t,n){let r=tu.get(e);if(r!==void 0)return r?iu:nu;if(t.has(e))return iu;t.add(e);let i=nu,a=e=>{if(i!==iu&&e?._zod){let r=au(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=nu;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?ru:o.value?._zod?au(o.value,t,n):nu;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=za(c);s(e?o(e,!0):ru),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?au(r,t,!1):ru);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ou(e,i)}function ou(e,t){return t!==ru&&tu.set(e,t===iu),t}function su(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var cu,lu=[],uu={alloc(e,t,n){let r=cu;if(!r)return n;cu=void 0;let i={value:n,issues:null};return r.set(t.value,i),lu.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&fu(n,e.value))throw new Xl;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=au(e,new Set,!1);if(i===nu)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===iu||r?n=!0:r=!0}let l=s.value;if(!$l(l))return t(s,c);let u=c[Zl];u||(u={buckets:new WeakMap,backEdges:void 0},c[Zl]=u);let d;i===c?d=a:(d=su(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...eu(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;cu=d;let p=lu.length,m=t(s,c);cu=void 0;let h=lu.length>p?lu.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?eu(e.issues):Ql),e)):(h&&(h.issues=m.issues.length?eu(m.issues):Ql),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function du(){return uu}function fu(e,t){let n=e[Zl]?.backEdges;return n!==void 0&&$l(t)&&n.has(t)}var pu=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(To(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${to(e.values[0])}`:`Invalid option: expected one of ${ja(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ja(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function mu(){return{localeError:pu()}}var hu,gu=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 _u(){return new gu}(hu=globalThis).__zod_globalRegistry??(hu.__zod_globalRegistry=_u());var vu=globalThis.__zod_globalRegistry;function yu(e){return e.checks&&=[...e.checks],e}function bu(e,t){return new e(yu({type:`string`,...R(t)}))}function xu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function Su(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function Cu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function wu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function Tu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function Eu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function Du(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function Ou(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function ku(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function Au(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function ju(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function Mu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function Nu(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function Pu(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function Fu(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function Iu(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function Lu(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function Ru(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function zu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function Bu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function Vu(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function Hu(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function Uu(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function Wu(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function Gu(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function Ku(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function qu(e,t){return new e(yu({type:`number`,checks:[],...R(t)}))}function Ju(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function Yu(e,t){return new e({type:`boolean`,...R(t)})}function Xu(e){return new e({type:`unknown`})}function Zu(e,t){return new e({type:`never`,...R(t)})}function Qu(e,t){return new rc({check:`less_than`,...R(t),value:e,inclusive:!1})}function $u(e,t){return new rc({check:`less_than`,...R(t),value:e,inclusive:!0})}function ed(e,t){return new ic({check:`greater_than`,...R(t),value:e,inclusive:!1})}function td(e,t){return new ic({check:`greater_than`,...R(t),value:e,inclusive:!0})}function nd(e,t){return new ac({check:`multiple_of`,...R(t),value:e})}function rd(e,t){return new sc({check:`max_length`,...R(t),maximum:e})}function id(e,t){return new cc({check:`min_length`,...R(t),minimum:e})}function ad(e,t){return new lc({check:`length_equals`,...R(t),length:e})}function od(e,t){return new dc({check:`string_format`,format:`regex`,...R(t),pattern:e})}function sd(e){return new fc({check:`string_format`,format:`lowercase`,...R(e)})}function cd(e){return new pc({check:`string_format`,format:`uppercase`,...R(e)})}function ld(e,t){return new mc({check:`string_format`,format:`includes`,...R(t),includes:e})}function ud(e,t){return new hc({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function dd(e,t){return new gc({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function fd(e){return new _c({check:`overwrite`,tx:e})}function pd(e){return fd(t=>t.normalize(e))}function md(){return fd(e=>e.trim())}function hd(){return fd(e=>e.toLowerCase())}function gd(){return fd(e=>e.toUpperCase())}function _d(){return fd(e=>Ka(e))}function vd(e,t,n){return new e({type:`array`,element:t,...R(n)})}function yd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function bd(e,t){let n=xd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Eo(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Eo(r))}},e(t.value,t)),t);return n}function xd(e,t){let n=new V({check:`custom`,...R(t)});return n._zod.check=e,n}function Sd(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Ra(e,t,n[t]);return e}function Cd(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??vu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function wd(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function W(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,W(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Sd(o.schema,c),t.io===`input`&&G(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Td(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ed(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Td(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Td(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>
|
|
66
66
|
|
|
67
|
-
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Dd(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Dd(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Od=new Set([`type`,`properties`,`required`,`additionalProperties`]),kd=[`oneOf`,`anyOf`];function Ad(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function jd(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Od.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ad(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Ra(n,r,e.length===1?e[0]:jd(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ad(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Md(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Od)if(t in e)return;let n=t.filter(e=>kd.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=jd(t);else{let e=n[0],i=kd.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>jd([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Sd(e,r))}function Nd(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)):Sd(i,s),Sd(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Dd(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Md(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Sd(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Ra(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Fd(t,`input`,e.processors),output:Fd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function G(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 G(r.element,n);if(r.type===`set`)return G(r.valueType,n);if(r.type===`lazy`)return G(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return G(r.innerType,n);if(r.type===`intersection`)return G(r.left,n)||G(r.right,n);if(r.type===`record`||r.type===`map`)return G(r.keyType,n)||G(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:G(r.in,n)||G(r.out,n);if(r.type===`object`){for(let e in r.shape)if(G(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(G(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(G(e,n))return!0;return!!(r.rest&&G(r.rest,n))}return!1}var Pd=(e,t={})=>n=>{let r=Cd({...n,processors:t});return W(e,r),Ed(r,e),Nd(r,e)},Fd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Cd({...i??{},target:a,io:t,processors:n});return W(e,o),Ed(o,e),Nd(o,e)},Id=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Ld=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Rd=(e,t)=>{Id(e,`minimum`,t),Ld(e,`maximum`,t)},zd=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Bd=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Vd=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Hd=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ud=(e,t)=>Id(e,`minimum`,t.minimum),Wd=(e,t)=>Ld(e,`maximum`,t.maximum),Gd=e=>(t,n)=>{Hd(t,n.format);let[r,i]=e[n.format];Id(t,`minimum`,r),Ld(t,`maximum`,i)},Kd={greater_than:(e,t)=>Id(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Ld(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>zd(e,t.value),number_format:Gd(ro),bigint_format:Gd(io),min_length:Ud,max_length:Wd,length_equals:(e,t)=>Rd(e,t.length),min_size:Ud,max_size:Wd,size_equals:(e,t)=>Rd(e,t.size),string_format:(e,t)=>{Hd(e,t.format),t.pattern&&Bd(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Vd(e,t.mime)};function qd(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Kd[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Id(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Id(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Ld(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Ld(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&zd(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Vd(t,i.mime);for(let e of i.patterns??[])Bd(t,e);return t}var Jd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yd=new Map([[el,Bs],[nl,Vs]]),Xd=e=>Yd.get(e)??e,Zd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=qd(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jd[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Xd);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}))])}},Qd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=qd(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):wd(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},$d=(e,t,n,r)=>{n.type=`boolean`},ef=(e,t,n,r)=>{n.not={}},tf=(e,t,n,r)=>{let i=e._zod.def,a=Aa(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},nf=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(wd(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(wd(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},rf=(e,t,n,r)=>{wd(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},af=(e,t,n,r)=>{wd(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},of=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=qd(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=W(a.element,t,{...r,path:[...r.path,`items`]})};function sf(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?sf(t.out):t.type===`catch`?sf(t.innerType):e._zod.optin}var cf=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&wd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Ra(i.properties,e,W(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?sf(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=W(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},lf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>W(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},uf=(e,t,n,r)=>{let i=e._zod.def,a=W(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=W(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},df=(e,t,n,r)=>{let i=e._zod.def,a=W(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`}]},ff=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pf=Symbol();function mf(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(wd(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),pf):JSON.parse(o)}var hf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=mf(i.defaultValue,e,t,n,r);o!==pf&&(n.default=o)},gf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=mf(i.defaultValue,e,t,n,r);o!==pf&&(n._prefault=o)},_f=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{wd(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},vf=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;W(o,t,r);let s=t.seen.get(e);s.ref=o},yf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},bf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xf=new WeakSet([Object.prototype,Error.prototype]);function Sf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var K=B(`ZodError`,(e,t)=>{Qo.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);xf.has(n)||(xf.add(n),Sf(n,`format`,e=>t=>ts(e,t)),Sf(n,`flatten`,e=>t=>es(e,t)),Sf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ma,2)}),Sf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ma,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Cf=as(K),wf=os(K),Tf=ss(K),Ef=ls(K),Df=hs(K),Of=gs(K),kf=_s(K),Af=vs(K),jf=ys(K),Mf=bs(K),Nf=xs(K),Pf=Ss(K);function Ff(){Go.localeError||Ko(mu())}function If(){Go.memoizer||Ko({memoizer:du()})}var q=B(`ZodType`,(e,t)=>(Ff(),H.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(L(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(em(e,t))},superRefine(e,t){return this.check(tm(e,t))},overwrite(e){return this.check(fd(e))},optional(){return Ip(this)},exactOptional(){return Rp(this)},nullable(){return Bp(this)},nullish(){return Ip(Bp(this))},nonoptional(e){return Kp(this,e)},array(){return yp(this)},or(e){return wp([this,e])},and(e){return Op(this,e)},transform(e){return Xp(this,Pp(e))},default(e){return Hp(this,e)},prefault(e){return Wp(this,e)},catch(e){return Jp(this,e)},pipe(e){return Xp(this,e)},readonly(){return Qp(this)},describe(e){let t=this.clone();return vu.add(t,{description:e}),t},meta(...e){if(e.length===0)return vu.get(this);let t=this.clone();return vu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ko(this,`~standard`,{...Sc(this),jsonSchema:{input:Fd(this,`input`),output:Fd(this,`output`)}})},set"~standard"(e){Oo(this,`~standard`,e)},parse:function e(t,n){return Cf(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await wf(this,t,n,{callee:e})},safeParse(e,t){return Tf(this,e,t)},async safeParseAsync(e,t){return Ef(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Oo(this,`spa`,e)},validate(e,t){return fs(this,e,t)},validateAsync(e,t){return ms(this,e,t)},encode:function e(t,n){return Df(this,t,n,{callee:e})},decode:function e(t,n){return Of(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await kf(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Af(this,t,n,{callee:e})},safeEncode(e,t){return jf(this,e,t)},safeDecode(e,t){return Mf(this,e,t)},async safeEncodeAsync(e,t){return Nf(this,e,t)},async safeDecodeAsync(e,t){return Pf(this,e,t)},toJSONSchema(e){return Pd(this,{})(e)},get description(){return vu.get(this)?.description},get _def(){return this._zod.def}}),Lf=B(`_ZodString`,(e,t)=>{Cc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r)},Ao({format:e=>qd(e).format??null,minLength:e=>qd(e).minimum??null,maxLength:e=>qd(e).maximum??null},{regex(...e){return this.check(od(...e))},includes(...e){return this.check(ld(...e))},startsWith(...e){return this.check(ud(...e))},endsWith(...e){return this.check(dd(...e))},min(...e){return this.check(id(...e))},max(...e){return this.check(rd(...e))},length(...e){return this.check(ad(...e))},nonempty(...e){return this.check(id(1,...e))},lowercase(e){return this.check(sd(e))},uppercase(e){return this.check(cd(e))},trim(){return this.check(md())},normalize(...e){return this.check(pd(...e))},toLowerCase(){return this.check(hd())},toUpperCase(){return this.check(gd())},slugify(){return this.check(_d())}})),Rf=B(`ZodString`,(e,t)=>{Cc.init(e,t),Lf.init(e,t)},{email(e){return this.check(xu(Wf,e))},url(e){return this.check(Du(qf,e))},jwt(e){return this.check(Hu(cp,e))},emoji(e){return this.check(Ou(Jf,e))},guid(e){return this.check(Su(Gf,e))},uuid(e){return this.check(Cu(Kf,e))},uuidv4(e){return this.check(wu(Kf,e))},uuidv6(e){return this.check(Tu(Kf,e))},uuidv7(e){return this.check(Eu(Kf,e))},nanoid(e){return this.check(ku(Yf,e))},cuid(e){return this.check(Au(Xf,e))},cuid2(e){return this.check(ju(Zf,e))},ulid(e){return this.check(Mu(Qf,e))},base64(e){return this.check(zu(ap,e))},base64url(e){return this.check(Bu(op,e))},xid(e){return this.check(Nu($f,e))},ksuid(e){return this.check(Pu(ep,e))},ipv4(e){return this.check(Fu(tp,e))},ipv6(e){return this.check(Iu(np,e))},cidrv4(e){return this.check(Lu(rp,e))},cidrv6(e){return this.check(Ru(ip,e))},e164(e){return this.check(Vu(sp,e))},datetime(e){return this.check(Uu(Bf,e))},date(e){return this.check(Wu(Vf,e))},time(e){return this.check(Gu(Hf,e))},duration(e){return this.check(Ku(Uf,e))}});function zf(e){return bu(Rf,e)}var J=B(`ZodStringFormat`,(e,t)=>{U.init(e,t),Lf.init(e,t)}),Bf=B(`ZodISODateTime`,(e,t)=>{Hc.init(e,t),J.init(e,t)}),Vf=B(`ZodISODate`,(e,t)=>{Uc.init(e,t),J.init(e,t)}),Hf=B(`ZodISOTime`,(e,t)=>{Wc.init(e,t),J.init(e,t)}),Uf=B(`ZodISODuration`,(e,t)=>{Gc.init(e,t),J.init(e,t)}),Wf=B(`ZodEmail`,(e,t)=>{Ec.init(e,t),J.init(e,t)}),Gf=B(`ZodGUID`,(e,t)=>{wc.init(e,t),J.init(e,t)}),Kf=B(`ZodUUID`,(e,t)=>{Tc.init(e,t),J.init(e,t)}),qf=B(`ZodURL`,(e,t)=>{Pc.init(e,t),J.init(e,t)}),Jf=B(`ZodEmoji`,(e,t)=>{Fc.init(e,t),J.init(e,t)}),Yf=B(`ZodNanoID`,(e,t)=>{Ic.init(e,t),J.init(e,t)}),Xf=B(`ZodCUID`,(e,t)=>{Lc.init(e,t),J.init(e,t)}),Zf=B(`ZodCUID2`,(e,t)=>{Rc.init(e,t),J.init(e,t)}),Qf=B(`ZodULID`,(e,t)=>{zc.init(e,t),J.init(e,t)}),$f=B(`ZodXID`,(e,t)=>{Bc.init(e,t),J.init(e,t)}),ep=B(`ZodKSUID`,(e,t)=>{Vc.init(e,t),J.init(e,t)}),tp=B(`ZodIPv4`,(e,t)=>{Kc.init(e,t),J.init(e,t)}),np=B(`ZodIPv6`,(e,t)=>{Yc.init(e,t),J.init(e,t)}),rp=B(`ZodCIDRv4`,(e,t)=>{Xc.init(e,t),J.init(e,t)}),ip=B(`ZodCIDRv6`,(e,t)=>{Qc.init(e,t),J.init(e,t)}),ap=B(`ZodBase64`,(e,t)=>{tl.init(e,t),J.init(e,t)}),op=B(`ZodBase64URL`,(e,t)=>{il.init(e,t),J.init(e,t)}),sp=B(`ZodE164`,(e,t)=>{al.init(e,t),J.init(e,t)}),cp=B(`ZodJWT`,(e,t)=>{sl.init(e,t),J.init(e,t)}),lp=B(`ZodNumber`,(e,t)=>{cl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r),e.isFinite=!0},Ao({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=qd(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=qd(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=qd(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>qd(e).format??null},{gt(e,t){return this.check(ed(e,t))},gte(e,t){return this.check(td(e,t))},min(e,t){return this.check(td(e,t))},lt(e,t){return this.check(Qu(e,t))},lte(e,t){return this.check($u(e,t))},max(e,t){return this.check($u(e,t))},int(e){return this.check(fp(e))},safe(e){return this.check(fp(e))},positive(e){return this.check(ed(0,e))},nonnegative(e){return this.check(td(0,e))},negative(e){return this.check(Qu(0,e))},nonpositive(e){return this.check($u(0,e))},multipleOf(e,t){return this.check(nd(e,t))},step(e,t){return this.check(nd(e,t))},finite(){return this}}));function up(e){return qu(lp,e)}var dp=B(`ZodNumberFormat`,(e,t)=>{ll.init(e,t),lp.init(e,t)});function fp(e){return Ju(dp,e)}var pp=B(`ZodBoolean`,(e,t)=>{ul.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r)});function Y(e){return Yu(pp,e)}var mp=B(`ZodUnknown`,(e,t)=>{dl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function hp(){return Xu(mp)}var gp=B(`ZodNever`,(e,t)=>{fl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r)});function _p(e){return Zu(gp,e)}var vp=B(`ZodArray`,(e,t)=>{If(),gl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.element=t.element},{min(e,t){return this.check(id(e,t))},nonempty(e){return this.check(id(1,e))},max(e,t){return this.check(rd(e,t))},length(e,t){return this.check(ad(e,t))},unwrap(){return this.element}});function yp(e,t){return vd(vp,e,t)}var bp=B(`ZodObject`,(e,t)=>{If(),Sl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),Io(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Ap(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(L(this._zod.def,{catchall:e}))},passthrough(){return this.clone(L(this._zod.def,{catchall:hp()}))},loose(){return this.clone(L(this._zod.def,{catchall:hp()}))},strict(){return this.clone(L(this._zod.def,{catchall:_p()}))},strip(){return this.clone(L(this._zod.def,{catchall:void 0}))},extend(e){return co(this,e)},safeExtend(e){return uo(this,e)},merge(e){return fo(this,e)},pick(e){return ao(this,e)},omit(e){return so(this,e)},partial(...e){return po(Fp,this,e[0])},exactPartial(...e){return po(Lp,this,e[0],`exactPartial`)},required(...e){return mo(Gp,this,e[0])}});function xp(e,t){return new bp({type:`object`,shape:e??{},...R(t)})}function Sp(e,t){return new bp({type:`object`,shape:e,catchall:_p(),...R(t)})}var Cp=B(`ZodUnion`,(e,t)=>{wl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.options=t.options});function wp(e,t){return new Cp({type:`union`,options:e,...R(t)})}var Tp=B(`ZodDiscriminatedUnion`,(e,t)=>{Cp.init(e,t),El.init(e,t)});function Ep(e,t,n){return new Tp({type:`union`,options:t,discriminator:e,...R(n)})}var Dp=B(`ZodIntersection`,(e,t)=>{Dl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r)});function Op(e,t){return new Dp({type:`intersection`,left:e,right:t})}var kp=B(`ZodEnum`,(e,t)=>{Al.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new kp({...t,checks:[],...R(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 kp({...t,checks:[],...R(r),entries:i})}});function Ap(e,t){return new kp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var jp=B(`ZodLiteral`,(e,t)=>{jl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(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 Mp(e,t){return new jp({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var Np=B(`ZodTransform`,(e,t)=>{If(),Ml.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Wo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Eo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Eo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Pp(e){return new Np({type:`transform`,transform:e})}var Fp=B(`ZodOptional`,(e,t)=>{Pl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ip(e){return new Fp({type:`optional`,innerType:e})}var Lp=B(`ZodExactOptional`,(e,t)=>{Fl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rp(e){return new Lp({type:`optional`,innerType:e})}var zp=B(`ZodNullable`,(e,t)=>{Il.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>df(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bp(e){return new zp({type:`nullable`,innerType:e})}var Vp=B(`ZodDefault`,(e,t)=>{Ll.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Hp(e,t){return new Vp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Za(t)}})}var Up=B(`ZodPrefault`,(e,t)=>{zl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wp(e,t){return new Up({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Za(t)}})}var Gp=B(`ZodNonOptional`,(e,t)=>{Bl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kp(e,t){return new Gp({type:`nonoptional`,innerType:e,...R(t)})}var qp=B(`ZodCatch`,(e,t)=>{Ul.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_f(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jp(e,t){return new qp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ro(t)})}var Yp=B(`ZodPipe`,(e,t)=>{Wl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vf(e,t,n,r),e.in=t.in,e.out=t.out});function Xp(e,t){return new Yp({type:`pipe`,in:e,out:t})}var Zp=B(`ZodReadonly`,(e,t)=>{Kl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qp(e){return new Zp({type:`readonly`,innerType:e})}var $p=B(`ZodCustom`,(e,t)=>{Jl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r)});function em(e,t={}){return yd($p,e,t)}function tm(e,t){return bd(e,t)}var nm=`no-project`;function rm(){return X.parseLocation(X.history.location).search}function im(){let e=/^\/terminal\/([^/]+)$/.exec(X.history.location.pathname);if(e===null)return null;let t=decodeURIComponent(e[1]);return Z().machines.some(e=>e.id===t)?t:null}function am(){let e=sr({strict:!1,select:e=>e.machine??null});return Fh(t=>t.machines.some(t=>t.id===e)?e:null)}function om(){return rm().project??`global`}function sm(){return cr({strict:!1,select:e=>e.project??`global`})}function cm(e){let t=rm();return t.machine===void 0||t.project===void 0||!e.includes(t.machine)?null:{machine:t.machine,projectId:t.project,sessionId:t.session??null}}function lm(e){Em({...rm(),...e},!0,X.history.location.state.layer)}function um(e,t){Em({...rm(),...e},!1,t)}function dm(e){let t=Z();if(t.selection===null)throw Error(`no project is open to show the browser in`);if(e.startsWith(`file:`)){lm({panel:`browser`,browse:decodeURIComponent(new URL(e).pathname)});return}if(/^https?:\/\//i.test(e)||e.startsWith(`/`)||/^[a-z]:[\\/]/i.test(e)){lm({panel:`browser`,browse:e});return}let n=Lh(t,t.selection.machine,t.selection.projectId);if(n===void 0)throw Error(`project ${t.selection.projectId} is not listed`);lm({panel:`browser`,browse:`${n.path}/${e}`})}function fm(e,t){X.history.location.state.layer===e?X.history.back():t()}var pm=[],mm=!1,hm=!1,gm=!1;function _m(){return X.history.location.state.guard===!0}function vm(){return gm}function ym(){mm||(pm.length>0&&!_m()?X.history.push(X.history.location.href,{guard:!0}):pm.length===0&&_m()&&(mm=!0,X.history.back()))}function bm(){hm=_m(),X.history.subscribe(({action:e})=>{let t=hm;hm=_m(),e.type===`PUSH`||e.type===`REPLACE`?gm=!1:(gm=t,gm&&mm?mm=!1:gm&&pm.at(-1)?.(),setTimeout(ym))}),setTimeout(ym)}function xm(e,t){let n=(0,j.useEffectEvent)(t);(0,j.useEffect)(()=>{if(!e)return;function t(){n()}return pm.push(t),setTimeout(ym),()=>{pm.splice(pm.indexOf(t),1),setTimeout(ym)}},[e])}var Sm=`terminalProjects`;function Cm(){return JSON.parse(localStorage.getItem(Sm)??`[]`)}function wm(){let e=rm();if(im()!==null||e.machine===void 0||e.project===void 0||e.session===void 0)return;let t=`${e.machine} ${e.project}`,n=Cm().filter(e=>e!==t);localStorage.setItem(Sm,JSON.stringify(e.bottom===`terminal`?[...n,t]:n))}function Tm(e=!1){let t=Z().selection;if(t===null){Em({project:im()===null?void 0:rm().project},!0,X.history.location.state.layer);return}let n=rm(),r=n.machine===t.machine&&n.project===t.projectId&&n.session===void 0&&(t.sessionId===null||Z().loaded),i=Cm().includes(`${t.machine} ${t.projectId}`),a={machine:t.machine,project:t.projectId,session:t.sessionId??void 0,bottom:r?n.bottom:t.sessionId!==null&&i?`terminal`:void 0};if(im()!==null){X.navigate({to:`/`,search:a,replace:e||_m(),state:{layer:`chat`},resetScroll:!1});return}let o=n.machine===a.machine&&n.project===a.project&&n.session===a.session,s=n.machine!==void 0&&n.session===void 0&&a.session===void 0;e||o||r||s?lm(a):um(a,`chat`)}function Em(e,t,n){let r=im(),i=_m(),a=t&&i?{layer:n,guard:i}:{layer:n};r===null?X.navigate({to:`/`,search:e,replace:t||i,state:a,resetScroll:!1}):X.navigate({to:`/terminal/$machine`,params:{machine:r},search:e,replace:t||i,state:a,resetScroll:!1})}function Dm(e,t=null,n=!1){let r=Ih(Z(),e.machine),i=Z().selection;localStorage.setItem(`lastProject`,JSON.stringify({machine:e.machine,projectId:e.projectId})),Q({selection:e,loaded:e.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:e.sessionId===null?i?.sessionId===null&&i.machine===e.machine?Z().settings:tg(r):Sa(Uh(e))??eg(r.lastUsed,Z().sessions.find(t=>t.machine===e.machine&&t.id===e.sessionId)?.provider??tg(r).provider),context:null,replacing:null,paletteOpen:!1,unseen:Z().unseen.filter(t=>e.sessionId===null||t!==oh(e.machine,e.sessionId))}),Tm(n),og(e.machine),e.sessionId!==null&&r.status===`online`&&Om(e.machine,e.projectId,e.sessionId,!0,t)}function Om(e,t,n,r,i){F(e,`sessions.open`,{projectId:t,sessionId:n,opened:r,query:i}).then(t=>{t===null||Z().sessions.some(n=>n.machine===e&&n.id===t.id)||Q({sessions:[...Z().sessions,{...t,machine:e}]})}).catch($)}function km(){Q({selection:null,loaded:!1,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],context:null}),Tm()}function Am(){let e=Z().machines,t=localStorage.getItem(`lastTerminal`);return t!==null&&e.some(e=>e.id===t)?t:e.at(0)?.id??null}function jm(e,t,n=!1){Dm({machine:e,projectId:Lh(Z(),e,t)?.scratch===!0?nm:t,sessionId:null},null,n)}function Mm(){let e=Z(),t=localStorage.getItem(`lastProject`),n=t===null?null:JSON.parse(t),r=e.machines.filter(e=>e.system?.scratchAvailable===!0);if(n!==null&&n.projectId===`no-project`&&r.some(e=>e.id===n.machine))return n;let i=(n===null?void 0:e.projects.find(e=>e.machine===n.machine&&e.id===n.projectId))??e.projects.find(e=>!e.scratch);return i===void 0?r.length>0?{machine:r[0].id,projectId:nm}:null:{machine:i.machine,projectId:i.id}}function Nm(e,t){let n=im();(n!==e||om()!==t)&&(X.navigate({to:`/terminal/$machine`,params:{machine:e},search:{project:t===`global`?void 0:t},replace:n!==null||_m(),state:{layer:`chat`},resetScroll:!1}),km())}async function Pm(e,t,n,r){if(n===null)throw Error(`no session selected`);`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission(),Q({sentAt:Date.now()}),await F(n.machine,`sessions.send`,{sessionId:n.sessionId,projectId:n.projectId,prompt:e,settings:r,delivery:t});let i=Z().replacing;n.sessionId===null&&i!==null&&i.machine===n.machine&&i.sessionId!==null&&(Q({replacing:null}),await Km(i.machine,i.sessionId,i.projectId))}function Fm(e){let t=Z().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.unqueue`,{sessionId:t.sessionId,id:e}).catch($)}function Im(e){let t=Z().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.steer`,{sessionId:t.sessionId,id:e}).catch($)}function Lm(){let e=Z().selection;e!==null&&e.sessionId!==null&&F(e.machine,`sessions.interrupt`,{sessionId:e.sessionId}).catch($)}function Rm(e,t,n){F(e,`sessions.stopTask`,{sessionId:t,taskId:n}).catch($)}function zm(e,t,n){let r=Z().selection;r!==null&&r.sessionId!==null&&F(r.machine,`sessions.respond`,{sessionId:r.sessionId,requestId:e,decision:t,answers:n}).catch($)}async function Bm(e){let t=Z().selection;if(t!==null&&t.sessionId!==null)try{let n=await F(t.machine,`sessions.fork`,{sessionId:t.sessionId,projectId:t.projectId,messageId:e});Dm({...t,sessionId:n.sessionId})}catch(e){$(e)}}async function Vm(){let e=Z().selection,t=Z().before;if(e!==null&&e.sessionId!==null&&t!==null)try{let n=await F(e.machine,`sessions.earlier`,{sessionId:e.sessionId,before:t});if(Z().selection!==e||Z().before!==t)return;Q({earlier:[...n.items,...Z().earlier],before:n.before})}catch(e){$(e)}}async function Hm(e,t){let n=Z().selection;if(n!==null&&n.sessionId!==null)try{let r=await F(n.machine,`sessions.agent`,{sessionId:n.sessionId,projectId:n.projectId,agentId:t,parent:e});if(Z().selection!==n)return;let i=new Set(r.map(e=>e.id)),a=Z().items;Q({items:[...a.filter(t=>t.parent!==e),...r,...a.filter(t=>t.parent===e&&!i.has(t.id))]})}catch(e){$(e)}}async function Um(e,t,n){let r=Z();function i(n){return n.machine===e&&n.id===t}let a=[...r.sessions,...r.inactive].find(i);if(a!==void 0){let e={...a,...n};Q({sessions:r.sessions.some(i)?r.sessions.map(t=>i(t)?e:t):e.status===`inactive`?r.sessions:[...r.sessions,e],inactive:e.status===`inactive`?r.inactive.some(i)?r.inactive.map(t=>i(t)?e:t):[e,...r.inactive]:r.inactive.filter(e=>!i(e))})}try{await F(e,`sessions.update`,{id:t,patch:n})}catch(e){$(e)}}async function Wm(e){let t=oh(e.machine,e.id);Q({generatingTitles:[...Z().generatingTitles,t]});try{await F(e.machine,`sessions.generateTitle`,{id:e.id,projectId:e.projectId})}catch(e){$(e)}finally{Q({generatingTitles:Z().generatingTitles.filter(e=>e!==t)})}}async function Gm(e,t,n){let r=Z().selection;if(r?.machine===e&&r.sessionId===t){let i=Z().sessions.filter(r=>(r.status===`pinned`||r.status===`active`||r.status===`snoozed`)&&(r.machine!==e||r.id!==t)&&(n===null||r.machine===n.machine&&(r.projectId===n.projectId||n.projectId===`no-project`&&Lh(Z(),r.machine,r.projectId)?.scratch===!0))).sort((e,t)=>t.updatedAt-e.updatedAt).at(0);i===void 0?jm(r.machine,r.projectId,!0):Dm({machine:i.machine,projectId:i.projectId,sessionId:i.id},null,!0)}await Um(e,t,{status:`inactive`})}async function Km(e,t,n){Q({sessions:Z().sessions.filter(n=>n.machine!==e||n.id!==t),inactive:Z().inactive.filter(n=>n.machine!==e||n.id!==t)}),ba(oh(e,t));let r=Z().selection;r?.machine===e&&r.sessionId===t&&jm(e,r.projectId,!0);try{await F(e,`sessions.remove`,{id:t,projectId:n})}catch(e){$(e)}}var qm=xp({machine:zf().optional().catch(void 0),project:zf().optional().catch(void 0),session:zf().optional().catch(void 0),panel:Ap([`diff`,`tasks`,`browser`]).optional().catch(void 0),browse:zf().optional().catch(void 0),bottom:Mp(`terminal`).optional().catch(void 0),terminal:zf().optional().catch(void 0)}),Jm=Ar({validateSearch:qm}),Ym=Or({getParentRoute:()=>Jm,path:`/`}),Xm=Or({getParentRoute:()=>Jm,path:`/terminal`,beforeLoad:()=>{let e=Am();throw ke(e===null?{to:`/`,search:{},replace:!0}:{to:`/terminal/$machine`,params:{machine:e},search:{},replace:!0})}}),Zm=Or({getParentRoute:()=>Jm,path:`/terminal/$machine`});if(window.history.state?.__TSR_index===void 0&&(location.pathname.startsWith(`/terminal`)||new URLSearchParams(location.search).has(`machine`))){let e=`${location.pathname}${location.search}${location.hash}`,t=Math.random().toString(36).slice(2),n=Math.random().toString(36).slice(2);window.history.replaceState({__TSR_index:0,__TSR_key:t,key:t},``,`/`),window.history.pushState({__TSR_index:1,__TSR_key:n,key:n,layer:`chat`},``,e)}var X=Mr({routeTree:Jm.addChildren([Ym,Xm,Zm]),disableGlobalCatchBoundary:!0,parseSearch:e=>qm.parse(Object.fromEntries(new URLSearchParams(e))),stringifySearch:e=>{let t=new URLSearchParams;for(let n of Object.entries(e))n[1]!==void 0&&t.set(n[0],String(n[1]));let n=t.toString();return n===``?``:`?${n}`}}),Qm=fi.withTag(`machines`),$m=`machines`,eh=document.querySelector(`meta[name="offsite-connect"]`)?.getAttribute(`content`)?.split(` `)??null;function th(){let e=localStorage.getItem($m);return e===null?[]:JSON.parse(e)}function nh(e){localStorage.setItem($m,JSON.stringify(e))}async function rh(e){if(!(`caches`in window))return;let t=e.map(e=>({id:e.id,addresses:e.addresses}));await(await caches.open(`offsite-worker`)).put(`/machines`,new Response(JSON.stringify(t)))}function ih(){if(location.pathname!==`/pair`)return null;let e=new URLSearchParams(location.hash.slice(1));X.navigate({to:`/`,replace:!0});let t=e.get(`machine`);if(t===null)throw Error(`the pairing link has no machine`);return{address:ah(t).address,code:e.get(`code`)}}function ah(e){let t=e.trim(),n=new URL(/^[a-z]+:\/\//i.test(t)?t:`http://${t}`);if(n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`Use an http:// or https:// address`);let r=new URLSearchParams(n.hash.slice(1)),i=r.get(`machine`);return{address:i===null?n.origin:ah(i).address,code:r.get(`code`)}}function oh(e,t){return`${e} ${t}`}function sh(e){return{id:e.id,addresses:e.addresses,via:null,status:`connecting`,name:e.label??e.name,hostname:e.name,label:e.label,icon:e.icon,pairedAt:e.pairedAt??null,config:null,lastUsed:null,appIcon:null,configError:null,system:null,claudeAccounts:[],codexAccounts:[],openCode:{available:!1},notifier:!1,activity:{},providers:[],terminals:[]}}function ch(e){return e.projects.map(t=>({...t,machine:e.id}))}function lh(){let e=th(),t=Z().machines;for(let n of t)e.some(e=>e.id===n.id)||vh(n.id);for(let n of e){let e=t.find(e=>e.id===n.id);if(e===void 0){let e=Z();Q({machines:[...e.machines,sh(n)],projects:[...e.projects,...ch(n)]}),Ni(n.id,n.addresses)}else zh(n.id,{label:n.label,icon:n.icon,name:n.label??e.hostname}),(n.addresses.join(` `)!==e.addresses.join(` `)||n.pairedAt!==e.pairedAt)&&(zh(n.id,{addresses:n.addresses,pairedAt:n.pairedAt}),gh(n.id))}let n=e.map(e=>e.id);Q({machines:[...Z().machines].sort((e,t)=>n.indexOf(e.id)-n.indexOf(t.id))})}async function uh(e,t){let n=Z().machines.find(t=>t.addresses.some(t=>e.includes(t)));if(n!==void 0)return t!==null&&await dh(n.id,t),n.id;let r=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);return t!==null&&await ai(r,await fh(e,t)),Q({machines:[...Z().machines,sh({id:r,addresses:e,name:new URL(e[0]).hostname,label:null,icon:`computer`,pairedAt:t===null?null:Date.now(),projects:[]})]}),yh(),Ni(r,e),r}async function dh(e,t){await ai(e,await fh(Ih(Z(),e).addresses,t)),zh(e,{pairedAt:Date.now()}),yh(),gh(e)}async function fh(e,t){let n;for(let r of e){let e=await fetch(`${r}/api/pair`,{method:`POST`,headers:{authorization:`Bearer ${t}`}}).catch(e=>(n??=e,null));if(e!==null){if(!e.ok)throw Error(await e.text());return(await e.json()).token}}throw Error(`Could not reach the machine to pair: ${String(n)}`)}function ph(e,t){let n=Ih(Z(),e),r={...n,...t};zh(e,{...t,name:r.label??r.hostname}),yh(),r.addresses.join(` `)!==n.addresses.join(` `)&&gh(e)}function mh(e){Q({machines:[...Z().machines].sort((t,n)=>e.indexOf(t.id)-e.indexOf(n.id))}),yh()}function hh(e){rh(e).catch(e=>Qm.error(`could not share the machines with the service worker`,e))}function gh(e){Pi(e),zh(e,{status:`connecting`,via:null}),Ni(e,Ih(Z(),e).addresses)}function _h(e){vh(e),yh(),oi(e).catch(e=>Qm.error(`could not remove the device token`,e))}function vh(e){Pi(e);let t=Z(),n=t.machines.filter(t=>t.id!==e);Q({machines:n,projects:t.projects.filter(t=>t.machine!==e),sessions:t.sessions.filter(t=>t.machine!==e),inactive:t.inactive.filter(t=>t.machine!==e),unseen:t.unseen.filter(t=>!t.startsWith(`${e} `)),...t.settingsMachine===e&&{settingsMachine:n.at(0)?.id??null},...t.selection?.machine===e&&{selection:null}}),Tm()}function yh(){let e=Z(),t=e.machines.map(t=>({id:t.id,addresses:t.addresses,name:t.hostname,label:t.label,icon:t.icon,pairedAt:t.pairedAt,projects:e.projects.filter(e=>e.machine===t.id).map(e=>({id:e.id,path:e.path,name:e.name,logo:e.logo,hidden:e.hidden,scratch:e.scratch}))}));nh(t),hh(t)}var bh=[{id:`one-dark-darker`,name:`One Dark Darker`,codeTheme:`one-dark-pro`,background:`#15181C`,foreground:`#ABB2BF`,cursor:`#B3BAC5`,selectionBackground:`#3B414D`,palette:[`#4A4F5A`,`#EE5D69`,`#97C775`,`#B68353`,`#61AFEF`,`#C678DD`,`#56B6C2`,`#CCCCCC`,`#616A7B`,`#FE808A`,`#C2DEAD`,`#D1A47A`,`#93CFFF`,`#E0A8F1`,`#82D2DC`,`#FFFFFF`]},{id:`one-dark-pro`,name:`One Dark Pro`,codeTheme:`one-dark-pro`,background:`#282C34`,foreground:`#ABB2BF`,cursor:`#528BFF`,selectionBackground:`#41454E`,palette:[`#3F4451`,`#E05561`,`#8CC265`,`#D18F52`,`#4AA5F0`,`#C162DE`,`#42B3C2`,`#D7DAE0`,`#4F5666`,`#FF616E`,`#A5E075`,`#F0A45D`,`#4DC4FF`,`#DE73FF`,`#4CD1E0`,`#E6E6E6`]},{id:`dracula`,name:`Dracula`,codeTheme:`dracula`,background:`#282A36`,foreground:`#F8F8F2`,cursor:`#F8F8F2`,selectionBackground:`#44475A`,palette:[`#21222C`,`#FF5555`,`#50FA7B`,`#F1FA8C`,`#BD93F9`,`#FF79C6`,`#8BE9FD`,`#F8F8F2`,`#6272A4`,`#FF6E6E`,`#69FF94`,`#FFFFA5`,`#D6ACFF`,`#FF92DF`,`#A4FFFF`,`#FFFFFF`]},{id:`tokyo-night`,name:`Tokyo Night`,codeTheme:`tokyo-night`,background:`#1A1B26`,foreground:`#C0CAF5`,cursor:`#C0CAF5`,selectionBackground:`#33467C`,palette:[`#15161E`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#A9B1D6`,`#414868`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#C0CAF5`]},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,codeTheme:`catppuccin-mocha`,background:`#1E1E2E`,foreground:`#CDD6F4`,cursor:`#F5E0DC`,selectionBackground:`#585B70`,palette:[`#45475A`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#BAC2DE`,`#585B70`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#A6ADC8`]},{id:`nord`,name:`Nord`,codeTheme:`nord`,background:`#2E3440`,foreground:`#D8DEE9`,cursor:`#D8DEE9`,selectionBackground:`#434C5E`,palette:[`#3B4252`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#88C0D0`,`#E5E9F0`,`#4C566A`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#8FBCBB`,`#ECEFF4`]},{id:`gruvbox-dark`,name:`Gruvbox Dark`,codeTheme:`gruvbox-dark-medium`,background:`#282828`,foreground:`#EBDBB2`,cursor:`#EBDBB2`,selectionBackground:`#504945`,palette:[`#282828`,`#CC241D`,`#98971A`,`#D79921`,`#458588`,`#B16286`,`#689D6A`,`#A89984`,`#928374`,`#FB4934`,`#B8BB26`,`#FABD2F`,`#83A598`,`#D3869B`,`#8EC07C`,`#EBDBB2`]},{id:`solarized-dark`,name:`Solarized Dark`,codeTheme:`solarized-dark`,background:`#002B36`,foreground:`#839496`,cursor:`#839496`,selectionBackground:`#073642`,palette:[`#073642`,`#DC322F`,`#859900`,`#B58900`,`#268BD2`,`#D33682`,`#2AA198`,`#EEE8D5`,`#002B36`,`#CB4B16`,`#586E75`,`#657B83`,`#839496`,`#6C71C4`,`#93A1A1`,`#FDF6E3`]},{id:`github-dark`,name:`GitHub Dark`,codeTheme:`github-dark`,background:`#0D1117`,foreground:`#E6EDF3`,cursor:`#E6EDF3`,selectionBackground:`#264F78`,palette:[`#484F58`,`#FF7B72`,`#3FB950`,`#D29922`,`#58A6FF`,`#BC8CFF`,`#39C5CF`,`#B1BAC4`,`#6E7681`,`#FFA198`,`#56D364`,`#E3B341`,`#79C0FF`,`#D2A8FF`,`#56D4DD`,`#FFFFFF`]},{id:`rose-pine`,name:`Rosé Pine`,codeTheme:`rose-pine`,background:`#191724`,foreground:`#E0DEF4`,cursor:`#E0DEF4`,selectionBackground:`#403D52`,palette:[`#26233A`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`,`#6E6A86`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`]}],xh=fi.withTag(`prefs`),Sh=Sp({theme:zf().refine(e=>bh.some(t=>t.id===e)).default(bh[0].id),terminal:Sp({font:Sp({family:zf().default(`FiraCode Nerd Font`),size:up().default(14),lineHeight:up().default(1.35),ligatures:Y().default(!0)}).prefault({}),cursor:Sp({style:Ap([`block`,`bar`,`underline`]).default(`bar`),blink:Y().default(!0)}).prefault({}),padding:Sp({top:up().default(4),right:up().default(4),bottom:up().default(0),left:up().default(4)}).prefault({}),scrollback:up().default(1e3),boldIsBright:Y().default(!0),behavior:Sp({modernizeShiftEnter:Y().default(!0),pasteBrowserImages:Y().default(!0),captureShortcuts:Y().default(!0),bellFlash:Y().default(!0),bellSound:Y().default(!0),clickToMoveCursor:Y().default(!0),optionAsMeta:Ap([`off`,`left`,`right`,`both`]).default(`off`),windowsCopyPaste:Y().default(!0),confirmCloseBusyTab:Y().default(!0)}).prefault({})}).prefault({}),editor:Sp({font:Sp({family:zf().default(`FiraCode Nerd Font`),size:up().default(15.3),lineHeight:up().default(1.8),ligatures:Y().default(!0),features:zf().default(`'zero', 'ss02', 'ss06', 'cv02', 'cv14', 'cv26'`)}).prefault({}),cursor:Sp({style:Ap([`block`,`bar`,`underline`]).default(`bar`),blink:Y().default(!0)}).prefault({}),tabSize:up().default(2),wordWrap:Y().default(!0),graph:Y().default(!0)}).prefault({}),diff:Sp({split:Y().default(!1),wrap:Y().default(!0),collapsed:Y().default(!1)}).prefault({}),rewind:Ap([`all`,`chat`,`code`]).default(`chat`),groupActiveByProject:Y().default(!1),dictateButton:Sp({desktop:Y().default(!1),mobile:Y().default(!0)}).prefault({}),toolbar:yp(Ap([`diff`,`terminal`,`tasks`,`browser`,`editor`])).default([`diff`,`terminal`,`editor`])}),Ch=`prefs`,wh=Sh.parse({});function Th(){let e=localStorage.getItem(Ch);if(e===null)return structuredClone(wh);let t=Sh.safeParse(JSON.parse(e));return t.success?t.data:(xh.warn(`invalid stored prefs, using the defaults:\n${rs(t.error)}`),structuredClone(wh))}function Eh(e){localStorage.setItem(Ch,JSON.stringify(e))}function Dh(){let e=Z().prefs.theme,t=bh.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t}function Oh(){let e=Fh(e=>e.prefs.theme),t=bh.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t.codeTheme}function kh(){let e=Dh(),t=document.documentElement.style;t.setProperty(`--bg`,e.background),t.setProperty(`--text`,e.foreground),t.setProperty(`--blue`,e.palette[4]),t.setProperty(`--danger`,e.palette[1]),t.setProperty(`--green`,e.palette[2]),t.setProperty(`--yellow`,e.palette[3]),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.background)}var Ah=fi.withTag(`ui`),jh={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},Mh;function Nh(e){Mh=ea()(()=>e)}function Ph(e){return Mh.subscribe(e)}function Z(){return Mh.getState()}function Fh(e){return na(Mh,e)}function Q(e){Mh.setState(e)}function Ih(e,t){let n=e.machines.find(e=>e.id===t);if(n===void 0)throw Error(`unknown machine ${t}`);return n}function Lh(e,t,n){return e.projects.find(e=>e.machine===t&&e.id===n)}function Rh(e){return e.selection?.machine??e.machines.at(0)?.id??null}function zh(e,t){Q({machines:Z().machines.map(n=>n.id===e?{...n,...t}:n)})}function Bh(e,t,n){if(n!==null)return e.find(e=>e.id===t)?.activity[n]}function Vh(e){let t=e.selection;if(t!==null)return Bh(e.machines,t.machine,t.sessionId)}function Hh(e){return Vh(e)?.running===!0}function Uh(e){return e.sessionId===null?`new`:oh(e.machine,e.sessionId)}function Wh(e){Q({draft:e})}function Gh(e){Q({paletteOpen:e})}function Kh(e){Q({editor:e})}function qh(e){Q({exporting:e})}function Jh(e){Q({settingsOpen:e,paletteOpen:!1,...e&&{settingsMachine:Rh(Z()),settingsAccount:null,settingsEditedMachine:null,settingsListing:!0}})}function Yh(e){Q({usageOpen:e,paletteOpen:!1})}function Xh(e){Q({settingsOpen:!0,settingsPage:e,settingsAccount:null,settingsEditedMachine:null,settingsListing:!1,paletteOpen:!1,...!Z().settingsOpen&&{settingsMachine:Rh(Z())}})}function Zh(e){Q({prefs:e}),Eh(e),kh()}function $(e){Ah.warn(`showing an error:`,e),Q({errors:[...Z().errors,i(e)]})}function Qh(){Q({errors:[]})}var $h=null;function eg(e,t){let n=e?.find(e=>e.provider===t),r=t===`claude`?Yi:t===`codex`?Xi:null;return n===void 0?{provider:t,accountId:null,model:null,effort:null,mode:r,plan:!1}:{provider:t,accountId:n.accountId,model:n.model,effort:null,mode:r,plan:!1}}function tg(e){let t=Zi(e.lastUsed??[],e=>e.usedAt);return t===void 0?{provider:Ji,accountId:null,model:null,effort:null,mode:Yi,plan:!1}:eg(e.lastUsed,t.provider)}function ng(e,t,n,r){F(e,`lastUsed.save`,{provider:t,accountId:n,model:r}).catch($);let i=Z().machines.filter(t=>t.id!==e&&t.status===`online`);if(t===`opencode`){for(let e of i.filter(e=>e.openCode.available))F(e.id,`lastUsed.save`,{provider:t,accountId:null,model:r}).catch($);return}let a=Ih(Z(),e),o=(t===`claude`?a.claudeAccounts:a.codexAccounts).find(e=>e.id===n)?.identity;if(o!=null)for(let e of i){let n=(t===`claude`?e.claudeAccounts:e.codexAccounts).find(e=>e.enabled&&e.identity!==null&&e.identity.accountId===o.accountId&&e.identity.organizationId===o.organizationId);n!==void 0&&F(e.id,`lastUsed.save`,{provider:t,accountId:n.id,model:r}).catch($)}}function rg(e){let t={...Z().settings,...e};Q({settings:t});let n=Z().selection;n!==null&&(n.sessionId!==null&&Ca(Uh(n),t),e.accountId!==void 0&&cg(),n.sessionId!==null&&Bh(Z().machines,n.machine,n.sessionId)!==void 0&&e.accountId===void 0&&F(n.machine,`sessions.configure`,{sessionId:n.sessionId,settings:t}).catch($))}function ig(e,t){if(zh(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),Z().selection?.machine!==e)return;let n=Z().settings,r=[...[...t.claudeAccounts,...t.codexAccounts].filter(e=>e.valid).map(e=>({provider:e.provider,accountId:e.id})),...t.openCode.available?[{provider:`opencode`,accountId:null}]:[]];if(r.some(e=>e.provider===n.provider&&e.accountId===n.accountId))return;let i=r.find(e=>e.provider===n.provider),a=Z().selection?.sessionId===null?r.at(0):void 0;i===void 0?a===void 0?n.accountId!==null&&rg({accountId:null}):rg({...eg(Ih(Z(),e).lastUsed,a.provider),accountId:a.accountId}):rg({accountId:i.accountId})}function ag(e){let t=Z().selection;t?.machine===e&&t.sessionId===null&&(Q({settings:tg(Ih(Z(),e))}),og(e))}function og(e){let t=Ih(Z(),e);(t.claudeAccounts.length>0||t.codexAccounts.length>0||t.openCode.available)&&ig(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),cg()}async function sg(e){try{ig(e,await F(e,`accounts.list`,void 0))}catch(e){$(e)}}async function cg(){let e=Z().selection;if(e===null)return;let{provider:t,accountId:n}=Z().settings;if(t!==`opencode`&&n===null)Q({capabilities:null});else try{let r=JSON.stringify([e.machine,t,n,e.projectId]);if($h?.key!==r){let i=F(e.machine,`capabilities`,{provider:t,accountId:n,projectId:e.projectId});function a(){$h?.result===i&&($h=null)}i.then(a,a),$h={key:r,result:i}}let i=await $h.result;if(Z().selection?.machine!==e.machine||Z().selection?.projectId!==e.projectId||Z().settings.provider!==t||Z().settings.accountId!==n)return;Q({capabilities:i});let a=Z().settings;if(a.model!==null){let e=i.models.find(e=>e.value===a.model)?.effort;a.provider!==`opencode`&&a.effort===null&&e!=null&&rg({effort:e});return}let o=i.models.find(e=>!e.hidden&&e.value===i.defaultModel)??i.models.find(e=>!e.hidden);if(o===void 0)return;rg({model:o.value,...o.effort===null?{}:{effort:o.effort}})}catch(e){$(e)}}var lg=[[`path`,{d:`M18 6L12 12M12 12L6 18M12 12L18 18M12 12L6 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]];export{ch as $,Da as $t,Q as A,Tm as At,eh as B,xp as Bt,$ as C,Oe as Cn,vm as Ct,Xh as D,lm as Dt,Jh as E,c as En,wm as Et,Oh as F,sm as Ft,ih as G,Sa as Gt,th as H,ka as Ht,wh as I,nm as It,lh as J,ya as Jt,yh as K,Ta as Kt,Th as L,Y as Lt,Fh as M,om as Mt,kh as N,xm as Nt,Yh as O,cm as Ot,Dh as P,am as Pt,sh as Q,Ca as Qt,bh as R,Ep as Rt,Kh as S,_t as Sn,fm as St,Gh as T,D as Tn,um as Tt,oh as U,_a as Ut,ph as V,zf as Vt,dh as W,xa as Wt,_h as X,Oa as Xt,gh as Y,ha as Yt,mh as Z,va as Zt,jh as _,cr as _n,jm as _t,cg as a,Ni as an,Bm as at,Wh as b,On as bn,Fm as bt,ig as c,Li as cn,Hm as ct,Rh as d,fi as dn,Dm as dt,ga as en,hh as et,Qh as f,mi as fn,Nm as ft,Lh as g,Pr as gn,Pm as gt,Ih as h,ti as hn,zm as ht,sg as i,F as in,Um as it,Zh as j,im as jt,Ph as k,bm as kt,Bh as l,Ri as ln,Vm as lt,Z as m,ei as mn,Km as mt,rg as n,Yi as nn,km as nt,ag as o,Ii as on,Lm as ot,Uh as p,Zr as pn,Wm as pt,ah as q,Ea as qt,eg as r,Ji as rn,Gm as rt,ng as s,Fi as sn,Mm as st,lg as t,wa as tn,X as tt,Nh as u,ji as un,Om as ut,Vh as v,tr as vn,Im as vt,qh as w,O as wn,dm as wt,zh as x,Dn as xn,rm as xt,Hh as y,An as yn,Rm as yt,uh as z,Mp as zt};
|
|
67
|
+
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Dd(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Dd(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Od=new Set([`type`,`properties`,`required`,`additionalProperties`]),kd=[`oneOf`,`anyOf`];function Ad(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function jd(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Od.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ad(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Ra(n,r,e.length===1?e[0]:jd(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ad(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Md(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Od)if(t in e)return;let n=t.filter(e=>kd.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=jd(t);else{let e=n[0],i=kd.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>jd([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Sd(e,r))}function Nd(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)):Sd(i,s),Sd(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Dd(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Md(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Sd(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Ra(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Fd(t,`input`,e.processors),output:Fd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function G(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 G(r.element,n);if(r.type===`set`)return G(r.valueType,n);if(r.type===`lazy`)return G(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return G(r.innerType,n);if(r.type===`intersection`)return G(r.left,n)||G(r.right,n);if(r.type===`record`||r.type===`map`)return G(r.keyType,n)||G(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:G(r.in,n)||G(r.out,n);if(r.type===`object`){for(let e in r.shape)if(G(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(G(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(G(e,n))return!0;return!!(r.rest&&G(r.rest,n))}return!1}var Pd=(e,t={})=>n=>{let r=Cd({...n,processors:t});return W(e,r),Ed(r,e),Nd(r,e)},Fd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Cd({...i??{},target:a,io:t,processors:n});return W(e,o),Ed(o,e),Nd(o,e)},Id=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Ld=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Rd=(e,t)=>{Id(e,`minimum`,t),Ld(e,`maximum`,t)},zd=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Bd=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Vd=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Hd=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ud=(e,t)=>Id(e,`minimum`,t.minimum),Wd=(e,t)=>Ld(e,`maximum`,t.maximum),Gd=e=>(t,n)=>{Hd(t,n.format);let[r,i]=e[n.format];Id(t,`minimum`,r),Ld(t,`maximum`,i)},Kd={greater_than:(e,t)=>Id(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Ld(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>zd(e,t.value),number_format:Gd(ro),bigint_format:Gd(io),min_length:Ud,max_length:Wd,length_equals:(e,t)=>Rd(e,t.length),min_size:Ud,max_size:Wd,size_equals:(e,t)=>Rd(e,t.size),string_format:(e,t)=>{Hd(e,t.format),t.pattern&&Bd(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Vd(e,t.mime)};function qd(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Kd[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Id(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Id(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Ld(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Ld(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&zd(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Vd(t,i.mime);for(let e of i.patterns??[])Bd(t,e);return t}var Jd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yd=new Map([[el,Bs],[nl,Vs]]),Xd=e=>Yd.get(e)??e,Zd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=qd(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jd[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Xd);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}))])}},Qd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=qd(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):wd(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},$d=(e,t,n,r)=>{n.type=`boolean`},ef=(e,t,n,r)=>{n.not={}},tf=(e,t,n,r)=>{let i=e._zod.def,a=Aa(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},nf=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(wd(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(wd(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},rf=(e,t,n,r)=>{wd(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},af=(e,t,n,r)=>{wd(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},of=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=qd(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=W(a.element,t,{...r,path:[...r.path,`items`]})};function sf(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?sf(t.out):t.type===`catch`?sf(t.innerType):e._zod.optin}var cf=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&wd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Ra(i.properties,e,W(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?sf(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=W(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},lf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>W(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},uf=(e,t,n,r)=>{let i=e._zod.def,a=W(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=W(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},df=(e,t,n,r)=>{let i=e._zod.def,a=W(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`}]},ff=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pf=Symbol();function mf(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(wd(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),pf):JSON.parse(o)}var hf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=mf(i.defaultValue,e,t,n,r);o!==pf&&(n.default=o)},gf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=mf(i.defaultValue,e,t,n,r);o!==pf&&(n._prefault=o)},_f=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{wd(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},vf=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;W(o,t,r);let s=t.seen.get(e);s.ref=o},yf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},bf=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xf=new WeakSet([Object.prototype,Error.prototype]);function Sf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var K=B(`ZodError`,(e,t)=>{Qo.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);xf.has(n)||(xf.add(n),Sf(n,`format`,e=>t=>ts(e,t)),Sf(n,`flatten`,e=>t=>es(e,t)),Sf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ma,2)}),Sf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ma,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Cf=as(K),wf=os(K),Tf=ss(K),Ef=ls(K),Df=hs(K),Of=gs(K),kf=_s(K),Af=vs(K),jf=ys(K),Mf=bs(K),Nf=xs(K),Pf=Ss(K);function Ff(){Go.localeError||Ko(mu())}function If(){Go.memoizer||Ko({memoizer:du()})}var q=B(`ZodType`,(e,t)=>(Ff(),H.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(L(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(em(e,t))},superRefine(e,t){return this.check(tm(e,t))},overwrite(e){return this.check(fd(e))},optional(){return Ip(this)},exactOptional(){return Rp(this)},nullable(){return Bp(this)},nullish(){return Ip(Bp(this))},nonoptional(e){return Kp(this,e)},array(){return yp(this)},or(e){return wp([this,e])},and(e){return Op(this,e)},transform(e){return Xp(this,Pp(e))},default(e){return Hp(this,e)},prefault(e){return Wp(this,e)},catch(e){return Jp(this,e)},pipe(e){return Xp(this,e)},readonly(){return Qp(this)},describe(e){let t=this.clone();return vu.add(t,{description:e}),t},meta(...e){if(e.length===0)return vu.get(this);let t=this.clone();return vu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ko(this,`~standard`,{...Sc(this),jsonSchema:{input:Fd(this,`input`),output:Fd(this,`output`)}})},set"~standard"(e){Oo(this,`~standard`,e)},parse:function e(t,n){return Cf(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await wf(this,t,n,{callee:e})},safeParse(e,t){return Tf(this,e,t)},async safeParseAsync(e,t){return Ef(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Oo(this,`spa`,e)},validate(e,t){return fs(this,e,t)},validateAsync(e,t){return ms(this,e,t)},encode:function e(t,n){return Df(this,t,n,{callee:e})},decode:function e(t,n){return Of(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await kf(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Af(this,t,n,{callee:e})},safeEncode(e,t){return jf(this,e,t)},safeDecode(e,t){return Mf(this,e,t)},async safeEncodeAsync(e,t){return Nf(this,e,t)},async safeDecodeAsync(e,t){return Pf(this,e,t)},toJSONSchema(e){return Pd(this,{})(e)},get description(){return vu.get(this)?.description},get _def(){return this._zod.def}}),Lf=B(`_ZodString`,(e,t)=>{Cc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r)},Ao({format:e=>qd(e).format??null,minLength:e=>qd(e).minimum??null,maxLength:e=>qd(e).maximum??null},{regex(...e){return this.check(od(...e))},includes(...e){return this.check(ld(...e))},startsWith(...e){return this.check(ud(...e))},endsWith(...e){return this.check(dd(...e))},min(...e){return this.check(id(...e))},max(...e){return this.check(rd(...e))},length(...e){return this.check(ad(...e))},nonempty(...e){return this.check(id(1,...e))},lowercase(e){return this.check(sd(e))},uppercase(e){return this.check(cd(e))},trim(){return this.check(md())},normalize(...e){return this.check(pd(...e))},toLowerCase(){return this.check(hd())},toUpperCase(){return this.check(gd())},slugify(){return this.check(_d())}})),Rf=B(`ZodString`,(e,t)=>{Cc.init(e,t),Lf.init(e,t)},{email(e){return this.check(xu(Wf,e))},url(e){return this.check(Du(qf,e))},jwt(e){return this.check(Hu(cp,e))},emoji(e){return this.check(Ou(Jf,e))},guid(e){return this.check(Su(Gf,e))},uuid(e){return this.check(Cu(Kf,e))},uuidv4(e){return this.check(wu(Kf,e))},uuidv6(e){return this.check(Tu(Kf,e))},uuidv7(e){return this.check(Eu(Kf,e))},nanoid(e){return this.check(ku(Yf,e))},cuid(e){return this.check(Au(Xf,e))},cuid2(e){return this.check(ju(Zf,e))},ulid(e){return this.check(Mu(Qf,e))},base64(e){return this.check(zu(ap,e))},base64url(e){return this.check(Bu(op,e))},xid(e){return this.check(Nu($f,e))},ksuid(e){return this.check(Pu(ep,e))},ipv4(e){return this.check(Fu(tp,e))},ipv6(e){return this.check(Iu(np,e))},cidrv4(e){return this.check(Lu(rp,e))},cidrv6(e){return this.check(Ru(ip,e))},e164(e){return this.check(Vu(sp,e))},datetime(e){return this.check(Uu(Bf,e))},date(e){return this.check(Wu(Vf,e))},time(e){return this.check(Gu(Hf,e))},duration(e){return this.check(Ku(Uf,e))}});function zf(e){return bu(Rf,e)}var J=B(`ZodStringFormat`,(e,t)=>{U.init(e,t),Lf.init(e,t)}),Bf=B(`ZodISODateTime`,(e,t)=>{Hc.init(e,t),J.init(e,t)}),Vf=B(`ZodISODate`,(e,t)=>{Uc.init(e,t),J.init(e,t)}),Hf=B(`ZodISOTime`,(e,t)=>{Wc.init(e,t),J.init(e,t)}),Uf=B(`ZodISODuration`,(e,t)=>{Gc.init(e,t),J.init(e,t)}),Wf=B(`ZodEmail`,(e,t)=>{Ec.init(e,t),J.init(e,t)}),Gf=B(`ZodGUID`,(e,t)=>{wc.init(e,t),J.init(e,t)}),Kf=B(`ZodUUID`,(e,t)=>{Tc.init(e,t),J.init(e,t)}),qf=B(`ZodURL`,(e,t)=>{Pc.init(e,t),J.init(e,t)}),Jf=B(`ZodEmoji`,(e,t)=>{Fc.init(e,t),J.init(e,t)}),Yf=B(`ZodNanoID`,(e,t)=>{Ic.init(e,t),J.init(e,t)}),Xf=B(`ZodCUID`,(e,t)=>{Lc.init(e,t),J.init(e,t)}),Zf=B(`ZodCUID2`,(e,t)=>{Rc.init(e,t),J.init(e,t)}),Qf=B(`ZodULID`,(e,t)=>{zc.init(e,t),J.init(e,t)}),$f=B(`ZodXID`,(e,t)=>{Bc.init(e,t),J.init(e,t)}),ep=B(`ZodKSUID`,(e,t)=>{Vc.init(e,t),J.init(e,t)}),tp=B(`ZodIPv4`,(e,t)=>{Kc.init(e,t),J.init(e,t)}),np=B(`ZodIPv6`,(e,t)=>{Yc.init(e,t),J.init(e,t)}),rp=B(`ZodCIDRv4`,(e,t)=>{Xc.init(e,t),J.init(e,t)}),ip=B(`ZodCIDRv6`,(e,t)=>{Qc.init(e,t),J.init(e,t)}),ap=B(`ZodBase64`,(e,t)=>{tl.init(e,t),J.init(e,t)}),op=B(`ZodBase64URL`,(e,t)=>{il.init(e,t),J.init(e,t)}),sp=B(`ZodE164`,(e,t)=>{al.init(e,t),J.init(e,t)}),cp=B(`ZodJWT`,(e,t)=>{sl.init(e,t),J.init(e,t)}),lp=B(`ZodNumber`,(e,t)=>{cl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r),e.isFinite=!0},Ao({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=qd(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=qd(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=qd(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>qd(e).format??null},{gt(e,t){return this.check(ed(e,t))},gte(e,t){return this.check(td(e,t))},min(e,t){return this.check(td(e,t))},lt(e,t){return this.check(Qu(e,t))},lte(e,t){return this.check($u(e,t))},max(e,t){return this.check($u(e,t))},int(e){return this.check(fp(e))},safe(e){return this.check(fp(e))},positive(e){return this.check(ed(0,e))},nonnegative(e){return this.check(td(0,e))},negative(e){return this.check(Qu(0,e))},nonpositive(e){return this.check($u(0,e))},multipleOf(e,t){return this.check(nd(e,t))},step(e,t){return this.check(nd(e,t))},finite(){return this}}));function up(e){return qu(lp,e)}var dp=B(`ZodNumberFormat`,(e,t)=>{ll.init(e,t),lp.init(e,t)});function fp(e){return Ju(dp,e)}var pp=B(`ZodBoolean`,(e,t)=>{ul.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r)});function Y(e){return Yu(pp,e)}var mp=B(`ZodUnknown`,(e,t)=>{dl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function hp(){return Xu(mp)}var gp=B(`ZodNever`,(e,t)=>{fl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r)});function _p(e){return Zu(gp,e)}var vp=B(`ZodArray`,(e,t)=>{If(),gl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.element=t.element},{min(e,t){return this.check(id(e,t))},nonempty(e){return this.check(id(1,e))},max(e,t){return this.check(rd(e,t))},length(e,t){return this.check(ad(e,t))},unwrap(){return this.element}});function yp(e,t){return vd(vp,e,t)}var bp=B(`ZodObject`,(e,t)=>{If(),Sl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),Io(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Ap(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(L(this._zod.def,{catchall:e}))},passthrough(){return this.clone(L(this._zod.def,{catchall:hp()}))},loose(){return this.clone(L(this._zod.def,{catchall:hp()}))},strict(){return this.clone(L(this._zod.def,{catchall:_p()}))},strip(){return this.clone(L(this._zod.def,{catchall:void 0}))},extend(e){return co(this,e)},safeExtend(e){return uo(this,e)},merge(e){return fo(this,e)},pick(e){return ao(this,e)},omit(e){return so(this,e)},partial(...e){return po(Fp,this,e[0])},exactPartial(...e){return po(Lp,this,e[0],`exactPartial`)},required(...e){return mo(Gp,this,e[0])}});function xp(e,t){return new bp({type:`object`,shape:e??{},...R(t)})}function Sp(e,t){return new bp({type:`object`,shape:e,catchall:_p(),...R(t)})}var Cp=B(`ZodUnion`,(e,t)=>{wl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.options=t.options});function wp(e,t){return new Cp({type:`union`,options:e,...R(t)})}var Tp=B(`ZodDiscriminatedUnion`,(e,t)=>{Cp.init(e,t),El.init(e,t)});function Ep(e,t,n){return new Tp({type:`union`,options:t,discriminator:e,...R(n)})}var Dp=B(`ZodIntersection`,(e,t)=>{Dl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r)});function Op(e,t){return new Dp({type:`intersection`,left:e,right:t})}var kp=B(`ZodEnum`,(e,t)=>{Al.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new kp({...t,checks:[],...R(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 kp({...t,checks:[],...R(r),entries:i})}});function Ap(e,t){return new kp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var jp=B(`ZodLiteral`,(e,t)=>{jl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(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 Mp(e,t){return new jp({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var Np=B(`ZodTransform`,(e,t)=>{If(),Ml.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Wo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Eo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Eo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Pp(e){return new Np({type:`transform`,transform:e})}var Fp=B(`ZodOptional`,(e,t)=>{Pl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ip(e){return new Fp({type:`optional`,innerType:e})}var Lp=B(`ZodExactOptional`,(e,t)=>{Fl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rp(e){return new Lp({type:`optional`,innerType:e})}var zp=B(`ZodNullable`,(e,t)=>{Il.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>df(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bp(e){return new zp({type:`nullable`,innerType:e})}var Vp=B(`ZodDefault`,(e,t)=>{Ll.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Hp(e,t){return new Vp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Za(t)}})}var Up=B(`ZodPrefault`,(e,t)=>{zl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wp(e,t){return new Up({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Za(t)}})}var Gp=B(`ZodNonOptional`,(e,t)=>{Bl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kp(e,t){return new Gp({type:`nonoptional`,innerType:e,...R(t)})}var qp=B(`ZodCatch`,(e,t)=>{Ul.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_f(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jp(e,t){return new qp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ro(t)})}var Yp=B(`ZodPipe`,(e,t)=>{Wl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vf(e,t,n,r),e.in=t.in,e.out=t.out});function Xp(e,t){return new Yp({type:`pipe`,in:e,out:t})}var Zp=B(`ZodReadonly`,(e,t)=>{Kl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qp(e){return new Zp({type:`readonly`,innerType:e})}var $p=B(`ZodCustom`,(e,t)=>{Jl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r)});function em(e,t={}){return yd($p,e,t)}function tm(e,t){return bd(e,t)}var nm=`no-project`;function rm(){return X.parseLocation(X.history.location).search}function im(){let e=/^\/terminal\/([^/]+)$/.exec(X.history.location.pathname);if(e===null)return null;let t=decodeURIComponent(e[1]);return Z().machines.some(e=>e.id===t)?t:null}function am(){let e=sr({strict:!1,select:e=>e.machine??null});return Fh(t=>t.machines.some(t=>t.id===e)?e:null)}function om(){return rm().project??`global`}function sm(){return cr({strict:!1,select:e=>e.project??`global`})}function cm(e){let t=rm();return t.machine===void 0||t.project===void 0||!e.includes(t.machine)?null:{machine:t.machine,projectId:t.project,sessionId:t.session??null}}function lm(e){Tm({...rm(),...e},!0,X.history.location.state.layer)}function um(e,t){Tm({...rm(),...e},!1,t)}function dm(e){let t=Z();if(t.selection===null)throw Error(`no project is open to show the browser in`);if(e.startsWith(`file:`)){lm({panel:`browser`,browse:decodeURIComponent(new URL(e).pathname)});return}if(/^https?:\/\//i.test(e)||e.startsWith(`/`)||/^[a-z]:[\\/]/i.test(e)){lm({panel:`browser`,browse:e});return}let n=Lh(t,t.selection.machine,t.selection.projectId);if(n===void 0)throw Error(`project ${t.selection.projectId} is not listed`);lm({panel:`browser`,browse:`${n.path}/${e}`})}var fm=[],pm=!1,mm=!1,hm=!1;function gm(){return X.history.location.state.guard===!0}function _m(){return hm}function vm(){pm||(fm.length>0&&!gm()?X.history.push(X.history.location.href,{guard:!0}):fm.length===0&&gm()&&(pm=!0,X.history.back()))}function ym(){mm=gm(),X.history.subscribe(({action:e})=>{let t=mm;mm=gm(),e.type===`PUSH`||e.type===`REPLACE`?hm=!1:(hm=t,hm&&pm?pm=!1:hm&&fm.at(-1)?.(),setTimeout(vm))}),setTimeout(vm)}function bm(e,t){let n=(0,j.useEffectEvent)(t);(0,j.useEffect)(()=>{if(!e)return;function t(){n()}return fm.push(t),setTimeout(vm),()=>{fm.splice(fm.indexOf(t),1),setTimeout(vm)}},[e])}var xm=`terminalProjects`;function Sm(){return JSON.parse(localStorage.getItem(xm)??`[]`)}function Cm(){let e=rm();if(im()!==null||e.machine===void 0||e.project===void 0||e.session===void 0)return;let t=`${e.machine} ${e.project}`,n=Sm().filter(e=>e!==t);localStorage.setItem(xm,JSON.stringify(e.bottom===`terminal`?[...n,t]:n))}function wm(e=!1){let t=Z().selection;if(t===null){Tm({project:im()===null?void 0:rm().project},!0,X.history.location.state.layer);return}let n=rm(),r=n.machine===t.machine&&n.project===t.projectId&&n.session===void 0&&(t.sessionId===null||Z().loaded),i=Sm().includes(`${t.machine} ${t.projectId}`),a={machine:t.machine,project:t.projectId,session:t.sessionId??void 0,bottom:r?n.bottom:t.sessionId!==null&&i?`terminal`:void 0};if(im()!==null){X.navigate({to:`/`,search:a,replace:e||gm(),resetScroll:!1});return}let o=n.machine===a.machine&&n.project===a.project&&n.session===a.session,s=n.machine!==void 0&&n.session===void 0&&a.session===void 0;e||o||r||s?lm(a):um(a,void 0)}function Tm(e,t,n){let r=im(),i=gm(),a=t&&i?{layer:n,guard:i}:{layer:n};r===null?X.navigate({to:`/`,search:e,replace:t||i,state:a,resetScroll:!1}):X.navigate({to:`/terminal/$machine`,params:{machine:r},search:e,replace:t||i,state:a,resetScroll:!1})}function Em(e,t=null,n=!1){let r=Ih(Z(),e.machine),i=Z().selection;localStorage.setItem(`lastProject`,JSON.stringify({machine:e.machine,projectId:e.projectId})),Q({selection:e,loaded:e.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:e.sessionId===null?i?.sessionId===null&&i.machine===e.machine?Z().settings:rg(r):Sa(Uh(e))??ng(r,Z().sessions.find(t=>t.machine===e.machine&&t.id===e.sessionId)?.provider??rg(r).provider),context:null,replacing:null,paletteOpen:!1,unseen:Z().unseen.filter(t=>e.sessionId===null||t!==oh(e.machine,e.sessionId))}),wm(n),cg(e.machine),e.sessionId!==null&&r.status===`online`&&Dm(e.machine,e.projectId,e.sessionId,!0,t)}function Dm(e,t,n,r,i){F(e,`sessions.open`,{projectId:t,sessionId:n,opened:r,query:i}).then(t=>{t===null||Z().sessions.some(n=>n.machine===e&&n.id===t.id)||Q({sessions:[...Z().sessions,{...t,machine:e}]})}).catch($)}function Om(){Q({selection:null,loaded:!1,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],context:null}),wm()}function km(){let e=Z().machines,t=localStorage.getItem(`lastTerminal`);return t!==null&&e.some(e=>e.id===t)?t:e.at(0)?.id??null}function Am(e,t,n=!1){Em({machine:e,projectId:Lh(Z(),e,t)?.scratch===!0?nm:t,sessionId:null},null,n)}function jm(){let e=Z(),t=localStorage.getItem(`lastProject`),n=t===null?null:JSON.parse(t),r=e.machines.filter(e=>e.system?.scratchAvailable===!0);if(n!==null&&n.projectId===`no-project`&&r.some(e=>e.id===n.machine))return n;let i=(n===null?void 0:e.projects.find(e=>e.machine===n.machine&&e.id===n.projectId))??e.projects.find(e=>!e.scratch);return i===void 0?r.length>0?{machine:r[0].id,projectId:nm}:null:{machine:i.machine,projectId:i.id}}function Mm(e,t){let n=im();(n!==e||om()!==t)&&(X.navigate({to:`/terminal/$machine`,params:{machine:e},search:{project:t===`global`?void 0:t},replace:n!==null||gm(),resetScroll:!1}),Om())}async function Nm(e,t,n,r,i){if(n===null)throw Error(`no session selected`);`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission(),Q({sentAt:Date.now()}),await F(n.machine,`sessions.send`,{sessionId:n.sessionId,projectId:n.projectId,prompt:e,settings:r,delivery:t,status:i});let a=Z().replacing;n.sessionId===null&&a!==null&&a.machine===n.machine&&a.sessionId!==null&&(Q({replacing:null}),await Km(a.machine,a.sessionId,a.projectId))}function Pm(e){let t=Z().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.unqueue`,{sessionId:t.sessionId,id:e}).catch($)}function Fm(e){let t=Z().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.steer`,{sessionId:t.sessionId,id:e}).catch($)}function Im(){let e=Z().selection;e!==null&&e.sessionId!==null&&F(e.machine,`sessions.interrupt`,{sessionId:e.sessionId}).catch($)}function Lm(e,t){F(e,`sessions.restart`,{sessionId:t}).catch($)}function Rm(e,t,n){F(e,`sessions.stopTask`,{sessionId:t,taskId:n}).catch($)}function zm(e,t,n){let r=Z().selection;r!==null&&r.sessionId!==null&&F(r.machine,`sessions.respond`,{sessionId:r.sessionId,requestId:e,decision:t,answers:n}).catch($)}async function Bm(e){let t=Z().selection;if(t!==null&&t.sessionId!==null)try{let n=await F(t.machine,`sessions.fork`,{sessionId:t.sessionId,projectId:t.projectId,messageId:e});Em({...t,sessionId:n.sessionId})}catch(e){$(e)}}async function Vm(){let e=Z().selection,t=Z().before;if(e!==null&&e.sessionId!==null&&t!==null)try{let n=await F(e.machine,`sessions.earlier`,{sessionId:e.sessionId,before:t});if(Z().selection!==e||Z().before!==t)return;Q({earlier:[...n.items,...Z().earlier],before:n.before})}catch(e){$(e)}}async function Hm(e,t){let n=Z().selection;if(n!==null&&n.sessionId!==null)try{let r=await F(n.machine,`sessions.agent`,{sessionId:n.sessionId,projectId:n.projectId,agentId:t,parent:e});if(Z().selection!==n)return;let i=new Set(r.map(e=>e.id)),a=Z().items;Q({items:[...a.filter(t=>t.parent!==e),...r,...a.filter(t=>t.parent===e&&!i.has(t.id))]})}catch(e){$(e)}}async function Um(e,t,n){let r=Z();function i(n){return n.machine===e&&n.id===t}let a=[...r.sessions,...r.inactive].find(i);if(a!==void 0){let e={...a,...n};Q({sessions:r.sessions.some(i)?r.sessions.map(t=>i(t)?e:t):e.status===`inactive`?r.sessions:[...r.sessions,e],inactive:e.status===`inactive`?r.inactive.some(i)?r.inactive.map(t=>i(t)?e:t):[e,...r.inactive]:r.inactive.filter(e=>!i(e))})}try{await F(e,`sessions.update`,{id:t,patch:n})}catch(e){$(e)}}async function Wm(e){let t=oh(e.machine,e.id);Q({generatingTitles:[...Z().generatingTitles,t]});try{await F(e.machine,`sessions.generateTitle`,{id:e.id,projectId:e.projectId})}catch(e){$(e)}finally{Q({generatingTitles:Z().generatingTitles.filter(e=>e!==t)})}}async function Gm(e,t,n){let r=Z().selection;if(r?.machine===e&&r.sessionId===t){let i=Z().sessions.filter(r=>(r.status===`pinned`||r.status===`active`||r.status===`snoozed`)&&(r.machine!==e||r.id!==t)&&(n===null||r.machine===n.machine&&(r.projectId===n.projectId||n.projectId===`no-project`&&Lh(Z(),r.machine,r.projectId)?.scratch===!0))).sort((e,t)=>t.updatedAt-e.updatedAt).at(0);i===void 0?Am(r.machine,r.projectId,!0):Em({machine:i.machine,projectId:i.projectId,sessionId:i.id},null,!0)}await Um(e,t,{status:`inactive`})}async function Km(e,t,n){Q({sessions:Z().sessions.filter(n=>n.machine!==e||n.id!==t),inactive:Z().inactive.filter(n=>n.machine!==e||n.id!==t)}),ba(oh(e,t));let r=Z().selection;r?.machine===e&&r.sessionId===t&&Am(e,r.projectId,!0);try{await F(e,`sessions.remove`,{id:t,projectId:n})}catch(e){$(e)}}var qm=xp({machine:zf().optional().catch(void 0),project:zf().optional().catch(void 0),session:zf().optional().catch(void 0),panel:Ap([`diff`,`tasks`,`browser`]).optional().catch(void 0),browse:zf().optional().catch(void 0),bottom:Mp(`terminal`).optional().catch(void 0),terminal:zf().optional().catch(void 0)}),Jm=Ar({validateSearch:qm}),Ym=Or({getParentRoute:()=>Jm,path:`/`}),Xm=Or({getParentRoute:()=>Jm,path:`/terminal`,beforeLoad:()=>{let e=km();throw ke(e===null?{to:`/`,search:{},replace:!0}:{to:`/terminal/$machine`,params:{machine:e},search:{},replace:!0})}}),Zm=Or({getParentRoute:()=>Jm,path:`/terminal/$machine`});if(window.history.state?.__TSR_index===void 0&&(location.pathname.startsWith(`/terminal`)||new URLSearchParams(location.search).has(`machine`))){let e=`${location.pathname}${location.search}${location.hash}`,t=Math.random().toString(36).slice(2),n=Math.random().toString(36).slice(2);window.history.replaceState({__TSR_index:0,__TSR_key:t,key:t},``,`/`),window.history.pushState({__TSR_index:1,__TSR_key:n,key:n},``,e)}var X=Mr({routeTree:Jm.addChildren([Ym,Xm,Zm]),disableGlobalCatchBoundary:!0,parseSearch:e=>qm.parse(Object.fromEntries(new URLSearchParams(e))),stringifySearch:e=>{let t=new URLSearchParams;for(let n of Object.entries(e))n[1]!==void 0&&t.set(n[0],String(n[1]));let n=t.toString();return n===``?``:`?${n}`}}),Qm=fi.withTag(`machines`),$m=`machines`,eh=document.querySelector(`meta[name="offsite-connect"]`)?.getAttribute(`content`)?.split(` `)??null;function th(){let e=localStorage.getItem($m);return e===null?[]:JSON.parse(e)}function nh(e){localStorage.setItem($m,JSON.stringify(e))}async function rh(e){if(!(`caches`in window))return;let t=e.map(e=>({id:e.id,addresses:e.addresses}));await(await caches.open(`offsite-worker`)).put(`/machines`,new Response(JSON.stringify(t)))}function ih(){if(location.pathname!==`/pair`)return null;let e=new URLSearchParams(location.hash.slice(1));X.navigate({to:`/`,replace:!0});let t=e.get(`machine`);if(t===null)throw Error(`the pairing link has no machine`);return{address:ah(t).address,code:e.get(`code`)}}function ah(e){let t=e.trim(),n=new URL(/^[a-z]+:\/\//i.test(t)?t:`http://${t}`);if(n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`Use an http:// or https:// address`);let r=new URLSearchParams(n.hash.slice(1)),i=r.get(`machine`);return{address:i===null?n.origin:ah(i).address,code:r.get(`code`)}}function oh(e,t){return`${e} ${t}`}function sh(e){return{id:e.id,addresses:e.addresses,via:null,status:`connecting`,name:e.label??e.name,hostname:e.name,label:e.label,icon:e.icon,pairedAt:e.pairedAt??null,config:null,lastUsed:null,lastEfforts:[],appIcon:null,configError:null,system:null,claudeAccounts:[],codexAccounts:[],openCode:{available:!1},notifier:!1,activity:{},providers:[],terminals:[]}}function ch(e){return e.projects.map(t=>({...t,machine:e.id}))}function lh(){let e=th(),t=Z().machines;for(let n of t)e.some(e=>e.id===n.id)||vh(n.id);for(let n of e){let e=t.find(e=>e.id===n.id);if(e===void 0){let e=Z();Q({machines:[...e.machines,sh(n)],projects:[...e.projects,...ch(n)]}),Ni(n.id,n.addresses)}else zh(n.id,{label:n.label,icon:n.icon,name:n.label??e.hostname}),(n.addresses.join(` `)!==e.addresses.join(` `)||n.pairedAt!==e.pairedAt)&&(zh(n.id,{addresses:n.addresses,pairedAt:n.pairedAt}),gh(n.id))}let n=e.map(e=>e.id);Q({machines:[...Z().machines].sort((e,t)=>n.indexOf(e.id)-n.indexOf(t.id))})}async function uh(e,t){let n=Z().machines.find(t=>t.addresses.some(t=>e.includes(t)));if(n!==void 0)return t!==null&&await dh(n.id,t),n.id;let r=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);return t!==null&&await ai(r,await fh(e,t)),Q({machines:[...Z().machines,sh({id:r,addresses:e,name:new URL(e[0]).hostname,label:null,icon:`computer`,pairedAt:t===null?null:Date.now(),projects:[]})]}),yh(),Ni(r,e),r}async function dh(e,t){await ai(e,await fh(Ih(Z(),e).addresses,t)),zh(e,{pairedAt:Date.now()}),yh(),gh(e)}async function fh(e,t){let n;for(let r of e){let e=await fetch(`${r}/api/pair`,{method:`POST`,headers:{authorization:`Bearer ${t}`}}).catch(e=>(n??=e,null));if(e!==null){if(!e.ok)throw Error(await e.text());return(await e.json()).token}}throw Error(`Could not reach the machine to pair: ${String(n)}`)}function ph(e,t){let n=Ih(Z(),e),r={...n,...t};zh(e,{...t,name:r.label??r.hostname}),yh(),r.addresses.join(` `)!==n.addresses.join(` `)&&gh(e)}function mh(e){Q({machines:[...Z().machines].sort((t,n)=>e.indexOf(t.id)-e.indexOf(n.id))}),yh()}function hh(e){rh(e).catch(e=>Qm.error(`could not share the machines with the service worker`,e))}function gh(e){Pi(e),zh(e,{status:`connecting`,via:null}),Ni(e,Ih(Z(),e).addresses)}function _h(e){vh(e),yh(),oi(e).catch(e=>Qm.error(`could not remove the device token`,e))}function vh(e){Pi(e);let t=Z(),n=t.machines.filter(t=>t.id!==e);Q({machines:n,projects:t.projects.filter(t=>t.machine!==e),sessions:t.sessions.filter(t=>t.machine!==e),inactive:t.inactive.filter(t=>t.machine!==e),unseen:t.unseen.filter(t=>!t.startsWith(`${e} `)),...t.settingsMachine===e&&{settingsMachine:n.at(0)?.id??null},...t.selection?.machine===e&&{selection:null}}),wm()}function yh(){let e=Z(),t=e.machines.map(t=>({id:t.id,addresses:t.addresses,name:t.hostname,label:t.label,icon:t.icon,pairedAt:t.pairedAt,projects:e.projects.filter(e=>e.machine===t.id).map(e=>({id:e.id,path:e.path,name:e.name,logo:e.logo,hidden:e.hidden,scratch:e.scratch}))}));nh(t),hh(t)}var bh=[{id:`one-dark-darker`,name:`One Dark Darker`,codeTheme:`one-dark-pro`,background:`#15181C`,foreground:`#ABB2BF`,cursor:`#B3BAC5`,selectionBackground:`#3B414D`,palette:[`#4A4F5A`,`#EE5D69`,`#97C775`,`#B68353`,`#61AFEF`,`#C678DD`,`#56B6C2`,`#CCCCCC`,`#616A7B`,`#FE808A`,`#C2DEAD`,`#D1A47A`,`#93CFFF`,`#E0A8F1`,`#82D2DC`,`#FFFFFF`]},{id:`one-dark-pro`,name:`One Dark Pro`,codeTheme:`one-dark-pro`,background:`#282C34`,foreground:`#ABB2BF`,cursor:`#528BFF`,selectionBackground:`#41454E`,palette:[`#3F4451`,`#E05561`,`#8CC265`,`#D18F52`,`#4AA5F0`,`#C162DE`,`#42B3C2`,`#D7DAE0`,`#4F5666`,`#FF616E`,`#A5E075`,`#F0A45D`,`#4DC4FF`,`#DE73FF`,`#4CD1E0`,`#E6E6E6`]},{id:`dracula`,name:`Dracula`,codeTheme:`dracula`,background:`#282A36`,foreground:`#F8F8F2`,cursor:`#F8F8F2`,selectionBackground:`#44475A`,palette:[`#21222C`,`#FF5555`,`#50FA7B`,`#F1FA8C`,`#BD93F9`,`#FF79C6`,`#8BE9FD`,`#F8F8F2`,`#6272A4`,`#FF6E6E`,`#69FF94`,`#FFFFA5`,`#D6ACFF`,`#FF92DF`,`#A4FFFF`,`#FFFFFF`]},{id:`tokyo-night`,name:`Tokyo Night`,codeTheme:`tokyo-night`,background:`#1A1B26`,foreground:`#C0CAF5`,cursor:`#C0CAF5`,selectionBackground:`#33467C`,palette:[`#15161E`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#A9B1D6`,`#414868`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#C0CAF5`]},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,codeTheme:`catppuccin-mocha`,background:`#1E1E2E`,foreground:`#CDD6F4`,cursor:`#F5E0DC`,selectionBackground:`#585B70`,palette:[`#45475A`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#BAC2DE`,`#585B70`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#A6ADC8`]},{id:`nord`,name:`Nord`,codeTheme:`nord`,background:`#2E3440`,foreground:`#D8DEE9`,cursor:`#D8DEE9`,selectionBackground:`#434C5E`,palette:[`#3B4252`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#88C0D0`,`#E5E9F0`,`#4C566A`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#8FBCBB`,`#ECEFF4`]},{id:`gruvbox-dark`,name:`Gruvbox Dark`,codeTheme:`gruvbox-dark-medium`,background:`#282828`,foreground:`#EBDBB2`,cursor:`#EBDBB2`,selectionBackground:`#504945`,palette:[`#282828`,`#CC241D`,`#98971A`,`#D79921`,`#458588`,`#B16286`,`#689D6A`,`#A89984`,`#928374`,`#FB4934`,`#B8BB26`,`#FABD2F`,`#83A598`,`#D3869B`,`#8EC07C`,`#EBDBB2`]},{id:`solarized-dark`,name:`Solarized Dark`,codeTheme:`solarized-dark`,background:`#002B36`,foreground:`#839496`,cursor:`#839496`,selectionBackground:`#073642`,palette:[`#073642`,`#DC322F`,`#859900`,`#B58900`,`#268BD2`,`#D33682`,`#2AA198`,`#EEE8D5`,`#002B36`,`#CB4B16`,`#586E75`,`#657B83`,`#839496`,`#6C71C4`,`#93A1A1`,`#FDF6E3`]},{id:`github-dark`,name:`GitHub Dark`,codeTheme:`github-dark`,background:`#0D1117`,foreground:`#E6EDF3`,cursor:`#E6EDF3`,selectionBackground:`#264F78`,palette:[`#484F58`,`#FF7B72`,`#3FB950`,`#D29922`,`#58A6FF`,`#BC8CFF`,`#39C5CF`,`#B1BAC4`,`#6E7681`,`#FFA198`,`#56D364`,`#E3B341`,`#79C0FF`,`#D2A8FF`,`#56D4DD`,`#FFFFFF`]},{id:`rose-pine`,name:`Rosé Pine`,codeTheme:`rose-pine`,background:`#191724`,foreground:`#E0DEF4`,cursor:`#E0DEF4`,selectionBackground:`#403D52`,palette:[`#26233A`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`,`#6E6A86`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`]}],xh=fi.withTag(`prefs`),Sh=Sp({theme:zf().refine(e=>bh.some(t=>t.id===e)).default(bh[0].id),terminal:Sp({font:Sp({family:zf().default(`FiraCode Nerd Font`),size:up().default(14),lineHeight:up().default(1.35),ligatures:Y().default(!0)}).prefault({}),cursor:Sp({style:Ap([`block`,`bar`,`underline`]).default(`bar`),blink:Y().default(!0)}).prefault({}),padding:Sp({top:up().default(4),right:up().default(4),bottom:up().default(0),left:up().default(4)}).prefault({}),scrollback:up().default(1e3),boldIsBright:Y().default(!0),behavior:Sp({modernizeShiftEnter:Y().default(!0),pasteBrowserImages:Y().default(!0),captureShortcuts:Y().default(!0),bellFlash:Y().default(!0),bellSound:Y().default(!0),clickToMoveCursor:Y().default(!0),optionAsMeta:Ap([`off`,`left`,`right`,`both`]).default(`off`),windowsCopyPaste:Y().default(!0),confirmCloseBusyTab:Y().default(!0)}).prefault({})}).prefault({}),editor:Sp({font:Sp({family:zf().default(`FiraCode Nerd Font`),size:up().default(15.3),lineHeight:up().default(1.8),ligatures:Y().default(!0),features:zf().default(`'zero', 'ss02', 'ss06', 'cv02', 'cv14', 'cv26'`)}).prefault({}),cursor:Sp({style:Ap([`block`,`bar`,`underline`]).default(`bar`),blink:Y().default(!0)}).prefault({}),tabSize:up().default(2),wordWrap:Y().default(!0),graph:Y().default(!0)}).prefault({}),diff:Sp({split:Y().default(!1),wrap:Y().default(!0),collapsed:Y().default(!1)}).prefault({}),rewind:Ap([`all`,`chat`,`code`]).default(`chat`),groupActiveByProject:Y().default(!1),autoMoveToSnooze:Y().default(!1),dictateButton:xp({mobile:Y().default(!0)}).prefault({}),toolbar:yp(Ap([`diff`,`terminal`,`tasks`,`browser`,`editor`])).default([`diff`,`terminal`,`editor`])}),Ch=`prefs`,wh=Sh.parse({});function Th(){let e=localStorage.getItem(Ch);if(e===null)return structuredClone(wh);let t=Sh.safeParse(JSON.parse(e));return t.success?t.data:(xh.warn(`invalid stored prefs, using the defaults:\n${rs(t.error)}`),structuredClone(wh))}function Eh(e){localStorage.setItem(Ch,JSON.stringify(e))}function Dh(){let e=Z().prefs.theme,t=bh.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t}function Oh(){let e=Fh(e=>e.prefs.theme),t=bh.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t.codeTheme}function kh(){let e=Dh(),t=document.documentElement.style;t.setProperty(`--bg`,e.background),t.setProperty(`--text`,e.foreground),t.setProperty(`--blue`,e.palette[4]),t.setProperty(`--danger`,e.palette[1]),t.setProperty(`--green`,e.palette[2]),t.setProperty(`--yellow`,e.palette[3]),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.background)}var Ah=fi.withTag(`ui`),jh={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},Mh;function Nh(e){Mh=ea()(()=>e)}function Ph(e){return Mh.subscribe(e)}function Z(){return Mh.getState()}function Fh(e){return na(Mh,e)}function Q(e){Mh.setState(e)}function Ih(e,t){let n=e.machines.find(e=>e.id===t);if(n===void 0)throw Error(`unknown machine ${t}`);return n}function Lh(e,t,n){return e.projects.find(e=>e.machine===t&&e.id===n)}function Rh(e){return e.selection?.machine??e.machines.at(0)?.id??null}function zh(e,t){Q({machines:Z().machines.map(n=>n.id===e?{...n,...t}:n)})}function Bh(e,t,n){if(n!==null)return e.find(e=>e.id===t)?.activity[n]}function Vh(e){let t=e.selection;if(t!==null)return Bh(e.machines,t.machine,t.sessionId)}function Hh(e){return Vh(e)?.running===!0}function Uh(e){return e.sessionId===null?`new`:oh(e.machine,e.sessionId)}function Wh(e){Q({draft:e})}function Gh(e){Q({paletteOpen:e})}function Kh(e){Q({editor:e})}function qh(e){Q({exporting:e})}function Jh(e){Q({settingsOpen:e,paletteOpen:!1,...e&&{settingsMachine:Rh(Z()),settingsAccount:null,settingsEditedMachine:null,settingsListing:!0}})}function Yh(e){Q({usageOpen:e,paletteOpen:!1})}function Xh(e){Q({settingsOpen:!0,settingsPage:e,settingsAccount:null,settingsEditedMachine:null,settingsListing:!1,paletteOpen:!1,...!Z().settingsOpen&&{settingsMachine:Rh(Z())}})}function Zh(e){Q({prefs:e}),Eh(e),kh()}function $(e){Ah.warn(`showing an error:`,e),Q({errors:[...Z().errors,r(e)]})}function Qh(){Q({errors:[]})}var $h=null;function eg(e,t,n){return e.lastEfforts.find(e=>e.provider===t&&e.model===n)?.effort??null}function tg(e,t,n){for(let r of Z().machines)r.status===`online`&&F(r.id,`lastEffort.save`,{provider:e,model:t,effort:n}).catch($)}function ng(e,t){let n=e.lastUsed?.find(e=>e.provider===t),r=t===`claude`?Yi:t===`codex`?Xi:null;return n===void 0?{provider:t,accountId:null,model:null,effort:null,mode:r,plan:!1}:{provider:t,accountId:n.accountId,model:n.model,effort:eg(e,t,n.model),mode:r,plan:!1}}function rg(e){let t=Zi(e.lastUsed??[],e=>e.usedAt);return t===void 0?{provider:Ji,accountId:null,model:null,effort:null,mode:Yi,plan:!1}:ng(e,t.provider)}function ig(e,t,n,r){F(e,`lastUsed.save`,{provider:t,accountId:n,model:r}).catch($);let i=Z().machines.filter(t=>t.id!==e&&t.status===`online`);if(t===`opencode`){for(let e of i.filter(e=>e.openCode.available))F(e.id,`lastUsed.save`,{provider:t,accountId:null,model:r}).catch($);return}let a=Ih(Z(),e),o=(t===`claude`?a.claudeAccounts:a.codexAccounts).find(e=>e.id===n)?.identity;if(o!=null)for(let e of i){let n=(t===`claude`?e.claudeAccounts:e.codexAccounts).find(e=>e.enabled&&e.identity!==null&&e.identity.accountId===o.accountId&&e.identity.organizationId===o.organizationId);n!==void 0&&F(e.id,`lastUsed.save`,{provider:t,accountId:n.id,model:r}).catch($)}}function ag(e){let t={...Z().settings,...e};Q({settings:t});let n=Z().selection;n!==null&&(n.sessionId!==null&&Ca(Uh(n),t),e.accountId!==void 0&&ug(),n.sessionId!==null&&Bh(Z().machines,n.machine,n.sessionId)!==void 0&&e.accountId===void 0&&F(n.machine,`sessions.configure`,{sessionId:n.sessionId,settings:t}).catch($))}function og(e,t){if(zh(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),Z().selection?.machine!==e)return;let n=Z().settings,r=[...[...t.claudeAccounts,...t.codexAccounts].filter(e=>e.valid).map(e=>({provider:e.provider,accountId:e.id})),...t.openCode.available?[{provider:`opencode`,accountId:null}]:[]];if(r.some(e=>e.provider===n.provider&&e.accountId===n.accountId))return;let i=r.find(e=>e.provider===n.provider),a=Z().selection?.sessionId===null?r.at(0):void 0;i===void 0?a===void 0?n.accountId!==null&&ag({accountId:null}):ag({...ng(Ih(Z(),e),a.provider),accountId:a.accountId}):ag({accountId:i.accountId})}function sg(e){let t=Z().selection;t?.machine===e&&t.sessionId===null&&(Q({settings:rg(Ih(Z(),e))}),cg(e))}function cg(e){let t=Ih(Z(),e);(t.claudeAccounts.length>0||t.codexAccounts.length>0||t.openCode.available)&&og(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),ug()}async function lg(e){try{og(e,await F(e,`accounts.list`,void 0))}catch(e){$(e)}}async function ug(){let e=Z().selection;if(e===null)return;let{provider:t,accountId:n}=Z().settings;if(t!==`opencode`&&n===null)Q({capabilities:null});else try{let r=JSON.stringify([e.machine,t,n,e.projectId]);if($h?.key!==r){let i=F(e.machine,`capabilities`,{provider:t,accountId:n,projectId:e.projectId});function a(){$h?.result===i&&($h=null)}i.then(a,a),$h={key:r,result:i}}let i=await $h.result;if(Z().selection?.machine!==e.machine||Z().selection?.projectId!==e.projectId||Z().settings.provider!==t||Z().settings.accountId!==n)return;Q({capabilities:i});let a=Z().settings;if(a.model!==null){let e=i.models.find(e=>e.value===a.model)?.effort;a.provider!==`opencode`&&a.effort===null&&e!=null&&ag({effort:e});return}let o=i.models.find(e=>!e.hidden&&e.value===i.defaultModel)??i.models.find(e=>!e.hidden);if(o===void 0)return;ag({model:o.value,effort:eg(Ih(Z(),e.machine),t,o.value)??o.effort})}catch(e){$(e)}}var dg=[[`path`,{d:`M18 6L12 12M12 12L6 18M12 12L18 18M12 12L6 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]];export{mh as $,va as $t,Yh as A,cm as At,bh as B,Ep as Bt,zh as C,Dn as Cn,Pm as Ct,Gh as D,D as Dn,um as Dt,qh as E,O as En,dm as Et,kh as F,bm as Ft,oh as G,_a as Gt,eh as H,xp as Ht,Dh as I,am as It,yh as J,Ta as Jt,dh as K,xa as Kt,Oh as L,sm as Lt,Q as M,wm as Mt,Zh as N,im as Nt,Jh as O,c as On,Cm as Ot,Fh as P,om as Pt,_h as Q,Oa as Qt,wh as R,nm as Rt,Wh as S,On as Sn,Rm as St,$ as T,Oe as Tn,_m as Tt,ph as U,zf as Ut,uh as V,Mp as Vt,th as W,ka as Wt,lh as X,ya as Xt,ah as Y,Ea as Yt,gh as Z,ha as Zt,Ih as _,ti as _n,zm as _t,lg as a,Ji as an,Gm as at,Vh as b,tr as bn,Am as bt,tg as c,Ii as cn,Im as ct,Bh as d,Ri as dn,Vm as dt,Ca as en,sh as et,Nh as f,ji as fn,Dm as ft,Z as g,ei as gn,Km as gt,Uh as h,Zr as hn,Wm as ht,ng as i,Yi as in,Om as it,Ph as j,ym as jt,Xh as k,lm as kt,ig as l,Fi as ln,jm as lt,Qh as m,mi as mn,Mm as mt,ag as n,ga as nn,hh as nt,ug as o,F as on,Um as ot,Rh as p,fi as pn,Em as pt,ih as q,Sa as qt,eg as r,wa as rn,X as rt,sg as s,Ni as sn,Bm as st,dg as t,Da as tn,ch as tt,og as u,Li as un,Hm as ut,Lh as v,Pr as vn,Lm as vt,Kh as w,_t as wn,rm as wt,Hh as x,An as xn,Fm as xt,jh as y,cr as yn,Nm as yt,Th as z,Y as zt};
|