editlet 0.0.0-stage → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +140 -2
- package/dist/admin/config.d.ts +22 -0
- package/dist/admin/config.js +75 -0
- package/dist/admin/dist/assets/RichEditor-BlaCRrEX.css +1 -0
- package/dist/admin/dist/assets/RichEditor-IZKdt6MK.js +42 -0
- package/dist/admin/dist/assets/blank-line-CbGzlqBI.js +1 -0
- package/dist/admin/dist/assets/channel-CljeMIwA.js +1 -0
- package/dist/admin/dist/assets/db-CCMyPgQa.js +1 -0
- package/dist/admin/dist/assets/index-CWoJh4H8.js +257 -0
- package/dist/admin/dist/assets/index-DkRMnD_M.css +1 -0
- package/dist/admin/dist/assets/mdast-util-from-markdown-C79q1_d8.js +3 -0
- package/dist/admin/dist/assets/mdast-util-gfm-cM-_xFJE.js +19 -0
- package/dist/admin/dist/assets/micromark-extension-gfm-Wz6-oszS.js +1 -0
- package/dist/admin/dist/assets/micromark-util-classify-character-BgXaGAja.js +1 -0
- package/dist/admin/dist/assets/micromark-util-html-tag-name-B61T18yC.js +1 -0
- package/dist/admin/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/admin/dist/index.html +16 -0
- package/dist/admin/dist/preview.js +1 -0
- package/dist/admin/dist/window.js +1 -0
- package/dist/astro/content.d.ts +21 -0
- package/dist/astro/content.js +235 -0
- package/dist/astro/devServer.js +89 -0
- package/dist/astro/index.d.ts +15 -0
- package/dist/astro/index.js +98 -0
- package/dist/astro/nodeBridge.js +36 -0
- package/dist/astro/shared.js +10 -0
- package/dist/astro/stub/index.html +71 -0
- package/dist/auth/client.d.ts +24 -0
- package/dist/auth/client.js +120 -0
- package/dist/auth/handler.d.ts +16 -0
- package/dist/auth/handler.js +281 -0
- package/dist/auth/protocol.d.ts +25 -0
- package/dist/auth/protocol.js +3 -0
- package/dist/core/assets.d.ts +73 -0
- package/dist/core/assets.js +405 -0
- package/dist/core/devApi.d.ts +28 -0
- package/dist/core/devApi.js +3 -0
- package/dist/core/entryFile.d.ts +13 -0
- package/dist/core/entryFile.js +81 -0
- package/dist/core/fields.js +147 -0
- package/dist/core/generate.d.ts +3 -0
- package/dist/core/generate.js +70 -0
- package/dist/core/gitStyle.d.ts +92 -0
- package/dist/core/gitStyle.js +206 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +16 -0
- package/dist/core/issues.d.ts +10 -0
- package/dist/core/issues.js +10 -0
- package/dist/core/paths.d.ts +31 -0
- package/dist/core/paths.js +114 -0
- package/dist/core/project.js +56 -0
- package/dist/core/references.d.ts +68 -0
- package/dist/core/references.js +103 -0
- package/dist/core/rename.d.ts +60 -0
- package/dist/core/rename.js +133 -0
- package/dist/core/schema.d.ts +117 -0
- package/dist/core/schema.js +299 -0
- package/dist/core/sha.d.ts +2 -0
- package/dist/core/sha.js +13 -0
- package/dist/core/source.d.ts +48 -0
- package/dist/core/source.js +57 -0
- package/dist/core/validate.d.ts +22 -0
- package/dist/core/validate.js +148 -0
- package/dist/core/walk.d.ts +23 -0
- package/dist/core/walk.js +94 -0
- package/dist/core/writes.d.ts +37 -0
- package/dist/core/writes.js +166 -0
- package/dist/github/base64.js +16 -0
- package/dist/github/cache.d.ts +34 -0
- package/dist/github/cache.js +126 -0
- package/dist/github/client.d.ts +38 -0
- package/dist/github/client.js +228 -0
- package/dist/github/codeowners.d.ts +23 -0
- package/dist/github/codeowners.js +96 -0
- package/dist/github/commitReader.d.ts +25 -0
- package/dist/github/commitReader.js +38 -0
- package/dist/github/deploy.d.ts +15 -0
- package/dist/github/deploy.js +33 -0
- package/dist/github/index.d.ts +9 -0
- package/dist/github/index.js +8 -0
- package/dist/github/repo.d.ts +95 -0
- package/dist/github/repo.js +375 -0
- package/dist/github/source.d.ts +115 -0
- package/dist/github/source.js +558 -0
- package/dist/loader/index.d.ts +27 -0
- package/dist/loader/index.js +151 -0
- package/dist/loader/protocol.d.ts +95 -0
- package/dist/loader/protocol.js +120 -0
- package/dist/loader/window/geometry.js +9 -0
- package/dist/next/EditletLoader.d.ts +5 -0
- package/dist/next/EditletLoader.js +33 -0
- package/dist/next/assetUrl.d.ts +9 -0
- package/dist/next/assetUrl.js +13 -0
- package/dist/next/buildGuard.js +26 -0
- package/dist/next/config.d.ts +18 -0
- package/dist/next/config.js +255 -0
- package/dist/next/devServer.js +70 -0
- package/dist/next/editletField.d.ts +7 -0
- package/dist/next/editletField.js +7 -0
- package/dist/next/index.d.ts +8 -0
- package/dist/next/index.js +6 -0
- package/dist/next/preview.d.ts +18 -0
- package/dist/next/preview.js +100 -0
- package/dist/next/previewCookie.d.ts +5 -0
- package/dist/next/previewCookie.js +72 -0
- package/dist/next/previewEnv.js +25 -0
- package/dist/next/previewRef.d.ts +8 -0
- package/dist/next/previewRef.js +17 -0
- package/dist/next/publicDir.js +65 -0
- package/dist/next/reader.d.ts +49 -0
- package/dist/next/reader.js +161 -0
- package/dist/next/stub/index.html +56 -0
- package/dist/node/devHandler.d.ts +6 -0
- package/dist/node/devHandler.js +430 -0
- package/dist/node/fs.js +37 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +3 -0
- package/dist/node/project.d.ts +12 -0
- package/dist/node/project.js +43 -0
- package/package.json +187 -4
- package/skills/README.md +84 -0
- package/skills/editlet/SKILL.md +119 -0
- package/skills/editlet/references/content-format.md +191 -0
- package/skills/editlet/references/preview.md +75 -0
- package/skills/editlet/references/publishing.md +137 -0
- package/skills/editlet/references/schema-changes.md +127 -0
- package/skills/editlet/scripts/guard.mjs +1061 -0
- package/skills/editlet/scripts/link.mjs +193 -0
- package/skills/editlet/scripts/refs.mjs +1480 -0
- package/skills/editlet/scripts/schema.mjs +1340 -0
- package/skills/editlet/scripts/style.mjs +657 -0
- package/skills/editlet/scripts/types.mjs +525 -0
- package/skills/editlet/scripts/validate.mjs +724 -0
- package/skills/editlet-migrate/SKILL.md +92 -0
- package/skills/editlet-migrate/references/mapping.md +73 -0
- package/skills/editlet-migrate/references/sources.md +70 -0
- package/skills/editlet-setup/SKILL.md +108 -0
- package/skills/editlet-setup/references/astro.md +83 -0
- package/skills/editlet-setup/references/doctor.md +89 -0
- package/skills/editlet-setup/references/next.md +140 -0
- package/skills/editlet-setup/references/preview.md +54 -0
- package/skills/editlet-setup/references/production.md +153 -0
- package/skills/editlet-setup/references/roles.md +238 -0
- package/skills/editlet-setup/references/skills.md +99 -0
- package/skills/editlet-setup/scripts/doctor.mjs +1378 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mdast-util-from-markdown-C79q1_d8.js","./rolldown-runtime-XKyaHtl9.js","./micromark-util-html-tag-name-B61T18yC.js","./blank-line-CbGzlqBI.js","./micromark-util-classify-character-BgXaGAja.js","./micromark-extension-gfm-Wz6-oszS.js","./mdast-util-gfm-cM-_xFJE.js","./RichEditor-IZKdt6MK.js","./RichEditor-BlaCRrEX.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{C as n,D as r,O as i,a,i as o,k as s,m as c,o as l,p as u,t as d,x as f}from"./channel-CljeMIwA.js";import{a as p,i as m,n as h,t as g}from"./db-CCMyPgQa.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var _=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function ie(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function ae(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function oe(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,oe(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ie(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),oe(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ie(a,u),c+=oe(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ie(a,u++),c+=oe(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return oe(ae(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function se(e,t,n){if(e==null)return e;var r=[],i=0;return oe(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ce(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ue(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function de(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ue(de.bind(null,e))}var O={map:se,forEach:function(e,t,n){se(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return se(e,function(){t++}),t},toArray:function(e){return se(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=O,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=de,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ee.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ee.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ce}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ue,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),v=t(((e,t)=>{t.exports=_()})),y=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,ne=te.port2;te.port1.onmessage=E,D=function(){ne.postMessage(null)}}else D=function(){_(E,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),b=t(((e,t)=>{t.exports=y()})),x=t((e=>{var t=v();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),S=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=x()})),C=t((e=>{var t=b(),n=v(),r=S();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,x=null;function C(e,t,n){return e===n||e===t&&(y=e,!0)}function w(e,t,n){return e===n?(x=e,!1):e===t&&(x!==null&&(y=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var E=Object.assign,D=Symbol.for(`react.element`),te=Symbol.for(`react.transitional.element`),ne=Symbol.for(`react.portal`),re=Symbol.for(`react.fragment`),ie=Symbol.for(`react.strict_mode`),ae=Symbol.for(`react.profiler`),oe=Symbol.for(`react.consumer`),se=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),fe=Symbol.for(`react.activity`),pe=Symbol.for(`react.legacy_hidden`),me=Symbol.for(`react.memo_cache_sentinel`),he=Symbol.for(`react.view_transition`),ge=Symbol.for(`react.recoverable`),_e=Symbol.iterator;function ve(e){return typeof e!=`object`||!e?null:(e=_e&&e[_e]||e[`@@iterator`],typeof e==`function`?e:null)}var ye=Symbol.for(`react.client.reference`);function be(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case re:return`Fragment`;case ae:return`Profiler`;case ie:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case fe:return`Activity`;case he:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ne:return`Portal`;case se:return e.displayName||`Context`;case oe:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?be(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return be(e(t))}catch{}}return null}var xe=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Se=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A={pending:!1,data:null,method:null,action:null},Ce=[],we=-1;function Te(e){return{current:e}}function j(e){0>we||(e.current=Ce[we],Ce[we]=null,we--)}function M(e,t){we++,Ce[we]=e.current,e.current=t}var Ee=Te(null),De=Te(null),Oe=Te(null),ke=Te(null);function Ae(e,t){switch(M(Oe,t),M(De,e),M(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?mp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=mp(t),e=X(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}j(Ee),M(Ee,e)}function je(){j(Ee),j(De),j(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(uh._currentValue=t.memoizedState,M(ke,e)),t=Ee.current;var n=X(t,e.type);t!==n&&(M(De,e),M(Ee,n))}function Ne(e){De.current===e&&(j(Ee),j(De)),ke.current===e&&(j(ke),uh._currentValue=A)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+Pe+e+Fe}var Le=!1;function Re(e,t){if(!e||Le)return``;Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ie(n):``}function ze(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie(`Lazy`);case 13:return e.child!==t&&t!==null?Ie(`Suspense Fallback`):Ie(`Suspense`);case 19:return Ie(`SuspenseList`);case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return Ie(`Activity`);case 30:return Ie(`ViewTransition`);default:return``}}function Be(e){try{var t=``,n=null;do t+=ze(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var Ve=Object.prototype.hasOwnProperty,He=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,We=t.unstable_shouldYield,Ge=t.unstable_requestPaint,Ke=t.unstable_now,qe=t.unstable_getCurrentPriorityLevel,Je=t.unstable_ImmediatePriority,Ye=t.unstable_UserBlockingPriority,Xe=t.unstable_NormalPriority,Ze=t.unstable_LowPriority,N=t.unstable_IdlePriority,Qe=t.log,$e=t.unstable_setDisableYieldValue,et=null,P=null;function tt(e){if(typeof Qe==`function`&&$e(e),P&&typeof P.setStrictMode==`function`)try{P.setStrictMode(et,e)}catch{}}var nt=Math.clz32?Math.clz32:at,rt=Math.log,it=Math.LN2;function at(e){return e>>>=0,e===0?32:31-(rt(e)/it|0)|0}var ot=256,st=262144,ct=4194304;function lt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ut(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=lt(n))):i=lt(o):i=lt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=lt(n))):i=lt(o)):i=lt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function dt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ft(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-nt(n),i=1<<r;t|=e[r],n&=~i}return t}function pt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mt(){var e=ct;return ct<<=1,!(ct&62914560)&&(ct=4194304),e}function ht(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function gt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _t(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-nt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&vt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function vt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-nt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function yt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-nt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function bt(e,t){var n=t&-t;return n=n&42?1:xt(n),(n&(e.suspendedLanes|t))===0?n:0}function xt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function St(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ct(){var e=Se.p;return e===0?(e=window.event,e===void 0?32:Eh(e.type)):e}function wt(e,t){var n=Se.p;try{return Se.p=e,t()}finally{Se.p=n}}var Tt=Math.random().toString(36).slice(2),Et=`__reactFiber$`+Tt,Dt=`__reactProps$`+Tt,Ot=`__reactContainer$`+Tt,kt=`__reactEvents$`+Tt,At=`__reactListeners$`+Tt,jt=`__reactHandles$`+Tt,Mt=`__reactResources$`+Tt,Nt=`__reactMarker$`+Tt,Pt=`__reactLoad$`+Tt;function Ft(e){delete e[Et],delete e[Dt],delete e[At],delete e[jt]}function It(e){var t;if(t=e[Et])return t;for(var n=e.parentNode;n;){if(t=n[Ot]||n[Et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hm(e);e!==null;){if(n=e[Et])return n;e=hm(e)}return t}e=n,n=e.parentNode}return null}function Lt(e){if(e=e[Et]||e[Ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function F(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Rt(e){var t=e[Mt];return t||=e[Mt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function zt(e){e[Nt]=!0}function Bt(e){e[Pt]=void 0}var Vt=new Set,Ht={};function Ut(e,t){Wt(e,t),Wt(e+`Capture`,t)}function Wt(e,t){for(Ht[e]=t,e=0;e<t.length;e++)Vt.add(t[e])}var Gt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Kt={},qt={};function I(e){return Ve.call(qt,e)?!0:Ve.call(Kt,e)?!1:Gt.test(e)?qt[e]=!0:(Kt[e]=!0,!1)}var Jt=!1;function Yt(){var e=Jt;return Jt=!1,e}function Xt(e,t,n){if(I(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Zt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Qt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function $t(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function en(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function tn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nn(e){if(!e._valueTracker){var t=en(e)?`checked`:`value`;e._valueTracker=tn(e,t,``+e[t])}}function rn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=en(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var an=/[\n"\\]/g;function on(e){return e.replace(an,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function sn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+$t(t)):e.value!==``+$t(t)&&(e.value=``+$t(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):ln(e,$t(n)):o===`number`&&e.value==t?ln(e,$t(e.value)):ln(e,$t(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+$t(s):e.removeAttribute(`name`)}function cn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){nn(e);return}n=n==null?``:``+$t(n),t=t==null?n:``+$t(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),nn(e)}function ln(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function un(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+$t(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function dn(e,t,n){t!=null&&(t=``+$t(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+$t(n)}function fn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(xe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=$t(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),nn(e)}function pn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function hn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||mn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function gn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Jt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(hn(e,a,r),Jt=!0)}else for(var o in t)t.hasOwnProperty(o)&&hn(e,o,t[o])}function _n(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var vn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),yn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bn(e){return yn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function xn(){}var Sn=null;function Cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wn=null,Tn=null;function En(e){var t=Lt(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(sn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+on(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Dt]||null;if(!a)throw Error(i(90));sn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&rn(r)}break a;case`textarea`:dn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&un(e,!!n.multiple,t,!1)}}}var Dn=!1;function On(e,t,n){if(Dn)return e(t,n);Dn=!0;try{return e(t)}finally{if(Dn=!1,(wn!==null||Tn!==null)&&(Hd(),wn&&(t=wn,e=Tn,Tn=wn=null,En(t),e)))for(t=0;t<e.length;t++)En(e[t])}}function kn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Dt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var An=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,jn=!1;if(An)try{var Mn={};Object.defineProperty(Mn,"passive",{get:function(){jn=!0}}),window.addEventListener(`test`,Mn,Mn),window.removeEventListener(`test`,Mn,Mn)}catch{jn=!1}var Nn=null,Pn=null,Fn=null;function In(){if(Fn)return Fn;var e,t=Pn,n=t.length,r,i=`value`in Nn?Nn.value:Nn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Fn=i.slice(e,1<r?1-r:void 0)}function Ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Rn(){return!0}function zn(){return!1}function Bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Rn:zn,this.isPropagationStopped=zn,this}return E(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Rn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Rn)},persist:function(){},isPersistent:Rn}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hn=Bn(Vn),Un=E({},Vn,{view:0,detail:0}),Wn=Bn(Un),Gn,Kn,qn,Jn=E({},Un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ar,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==qn&&(qn&&e.type===`mousemove`?(Gn=e.screenX-qn.screenX,Kn=e.screenY-qn.screenY):Kn=Gn=0,qn=e),Gn)},movementY:function(e){return`movementY`in e?e.movementY:Kn}}),Yn=Bn(Jn),Xn=Bn(E({},Jn,{dataTransfer:0})),Zn=Bn(E({},Un,{relatedTarget:0})),Qn=Bn(E({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0})),$n=Bn(E({},Vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),er=Bn(E({},Vn,{data:0})),tr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},nr={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},rr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function ir(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rr[e])?!!t[e]:!1}function ar(){return ir}var or=Bn(E({},Un,{key:function(e){if(e.key){var t=tr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?nr[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ar,charCode:function(e){return e.type===`keypress`?Ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),sr=Bn(E({},Jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),cr=Bn(E({},Vn,{submitter:0})),L=Bn(E({},Un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ar})),lr=Bn(E({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ur=Bn(E({},Jn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),dr=Bn(E({},Vn,{newState:0,oldState:0,source:0})),fr=[9,13,27,32],pr=An&&`CompositionEvent`in window,mr=null;An&&`documentMode`in document&&(mr=document.documentMode);var hr=An&&`TextEvent`in window&&!mr,gr=An&&(!pr||mr&&8<mr&&11>=mr),_r=` `,vr=!1;function yr(e,t){switch(e){case`keyup`:return fr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function br(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var xr=!1;function Sr(e,t){switch(e){case`compositionend`:return br(t);case`keypress`:return t.which===32?(vr=!0,_r):null;case`textInput`:return e=t.data,e===_r&&vr?null:e;default:return null}}function Cr(e,t){if(xr)return e===`compositionend`||!pr&&yr(e,t)?(e=In(),Fn=Pn=Nn=null,xr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return gr&&t.locale!==`ko`?null:t.data;default:return null}}var wr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!wr[e.type]:t===`textarea`}function Er(e,t,n,r){wn?Tn?Tn.push(r):Tn=[r]:wn=r,t=Qf(t,`onChange`),0<t.length&&(n=new Hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Dr=null,Or=null;function kr(e){Gf(e,0)}function Ar(e){if(rn(F(e)))return e}function jr(e,t){if(e===`change`)return t}var Mr=!1;if(An){var Nr;if(An){var Pr=`oninput`in document;if(!Pr){var Fr=document.createElement(`div`);Fr.setAttribute(`oninput`,`return;`),Pr=typeof Fr.oninput==`function`}Nr=Pr}else Nr=!1;Mr=Nr&&(!document.documentMode||9<document.documentMode)}function Ir(){Dr&&(Dr.detachEvent(`onpropertychange`,Lr),Or=Dr=null)}function Lr(e){if(e.propertyName===`value`&&Ar(Or)){var t=[];Er(t,Or,e,Cn(e)),On(kr,t)}}function Rr(e,t,n){e===`focusin`?(Ir(),Dr=t,Or=n,Dr.attachEvent(`onpropertychange`,Lr)):e===`focusout`&&Ir()}function zr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Ar(Or)}function Br(e,t){if(e===`click`)return Ar(t)}function Vr(e,t){if(e===`input`||e===`change`)return Ar(t)}function Hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var R=typeof Object.is==`function`?Object.is:Hr;function Ur(e,t){if(R(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ve.call(t,i)||!R(e[i],t[i]))return!1}return!0}function Wr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Gr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kr(e,t){var n=Gr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Gr(n)}}function qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wr(e.document)}return t}function Yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var z=An&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Wr(r)||(r=Xr,`selectionStart`in r&&Yr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qr&&Ur(Qr,r)||(Qr=r,r=Qf(Zr,`onSelect`),0<r.length&&(t=new Hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Xr)))}function ti(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ni={animationend:ti(`Animation`,`AnimationEnd`),animationiteration:ti(`Animation`,`AnimationIteration`),animationstart:ti(`Animation`,`AnimationStart`),transitionrun:ti(`Transition`,`TransitionRun`),transitionstart:ti(`Transition`,`TransitionStart`),transitioncancel:ti(`Transition`,`TransitionCancel`),transitionend:ti(`Transition`,`TransitionEnd`)},ri={},ii={};An&&(ii=document.createElement(`div`).style,`AnimationEvent`in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),`TransitionEvent`in window||delete ni.transitionend.transition);function ai(e){if(ri[e])return ri[e];if(!ni[e])return e;var t=ni[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ii)return ri[e]=t[n];return e}var oi=ai(`animationend`),si=ai(`animationiteration`),ci=ai(`animationstart`),li=ai(`transitionrun`),ui=ai(`transitionstart`),di=ai(`transitioncancel`),fi=ai(`transitionend`),pi=new Map,mi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);mi.push(`scrollEnd`);function hi(e,t){pi.set(e,t),Ut(t,[e])}var gi=0;function _i(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Cd.identifierPrefix;var n=gi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function vi(e){if(e==null||typeof e==`string`)return e;var t=null,n=jd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function yi(e,t){return e=vi(e),t=vi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var bi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},xi=[],Si=0,Ci=0;function wi(){for(var e=Si,t=Ci=Si=0;t<e;){var n=xi[t];xi[t++]=null;var r=xi[t];xi[t++]=null;var i=xi[t];xi[t++]=null;var a=xi[t];if(xi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Oi(n,i,a)}}function Ti(e,t,n,r){xi[Si++]=e,xi[Si++]=t,xi[Si++]=n,xi[Si++]=r,Ci|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ei(e,t,n,r){return Ti(e,t,n,r),ki(e)}function Di(e,t){return Ti(e,null,null,t),ki(e)}function Oi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-nt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ki(e){if(50<Md)throw Md=0,Nd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ai={};function ji(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(e,t,n,r){return new ji(e,t,n,r)}function Ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pi(e,t){var n=e.alternate;return n===null?(n=Mi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Fi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ii(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ni(r)&&(s=1);else if(typeof r==`string`)s=Xm(e,n,Ee.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case fe:return e=Mi(31,n,t,a),e.elementType=fe,e.lanes=o,e;case re:return Li(n.children,a,o,t);case ie:s=8,a|=24;break;case ae:return e=Mi(12,n,t,a|2),e.elementType=ae,e.lanes=o,e;case le:return e=Mi(13,n,t,a),e.elementType=le,e.lanes=o,e;case ue:return e=Mi(19,n,t,a),e.elementType=ue,e.lanes=o,e;case pe:case he:return e=a|32,e=Mi(30,n,t,e),e.elementType=he,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case se:s=10;break a;case oe:s=9;break a;case ce:s=11;break a;case de:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Li(e,t,n,r){return e=Mi(7,e,r,t),e.lanes=n,e}function Ri(e,t,n){return e=Mi(6,e,null,t),e.lanes=n,e}function zi(e){var t=Mi(18,null,null,0);return t.stateNode=e,t}function Bi(e,t,n){return t=Mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vi=new WeakMap;function Hi(e,t){if(typeof e==`object`&&e){var n=Vi.get(e);return n===void 0?(t={value:e,source:t,stack:Be(t)},Vi.set(e,t),t):n}return{value:e,source:t,stack:Be(t)}}var Ui=[],Wi=0,Gi=null,Ki=0,qi=[],Ji=0,Yi=null,Xi=1,Zi=``;function Qi(e,t){Ui[Wi++]=Ki,Ui[Wi++]=Gi,Gi=e,Ki=t}function $i(e,t,n){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Yi=e;var r=Xi;e=Zi;var i=32-nt(r)-1;r&=~(1<<i),n+=1;var a=32-nt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Xi=1<<32-nt(t)+i|n<<i|r,Zi=a+e}else Xi=1<<a|n<<i|r,Zi=e}function ea(e){e.return!==null&&(Qi(e,1),$i(e,1,0))}function ta(e){for(;e===Gi;)Gi=Ui[--Wi],Ui[Wi]=null,Ki=Ui[--Wi],Ui[Wi]=null;for(;e===Yi;)Yi=qi[--Ji],qi[Ji]=null,Zi=qi[--Ji],qi[Ji]=null,Xi=qi[--Ji],qi[Ji]=null}function na(e,t){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Xi=t.id,Zi=t.overflow,Yi=e}var ra=null,ia=null,B=!1,aa=null,oa=!1,sa=Error(i(519));function ca(e){throw ma(Hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),sa}function la(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Et]=e,t[Dt]=r,n){case`dialog`:J(`cancel`,t),J(`close`,t);break;case`iframe`:case`object`:case`embed`:J(`load`,t);break;case`video`:case`audio`:for(n=0;n<Uf.length;n++)J(Uf[n],t);break;case`source`:J(`error`,t);break;case`img`:case`image`:case`link`:J(`error`,t),J(`load`,t);break;case`details`:J(`toggle`,t);break;case`input`:J(`invalid`,t),cn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:J(`invalid`,t);break;case`textarea`:J(`invalid`,t),fn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ip(t.textContent,n)?(r.popover!=null&&(J(`beforetoggle`,t),J(`toggle`,t)),r.onScroll!=null&&J(`scroll`,t),r.onScrollEnd!=null&&J(`scrollend`,t),r.onClick!=null&&(t.onclick=xn),t=!0):t=!1,t||ca(e,!0)}function ua(e){for(ra=e.return;ra;)switch(ra.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:ra=ra.return}}function da(e){if(e!==ra)return!1;if(!B)return ua(e),B=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||gp(e.type,e.memoizedProps)),n=!n),n&&ia&&ca(e),ua(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=mm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=mm(e)}else t===27?(t=ia,Tp(e.type)?(e=pm,pm=null,ia=e):ia=t):ia=ra?fm(e.stateNode.nextSibling):null;return!0}function fa(){ia=ra=null,B=!1}function pa(){var e=aa;return e!==null&&(hd===null?hd=e:hd.push.apply(hd,e),aa=null),e}function ma(e){aa===null?aa=[e]:aa.push(e)}var ha=Te(null),ga=null,_a=null;function va(e,t,n){M(ha,t._currentValue),t._currentValue=n}function ya(e){e._currentValue=ha.current,j(ha)}function ba(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function xa(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ba(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ba(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ba(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Sa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;R(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ke.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[uh]:e.push(uh))}a=a.return}return e!==null&&xa(t,e,n,r),t.flags|=262144,e!==null}function Ca(e){for(e=e.firstContext;e!==null;){if(!R(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function wa(e){ga=e,_a=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ta(e){return Da(ga,e)}function Ea(e,t){return ga===null&&wa(e),Da(e,t)}function Da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},_a===null){if(e===null)throw Error(i(308));_a=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else _a=_a.next=t;return n}var Oa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ka=t.unstable_scheduleCallback,Aa=t.unstable_NormalPriority,V={$$typeof:se,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ja(){return{controller:new Oa,data:new Map,refCount:0}}function Ma(e){e.refCount--,e.refCount===0&&ka(Aa,function(){e.controller.abort()})}function Na(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Pa=null;function Fa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ia=null,La=0,Ra=0,za=null;function Ba(e,t){if(Ia===null){var n=Ia=[];La=0,Ra=Rf(),za={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return La++,t.then(Va,Va),t}function Va(){if(--La===0&&(Pa=null,Ia!==null)){za!==null&&(za.status=`fulfilled`);var e=Ia;Ia=null,Ra=0,za=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ua=k.S;k.S=function(e,t){if(vd=Ke(),typeof t==`object`&&t&&typeof t.then==`function`&&Ba(e,t),Pa!==null)for(var n=wf;n!==null;)Na(n,Pa),n=n.next;if(n=e.types,n!==null){for(var r=wf;r!==null;)Na(r,n),r=r.next;if(Ra!==0){r=Pa,r===null&&(r=Pa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ua!==null&&Ua(e,t)};var Wa=Te(null);function Ga(){var e=Wa.current;return e===null?td.pooledCache:e}function Ka(e,t){t===null?M(Wa,Wa.current):M(Wa,t.pool)}function qa(){var e=Ga();return e===null?null:{parent:V._currentValue,pool:e}}var Ja=Error(i(460)),Ya=Error(i(474)),Xa=Error(i(542)),Za={then:function(){}};function Qa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function $a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(xn,xn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ro(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(xn,xn);else{if(e=td,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ro(e),e}throw to=t,Ja}}function eo(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(to=e,Ja):e}}var to=null;function no(){if(to===null)throw Error(i(459));var e=to;return to=null,e}function ro(e){if(e===Ja||e===Xa)throw Error(i(483))}var io=null,ao=0;function oo(e){var t=ao;return ao+=1,io===null&&(io=[]),$a(io,e,t)}function so(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function co(e,t){throw t.$$typeof===D?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function lo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Pi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ri(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===re?(e=d(e,t,n.props.children,r,n.key),so(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&eo(i)===t.type)?(t=a(t,n.props),so(t,n),t.return=e,t):(t=Ii(n.type,n.key,n.props,null,e.mode,r),so(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Bi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Li(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case te:return n=Ii(t.type,t.key,t.props,null,e.mode,n),so(n,t),n.return=e,n;case ne:return t=Bi(t,e.mode,n),t.return=e,t;case O:return t=eo(t),f(e,t,n)}if(xe(t)||ve(t))return t=Li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,oo(t),n);if(t.$$typeof===se)return f(e,Ea(e,t),n);co(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case te:return n.key===i?l(e,t,n,r):null;case ne:return n.key===i?u(e,t,n,r):null;case O:return n=eo(n),p(e,t,n,r)}if(xe(n)||ve(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,oo(n),r);if(n.$$typeof===se)return p(e,t,Ea(e,n),r);co(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case te:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case ne:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=eo(r),m(e,t,n,r,i)}if(xe(r)||ve(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,oo(r),i);if(r.$$typeof===se)return m(e,t,n,Ea(t,r),i);co(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),B&&Qi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return B&&Qi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),B&&Qi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),B&&Qi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return B&&Qi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),B&&Qi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===re&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case te:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===re){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),so(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&eo(l)===r.type){n(e,r.sibling),c=a(r,o.props),so(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===re?(c=Li(o.props.children,e.mode,c,o.key),so(c,o),c.return=e,e=c):(c=Ii(o.type,o.key,o.props,null,e.mode,c),so(c,o),c.return=e,e=c)}return s(e);case ne:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Bi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=eo(o),_(e,r,o,c)}if(xe(o))return h(e,r,o,c);if(ve(o)){if(l=ve(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,oo(o),c);if(o.$$typeof===se)return _(e,r,Ea(e,o),c);co(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ao=0;var i=_(e,t,n,r);return io=null,i}catch(t){if(t===Ja||t===Xa)throw t;var a=Mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var uo=lo(!0),fo=lo(!1),po=!1;function mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ho(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function go(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _o(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ed&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ki(e),Oi(e,null,n),t}return Ti(e,r,t,n),ki(e)}function vo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,yt(e,n)}}function yo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var bo=!1;function xo(){if(bo){var e=za;if(e!==null)throw e}}function So(e,t,n,r){bo=!1;var i=e.updateQueue;po=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Ra&&(bo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=E({},d,f);break a;case 2:po=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ld|=o,e.lanes=o,e.memoizedState=d}}function Co(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function wo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Co(n[e],t)}var To=Te(null),Eo=Te(0);function Do(e,t){e=sd,M(Eo,e),M(To,t),sd=e|t.baseLanes}function Oo(){M(Eo,sd),M(To,To.current)}function ko(){sd=Eo.current,j(To),j(Eo)}var Ao=Te(null),jo=null;function Mo(e){var t=e.alternate;M(Lo,Lo.current&1),M(Ao,e),jo===null&&(t===null||To.current!==null||t.memoizedState!==null)&&(jo=e)}function No(e){M(Lo,Lo.current),M(Ao,e),jo===null&&(jo=e)}function Po(e){e.tag===22?(M(Lo,Lo.current),M(Ao,e),jo===null&&(jo=e)):Fo()}function Fo(){M(Lo,Lo.current),M(Ao,Ao.current)}function Io(e){j(Ao),jo===e&&(jo=null),j(Lo)}var Lo=Te(0);function Ro(e,t){M(Ao,Ao.current),M(Lo,t)}function zo(e){j(Lo),j(Ao),jo===e&&(jo=null)}function Bo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lm(n)||um(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Vo=0,H=null,Ho=null,Uo=null,Wo=!1,Go=!1,Ko=!1,qo=0,Jo=0,Yo=null,Xo=0;function Zo(){throw Error(i(321))}function Qo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!R(e[n],t[n]))return!1;return!0}function $o(e,t,n,r,i,a){return Vo=a,H=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?gc:_c,Ko=!1,a=n(r,i),Ko=!1,Go&&(a=ts(t,n,r,i)),es(e),a}function es(e){k.H=hc;var t=Ho!==null&&Ho.next!==null;if(Vo=0,Uo=Ho=H=null,Wo=!1,Jo=0,Yo=null,t)throw Error(i(300));e===null||U||(e=e.dependencies,e!==null&&Ca(e)&&(U=!0))}function ts(e,t,n,r){H=e;var a=0;do{if(Go&&(Yo=null),Jo=0,Go=!1,25<=a)throw Error(i(301));if(a+=1,Uo=Ho=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=vc,o=t(n,r)}while(Go);return o}function ns(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?ls(t):t,e=e.useState()[0],(Ho===null?null:Ho.memoizedState)!==e&&(H.flags|=1024),t}function rs(){var e=qo!==0;return qo=0,e}function is(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function as(e){if(Wo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Wo=!1}Vo=0,Uo=Ho=H=null,Go=!1,Jo=qo=0,Yo=null}function os(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Uo===null?H.memoizedState=Uo=e:Uo=Uo.next=e,Uo}function ss(){if(Ho===null){var e=H.alternate;e=e===null?null:e.memoizedState}else e=Ho.next;var t=Uo===null?H.memoizedState:Uo.next;if(t!==null)Uo=t,Ho=e;else{if(e===null)throw H.alternate===null?Error(i(467)):Error(i(310));Ho=e,e={memoizedState:Ho.memoizedState,baseState:Ho.baseState,baseQueue:Ho.baseQueue,queue:Ho.queue,next:null},Uo===null?H.memoizedState=Uo=e:Uo=Uo.next=e}return Uo}function cs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ls(e){var t=Jo;return Jo+=1,Yo===null&&(Yo=[]),e=$a(Yo,e,t),t=H,(Uo===null?t.memoizedState:Uo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?gc:_c),e}function us(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ls(e);if(e.$$typeof===ge)return;if(e.$$typeof===se)return Ta(e)}throw Error(i(438,String(e)))}function ds(e){var t=null,n=H.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=H.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=cs(),H.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=me;return t.index++,n}function fs(e,t){return typeof t==`function`?t(e):t}function ps(e){return ms(ss(),Ho,e)}function ms(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Vo&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ra&&(d=!0);else if((Vo&p)===p){u=u.next,p===Ra&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,H.lanes|=p,ld|=p;f=u.action,Ko&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,H.lanes|=f,ld|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!R(o,e.memoizedState)&&(U=!0,d&&(n=za,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function hs(e){var t=ss(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);R(o,t.memoizedState)||(U=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function gs(e,t,n){var r=H,a=ss(),o=B;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!R((Ho||a).memoizedState,n);if(s&&(a.memoizedState=n,U=!0),a=a.queue,Vs(ys.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Uo!==null&&!!(Uo.memoizedState.tag&1),Is(e?9:8,{destroy:void 0},vs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,td===null)throw Error(i(349));o||Vo&127||_s(r,t,n)}return n}function _s(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=H.updateQueue,t===null?(t=cs(),H.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vs(e,t,n,r){t.value=n,t.getSnapshot=r,bs(t)&&xs(e)}function ys(e,t,n){return n(function(){bs(t)&&xs(e)})}function bs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!R(e,n)}catch{return!0}}function xs(e){var t=Di(e,2);t!==null&&Ld(t,e,2)}function Ss(e){var t=os();if(typeof e==`function`){var n=e;if(e=n(),Ko){tt(!0);try{n()}finally{tt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:e},t}function Cs(e,t,n,r){return e.baseState=n,ms(e,Ho,typeof r==`function`?r:fs)}function ws(e,t,n,r,a){if(fc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ts(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ts(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};o.types=a===null?null:a.types,k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Es(e,t,s)}catch(n){Os(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Es(e,t,a)}catch(n){Os(e,t,n)}}function Es(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ds(e,t,n)},function(n){return Os(e,t,n)}):Ds(e,t,n)}function Ds(e,t,n){t.status=`fulfilled`,t.value=n,ks(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ts(e,n)))}function Os(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ks(t),t=t.next;while(t!==r)}e.action=null}function ks(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function As(e,t){return t}function js(e,t){if(B){var n=td.formState;if(n!==null){a:{var r=H;if(B){if(ia){b:{for(var i=ia,a=oa;i.nodeType!==8;)if(!a||(i=fm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ia=fm(i.nextSibling),r=i.data===`F!`;break a}}ca(r)}r=!1}r&&(t=n[0])}}return n=os(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:As,lastRenderedState:t},n.queue=r,n=lc.bind(null,H,r),r.dispatch=n,r=Ss(!1),a=dc.bind(null,H,!1,r.queue),r=os(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ws.bind(null,H,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ms(e){return Ns(ss(),Ho,e)}function Ns(e,t,n){if(t=ms(e,t,As)[0],e=ps(fs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ls(t)}catch(e){throw e===Ja?Xa:e}else r=t;t=ss();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(H.flags|=2048,Is(9,{destroy:void 0},Ps.bind(null,i,n),null)),[r,a,e]}function Ps(e,t){e.action=t}function Fs(e){var t=ss(),n=Ho;if(n!==null)return Ns(t,n,e);ss(),t=t.memoizedState,n=ss();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Is(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=H.updateQueue,t===null&&(t=cs(),H.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ls(){return ss().memoizedState}function Rs(e,t,n,r){var i=os();H.flags|=e,i.memoizedState=Is(1|t,{destroy:void 0},n,r===void 0?null:r)}function zs(e,t,n,r){var i=ss();r=r===void 0?null:r;var a=i.memoizedState.inst;Ho!==null&&r!==null&&Qo(r,Ho.memoizedState.deps)?i.memoizedState=Is(t,a,n,r):(H.flags|=e,i.memoizedState=Is(1|t,a,n,r))}function Bs(e,t){Rs(8390656,8,e,t)}function Vs(e,t){zs(2048,8,e,t)}function Hs(e){H.flags|=4;var t=H.updateQueue;if(t===null)t=cs(),H.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Us(e){var t=ss().memoizedState;return Hs({ref:t,nextImpl:e}),function(){if(ed&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ws(e,t){return zs(4,2,e,t)}function Gs(e,t){return zs(4,4,e,t)}function Ks(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function qs(e,t,n){n=n==null?null:n.concat([e]),zs(4,4,Ks.bind(null,t,e),n)}function Js(){}function Ys(e,t){var n=ss();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Qo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Xs(e,t){var n=ss();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Qo(t,r[1]))return r[0];if(r=e(),Ko){tt(!0);try{e()}finally{tt(!1)}}return n.memoizedState=[r,t],r}function Zs(e,t,n){return n===void 0||Vo&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Fd(),H.lanes|=e,ld|=e,n)}function Qs(e,t,n,r){return R(n,t)?n:To.current===null?!(Vo&106)||Vo&1073741824&&!(q&261930)?(U=!0,e.memoizedState=n):(e=Fd(),H.lanes|=e,ld|=e,t):(e=Zs(e,n,r),R(e,t)||(U=!0),e)}function $s(e,t,n,r,i){var a=Se.p;Se.p=a!==0&&8>a?a:8;var o=k.T,s={};s.types=o===null?null:o.types,k.T=s,dc(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?uc(e,t,Ha(c,r),Pd(e)):uc(e,t,r,Pd(e))}catch(n){uc(e,t,{then:function(){},status:`rejected`,reason:n},Pd())}finally{Se.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function ec(){}function tc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=nc(e).queue;$s(e,a,t,A,n===null?ec:function(){return rc(e),n(r)})}function nc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:A,baseState:A,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:A},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rc(e){var t=nc(e);t.next===null&&(t=e.alternate.memoizedState),uc(e,t.next.queue,{},Pd())}function ic(){return Ta(uh)}function ac(){return ss().memoizedState}function oc(){return ss().memoizedState}function sc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Pd();e=go(n);var r=_o(t,e,n);r!==null&&(Ld(r,t,n),vo(r,t,n)),t={cache:ja()},e.payload=t;return}t=t.return}}function cc(e,t,n){var r=Pd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},fc(e)?pc(t,n):(n=Ei(e,t,n,r),n!==null&&(Ld(n,e,r),mc(n,t,r)))}function lc(e,t,n){uc(e,t,n,Pd())}function uc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(fc(e))pc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,R(s,o))return Ti(e,t,i,0),td===null&&wi(),!1}catch{}if(n=Ei(e,t,i,r),n!==null)return Ld(n,e,r),mc(n,t,r),!0}return!1}function dc(e,t,n,r){if(r={lane:2,revertLane:Rf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},fc(e)){if(t)throw Error(i(479))}else t=Ei(e,n,r,2),t!==null&&Ld(t,e,2)}function fc(e){var t=e.alternate;return e===H||t!==null&&t===H}function pc(e,t){Go=Wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function mc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,yt(e,n)}}var hc={readContext:Ta,use:us,useCallback:Zo,useContext:Zo,useEffect:Zo,useImperativeHandle:Zo,useLayoutEffect:Zo,useInsertionEffect:Zo,useMemo:Zo,useReducer:Zo,useRef:Zo,useState:Zo,useDebugValue:Zo,useDeferredValue:Zo,useTransition:Zo,useSyncExternalStore:Zo,useId:Zo,useHostTransitionStatus:Zo,useFormState:Zo,useActionState:Zo,useOptimistic:Zo,useMemoCache:Zo,useCacheRefresh:Zo,useEffectEvent:Zo},gc={readContext:Ta,use:us,useCallback:function(e,t){return os().memoizedState=[e,t===void 0?null:t],e},useContext:Ta,useEffect:Bs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Rs(4194308,4,Ks.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rs(4194308,4,e,t)},useInsertionEffect:function(e,t){Rs(4,2,e,t)},useMemo:function(e,t){var n=os();t=t===void 0?null:t;var r=e();if(Ko){tt(!0);try{e()}finally{tt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=os();if(n!==void 0){var i=n(t);if(Ko){tt(!0);try{n(t)}finally{tt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=cc.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=os();return e={current:e},t.memoizedState=e},useState:function(e){e=Ss(e);var t=e.queue,n=lc.bind(null,H,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Js,useDeferredValue:function(e,t){return Zs(os(),e,t)},useTransition:function(){var e=Ss(!1);return e=$s.bind(null,H,e.queue,!0,!1),os().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=H,a=os();if(B){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),td===null)throw Error(i(349));q&127||_s(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Bs(ys.bind(null,r,o,e),[e]),r.flags|=2048,Is(9,{destroy:void 0},vs.bind(null,r,o,n,t),null),n},useId:function(){var e=os(),t=td.identifierPrefix;if(B){var n=Zi,r=Xi;n=(r&~(1<<32-nt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=qo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ic,useFormState:js,useActionState:js,useOptimistic:function(e){var t=os();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=dc.bind(null,H,!0,n),n.dispatch=t,[e,t]},useMemoCache:ds,useCacheRefresh:function(){return os().memoizedState=sc.bind(null,H)},useEffectEvent:function(e){var t=os(),n={impl:e};return t.memoizedState=n,function(){if(ed&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},_c={readContext:Ta,use:us,useCallback:Ys,useContext:Ta,useEffect:Vs,useImperativeHandle:qs,useInsertionEffect:Ws,useLayoutEffect:Gs,useMemo:Xs,useReducer:ps,useRef:Ls,useState:function(){return ps(fs)},useDebugValue:Js,useDeferredValue:function(e,t){return Qs(ss(),Ho.memoizedState,e,t)},useTransition:function(){var e=ps(fs)[0],t=ss().memoizedState;return[typeof e==`boolean`?e:ls(e),t]},useSyncExternalStore:gs,useId:ac,useHostTransitionStatus:ic,useFormState:Ms,useActionState:Ms,useOptimistic:function(e,t){return Cs(ss(),Ho,e,t)},useMemoCache:ds,useCacheRefresh:oc,useEffectEvent:Us},vc={readContext:Ta,use:us,useCallback:Ys,useContext:Ta,useEffect:Vs,useImperativeHandle:qs,useInsertionEffect:Ws,useLayoutEffect:Gs,useMemo:Xs,useReducer:hs,useRef:Ls,useState:function(){return hs(fs)},useDebugValue:Js,useDeferredValue:function(e,t){var n=ss();return Ho===null?Zs(n,e,t):Qs(n,Ho.memoizedState,e,t)},useTransition:function(){var e=hs(fs)[0],t=ss().memoizedState;return[typeof e==`boolean`?e:ls(e),t]},useSyncExternalStore:gs,useId:ac,useHostTransitionStatus:ic,useFormState:Fs,useActionState:Fs,useOptimistic:function(e,t){var n=ss();return Ho===null?(n.baseState=e,[e,n.queue.dispatch]):Cs(n,Ho,e,t)},useMemoCache:ds,useCacheRefresh:oc,useEffectEvent:Us};function yc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:E({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Pd(),i=go(r);i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,r),t!==null&&(Ld(t,e,r),vo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Pd(),i=go(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,r),t!==null&&(Ld(t,e,r),vo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pd(),r=go(n);r.tag=2,t!=null&&(r.callback=t),t=_o(e,r,n),t!==null&&(Ld(t,e,n),vo(t,e,n))}};function xc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Ur(n,r)||!Ur(i,a):!0}function Sc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&bc.enqueueReplaceState(t,t.state,null)}function Cc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=E({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function wc(e){bi(e)}function Tc(e){console.error(e)}function Ec(e){bi(e)}function Dc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Oc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function kc(e,t,n){return n=go(n),n.tag=3,n.payload={element:null},n.callback=function(){Dc(e,t)},n}function Ac(e){return e=go(e),e.tag=3,e}function jc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Oc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Oc(t,n,r),typeof i!=`function`&&(xd===null?xd=new Set([this]):xd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Mc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Sa(t,n,a,!0),n=Ao.current,n!==null){switch(n.tag){case 31:case 13:case 19:return jo===null?Yd():n.alternate===null&&cd===0&&(cd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Za?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),vf(e,r,a)),!1;case 22:return n.flags|=65536,r===Za?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),vf(e,r,a)),!1}throw Error(i(435,n.tag))}return vf(e,r,a),Yd(),!1}if(B)return t=Ao.current,t===null?(r!==sa&&(t=Error(i(423),{cause:r}),ma(Hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Hi(r,n),a=kc(e.stateNode,r,a),yo(e,a),cd!==4&&(cd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==sa&&(e=Error(i(422),{cause:r}),ma(Hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Hi(o,n),md===null?md=[o]:md.push(o),cd!==4&&(cd=2),t===null)return!0;r=Hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=kc(n.stateNode,r,e),yo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(xd===null||!xd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ac(a),jc(a,e,n,r),yo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Nc=Error(i(461)),U=!1;function Pc(e,t,n,r){t.child=e===null?fo(t,null,n,r):uo(t,e.child,n,r)}function Fc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return wa(t),r=$o(e,t,n,o,a,i),s=rs(),e!==null&&!U?(is(e,t,i),ll(e,t,i)):(B&&s&&ea(t),t.flags|=1,Pc(e,t,r,i),t.child)}function Ic(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Lc(e,t,a,r,i)):(e=Ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!ul(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ur:n,n(o,r)&&e.ref===t.ref)return ll(e,t,i)}return t.flags|=1,e=Pi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ur(a,r)&&e.ref===t.ref){if(U=!1,t.pendingProps=r=a,ul(e,i))e.flags&131072&&(U=!0);else return t.lanes=e.lanes,ll(e,t,i)}}return Gc(e,t,n,r,i)}function Rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Bc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ka(t,a===null?null:a.cachePool),a===null?Oo():Do(t,a),Po(t);else return r=t.lanes=536870912,Bc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ka(t,null),Oo(),Fo()):(Ka(t,a.cachePool),Do(t,a),Fo(),t.memoizedState=null);return Pc(e,t,i,n),t.child}function zc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bc(e,t,n,r,i){var a=Ga();return a=a===null?null:{parent:V._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ka(t,null),Oo(),Po(t),e!==null&&Sa(e,t,r,!0),t.childLanes=i,null}function Vc(e,t){return t=el({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Hc(e,t,n){return uo(t,e.child,null,n),e=Vc(t,t.pendingProps),e.flags|=2,Io(t),t.memoizedState=null,e}function Uc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(B){if(r.mode===`hidden`)return e=Vc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},zc(null,e);if(No(t),(e=ia)?(e=cm(e,oa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw ca(t);return t.lanes=536870912,null}return Vc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(No(t),a){if(t.flags&256)t.flags&=-257,t=Hc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(U||Sa(e,t,n,!1),a=(n&e.childLanes)!==0,U||a){if(To.current===null){if(r=td,r!==null&&(s=bt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Di(e,s),Ld(r,e,s),Nc;Yd()}t=Hc(e,t,n)}else e=o.treeContext,ia=fm(s.nextSibling),ra=t,B=!0,aa=null,oa=!1,e!==null&&na(t,e),t=Vc(t,r),t.flags|=134221824;return t}return e=Pi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Wc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Gc(e,t,n,r,i){return wa(t),n=$o(e,t,n,r,void 0,i),r=rs(),e!==null&&!U?(is(e,t,i),ll(e,t,i)):(B&&r&&ea(t),t.flags|=1,Pc(e,t,n,i),t.child)}function Kc(e,t,n,r,i,a){return wa(t),t.updateQueue=null,n=ts(t,r,n,i),es(e),r=rs(),e!==null&&!U?(is(e,t,a),ll(e,t,a)):(B&&r&&ea(t),t.flags|=1,Pc(e,t,n,a),t.child)}function qc(e,t,n,r,i){if(wa(t),t.stateNode===null){var a=Ai,o=n.contextType;typeof o==`object`&&o&&(a=Ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=bc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},mo(t),o=n.contextType,a.context=typeof o==`object`&&o?Ta(o):Ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(yc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&bc.enqueueReplaceState(a,a.state,null),So(t,r,a,i),xo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Cc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ai,typeof u==`object`&&u&&(o=Ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Sc(t,a,r,o),po=!1;var f=t.memoizedState;a.state=f,So(t,r,a,i),xo(),l=t.memoizedState,s||f!==l||po?(typeof d==`function`&&(yc(t,n,d,r),l=t.memoizedState),(c=po||xc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ho(e,t),o=t.memoizedProps,u=Cc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ai,typeof l==`object`&&l&&(c=Ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Sc(t,a,r,c),po=!1,f=t.memoizedState,a.state=f,So(t,r,a,i),xo();var p=t.memoizedState;o!==d||f!==p||po||e!==null&&e.dependencies!==null&&Ca(e.dependencies)?(typeof s==`function`&&(yc(t,n,s,r),p=t.memoizedState),(u=po||xc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ca(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Wc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=uo(t,e.child,null,i),t.child=uo(t,null,n,i)):Pc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=ll(e,t,i),e}function Jc(e,t,n,r){return fa(),t.flags|=256,Pc(e,t,n,r),t.child}var Yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(e){return{baseLanes:e,cachePool:qa()}}function Zc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=fd),e}function Qc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Lo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(B){if(i?Mo(t):Fo(),(e=ia)?(e=cm(e,oa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw ca(t);return t.lanes=um(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Fo(),i=t.mode,a=el({mode:`hidden`,children:a},i),r=Li(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Xc(n),r.childLanes=Zc(e,o,n),t.memoizedState=Yc,zc(null,r)):(Mo(t),$c(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return nl(e,t,a,o,r,c,s,n)}return i?(Fo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Pi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Li(i,a,n,null),i.flags|=2):i=Pi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,zc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Xc(n):(a=i.cachePool,a===null?a=qa():(s=V._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Zc(e,o,n),t.memoizedState=Yc,zc(e.child,r)):(Mo(t),n=e.child,e=n.sibling,n=Pi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function $c(e,t){return t=el({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function el(e,t){return e=Mi(22,e,null,t),e.lanes=0,e}function tl(e,t,n){return uo(t,e.child,null,n),e=$c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nl(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Mo(t),t.flags&=-257,tl(e,t,c)):t.memoizedState===null?(Fo(),o=a.fallback,s=t.mode,a=el({mode:`visible`,children:a.children},s),o=Li(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,uo(t,e.child,null,c),a=t.child,a.memoizedState=Xc(c),a.childLanes=Zc(e,r,c),t.memoizedState=Yc,zc(null,a)):(Fo(),t.child=e.child,t.flags|=128,null);if(Mo(t),um(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ma({value:a,source:null,stack:null})),tl(e,t,c)}if(U||Sa(e,t,c,!1),r=(c&e.childLanes)!==0,U||r){if(To.current!==null)return tl(e,t,c);if(r=td,r!==null&&(a=bt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Di(e,a),Ld(r,e,a),Nc;return lm(o)||Yd(),tl(e,t,c)}return lm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ia=fm(o.nextSibling),ra=t,B=!0,aa=null,oa=!1,e!==null&&na(t,e),t=$c(t,a.children),t.flags|=134221824,t)}function rl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ba(e.return,t,n)}function il(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Bo(n)===null&&(t=e),e=e.sibling}return t}function al(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ol(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function sl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Lo.current;if(t.flags&128)return Ro(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Ro(t,o),i===`backwards`&&e!==null?(ol(e),Pc(e,t,r,n),ol(e)):Pc(e,t,r,n),r=B?Ki:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rl(e,n,t);else if(e.tag===19)rl(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=il(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ol(t)),al(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}al(t,!0,n,null,a,r);break;case`together`:al(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=il(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),al(t,!1,i,n,a,r)}return t.child}function cl(e,t,n){var r=t.pendingProps;return va(t,t.type,r.value),Pc(e,t,r.children,n),t.child}function ll(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ld|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Sa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Pi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ul(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ca(e)))}function dl(e,t,n){switch(t.tag){case 3:Ae(t,t.stateNode.containerInfo),va(t,V,e.memoizedState.cache),fa();break;case 27:case 5:Me(t);break;case 4:Ae(t,t.stateNode.containerInfo);break;case 10:va(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,No(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Mo(t),t.flags|=128,null;r=Sa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Qc(e,t,n):(Mo(t),e=ll(e,t,n),e===null?null:e.sibling)}Mo(t);break;case 19:if(t.flags&128)return sl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Sa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return sl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ro(t,Lo.current),r)break;return null;case 22:return t.lanes=0,Rc(e,t,n,t.pendingProps);case 24:va(t,V,e.memoizedState.cache)}return ll(e,t,n)}function fl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)U=!0;else{if(!ul(e,n)&&!(t.flags&128))return U=!1,dl(e,t,n);U=!!(e.flags&131072)}}else U=!1,B&&t.flags&1048576&&$i(t,Ki,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=eo(t.elementType),t.type=e,typeof e==`function`)Ni(e)?(r=Cc(e,r),t.tag=1,t=qc(null,t,e,r,n)):(t.tag=0,t=Gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ce){t.tag=11,t=Fc(null,t,e,r,n);break a}if(a===de){t.tag=14,t=Ic(null,t,e,r,n);break a}if(a===se){t.tag=10,t.type=e,t=cl(null,t,n);break a}}throw t=be(e)||e,Error(i(306,t,``))}}return t;case 0:return Gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Cc(r,t.pendingProps),qc(e,t,r,a,n);case 3:a:{if(Ae(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ho(e,t),So(t,r,null,n);var s=t.memoizedState;if(r=s.cache,va(t,V,r),r!==o.cache&&xa(t,[V],n,!0),xo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Jc(e,t,r,n);break a}if(r!==a){a=Hi(Error(i(424)),t),ma(a),t=Jc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ia=fm(e.firstChild),ra=t,B=!0,aa=null,oa=!0,n=fo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(fa(),r===a){t=ll(e,t,n);break a}Pc(e,t,r,n)}t=t.child}return t;case 26:return Wc(e,t),e===null?(n=Im(t.type,null,t.pendingProps,null))?t.memoizedState=n:B||(t.stateNode=hp(t.type,t.pendingProps,Oe.current,t)):t.memoizedState=Im(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Me(t),e===null&&B&&(r=t.stateNode=vm(t.type,t.pendingProps,Oe.current),ra=t,oa=!0,a=ia,Tp(t.type)?(pm=a,ia=fm(r.firstChild)):ia=a),Pc(e,t,t.pendingProps.children,n),Wc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&B&&((a=r=ia)&&(r=om(r,t.type,t.pendingProps,oa),r===null?a=!1:(t.stateNode=r,ra=t,ia=fm(r.firstChild),oa=!1,a=!0)),a||ca(t)),Me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,gp(a,o)?r=null:s!==null&&gp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=$o(e,t,ns,null,null,n),uh._currentValue=a),Wc(e,t),Pc(e,t,r,n),t.child;case 6:return e===null&&B&&((e=n=ia)&&(n=sm(n,t.pendingProps,oa),n===null?e=!1:(t.stateNode=n,ra=t,ia=null,e=!0)),e||ca(t)),null;case 13:return Qc(e,t,n);case 4:return Ae(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=uo(t,null,r,n):Pc(e,t,r,n),t.child;case 11:return Fc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Wc(e,t),Pc(e,t,r,n),t.child;case 8:return Pc(e,t,t.pendingProps.children,n),t.child;case 12:return Pc(e,t,t.pendingProps.children,n),t.child;case 10:return cl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,wa(t),a=Ta(a),r=r(a),t.flags|=1,Pc(e,t,r,n),t.child;case 14:return Ic(e,t,t.type,t.pendingProps,n);case 15:return Lc(e,t,t.type,t.pendingProps,n);case 19:return sl(e,t,n);case 31:return Uc(e,t,n);case 22:return Rc(e,t,n,t.pendingProps);case 24:return wa(t),r=Ta(V),e===null?(a=Ga(),a===null&&(a=td,o=ja(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},mo(t),va(t,V,a)):((e.lanes&n)!==0&&(ho(e,t),So(t,null,null,n),xo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,va(t,V,r),r!==a.cache&&xa(t,[V],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),va(t,V,r))),Pc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:B&&ea(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Wc(e,t),Pc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function pl(e){e.flags|=4}function ml(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Zm(t,r):Zm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Kd())e.flags|=8192;else throw to=Za,Ya}}else e.flags&=-16777217}function hl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qm(t)){if(Kd())e.flags|=8192;else throw to=Za,Ya}}function gl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:mt(),e.lanes|=t,pd|=t)}function _l(e,t){if(!B)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function vl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function yl(e,t,n){var r=t.pendingProps;switch(ta(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vl(t),null;case 1:return vl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ya(V),je(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(da(t)?pl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pa())),vl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(pl(t),o===null?(vl(t),ml(t,a,null,r,n)):(vl(t),hl(t,o))):o?o===e.memoizedState?(vl(t),t.flags&=-16777217):(pl(t),vl(t),hl(t,o)):(e=e.memoizedProps,e!==r&&pl(t),vl(t),ml(t,a,e,r,n)),null;case 27:if(Ne(t),n=Oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&pl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return vl(t),t.subtreeFlags&=-33554433,null}e=Ee.current,da(t)?la(t,e):(e=vm(a,r,n),t.stateNode=e,pl(t))}return vl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ne(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&pl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return vl(t),t.subtreeFlags&=-33554433,null}if(o=Ee.current,da(t))la(t,o);else{var s=pp(Oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Et]=t,o[Dt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(op(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&pl(t)}}return vl(t),t.subtreeFlags&=-33554433,ml(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&pl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Oe.current,da(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ra,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ip(e.nodeValue,n)),e||ca(t,!0)}else e=pp(e).createTextNode(r),e[Et]=t,t.stateNode=e}return vl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=da(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Et]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vl(t),e=!1}else n=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Io(t),t):(Io(t),null);if(t.flags&128)throw Error(i(558))}return vl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=da(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Et]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vl(t),a=!1}else a=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Io(t),t):(Io(t),null)}return Io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),gl(t,t.updateQueue),vl(t),null);case 4:return je(),e===null&&Jf(t.stateNode.containerInfo),t.flags|=67108864,vl(t),null;case 10:return ya(t.type),vl(t),null;case 19:if(zo(t),r=t.memoizedState,r===null)return vl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)_l(r,!1);else{if(cd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Bo(e),o!==null){for(t.flags|=128,_l(r,!1),e=o.updateQueue,t.updateQueue=e,gl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Fi(n,e),n=n.sibling;return Ro(t,Lo.current&1|2),B&&Qi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>yd&&(t.flags|=128,a=!0,_l(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Bo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,gl(t,e),_l(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!B)return vl(t),null}else 2*Ke()-r.renderingStartTime>yd&&n!==536870912&&(t.flags|=128,a=!0,_l(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Lo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||B?Ro(t,o):(n=o,M(Ao,t),M(Lo,n),jo===null&&(jo=t)),B&&Qi(t,r.treeForkCount),e}return vl(t),null;case 22:case 23:return Io(t),ko(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(vl(t),t.subtreeFlags&6&&(t.flags|=8192)):vl(t),n=t.updateQueue,n!==null&&gl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&j(Wa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ya(V),vl(t),null;case 25:return null;case 30:return t.flags|=33554432,vl(t),null}throw Error(i(156,t.tag))}function bl(e,t){switch(ta(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ya(V),je(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Io(t),t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return je(),null;case 10:return ya(t.type),null;case 22:case 23:return Io(t),ko(),e!==null&&j(Wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ya(V),null;case 25:return null;default:return null}}function xl(e,t){switch(ta(t),t.tag){case 3:ya(V),je();break;case 26:case 27:case 5:Ne(t);break;case 4:je();break;case 31:t.memoizedState!==null&&Io(t);break;case 13:Io(t);break;case 19:zo(t);break;case 10:ya(t.type);break;case 22:case 23:Io(t),ko(),e!==null&&j(Wa);break;case 24:ya(V)}}function Sl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){_f(t,t.return,e)}}function Cl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){_f(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){_f(t,t.return,e)}}function wl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{wo(t,n)}catch(t){_f(e,e.return,t)}}}function Tl(e,t,n){n.props=Cc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){_f(e,t,n)}}function El(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=_i(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Lp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Rp(e);f(e.child,!1,tm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){_f(e,t,n)}}function Dl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){_f(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){_f(e,t,n)}else n.current=null}}function Ol(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)rm(e.stateNode,t[n])}function kl(e){for(var t=e.return;t!==null&&(Ml(t)&&rm(e.stateNode,t.stateNode),!jl(t));)t=t.return}function Al(e){for(var t=e.return;t!==null&&(Ml(t)&&im(e.stateNode,t.stateNode),!jl(t));)t=t.return}function jl(e){return e.tag===5||e.tag===3||e.tag===27}function Ml(e){return e&&e.tag===7&&e.stateNode!==null}function Nl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){_f(e,e.return,t)}}function Pl(e,t,n){try{var r=e.stateNode;cp(r,e.type,n,t),r[Dt]=t}catch(t){_f(e,e.return,t)}}function Fl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Tp(e.type)||e.tag===4}function Il(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Fl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Tp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ll(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xn)),Ol(e,r),Jt=!0;else if(i!==4&&(i===27&&(Ol(e,r),r=null,Tp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ll(e,t,n,r),e=e.sibling;e!==null;)Ll(e,t,n,r),e=e.sibling}function Rl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Ol(e,r),Jt=!0;else if(i!==4&&(i===27&&(Ol(e,r),r=null,Tp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Rl(e,t,n,r),e=e.sibling;e!==null;)Rl(e,t,n,r),e=e.sibling}function zl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);op(t,r,n),t[Et]=e,t[Dt]=n}catch(t){_f(e,e.return,t)}}var Bl=!1,Vl=null;function Hl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Bl=!0)}var Ul=null;function Wl(){var e=Ul;return Ul=null,e}var Gl=0;function Kl(e,t,n,r,i){return Gl=0,ql(e.child,t,n,r,i)}function ql(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=jp(o);r.push(s),s.view&&(a=!0)}else a||jp(o).view&&(a=!0);Bl=!0,Op(o,Gl===0?t:t+`_`+Gl,n),Gl++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||ql(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Jl(e,t){for(;e!==null;)e.tag===5?kp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Jl(e.child,t),e=e.sibling}function Yl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Yl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=yi(t.default,t.share),t!==`none`&&(Kl(e,n,t,null,!1)||Jl(e.child,!1))}e=e.sibling}}function Xl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=_i(r,n),a=yi(r.default,n.paired?r.share:r.enter);a===`none`?Yl(e):Kl(e,i,a,null,!1)?(Yl(e),n.paired||t||Id(e,r.onEnter)):Jl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Xl(e,t),e=e.sibling;else Yl(e)}function Zl(e){if(Vl!==null&&Vl.size!==0){var t=Vl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=yi(n.default,n.share);if(a!==`none`&&(Kl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Id(e,n.onShare)):Jl(e.child,!1)),t.delete(r),t.size===0)break}}}Zl(e)}e=e.sibling}}}function Ql(e){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode),r=Vl===null?void 0:Vl.get(n),i=yi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Kl(e,n,i,null,!1)?r===void 0?Id(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Vl.delete(n),Id(e,t.onShare)):Jl(e.child,!1)),Vl!==null&&Zl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e),e=e.sibling;else Vl!==null&&Zl(e)}function $l(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode);t=yi(t.default,t.update),e.flags&=-5,t!==`none`&&Kl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&$l(e);e=e.sibling}}function eu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Jl(e.child,!1))}eu(e)}e=e.sibling}}function W(e){if(e.tag===30)e.stateNode.paired=null,Jl(e.child,!1),eu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)W(e),e=e.sibling;else eu(e)}function tu(e){for(e=e.child;e!==null;)e.tag===30?Jl(e.child,!1):e.subtreeFlags&33554432&&tu(e),e=e.sibling}function nu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Gl<a.length){var l=a[Gl],u=jp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Op(c,Gl===0?n:n+`_`+Gl,i),s&&e.flags&4||(Ul===null&&(Ul=[]),Ul.push(c,Gl===0?r:r+`_`+Gl,t.memoizedProps)),Gl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:nu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ru(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=_i(n,r),a=yi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Mp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Gl=0,i=nu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Id(e,n.onUpdate))}else e.subtreeFlags&33554432&&ru(e,t);e=e.sibling}}var iu=!1,au=!1,ou=!1,su=!1,cu=typeof WeakSet==`function`?WeakSet:Set,lu=null,uu=!1,du=!1,fu=!1,pu=!1;function mu(e,t,n){if(e=e.containerInfo,dp=yh,e=Jr(e),Yr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(fp={focusedElem:e,selectionRange:r},yh=!1,n=(n&335544064)===n,lu=t,t=n?9270:1024;lu!==null;){if(e=lu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Ql(r[a]);if(e.alternate===null&&e.flags&2)n&&Hl(e),hu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Ql(r),hu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Hl(e),hu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,lu=r):(n&&$l(e),hu(n))}}Vl=null}function hu(e){for(;lu!==null;){var t=lu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Cc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){_f(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)am(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:am(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=_i(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=yi(a.default,a.update),a!==`none`&&Kl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,lu=r;break}lu=t.return}}function gu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Iu(e,n),r&4&&Sl(5,n);break;case 1:if(Iu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){_f(n,n.return,e)}else{var i=Cc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){_f(n,n.return,e)}}}r&64&&wl(n),r&512&&El(n,n.return);break;case 3:if(Iu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{wo(e,t)}catch(e){_f(n,n.return,e)}}break;case 27:t===null&&r&4&&zl(n);case 26:case 5:Iu(e,n),t===null&&r&4&&Nl(n),r&512&&El(n,n.return);break;case 12:Iu(e,n);break;case 31:Iu(e,n),r&4&&Tu(e,n);break;case 13:Iu(e,n),r&4&&Eu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=xf.bind(null,n),dm(e,n))));break;case 22:if(r=n.memoizedState!==null||iu,!r){var a=t!==null&&t.memoizedState!==null||au;t=iu,i=au,iu=r,(au=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),G(e,n,r)):Iu(e,n),iu=t,au=i}break;case 30:Iu(e,n),r&512&&El(n,n.return);break;case 7:r&512&&El(n,n.return);default:Iu(e,n)}}function _u(e,t){for(e=e.child;e!==null;)vu(e,t),e=e.sibling}function vu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){_f(e,e.return,t)}yu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Jt=!0}catch(t){_f(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Dp(s,!0):Dp(e.stateNode,!1)}catch(t){_f(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&_u(e,t);break;default:_u(e,t)}}function yu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:vu(n,r);break a;case 22:n.memoizedState===null&&yu(n,r);break a;default:yu(n,r)}}e=e.sibling}}function bu(e){var t=e.alternate;t!==null&&(e.alternate=null,bu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var xu=null,Su=!1;function Cu(e,t,n){for(n=n.child;n!==null;)wu(e,t,n),n=n.sibling}function wu(e,t,n){if(P&&typeof P.onCommitFiberUnmount==`function`)try{P.onCommitFiberUnmount(et,n)}catch{}switch(n.tag){case 26:au||Dl(n,t),Cu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!au&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:au||Dl(n,t),Al(n);var r=xu,i=Su;Tp(n.type)&&(xu=n.stateNode,Su=!1),Cu(e,t,n),ym(n.stateNode,n.type,n.memoizedProps),xu=r,Su=i;break;case 5:au||Dl(n,t),Al(n);case 6:if(n.tag===6&&Al(n),r=xu,i=Su,xu=null,Cu(e,t,n),xu=r,Su=i,xu!==null){if(Su)try{(xu.nodeType===9?xu.body:xu.nodeName===`HTML`?xu.ownerDocument.body:xu).removeChild(n.stateNode),Jt=!0}catch(e){_f(n,t,e)}else try{xu.removeChild(n.stateNode),Jt=!0}catch(e){_f(n,t,e)}}break;case 18:xu!==null&&(Su?(e=xu,Ep(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Gh(e)):Ep(xu,n.stateNode));break;case 4:r=xu,i=Su,xu=n.stateNode.containerInfo,Su=!0,Cu(e,t,n),xu=r,Su=i;break;case 0:case 11:case 14:case 15:Cl(2,n,t),au||Cl(4,n,t),Cu(e,t,n);break;case 1:au||(Dl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Tl(n,t,r)),Cu(e,t,n);break;case 21:Cu(e,t,n);break;case 22:au=(r=au)||n.memoizedState!==null,Cu(e,t,n),au=r;break;case 30:Dl(n,t),Cu(e,t,n);break;case 7:au||Dl(n,t),Cu(e,t,n);break;default:Cu(e,t,n)}}function Tu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gh(e)}catch(e){_f(t,t.return,e)}}}function Eu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gh(e)}catch(e){_f(t,t.return,e)}}function Du(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cu),t;default:throw Error(i(435,e.tag))}}function Ou(e,t){var n=Du(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Sf.bind(null,e,t);t.then(r,r)}})}function ku(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Tp(l.type)){xu=l.stateNode,Su=!1;break a}break;case 5:xu=l.stateNode,Su=!1;break a;case 3:case 4:xu=l.stateNode.containerInfo,Su=!0;break a}l=l.return}if(xu===null)throw Error(i(160));wu(s,c,o),xu=null,Su=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ju(t,e,n),t=t.sibling}var Au=null;function ju(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}ku(t,e,n),Mu(e),a&4&&(Cl(3,e,e.return),Sl(3,e),Cl(5,e,e.return));break;case 1:ku(t,e,n),Mu(e),a&512&&(au||r===null||Dl(r,r.return)),a&64&&iu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Au,ku(t,e,n),Mu(e),a&512&&(au||r===null||Dl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(iu)e.stateNode=hp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Nt]||r[Et]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),op(r,t,n),r[Et]=e,zt(r),t=r;break a;case`link`:if(o=Jm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Jm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Et]=e,zt(r),t=r}e.stateNode=t}}else iu||Ym(o,e.type,e.stateNode)}else e.stateNode=Um(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Pl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||au||t.parentNode.removeChild(t)):a.count--,n===null?iu||Ym(o,e.type,e.stateNode):Um(o,n,e.memoizedProps))}break;case 27:ku(t,e,n),Mu(e),a&512&&(au||r===null||Dl(r,r.return)),r!==null&&a&4&&Pl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=ou,ou=!1,ku(t,e,n),ou=o,Mu(e),a&512&&(au||r===null||Dl(r,r.return)),e.flags&32){t=e.stateNode;try{pn(t,``),Jt=!0}catch(t){_f(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Pl(e,t,r===null?t:r.memoizedProps)),a&1024&&(su=!0);break;case 6:if(ku(t,e,n),Mu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Jt=!0}catch(t){_f(e,e.return,t)}}break;case 3:if(Jt=!1,qm=null,o=Au,Au=Cm(t.containerInfo),ku(t,e,n),Au=o,Mu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Gh(t.containerInfo)}catch(t){_f(e,e.return,t)}su&&(su=!1,Nu(e)),Jt=!1;break;case 4:a=ou,ou=iu,r=Yt(),o=Au,Au=Cm(e.stateNode.containerInfo),ku(t,e,n),Mu(e),Au=o,Jt&&du&&(fu=!0),Jt=r,ou=a;break;case 12:ku(t,e,n),Mu(e);break;case 31:ku(t,e,n),Mu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 13:ku(t,e,n),Mu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(_d=Ke()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=iu,l=au,u=ou;iu=c||o,ou=u||o,au=l||s,ku(t,e,n),au=l,ou=u,iu=c,Mu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||iu||au||(t=s||au,n=iu,r=au,iu=o||iu,au=t,Lu(e,2),iu=n,au=r),!o&&ou||_u(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Ou(e,n))));break;case 19:ku(t,e,n),Mu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 30:a&512&&(au||r===null||Dl(r,r.return)),a=Yt(),o=du,s=(n&335544064)===n,c=e.memoizedProps,du=s&&yi(c.default,c.update)!==`none`,ku(t,e,n),Mu(e),s&&r!==null&&Jt&&(e.flags|=4),du=o,Jt=a;break;case 21:break;case 7:a&512&&(au||r===null||Dl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:ku(t,e,n),Mu(e)}}function Mu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Fl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Ml(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(jl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Rl(e,Il(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(pn(l,``),n.flags&=-33),Rl(e,Il(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Ll(e,Il(e),u,s);break;default:throw Error(i(161))}}catch(t){_f(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,yh=!0,t.reset(),yh=!1),e=e.sibling}}function Pu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Fu(t,e),t=t.sibling;else ru(t,!1)}function Fu(e,t){var n=e.alternate;if(n===null)Xl(e,!1);else switch(e.tag){case 3:if(pu=uu=!1,Wl(),Pu(t,e),!uu&&!fu){if(e=Ul,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];kp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),pu=!0}Ul=null;break;case 5:Pu(t,e);break;case 4:r=uu,uu=!1,Pu(t,e),uu&&(fu=!0),uu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Pu(t,e):Xl(e,!1));break;case 30:r=uu,i=Wl(),uu=!1,Pu(t,e),uu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=_i(a,o),o=_i(n.memoizedProps,o);var s=yi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Gl=0,t=nu(e,n,t,o,s,a,!0),Gl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Id(e,e.memoizedProps.onUpdate),Ul=i):i!==null&&(i.push.apply(i,Ul),Ul=i),uu=e.flags&32?!0:r;break;default:Pu(t,e)}}function Iu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gu(e,t.alternate,t),t=t.sibling}function Lu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Cl(4,n,n.return),Lu(n,r);break;case 1:Dl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Tl(n,n.return,i),Lu(n,r);break;case 27:r&2&&ym(n.stateNode,n.type,n.memoizedProps);case 5:Dl(n,n.return),n.tag!==5&&n.tag!==27||Al(n),Lu(n,r);break;case 6:Al(n);break;case 26:Dl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||au||i.parentNode.removeChild(i),Lu(n,r);break;case 22:n.memoizedState===null&&Lu(n,r);break;case 30:Dl(n,n.return),Lu(n,r);break;case 7:Dl(n,n.return);default:Lu(n,r)}e=e.sibling}}function G(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:G(i,a,n),Sl(4,a);break;case 1:if(G(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){_f(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Co(l[i],c)}catch(e){_f(r,r.return,e)}}s&&o&64&&wl(a),El(a,a.return);break;case 27:n&2&&zl(a);case 5:a.tag!==5&&a.tag!==27||kl(a),G(i,a,n),s&&r===null&&o&4&&Nl(a),El(a,a.return);break;case 6:kl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||iu||Ym(Cm(c.ownerDocument),a.type,c),G(i,a,n),s&&r===null&&o&4&&Nl(a),El(a,a.return);break;case 12:G(i,a,n);break;case 31:G(i,a,n),s&&o&4&&Tu(i,a);break;case 13:G(i,a,n),s&&o&4&&Eu(i,a);break;case 22:a.memoizedState===null&&G(i,a,n),El(a,a.return);break;case 30:G(i,a,n),El(a,a.return);break;case 7:El(a,a.return);default:G(i,a,n)}t=t.sibling}}function Ru(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ma(n))}function zu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ma(e))}function Bu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Vu(e,t,n,r),t=t.sibling;else i&&tu(t)}function Vu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&W(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Bu(e,t,n,r),a&2048&&Sl(9,t);break;case 1:Bu(e,t,n,r);break;case 3:Bu(e,t,n,r),i&&pu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ma(a)));break;case 12:if(a&2048){Bu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){_f(t,t.return,e)}}else Bu(e,t,n,r);break;case 31:Bu(e,t,n,r);break;case 13:Bu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&W(t),o._visibility&2?Bu(e,t,n,r):(o._visibility|=2,Hu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&W(s),o._visibility&2?Bu(e,t,n,r):Uu(e,t)),a&2048&&Ru(s,t);break;case 24:Bu(e,t,n,r),a&2048&&zu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Jl(a.child,!0),Jl(t.child,!0))),Bu(e,t,n,r);break;default:Bu(e,t,n,r)}}function Hu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Hu(a,o,s,c,i),Sl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Hu(a,o,s,c,i)):u._visibility&2?Hu(a,o,s,c,i):Uu(a,o),i&&l&2048&&Ru(o.alternate,o);break;case 24:Hu(a,o,s,c,i),i&&l&2048&&zu(o.alternate,o);break;default:Hu(a,o,s,c,i)}t=t.sibling}}function Uu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Uu(n,r),i&2048&&Ru(r.alternate,r);break;case 24:Uu(n,r),i&2048&&zu(r.alternate,r);break;default:Uu(n,r)}t=t.sibling}}var Wu=8192;function Gu(e,t,n){if(e.subtreeFlags&Wu)for(e=e.child;e!==null;)Ku(e,t,n),e=e.sibling}function Ku(e,t,n){switch(e.tag){case 26:Gu(e,t,n),e.flags&Wu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&eh(n,e)):th(n,Au,e.memoizedState,e.memoizedProps));break;case 5:Gu(e,t,n),e.flags&Wu&&(e=e.stateNode,(t&335544128)===t&&eh(n,e));break;case 3:case 4:var r=Au;Au=Cm(e.stateNode.containerInfo),Gu(e,t,n),Au=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Wu,Wu=16777216,Gu(e,t,n),Wu=r):Gu(e,t,n));break;case 30:if((e.flags&Wu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Vl===null&&(Vl=new Map),Vl.set(r,i)}Gu(e,t,n);break;default:Gu(e,t,n)}}function qu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ju(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,Zu(r,e)}qu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Yu(e),e=e.sibling}function Yu(e){switch(e.tag){case 0:case 11:case 15:Ju(e),e.flags&2048&&Cl(9,e,e.return);break;case 3:Ju(e);break;case 12:Ju(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Xu(e)):Ju(e);break;default:Ju(e)}}function Xu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,Zu(r,e)}qu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cl(8,t,t.return),Xu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Xu(t));break;default:Xu(t)}e=e.sibling}}function Zu(e,t){for(;lu!==null;){var n=lu;switch(n.tag){case 0:case 11:case 15:Cl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ma(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,lu=r;else a:for(n=e;lu!==null;){r=lu;var i=r.sibling,a=r.return;if(bu(r),r===n){lu=null;break a}if(i!==null){i.return=a,lu=i;break a}lu=a}}}var Qu={getCacheForType:function(e){var t=Ta(V),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ta(V).controller.signal}},$u=typeof WeakMap==`function`?WeakMap:Map,ed=0,td=null,K=null,q=0,nd=0,rd=null,id=!1,ad=!1,od=!1,sd=0,cd=0,ld=0,ud=0,dd=0,fd=0,pd=0,md=null,hd=null,gd=!1,_d=0,vd=0,yd=1/0,bd=null,xd=null,Sd=0,Cd=null,wd=null,Td=0,Ed=0,Dd=null,Od=null,kd=null,Ad=null,jd=null,Md=0,Nd=null;function Pd(){return ed&2&&q!==0?q&-q:k.T===null?Ct():Rf()}function Fd(){if(fd===0){if(!(q&536870912)||B){var e=st;st<<=1,!(st&3932160)&&(st=262144),fd=e}else fd=536870912}return e=Ao.current,e!==null&&(e.flags|=32),fd}function Id(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Lp(_i(e.memoizedProps,n))),Ad===null&&(Ad=[]),Ad.push(t.bind(null,r))}}function Ld(e,t,n){(e===td&&(nd===2||nd===9)||e.cancelPendingCommit!==null)&&(Wd(e,0),Vd(e,q,fd,!1)),gt(e,n),ed&2&&e===td||(e===td&&(!(ed&2)&&(ud|=n),cd===4&&Vd(e,q,fd,!1)),Af(e))}function Rd(e,t,n){if(ed&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||dt(e,t),a=r?Qd(e,t):Xd(e,t,!0),o=r;do{if(a===0){ad&&!r&&Vd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Bd(n))a=Xd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=md;var l=c.current.memoizedState.isDehydrated;if(l&&(Wd(c,s).flags|=256),s=Xd(c,s,!1),s!==2&&s!==6){if(od&&!l){c.errorRecoveryDisabledLanes|=o,ud|=o,a=4;break a}o=hd,hd=a,o!==null&&(hd===null?hd=o:hd.push.apply(hd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Wd(e,0),Vd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Vd(r,t,fd,!id);break a;case 2:hd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=_d+300-Ke(),10<a)){if(Vd(r,t,fd,!id),ut(r,0,!0)!==0)break a;Td=t,r.timeoutHandle=yp(zd.bind(null,r,n,hd,bd,gd,t,fd,ud,pd,id,o,`Throttled`,-0,0),a);break a}zd(r,n,hd,bd,gd,t,fd,ud,pd,id,o,null,-0,0)}break}}while(1);Af(e)}function zd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xn},Vl=null,Ku(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ah.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?_d-Ke():(a&4194048)===a?vd-Ke():0,m=rh(d,m),m!==null)?(Td=a,e.cancelPendingCommit=m(of.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Vd(e,a,o,!l)):of(e,t,a,n,r,i,o,s,c,l,u,d)}function Bd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!R(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Vd(e,t,n,r){t=ft(e,t),t&=~dd,t&=~ud,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-nt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&vt(e,n,t)}function Hd(){return ed&6?!0:(jf(0,!1),!1)}function Ud(){if(K!==null){if(nd===0)var e=K.return;else e=K,_a=ga=null,as(e),io=null,ao=0,e=K;for(;e!==null;)xl(e.alternate,e),e=e.return;K=null}}function Wd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,bp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Td=0,Ud(),td=e,K=n=Pi(e.current,null),q=t,nd=0,rd=null,id=!1,ad=dt(e,t),od=!1,pd=fd=dd=ud=ld=cd=0,hd=md=null,gd=!1,sd=ft(e,t),wi(),n}function Gd(e,t){H=null,k.H=hc,t===Ja||t===Xa?(t=no(),nd=3):t===Ya?(t=no(),nd=4):nd=t===Nc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,rd=t,K===null&&(cd=1,Dc(e,Hi(t,e.current)))}function Kd(){var e=Ao.current;return e===null?!0:(q&4194048)===q?jo===null:(q&62914560)===q||q&536870912?e===jo:!1}function qd(){var e=k.H;return k.H=hc,e===null?hc:e}function Jd(){var e=k.A;return k.A=Qu,e}function Yd(){cd=4,id||(q&4194048)!==q&&Ao.current!==null||(ad=!0),!(ld&134217727)&&!(ud&134217727)||td===null||Vd(td,q,fd,!1)}function Xd(e,t,n){var r=ed;ed|=2;var i=qd(),a=Jd();(td!==e||q!==t)&&(bd=null,Wd(e,t)),t=!1;var o=cd;a:do try{if(nd!==0&&K!==null){var s=K,c=rd;switch(nd){case 8:Ud(),o=6;break a;case 3:case 2:case 9:case 6:Ao.current===null&&(t=!0);var l=nd;if(nd=0,rd=null,nf(e,s,c,l),n&&ad){o=0;break a}break;default:l=nd,nd=0,rd=null,nf(e,s,c,l)}}Zd(),o=cd;break}catch(t){Gd(e,t)}while(1);return t&&e.shellSuspendCounter++,_a=ga=null,ed=r,k.H=i,k.A=a,K===null&&(td=null,q=0,wi()),o}function Zd(){for(;K!==null;)ef(K)}function Qd(e,t){var n=ed;ed|=2;var r=qd(),a=Jd();td!==e||q!==t?(bd=null,yd=Ke()+500,Wd(e,t)):ad=dt(e,t);a:do try{if(nd!==0&&K!==null){t=K;var o=rd;b:switch(nd){case 1:nd=0,rd=null,nf(e,t,o,1);break;case 2:case 9:if(Qa(o)){nd=0,rd=null,tf(t);break}t=function(){nd!==2&&nd!==9||td!==e||(nd=7),Af(e)},o.then(t,t);break a;case 3:nd=7;break a;case 4:nd=5;break a;case 7:Qa(o)?(nd=0,rd=null,tf(t)):(nd=0,rd=null,nf(e,t,o,7));break;case 5:var s=null;switch(K.tag){case 26:s=K.memoizedState;case 5:case 27:var c=K;if(s?Qm(s):c.stateNode.complete){nd=0,rd=null;var l=c.sibling;if(l!==null)K=l;else{var u=c.return;u===null?K=null:(K=u,rf(u))}break b}}nd=0,rd=null,nf(e,t,o,5);break;case 6:nd=0,rd=null,nf(e,t,o,6);break;case 8:Ud(),cd=6;break a;default:throw Error(i(462))}}$d();break}catch(t){Gd(e,t)}while(1);return _a=ga=null,k.H=r,k.A=a,ed=n,K===null?(td=null,q=0,wi(),cd):0}function $d(){for(;K!==null&&!We();)ef(K)}function ef(e){var t=fl(e.alternate,e,sd);e.memoizedProps=e.pendingProps,t===null?rf(e):K=t}function tf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Kc(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=Kc(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:as(t);var r=t;r===ra&&(B?(ua(r),r.tag===5&&r.stateNode!=null&&(ia=r.stateNode)):(ua(r),B=!0));default:xl(n,t),t=K=Fi(t,sd),t=fl(n,t,sd)}e.memoizedProps=e.pendingProps,t===null?rf(e):K=t}function nf(e,t,n,r){_a=ga=null,as(t),io=null,ao=0;var i=t.return;try{if(Mc(e,i,t,n,q)){cd=1,Dc(e,Hi(n,e.current)),K=null;return}}catch(t){if(i!==null)throw K=i,t;cd=1,Dc(e,Hi(n,e.current)),K=null;return}t.flags&32768?(B||r===1?e=!0:ad||q&536870912?e=!1:(id=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ao.current,r!==null&&r.tag===13&&(r.flags|=16384))),af(t,e)):rf(t)}function rf(e){var t=e;do{if(t.flags&32768){af(t,id);return}e=t.return;var n=yl(t.alternate,t,sd);if(n!==null){K=n;return}if(t=t.sibling,t!==null){K=t;return}K=t=e}while(t!==null);cd===0&&(cd=5)}function af(e,t){do{var n=bl(e.alternate,e);if(n!==null){n.flags&=32767,K=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){K=e;return}K=e=n}while(e!==null);cd=6,K=null}function of(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do mf();while(Sd!==0);if(ed&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===td&&(K=td=null,q=0),wd=t,Cd=e,Td=n,Dd=a,Od=r,sf(e,t,n,s,c,l,f)}}function sf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Ed=s,s|=Ci,_t(e,n,s,r,i,a),Ad=null,(n&335544064)===n?(jd=Fa(e),r=10262):(jd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Cf(Xe,function(){return hf(),null})):(e.callbackNode=null,e.callbackPriority=0),Bl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=k.T,k.T=null,i=Se.p,Se.p=2,a=ed,ed|=4;try{mu(e,t,n)}finally{ed=a,Se.p=i,k.T=r}}Sd=1,Bl?kd=Fp(o,e.containerInfo,jd,uf,df,lf,ff,hf,cf,null,null):(uf(),df(),ff())}function cf(e){if(Sd!==0){var t=Cd.onRecoverableError;t(e,{componentStack:null})}}function lf(){Sd===3&&(Sd=0,Fu(wd,Cd),Sd=4)}function uf(){if(Sd===1){Sd=0;var e=Cd,t=wd,n=Td,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=k.T,k.T=null;var i=Se.p;Se.p=2;var a=ed;ed|=4;try{du=fu=!1,ju(t,e,n),n=fp;var o=Jr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&qr(s.ownerDocument.documentElement,s)){if(c!==null&&Yr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Kr(s,h),v=Kr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}yh=!!dp,fp=dp=null}finally{ed=a,Se.p=i,k.T=r}}e.current=t,Sd=2}}function df(){if(Sd===2){Sd=0;var e=Cd,t=wd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=Se.p;Se.p=2;var i=ed;ed|=4;try{gu(e,t.alternate,t)}finally{ed=i,Se.p=r,k.T=n}}Sd=3}}function ff(){if(Sd===4||Sd===3){Sd=0;var e=kd;kd=null,Ge();var t=Cd,n=wd,r=Td,i=Od,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Sd=5:(Sd=0,wd=Cd=null,pf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(xd=null),St(r),n=n.stateNode,P&&typeof P.onCommitFiberRoot==`function`)try{P.onCommitFiberRoot(et,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=k.T,a=Se.p,Se.p=2,k.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{k.T=n,Se.p=a}}if(i=Ad,o=jd,jd=null,i!==null&&(Ad=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Td&3&&mf(),Af(t),a=t.pendingLanes,r&261930&&a&42?t===Nd?Md++:(Md=0,Nd=t):(Md=0,Nd=null),jf(0,!1)}}function pf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ma(t)))}function mf(){return kd!==null&&(kd.skipTransition(),kd=null),uf(),df(),ff(),hf()}function hf(){if(Sd!==5)return!1;var e=Cd,t=Ed;Ed=0;var n=St(Td),r=k.T,a=Se.p;try{Se.p=32>n?32:n,k.T=null,n=Dd,Dd=null;var o=Cd,s=Td;if(Sd=0,wd=Cd=null,Td=0,ed&6)throw Error(i(331));var c=ed;if(ed|=4,Yu(o.current),Vu(o,o.current,s,n),ed=c,jf(0,!1),P&&typeof P.onPostCommitFiberRoot==`function`)try{P.onPostCommitFiberRoot(et,o)}catch{}return!0}finally{Se.p=a,k.T=r,pf(e,t)}}function gf(e,t,n){t=Hi(n,t),t=kc(e.stateNode,t,2),e=_o(e,t,2),e!==null&&(gt(e,2),Af(e))}function _f(e,t,n){if(e.tag===3)gf(e,e,n);else for(;t!==null;){if(t.tag===3){gf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(xd===null||!xd.has(r))){e=Hi(n,e),n=Ac(2),r=_o(t,n,2),r!==null&&(jc(n,r,t,e),gt(r,2),Af(r));break}}t=t.return}}function vf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $u;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(od=!0,i.add(n),e=yf.bind(null,e,t,n),t.then(e,e))}function yf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,td===e&&(q&n)===n&&(cd===4||cd===3&&(q&62914560)===q&&300>Ke()-_d?ed&2?dd|=n:Wd(e,0):dd|=n,pd===q&&(pd=0)),Af(e)}function bf(e,t){t===0&&(t=mt()),e=Di(e,t),e!==null&&(gt(e,t),Af(e))}function xf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bf(e,n)}function Sf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),bf(e,n)}function Cf(e,t){return He(e,t)}var wf=null,Tf=null,Ef=!1,Df=!1,Of=!1,kf=0;function Af(e){e!==Tf&&e.next===null&&(Tf===null?wf=Tf=e:Tf=Tf.next=e),Df=!0,Ef||(Ef=!0,Lf())}function jf(e,t){if(!Of&&Df){Of=!0;do for(var n=!1,r=wf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-nt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,If(r,a))}else a=q,a=ut(r,r===td?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||dt(r,a)||(n=!0,If(r,a))}r=r.next}while(n);Of=!1}}function Mf(){Nf()}function Nf(){Df=Ef=!1;var e=0;kf!==0&&vp()&&(e=kf);for(var t=Ke(),n=null,r=wf;r!==null;){var i=r.next,a=Pf(r,t);a===0?(r.next=null,n===null?wf=i:n.next=i,i===null&&(Tf=n)):(n=r,(e!==0||a&3)&&(Df=!0)),r=i}Sd!==0&&Sd!==5||jf(e,!1),kf!==0&&(kf=0)}function Pf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-nt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=pt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=td,n=q,n=ut(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(nd===2||nd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ue(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||dt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ue(r),St(n)){case 2:case 8:n=Ye;break;case 32:n=Xe;break;case 268435456:n=N;break;default:n=Xe}return r=Ff.bind(null,e),n=He(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ue(r),e.callbackPriority=2,e.callbackNode=null,2}function Ff(e,t){if(Sd!==0&&Sd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(mf()&&e.callbackNode!==n)return null;var r=q;return r=ut(e,e===td?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Rd(e,r,t),Pf(e,Ke()),e.callbackNode!=null&&e.callbackNode===n?Ff.bind(null,e):null)}function If(e,t){if(mf())return null;Rd(e,t,!0)}function Lf(){Cp(function(){ed&6?He(Je,Mf):Nf()})}function Rf(){if(kf===0){var e=Ra;e===0&&(e=ot,ot<<=1,!(ot&261888)&&(ot=256)),kf=e}return kf}function zf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:bn(e)}function Bf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=zf((i[Dt]||null).action),o=r.submitter;o&&(t=(t=o[Dt]||null)?zf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(kf!==0){var e=new FormData(i,o);tc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),tc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Vf=0;Vf<mi.length;Vf++){var Hf=mi[Vf];hi(Hf.toLowerCase(),`on`+(Hf[0].toUpperCase()+Hf.slice(1)))}hi(oi,`onAnimationEnd`),hi(si,`onAnimationIteration`),hi(ci,`onAnimationStart`),hi(`dblclick`,`onDoubleClick`),hi(`focusin`,`onFocus`),hi(`focusout`,`onBlur`),hi(li,`onTransitionRun`),hi(ui,`onTransitionStart`),hi(di,`onTransitionCancel`),hi(fi,`onTransitionEnd`),Wt(`onMouseEnter`,[`mouseout`,`mouseover`]),Wt(`onMouseLeave`,[`mouseout`,`mouseover`]),Wt(`onPointerEnter`,[`pointerout`,`pointerover`]),Wt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ut(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ut(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ut(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ut(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ut(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ut(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Uf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Wf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Uf));function Gf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){bi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){bi(e)}i.currentTarget=null,a=c}}}}function J(e,t){var n=t[kt];n===void 0&&(n=t[kt]=new Set);var r=e+`__bubble`;n.has(r)||(Yf(t,e,2,!1),n.add(r))}function Kf(e,t,n){var r=0;t&&(r|=4),Yf(n,e,r,t)}var qf=`_reactListening`+Math.random().toString(36).slice(2);function Jf(e){if(!e[qf]){e[qf]=!0,Vt.forEach(function(t){t!==`selectionchange`&&(Wf.has(t)||Kf(t,!1,e),Kf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qf]||(t[qf]=!0,Kf(`selectionchange`,!1,t))}}function Yf(e,t,n,r){switch(Eh(t)){case 2:var i=bh;break;case 8:i=xh;break;default:i=Sh}n=i.bind(null,t,n,e),i=void 0,!jn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Xf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=It(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}On(function(){var r=a,i=Cn(n),s=[];a:{var c=pi.get(e);if(c!==void 0){var l=Hn,u=e;switch(e){case`keypress`:if(Ln(n)===0)break a;case`keydown`:case`keyup`:l=or;break;case`focusin`:u=`focus`,l=Zn;break;case`focusout`:u=`blur`,l=Zn;break;case`beforeblur`:case`afterblur`:l=Zn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Yn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=L;break;case oi:case si:case ci:l=Qn;break;case fi:l=lr;break;case`scroll`:case`scrollend`:l=Wn;break;case`wheel`:l=ur;break;case`copy`:case`cut`:case`paste`:l=$n;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=sr;break;case`submit`:l=cr;break;case`toggle`:case`beforetoggle`:l=dr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=kn(m,p),g!=null&&d.push(Zf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==Sn&&(u=n.relatedTarget||n.fromElement)&&(It(u)||u[Ot]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?It(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Yn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=sr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:F(c),h=l==null?u:F(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,It(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?ee(c,l,$f):null,c!==null&&ep(s,u,c,d,!1),l!==null&&f!==null&&ep(s,f,l,d,!0)))}a:{if(c=r?F(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=jr;else if(Tr(c)){if(Mr)_=Vr;else{_=zr;var v=Rr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&_n(r.elementType)&&(_=jr):_=Br;if(_&&=_(e,r)){Er(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?F(r):window,e){case`focusin`:(Tr(v)||v.contentEditable===`true`)&&(Xr=v,Zr=r,Qr=null);break;case`focusout`:Qr=Zr=Xr=null;break;case`mousedown`:$r=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:$r=!1,ei(s,n,i);break;case`selectionchange`:if(z)break;case`keydown`:case`keyup`:ei(s,n,i)}var y;if(pr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else xr?yr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(gr&&n.locale!==`ko`&&(xr||b!==`onCompositionStart`?b===`onCompositionEnd`&&xr&&(y=In()):(Nn=i,Pn=`value`in Nn?Nn.value:Nn.textContent,xr=!0)),v=Qf(r,b),0<v.length&&(b=new er(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=br(n),y!==null&&(b.data=y)))),(y=hr?Sr(e,n):Cr(e,n))&&(b=Qf(r,`onBeforeInput`),0<b.length&&(v=new er(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Bf(s,e,r,n,i)}Gf(s,t)})}function Zf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=kn(e,n),i!=null&&r.unshift(Zf(e,i,a)),i=kn(e,t),i!=null&&r.push(Zf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function $f(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ep(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=kn(n,a),l!=null&&o.unshift(Zf(n,l,c))):i||(l=kn(n,a),l!=null&&o.push(Zf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var tp=/\r\n?/g,np=/\u0000|\uFFFD/g;function rp(e){return(typeof e==`string`?e:``+e).replace(tp,`
|
|
10
|
+
`).replace(np,``)}function ip(e,t){return t=rp(t),rp(e)===t}function Y(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&pn(e,``+r);else return;break;case`className`:Zt(e,`class`,r);break;case`tabIndex`:Zt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Zt(e,n,r);break;case`style`:gn(e,r,o);return;case`data`:if(t!==`object`){Zt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Y(e,t,`name`,a.name,a,null),Y(e,t,`formEncType`,a.formEncType,a,null),Y(e,t,`formMethod`,a.formMethod,a,null),Y(e,t,`formTarget`,a.formTarget,a,null)):(Y(e,t,`encType`,a.encType,a,null),Y(e,t,`method`,a.method,a,null),Y(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=xn);return;case`onScroll`:r!=null&&J(`scroll`,e);return;case`onScrollEnd`:r!=null&&J(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=bn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:J(`beforetoggle`,e),J(`toggle`,e),Xt(e,`popover`,r);break;case`xlinkActuate`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Xt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=vn.get(n)||n,Xt(e,n,r);else return}Jt=!0}function ap(e,t,n,r,a,o){switch(n){case`style`:gn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)pn(e,``+r);else return;break;case`onScroll`:r!=null&&J(`scroll`,e);return;case`onScrollEnd`:r!=null&&J(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=xn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Dt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Jt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Xt(e,n,r)}return}Jt=!0}function op(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:J(`error`,e),J(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Y(e,t,o,s,n,null)}}a&&Y(e,t,`srcSet`,n.srcSet,n,null),r&&Y(e,t,`src`,n.src,n,null);return;case`input`:J(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Y(e,t,r,d,n,null)}}cn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in J(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Y(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&un(e,!!r,n,!0):un(e,!!r,t,!1);return;case`textarea`:for(s in J(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Y(e,t,s,c,n,null)}fn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Y(e,t,l,r,n,null)}return;case`dialog`:J(`beforetoggle`,e),J(`toggle`,e),J(`cancel`,e),J(`close`,e);break;case`iframe`:case`object`:J(`load`,e);break;case`video`:case`audio`:for(r=0;r<Uf.length;r++)J(Uf[r],e);break;case`image`:J(`error`,e),J(`load`,e);break;case`details`:J(`toggle`,e);break;case`embed`:case`source`:case`link`:J(`error`,e),J(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Y(e,t,u,r,n,null)}return;default:if(_n(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&ap(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Y(e,t,c,r,n,null))}var sp={};function cp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Y(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Jt=!0),o=m;break;case`name`:m!==f&&(Jt=!0),a=m;break;case`checked`:m!==f&&(Jt=!0),u=m;break;case`defaultChecked`:m!==f&&(Jt=!0),d=m;break;case`value`:m!==f&&(Jt=!0),s=m;break;case`defaultValue`:m!==f&&(Jt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Y(e,t,p,m,r,f)}}sn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Y(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Jt=!0),p=o;break;case`defaultValue`:o!==l&&(Jt=!0),c=o;break;case`multiple`:o!==l&&(Jt=!0),s=o;default:o!==l&&Y(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?un(e,!!n,n?[]:``,!1):un(e,!!n,t,!0)):un(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Y(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Jt=!0),p=a;break;case`defaultValue`:a!==o&&(Jt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Y(e,t,s,a,r,o)}dn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Y(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Jt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Y(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Y(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Y(e,t,u,p,r,m)}return;default:if(_n(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&ap(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||ap(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Y(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Y(e,t,f,p,r,m)}function lp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function up(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&lp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&lp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var dp=null,fp=null;function pp(e){return e.nodeType===9?e:e.ownerDocument}function mp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function X(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function hp(e,t,n,r){return n=pp(n).createElement(e),n[Et]=r,n[Dt]=t,op(n,e,t),zt(n),n}function gp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _p=null;function vp(){var e=window.event;return e&&e.type===`popstate`?e!==_p&&(_p=e,!0):(_p=null,!1)}var yp=typeof setTimeout==`function`?setTimeout:void 0,bp=typeof clearTimeout==`function`?clearTimeout:void 0,xp=typeof Promise==`function`?Promise:void 0,Sp=typeof requestAnimationFrame==`function`?requestAnimationFrame:yp,Cp=typeof queueMicrotask==`function`?queueMicrotask:xp===void 0?yp:function(e){return xp.resolve(null).then(e).catch(wp)};function wp(e){setTimeout(function(){throw e})}function Tp(e){return e===`head`}function Ep(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Gh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)bm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,bm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Nt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&bm(e.ownerDocument.body)}n=i}while(n);Gh(t)}function Dp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Op(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function kp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Ap(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function jp(e){return Ap(e.getBoundingClientRect(),getComputedStyle(e),e)}function Mp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Ap(t,n,e)}function Np(e){return e.documentElement.clientHeight}function Pp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Fp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Np(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=$m(f),u>nh){s.length=o;break}f=new Promise(Pp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Ip(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Ip.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:E({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Ip.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Ip.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Lp(e){return{name:e,group:new Ip(`group`,e),imagePair:new Ip(`image-pair`,e),old:new Ip(`old`,e),new:new Ip(`new`,e)}}function Rp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Rp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Up(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Vp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,zp,e,s,r)}this._eventListeners=a}};function zp(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Rp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Up(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Vp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Bp,e,n,i),r.splice(t,1),a!==null&&a()}};function Bp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Vp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Hp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Up(e,t,n,r){if(e.length===0)return-1;r=Hp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Hp(a.optionsOrUseCapture)===r)return i}return-1}Rp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Rp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=_(e),gm(e,t))}Rp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Gp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Wp(t[n],e);n--);};function Gp(e,t){return t.push(e),!1}Rp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=pp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Kp,e,void 0,void 0))};function Kp(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Rp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,qp,e,void 0,void 0)};function qp(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Rp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Jp,e,void 0,void 0);for(var n=t=0;n<Yp.length;n++){var r=Yp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Yp[t++]=r}Yp.length=t}};function Jp(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var Yp=[],Xp=!1;function Zp(e,t,n){Yp.push({fragmentInstance:e,observer:t,instance:n}),Xp||(Xp=!0,_m(function(){Xp=!1;var e=Yp;Yp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Rp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Qp,e,void 0,void 0),e};function Qp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}Rp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Rp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Gp,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||$p(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function $p(e,t,n,r,i){var a=It(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ee(n,a,T),t===null?t=!1:(f(t,!0,C,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ee(r,a,T),t===null?t=!1:(f(t,!0,w,a,r),a=y,x=y=null,t=a!==null)),t):!1}function em(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Rp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Gp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),em(e,n);return}if(r=_(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=_(a),em(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function tm(e,t){return e=_(e),nm(e,t),!1}function nm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function rm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Yp.length;i++){var a=Yp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Yp[r++]=a)}Yp.length=r,n.observe(e)}),nm(e,t))}function im(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Zp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function am(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:am(n),Ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function om(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Nt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=fm(e.nextSibling),e===null)break}return null}function sm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=fm(e.nextSibling),e===null))return null;return e}function cm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=fm(e.nextSibling),e===null))return null;return e}function lm(e){return e.data===`$?`||e.data===`$~`}function um(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function dm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function fm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pm=null;function mm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return fm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function _m(e){Sp(function(){Sp(function(t){return e(t)})})}function vm(e,t,n){switch(t=pp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function ym(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&Y(e,t,r,null,sp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===xn&&(e.onclick=null),Ft(e)}function bm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ft(e)}var xm=new Map,Sm=new Set;function Cm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var wm=Se.d;Se.d={f:Tm,r:Em,D:km,C:Am,L:jm,m:Mm,X:Pm,S:Nm,M:Fm};function Tm(){var e=wm.f(),t=Hd();return e||t}function Em(e){var t=Lt(e);t!==null&&t.tag===5&&t.type===`form`?rc(t):wm.r(e)}var Dm=typeof document>`u`?null:document;function Om(e,t,n){var r=Dm;if(r&&typeof t==`string`&&t){var i=on(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sm.has(i)||(Sm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),op(t,`link`,e),zt(t),r.head.appendChild(t)))}}function km(e){wm.D(e),Om(`dns-prefetch`,e,null)}function Am(e,t){wm.C(e,t),Om(`preconnect`,e,t)}function jm(e,t,n){wm.L(e,t,n);var r=Dm;if(r&&e&&t){var i=`link[rel="preload"][as="`+on(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+on(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+on(n.imageSizes)+`"]`)):i+=`[href="`+on(e)+`"]`;var a=i;switch(t){case`style`:a=Lm(e);break;case`script`:a=Vm(e)}if(!(xm.has(a)||(e=E({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rm(a))||t===`script`&&r.querySelector(Hm(a))))){var o=r.createElement(`link`);op(o,`link`,e),t===`style`&&(o[Pt]=!0,o.onload=o.onerror=function(){Bt(o)}),zt(o),r.head.appendChild(o)}}}function Mm(e,t){wm.m(e,t);var n=Dm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+on(r)+`"][href="`+on(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vm(e)}if(!xm.has(a)&&(e=E({rel:`modulepreload`,href:e},t),xm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hm(a)))return}r=n.createElement(`link`),op(r,`link`,e),zt(r),n.head.appendChild(r)}}}function Nm(e,t,n){wm.S(e,t,n);var r=Dm;if(r&&e){var i=Rt(r).hoistableStyles,a=Lm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rm(a)))s.loading=5;else{e=E({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xm.get(a))&&Gm(e,n);var c=o=r.createElement(`link`);zt(c),op(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pm(e,t){wm.X(e,t);var n=Dm;if(n&&e){var r=Rt(n).hoistableScripts,i=Vm(e),a=r.get(i);a||(a=n.querySelector(Hm(i)),a||(e=E({src:e,async:!0},t),(t=xm.get(i))&&Km(e,t),a=n.createElement(`script`),zt(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Fm(e,t){wm.M(e,t);var n=Dm;if(n&&e){var r=Rt(n).hoistableScripts,i=Vm(e),a=r.get(i);a||(a=n.querySelector(Hm(i)),a||(e=E({src:e,async:!0,type:`module`},t),(t=xm.get(i))&&Km(e,t),a=n.createElement(`script`),zt(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Im(e,t,n,r){var a=(a=Oe.current)?Cm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Lm(n.href),t=Rt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Lm(n.href);var o=Rt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Rm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=xm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xm.set(e,o)),Bm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Vm(n),t=Rt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Lm(e){return`href="`+on(e)+`"`}function Rm(e){return`link[rel="stylesheet"][`+e+`]`}function zm(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function Bm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Pt]){r.loading=1;return}}else t=e.createElement(`link`),t[Pt]=!0,t.onload=t.onerror=Bt.bind(null,t),op(t,`link`,n),zt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Vm(e){return`[src="`+on(e)+`"]`}function Hm(e){return`script[async]`+e}function Um(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+on(n.href)+`"]`);if(r)return t.instance=r,zt(r),r;var a=E({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),zt(r),op(r,`style`,a),Wm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lm(n.href);var o=e.querySelector(Rm(a));if(o)return t.state.loading|=4,t.instance=o,zt(o),o;r=zm(n),(a=xm.get(a))&&Gm(r,a),o=(e.ownerDocument||e).createElement(`link`),zt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),op(o,`link`,r),t.state.loading|=4,Wm(o,n.precedence,e),t.instance=o;case`script`:return o=Vm(n.src),(a=e.querySelector(Hm(o)))?(t.instance=a,zt(a),a):(r=n,(a=xm.get(o))&&(r=E({},n),Km(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),zt(a),op(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wm(r,n.precedence,e));return t.instance}function Wm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Gm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Km(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var qm=null;function Jm(e,t,n){if(qm===null){var r=new Map,i=qm=new Map;i.set(n,r)}else i=qm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Nt]||a[Et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Ym(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Xm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Zm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Qm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $m(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function eh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=$m(t),e.suspenseyImages.push(t)),e=oh.bind(e),t.decode().then(e,e))}function th(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Lm(r.href),a=t.querySelector(Rm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ah.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,zt(a);return}a=t.ownerDocument||t,r=zm(r),(i=xm.get(i))&&Gm(r,i),a=a.createElement(`link`),zt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),op(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ah.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var nh=0;function rh(e,t){return e.stylesheets&&e.count===0&&ch(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ch(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&nh===0&&(nh=62500*up());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ch(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>nh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ih(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ch(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ah(){this.count--,ih(this)}function oh(){this.imgCount--,ih(this)}var sh=null;function ch(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sh=new Map,t.forEach(lh,e),sh=null,ah.call(e))}function lh(e,t){if(!(t.state.loading&4)){var n=sh.get(e);if(n)var r=n.get(null);else{n=new Map,sh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ah.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var uh={$$typeof:se,Provider:null,Consumer:null,_currentValue:A,_currentValue2:A,_threadCount:0};function dh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ht(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ht(0),this.hiddenUpdates=ht(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function fh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new dh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Mi(3,null,null,t),e.current=a,a.stateNode=e,t=ja(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},mo(a),e}function ph(e){return e?(e=Ai,e):Ai}function mh(e,t,n,r,i,a){i=ph(i),r.context===null?r.context=i:r.pendingContext=i,r=go(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=_o(e,r,t),n!==null&&(Ld(n,e,t),vo(n,e,t))}function hh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gh(e,t){hh(e,t),(e=e.alternate)&&hh(e,t)}function _h(e){if(e.tag===13||e.tag===31){var t=Di(e,67108864);t!==null&&Ld(t,e,67108864),gh(e,67108864)}}function vh(e){if(e.tag===13||e.tag===31){var t=Pd();t=xt(t);var n=Di(e,t);n!==null&&Ld(n,e,t),gh(e,t)}}var yh=!0;function bh(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=2,Sh(e,t,n,r)}finally{Se.p=a,k.T=i}}function xh(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=8,Sh(e,t,n,r)}finally{Se.p=a,k.T=i}}function Sh(e,t,n,r){if(yh){var i=Ch(r);if(i===null)Xf(e,t,r,wh,n),Fh(e,r);else if(Lh(i,e,t,n,r))r.stopPropagation();else if(Fh(e,r),t&4&&-1<Ph.indexOf(e)){for(;i!==null;){var a=Lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=lt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-nt(o);s.entanglements[1]|=c,o&=~c}Af(a),!(ed&6)&&(yd=Ke()+500,jf(0,!1))}}break;case 31:case 13:s=Di(a,2),s!==null&&Ld(s,a,2),Hd(),gh(a,2)}if(a=Ch(r),a===null&&Xf(e,t,r,wh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Xf(e,t,r,null,n)}}function Ch(e){return e=Cn(e),Th(e)}var wh=null;function Th(e){if(wh=null,e=It(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return wh=e,null}function Eh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(qe()){case Je:return 2;case Ye:return 8;case Xe:case Ze:return 32;case N:return 268435456;default:return 32}default:return 32}}var Dh=!1,Oh=null,kh=null,Ah=null,jh=new Map,Mh=new Map,Nh=[],Ph=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Fh(e,t){switch(e){case`focusin`:case`focusout`:Oh=null;break;case`dragenter`:case`dragleave`:kh=null;break;case`mouseover`:case`mouseout`:Ah=null;break;case`pointerover`:case`pointerout`:jh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Mh.delete(t.pointerId)}}function Ih(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Lt(t),t!==null&&_h(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Lh(e,t,n,r,i){switch(t){case`focusin`:return Oh=Ih(Oh,e,t,n,r,i),!0;case`dragenter`:return kh=Ih(kh,e,t,n,r,i),!0;case`mouseover`:return Ah=Ih(Ah,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return jh.set(a,Ih(jh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Mh.set(a,Ih(Mh.get(a)||null,e,t,n,r,i)),!0}return!1}function Rh(e){var t=It(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,wt(e.priority,function(){vh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,wt(e.priority,function(){vh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ch(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Sn=r,n.target.dispatchEvent(r),Sn=null}else return t=Lt(n),t!==null&&_h(t),e.blockedOn=n,!1;t.shift()}return!0}function Bh(e,t,n){zh(e)&&n.delete(t)}function Vh(){Dh=!1,Oh!==null&&zh(Oh)&&(Oh=null),kh!==null&&zh(kh)&&(kh=null),Ah!==null&&zh(Ah)&&(Ah=null),jh.forEach(Bh),Mh.forEach(Bh)}function Hh(e,n){e.blockedOn===n&&(e.blockedOn=null,Dh||(Dh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vh)))}var Uh=null;function Wh(e){Uh!==e&&(Uh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Uh===e&&(Uh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Th(r||n)===null)continue;break}var a=Lt(n);a!==null&&(e.splice(t,3),t-=3,tc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Gh(e){function t(t){return Hh(t,e)}Oh!==null&&Hh(Oh,e),kh!==null&&Hh(kh,e),Ah!==null&&Hh(Ah,e),jh.forEach(t),Mh.forEach(t);for(var n=0;n<Nh.length;n++){var r=Nh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Nh.length&&(n=Nh[0],n.blockedOn===null);)Rh(n),n.blockedOn===null&&Nh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Dt]||null;if(typeof a==`function`)o||Wh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Dt]||null)s=o.formAction;else if(Th(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Wh(n)}}}function Kh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function qh(e){this._internalRoot=e}Jh.prototype.render=qh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;mh(n,Pd(),e,t,null,null)},Jh.prototype.unmount=qh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mh(e.current,2,null,e,null,null),Hd(),t[Ot]=null}};function Jh(e){this._internalRoot=e}Jh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ct();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nh.length&&t!==0&&t<Nh[n].priority;n++);Nh.splice(n,0,e),n===0&&Rh(e)}};var Yh=n.version;if(Yh!==`19.3.1`)throw Error(i(527,Yh,`19.3.1`));Se.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Xh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Zh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zh.isDisabled&&Zh.supportsFiber)try{et=Zh.inject(Xh),P=Zh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=wc,s=Tc,c=Ec;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=fh(e,1,!1,null,null,n,r,null,o,s,c,Kh),e[Ot]=t.current,Jf(e),new qh(t)}})),w=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=C()})),T=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ee=t(((e,t)=>{t.exports=T()})),E=e(v(),1),D=ee(),te=E.createContext(void 0),ne=e=>{let t=E.useContext(te);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},re=({client:e,children:t})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,D.jsx)(te.Provider,{value:e,children:t})),ie={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ae=new class{#e=ie;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function oe(e){setTimeout(e,0)}var se=typeof window>`u`||`Deno`in globalThis;function ce(){}function le(e,t){return typeof e==`function`?e(t):e}function ue(e){return typeof e==`number`&&e>=0&&e!==1/0}function de(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function fe(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==me(o,t.options))return!1}else if(!ge(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function pe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(he(t.options.mutationKey)!==he(a))return!1}else if(!ge(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function me(e,t){return(t?.queryKeyHashFn||he)(e)}function he(e){return JSON.stringify(e,(e,t)=>xe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ge(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!ge(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ge(e[r],t[r]))return!1;return!0}return!1}var _e=Object.prototype.hasOwnProperty;function ve(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=be(e)&&be(t);if(!r&&!(xe(e)&&xe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:_e.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ve(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ye(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!_e.call(t,n)||e[n]!==t[n])return!1;return!0}function be(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xe(e){if(!k(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!k(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function k(e){return Object.prototype.toString.call(e)===`[object Object]`}function Se(e){return new Promise(t=>{ae.setTimeout(t,e)})}function A(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ve(e,t)}function Ce(e){return e}function we(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function Te(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var j=Symbol();function M(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===j?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ee(e,t){return typeof e==`function`?e(...t):!!e}var De=Symbol();function Oe(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[De]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var ke=()=>se,Ae=()=>ke(),je=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Me=new class extends je{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ne=oe;function Pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ne,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Fe=Pe(),Ie=new class extends je{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Le(e){return Math.min(1e3*2**e,3e4)}function Re(e){return(e??`online`)!==`online`||Ie.isOnline()}var ze=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Be(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ce);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ze(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Me.isFocused()&&(e.networkMode===`always`||Ie.isOnline())&&e.canRun(),p=()=>Re(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Ae()?0:3),a=e.retryDelay??Le,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),Se(o).then(()=>c()||f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var Ve=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ue(this.gcTime)&&(this.#e=ae.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ae()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(ae.clearTimeout(this.#e),this.#e=void 0)}};function He(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=t,u=e=>{Oe(e,()=>t.signal,()=>n=!0,l[De])},d=M(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?Te:we;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?We:Ue,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:Ue(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ue(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function We(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ge=class extends Ve{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Je(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Je(this.options);e.data!==void 0&&(this.setState(qe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=A(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ce).catch(ce):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===j||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!de(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[De]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=M(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?He(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ze&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ze){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ke(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...qe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Fe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ke(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Re(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function qe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Je(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ye=class extends je{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ze(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return N(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return N(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ye(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Qe(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ye(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ce)),t}#h(e){return!Ae()&&O(this.options.enabled,this.#t)!==!1&&ue(e)}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=de(this.#r.dataUpdatedAt,e)+1;this.#u=ae.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return O(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=ae.setInterval(()=>{(this.options.refetchIntervalInBackground||Me.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(ae.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(ae.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ze(e,t),o=i&&Qe(e,n,t,r);(a||o)&&(l={...l,...Ke(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=A(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=A(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=i?.error===f?i.errorUpdatedAt:Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:$e(e,t),refetch:this.refetch,isEnabled:O(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ye(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();Fe.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Xe(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function Ze(e,t){return Xe(e,t)||e.state.data!==void 0&&N(e,t,t.refetchOnMount)}function N(e,t,n){if(O(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=O(n,e);return r===`always`||r!==!1&&$e(e,t)}return!1}function Qe(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&$e(e,n)}function $e(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}var et=class extends Ve{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||P(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Fe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function P(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var tt=class extends je{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new et({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=nt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=nt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=nt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=nt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Fe.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pe(t,e))}findAll(e={}){return this.getAll().filter(t=>pe(e,t))}notify(e){Fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Fe.batch(()=>Promise.all(e.map(e=>e.continue().catch(ce))))}};function nt(e){return e.options.scope?.id}var rt=class extends je{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ye(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&he(t.mutationKey)!==he(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??P();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Fe.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function it(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var at=class extends je{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Fe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ye(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(it(e,n).forEach(e=>{e.destroy()}),it(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ve(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ye(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Fe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},ot=class extends je{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??me(r,t),a=this.get(i);return a||(a=new Ge({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Fe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>fe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>fe(e,t)):t}notify(e){Fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},st=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ot,this.#t=e.mutationCache||new tt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Me.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=le(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Fe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Fe.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Fe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ce).catch(ce)}invalidateQueries(e,t={}){return Fe.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(ce)),r?Promise.resolve():t}));return Promise.all(r).then(ce)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(O(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ce).catch(ce)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ce).catch(ce)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ie.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(he(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ge(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(he(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ge(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=me(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===j&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ct=E.createContext(!1),lt=()=>E.useContext(ct);ct.Provider;function ut(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dt=E.createContext(ut()),ft=()=>E.useContext(dt),pt=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?Ee(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},mt=e=>{E.useEffect(()=>{e.clearReset()},[e])},ht=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ee(n,[e.error,r])),gt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},_t=(e,t)=>e?.suspense&&t.isPending,vt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function yt({queries:e,...t},n){let r=ne(n),i=lt(),a=ft(),o=t.subscribed!==!1,s=E.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{gt(e);let t=r.getQueryCache().get(e.queryHash);pt(e,a,t)}),mt(a);let[c]=E.useState(()=>new at(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine);E.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let f=!i&&o;E.useSyncExternalStore(E.useCallback(e=>f?c.subscribe(Fe.batchCalls(e)):ce,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult());let p=l.some((e,t)=>_t(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&_t(n,e)?vt(n,new Ye(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&ht({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function bt(e,t,n){let r=lt(),i=ft(),a=ne(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,gt(o),pt(o,i,s),mt(i);let[l]=E.useState(()=>new t(a,o)),u=l.getOptimisticResult(o);E.useEffect(()=>{l.setOptions(o)},[o,l]);let d=!r&&c;if(E.useSyncExternalStore(E.useCallback(e=>{let t=d?l.subscribe(Fe.batchCalls(e)):ce;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_t(o,u))throw vt(o,l,i);if(ht({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function xt(e,t){return bt(e,Ye,t)}function St(e,t){let n=ne(t),r=n.getQueryCache();return E.useSyncExternalStore(E.useCallback(e=>r.subscribe(Fe.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function Ct(e,t){let n=ne(t);return Tt({filters:{...e,status:`pending`}},n).length}function wt(){let e;return(t,n)=>{let r=[],i;return()=>{let a=t.findAll(n.filters),o=a.flatMap(e=>[e,e.state]);return(!i||o.length!==r.length||o.some((e,t)=>!Object.is(e,r[t])))&&(r=o,i=ve(e,a.map(e=>n.select?n.select(e):e.state)),e=i),i}}}function Tt(e={},t){let n=ne(t).getMutationCache(),[r]=E.useState(()=>wt()),i=r(n,e);return E.useSyncExternalStore(E.useCallback(e=>n.subscribe(Fe.batchCalls(e)),[n]),i,i)}function Et(e,t){let n=ne(t),[r]=E.useState(()=>new rt(n,e));E.useEffect(()=>{r.setOptions(e)},[r,e]);let i=E.useSyncExternalStore(E.useCallback(e=>r.subscribe(Fe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=E.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(ce)},[r]);if(i.error&&Ee(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Dt=w(),Ot=class extends Error{code;description;constructor(e,t){super(t??e),this.name=`AuthError`,this.code=e,this.description=t}},kt=500,At=3e5,jt=3e5;function Mt(e,t){if(typeof e!=`object`||!e||typeof e.access_token!=`string`||!e.access_token)throw TypeError(`invalid token`);return{accessToken:e.access_token,tokenType:e.token_type,expiresAt:e.expires_in?t+e.expires_in*1e3:null,refreshToken:e.refresh_token??null,refreshTokenExpiresAt:e.refresh_token_expires_in?t+e.refresh_token_expires_in*1e3:null}}function Nt(e){return typeof e==`object`&&!!e&&e.source===`editlet-auth`}function Pt(e,t){let n=new URL(e);return n.pathname=`${n.pathname.replace(/\/+$/,``)}/${t}`,n.search=``,n.hash=``,n}function Ft(e){let t,n;try{t=new URL(e.workerUrl).origin,n=Pt(e.workerUrl,`auth`)}catch{return Promise.reject(new Ot(`invalid_worker_url`))}n.searchParams.set(`origin`,location.origin);let r=window.open(n.toString(),`editlet-auth`,`popup,width=600,height=720`);return r?new Promise((n,i)=>{let a=!1,o,s,c=e=>{a||(a=!0,clearInterval(o),clearTimeout(s),window.removeEventListener(`message`,l),e())};function l(e){if(e.origin!==t||e.source!==r||!Nt(e.data))return;let a=e.data;if(a.ok){let e;try{e=Mt(a.token,Date.now())}catch{c(()=>i(new Ot(`token_request_failed`)));return}c(()=>n(e))}else c(()=>i(new Ot(a.error,a.description)))}window.addEventListener(`message`,l),o=setInterval(()=>{r.closed&&c(()=>i(new Ot(`popup_closed`)))},kt),s=setTimeout(()=>c(()=>{try{r.close()}catch{}i(new Ot(`timeout`))}),e.timeoutMs??At)}):Promise.reject(new Ot(`popup_blocked`))}async function It(e){let t;try{t=Pt(e.workerUrl,`refresh`).toString()}catch{throw new Ot(`invalid_worker_url`)}let n;try{n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({refresh_token:e.refreshToken})})}catch{throw new Ot(`network_error`)}let r;try{r=await n.json()}catch{throw new Ot(`token_request_failed`)}let i=r??{};if(typeof i.error==`string`)throw new Ot(i.error,typeof i.error_description==`string`?i.error_description:void 0);if(!n.ok||typeof i.access_token!=`string`)throw new Ot(`token_request_failed`);return Mt(i,Date.now())}function Lt(e,t=Date.now()){return e.expiresAt!==null&&t>=e.expiresAt-jt}var F=class extends Error{code;status;retryAt;graphqlErrors;constructor(e,t,n){super(t),this.name=`GitHubError`,this.code=e,this.status=n?.status,this.retryAt=n?.retryAt,this.graphqlErrors=n?.graphqlErrors}};function Rt(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var zt=`https://api.github.com`,Bt=`2022-11-28`,Vt=3,Ht=6e4,Ut=6,Wt=[[6e4,80],[36e5,500]],Gt=class{limit;active=0;waiters=[];constructor(e){this.limit=e}async acquire(){this.active<this.limit?this.active++:await new Promise(e=>this.waiters.push(e))}release(){let e=this.waiters.shift();e?e():this.active--}};function Kt(e){if(e.length!==0)try{return JSON.parse(new TextDecoder().decode(e))}catch{return}}function qt(e,t){if(e&&typeof e==`object`&&typeof e.message==`string`){let t=I(e).map(e=>typeof e==`string`?e:e?.message).filter(e=>typeof e==`string`&&e!==``),n=e.message;return t.length>0?`${n}: ${t.join(`; `)}`:n}return`GitHub request failed with status ${t}`}function I(e){let t=e?.errors;return Array.isArray(t)?t:[]}function Jt(e,t){let n=qt(t,e.status);return e.status===401?new Ot(`unauthorized`,n):e.status===403?new Ot(`forbidden`,n):e.status===404?new F(`not_found`,n,{status:404}):new F(`http_error`,n,{status:e.status})}function Yt(e){let t=e.fetch??((...e)=>globalThis.fetch(...e)),n=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),r=e.now??Date.now,i=new Gt(Ut),a=new Gt(1),o=[];async function s(){let e=r(),t=0;for(let[n,r]of Wt){let i=o.filter(t=>e-t<n);i.length>=r&&(t=Math.max(t,i[i.length-r]+n-e))}t>0&&await n(t);let i=r();o.push(i);let a=i-Wt[1][0];for(;o.length>0&&o[0]<a;)o.shift()}async function c(e,t){if(!e){await i.acquire();try{return await t()}finally{i.release()}}await a.acquire();try{return await s(),await t()}finally{a.release()}}async function l(n,r){let i=typeof e.token==`function`?await e.token():e.token,a={...r.headers,Authorization:`Bearer ${i}`};try{let e=await t(n,{...r,headers:a}),i=new Uint8Array(await e.arrayBuffer());return{status:e.status,headers:e.headers,body:i}}catch(e){throw new F(`network_error`,e instanceof Error?e.message:`Network request failed`)}}function u(e,t){if(e.status!==403&&e.status!==429)return null;let n=e.headers.get(`retry-after`),r=t&&typeof t==`object`?t.message:void 0;return e.headers.get(`x-ratelimit-remaining`)===`0`||n!==null||typeof r==`string`&&/rate limit/i.test(r)?d(e.headers):null}function d(e){let t=e.get(`retry-after`);if(t!==null&&t!==``&&Number.isFinite(Number(t)))return Number(t)*1e3;let n=e.get(`x-ratelimit-reset`);return n!==null&&n!==``&&Number.isFinite(Number(n))?Math.max(0,Number(n)*1e3-r()):Ht}async function f(e,t,i){for(let a=1;;a++){let o=await l(e,t),s=o.status===204?void 0:Kt(o.body),c=null;if(o.status>=200&&o.status<300){if(c=i?i(s):null,c===null)return{res:o,parsed:s}}else if(c=u(o,s),c===null)throw Jt(o,s);if(c>Ht||a>=Vt)throw new F(`rate_limited`,`GitHub rate limit exceeded`,{status:o.status,retryAt:r()+c});await n(c)}}async function p(e,t,n={}){let r=e.toUpperCase(),i=`${zt}${t}`;if(n.query){let e=new URLSearchParams;for(let[t,r]of Object.entries(n.query))r!==void 0&&e.set(t,String(r));let t=e.toString();t&&(i+=`${i.includes(`?`)?`&`:`?`}${t}`)}let a={Accept:n.accept??`application/vnd.github+json`,"X-GitHub-Api-Version":Bt},o={method:r,headers:a};n.body!==void 0&&(a[`Content-Type`]=`application/json`,o.body=JSON.stringify(n.body)),n.fresh&&(o.cache=`no-cache`);let{res:s,parsed:l}=await c(r!==`GET`&&r!==`HEAD`,()=>f(i,o));if(s.status!==204)return n.raw?s.body:l}async function m(e,t){let n={method:`POST`,headers:{Accept:`application/vnd.github+json`,"X-GitHub-Api-Version":Bt,"Content-Type":`application/json`},body:JSON.stringify({query:e,variables:t})},r=/^\s*mutation/.test(e),i=e=>{let t=I(e);return t.length>0&&t.every(e=>e.type===`RATE_LIMITED`)?Ht:null},{parsed:a}=await c(r,()=>f(`${zt}/graphql`,n,i)),o=I(a);if(o.find(e=>e.type===`FORBIDDEN`))throw new Ot(`forbidden`,o.map(e=>e.message).join(`; `));if(o.length>0)throw new F(`graphql_error`,o.map(e=>e.message).join(`; `),{graphqlErrors:o});return a.data}return{rest:p,graphql:m,sleep:n}}var Xt=e(t(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.Dexie=r())})(n,(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};function r(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var i=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,a=Object.keys,o=Array.isArray;typeof Promise<`u`&&!i.Promise&&(i.Promise=Promise);function s(e,t){return typeof t==`object`&&a(t).forEach(function(n){e[n]=t[n]}),e}var c=Object.getPrototypeOf,l={}.hasOwnProperty;function u(e,t){return l.call(e,t)}function d(e,t){typeof t==`function`&&(t=t(c(e))),(typeof Reflect>`u`?a:Reflect.ownKeys)(t).forEach(function(n){p(e,n,t[n])})}var f=Object.defineProperty;function p(e,t,n,r){f(e,t,s(n&&u(n,`get`)&&typeof n.get==`function`?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function m(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,`constructor`,e),{extend:d.bind(null,e.prototype)}}}}var h=Object.getOwnPropertyDescriptor;function g(e,t){var n=h(e,t),r;return n||(r=c(e))&&g(r,t)}var _=[].slice;function v(e,t,n){return _.call(e,t,n)}function y(e,t){return t(e)}function b(e){if(!e)throw Error(`Assertion Failed`)}function x(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function S(e,t){return e.reduce(function(e,n,r){var i=t(n,r);return i&&(e[i[0]]=i[1]),e},{})}function C(e,t){if(typeof t==`string`&&u(e,t))return e[t];if(!t)return e;if(typeof t!=`string`){for(var n=[],r=0,i=t.length;r<i;++r){var a=C(e,t[r]);n.push(a)}return n}var o=t.indexOf(`.`);if(o!==-1){var s=e[t.substr(0,o)];return s==null?void 0:C(s,t.substr(o+1))}}function w(e,t,n){if(e&&t!==void 0&&!(`isFrozen`in Object&&Object.isFrozen(e))){if(typeof t!=`string`&&`length`in t){b(typeof n!=`string`&&`length`in n);for(var r=0,i=t.length;r<i;++r)w(e,t[r],n[r])}else{var a=t.indexOf(`.`);if(a!==-1){var s=t.substr(0,a),c=t.substr(a+1);if(c===``)n===void 0?o(e)&&!isNaN(parseInt(s))?e.splice(s,1):delete e[s]:e[s]=n;else{var l=e[s];if(!l||!u(e,s)){if(n===void 0)return;l=e[s]={}}w(l,c,n)}}else n===void 0?o(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}}function T(e,t){typeof t==`string`?w(e,t,void 0):`length`in t&&[].map.call(t,function(t){w(e,t,void 0)})}function ee(e){var t={};for(var n in e)u(e,n)&&(t[n]=e[n]);return t}var E=[].concat;function D(e){return E.apply([],e)}var te=`BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey`.split(`,`).concat(D([8,16,32,64].map(function(e){return[`Int`,`Uint`,`Float`].map(function(t){return t+e+`Array`})}))).filter(function(e){return i[e]}),ne=new Set(te.map(function(e){return i[e]}));function re(e){var t={};for(var n in e)if(u(e,n)){var r=e[n];t[n]=!r||typeof r!=`object`||ne.has(r.constructor)?r:re(r)}return t}var ie=null;function ae(e){ie=new WeakMap;var t=oe(e);return ie=null,t}function oe(e){if(!e||typeof e!=`object`)return e;var t=ie.get(e);if(t)return t;if(o(e)){t=[],ie.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(oe(e[n]))}else if(ne.has(e.constructor))t=e;else{var i=c(e);for(var a in t=i===Object.prototype?{}:Object.create(i),ie.set(e,t),e)u(e,a)&&(t[a]=oe(e[a]))}return t}var se={}.toString;function ce(e){return se.call(e).slice(8,-1)}var le=typeof Symbol<`u`?Symbol.iterator:`@@iterator`,ue=typeof le==`symbol`?function(e){var t;return e!=null&&(t=e[le])&&t.apply(e)}:function(){return null};function de(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n>=0}var O={};function fe(e){var t,n,r,i;if(arguments.length===1){if(o(e))return e.slice();if(this===O&&typeof e==`string`)return[e];if(i=ue(e)){for(n=[];r=i.next(),!r.done;)n.push(r.value);return n}if(e==null)return[e];if(t=e.length,typeof t==`number`){for(n=Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}var pe=typeof Symbol<`u`?function(e){return e[Symbol.toStringTag]===`AsyncFunction`}:function(){return!1},me=[`Modify`,`Bulk`,`OpenFailed`,`VersionChange`,`Schema`,`Upgrade`,`InvalidTable`,`MissingAPI`,`NoSuchDatabase`,`InvalidArgument`,`SubTransaction`,`Unsupported`,`Internal`,`DatabaseClosed`,`PrematureCommit`,`ForeignAwait`],he=[`Unknown`,`Constraint`,`Data`,`TransactionInactive`,`ReadOnly`,`Version`,`NotFound`,`InvalidState`,`InvalidAccess`,`Abort`,`Timeout`,`QuotaExceeded`,`Syntax`,`DataClone`],ge=me.concat(he),_e={VersionChanged:`Database version changed by other database connection`,DatabaseClosed:`Database has been closed`,Abort:`Transaction aborted`,TransactionInactive:`Transaction has already completed or failed`,MissingAPI:`IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb`};function ve(e,t){this.name=e,this.message=t}m(ve).from(Error).extend({toString:function(){return this.name+`: `+this.message}});function ye(e,t){return e+`. Errors: `+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join(`
|
|
11
|
+
`)}function be(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=ye(e,t)}m(be).from(ve);function xe(e,t){this.name=`BulkError`,this.failures=Object.keys(t).map(function(e){return t[e]}),this.failuresByPos=t,this.message=ye(e,this.failures)}m(xe).from(ve);var k=ge.reduce(function(e,t){return e[t]=t+`Error`,e},{}),Se=ve,A=ge.reduce(function(e,t){var n=t+`Error`;function r(e,r){this.name=n,e?typeof e==`string`?(this.message=`${e}${r?`
|
|
12
|
+
`+r:``}`,this.inner=r||null):typeof e==`object`&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=_e[t]||n,this.inner=null)}return m(r).from(Se),e[t]=r,e},{});A.Syntax=SyntaxError,A.Type=TypeError,A.Range=RangeError;var Ce=he.reduce(function(e,t){return e[t+`Error`]=A[t],e},{});function we(e,t){if(!e||e instanceof ve||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Ce[e.name])return e;var n=new Ce[e.name](t||e.message,e);return`stack`in e&&p(n,`stack`,{get:function(){return this.inner.stack}}),n}var Te=ge.reduce(function(e,t){return[`Syntax`,`Type`,`Range`].indexOf(t)===-1&&(e[t+`Error`]=A[t]),e},{});Te.ModifyError=be,Te.DexieError=ve,Te.BulkError=xe;function j(){}function M(e){return e}function Ee(e,t){return e==null||e===M?t:function(n){return t(e(n))}}function De(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Oe(e,t){return e===j?t:function(){var n=e.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?De(r,this.onsuccess):r),i&&(this.onerror=this.onerror?De(i,this.onerror):i),a===void 0?n:a}}function ke(e,t){return e===j?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?De(n,this.onsuccess):n),r&&(this.onerror=this.onerror?De(r,this.onerror):r)}}function Ae(e,t){return e===j?t:function(){var n=e.apply(this,arguments),r=arguments[0];s(r,n);var i=this.onsuccess,a=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?De(i,this.onsuccess):i),a&&(this.onerror=this.onerror?De(a,this.onerror):a),n===void 0?o===void 0?void 0:o:s(n,o)}}function je(e,t){return e===j?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function Me(e,t){return e===j?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then==`function`){for(var r=this,i=arguments.length,a=Array(i);i--;)a[i]=arguments[i];return n.then(function(){return t.apply(r,a)})}return t.apply(this,arguments)}}var Ne=typeof location<`u`&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Pe(e,t){Ne=e}var Fe={},Ie=100,Le=typeof Promise>`u`?[]:(function(){var e=Promise.resolve();if(typeof crypto>`u`||!crypto.subtle)return[e,c(e),e];var t=crypto.subtle.digest(`SHA-512`,new Uint8Array([0]));return[t,c(t),e]})(),Re=Le[0],ze=Le[1],Be=Le[2],Ve=ze&&ze.then,He=Re&&Re.constructor,Ue=!!Be;function We(){queueMicrotask(ct)}var Ge=function(e,t){Qe.push([e,t]),qe&&=(We(),!1)},Ke=!0,qe=!0,Je=[],Ye=[],Xe=M,Ze={id:`global`,global:!0,ref:0,unhandleds:[],onunhandled:j,pgp:!1,env:{},finalize:j},N=Ze,Qe=[],$e=0,et=[];function P(e){if(typeof this!=`object`)throw TypeError(`Promises must be constructed via new`);this._listeners=[],this._lib=!1;var t=this._PSD=N;if(typeof e!=`function`){if(e!==Fe)throw TypeError(`Not a function`);this._state=arguments[1],this._value=arguments[2],this._state===!1&&it(this,this._value)}else this._state=null,this._value=null,++t.ref,rt(this,e)}var tt={get:function(){var e=N,t=xt;function n(n,r){var i=this,a=!e.global&&(e!==N||t!==xt),o=a&&!Tt(),s=new P(function(t,s){ot(i,new nt(Mt(n,e,a,o),Mt(r,e,a,o),t,s,e))});return this._consoleTask&&(s._consoleTask=this._consoleTask),s}return n.prototype=Fe,n},set:function(e){p(this,`then`,e&&e.prototype===Fe?tt:{get:function(){return e},set:tt.set})}};d(P.prototype,{then:tt,_then:function(e,t){ot(this,new nt(null,null,e,t,N))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],n=arguments[1];return typeof t==`function`?this.then(null,function(e){return e instanceof t?n(e):ht(e)}):this.then(null,function(e){return e&&e.name===t?n(e):ht(e)})},finally:function(e){return this.then(function(t){return P.resolve(e()).then(function(){return t})},function(t){return P.resolve(e()).then(function(){return ht(t)})})},timeout:function(e,t){var n=this;return e<1/0?new P(function(r,i){var a=setTimeout(function(){return i(new A.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,a))}):this}}),typeof Symbol<`u`&&Symbol.toStringTag&&p(P.prototype,Symbol.toStringTag,`Dexie.Promise`),Ze.env=At();function nt(e,t,n,r,i){this.onFulfilled=typeof e==`function`?e:null,this.onRejected=typeof t==`function`?t:null,this.resolve=n,this.reject=r,this.psd=i}d(P,{all:function(){var e=fe.apply(null,arguments).map(Et);return new P(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,a){return P.resolve(i).then(function(n){e[a]=n,--r||t(e)},n)})})},resolve:function(e){return e instanceof P?e:e&&typeof e.then==`function`?new P(function(t,n){e.then(t,n)}):new P(Fe,!0,e)},reject:ht,race:function(){var e=fe.apply(null,arguments).map(Et);return new P(function(t,n){e.map(function(e){return P.resolve(e).then(t,n)})})},PSD:{get:function(){return N},set:function(e){return N=e}},totalEchoes:{get:function(){return xt}},newPSD:Ct,usePSD:jt,scheduler:{get:function(){return Ge},set:function(e){Ge=e}},rejectionMapper:{get:function(){return Xe},set:function(e){Xe=e}},follow:function(e,t){return new P(function(n,r){return Ct(function(t,n){var r=N;r.unhandleds=[],r.onunhandled=n,r.finalize=De(function(){var e=this;ft(function(){e.unhandleds.length===0?t():n(e.unhandleds[0])})},r.finalize),e()},t,n,r)})}}),He&&(He.allSettled&&p(P,`allSettled`,function(){var e=fe.apply(null,arguments).map(Et);return new P(function(t){e.length===0&&t([]);var n=e.length,r=Array(n);e.forEach(function(e,i){return P.resolve(e).then(function(e){return r[i]={status:`fulfilled`,value:e}},function(e){return r[i]={status:`rejected`,reason:e}}).then(function(){return--n||t(r)})})})}),He.any&&typeof AggregateError<`u`&&p(P,`any`,function(){var e=fe.apply(null,arguments).map(Et);return new P(function(t,n){e.length===0&&n(AggregateError([]));var r=e.length,i=Array(r);e.forEach(function(e,a){return P.resolve(e).then(function(e){return t(e)},function(e){i[a]=e,--r||n(AggregateError(i))})})})}),He.withResolvers&&(P.withResolvers=He.withResolvers));function rt(e,t){try{t(function(t){if(e._state===null){if(t===e)throw TypeError(`A promise cannot be resolved with itself.`);var n=e._lib&<();t&&typeof t.then==`function`?rt(e,function(e,n){t instanceof P?t._then(e,n):t.then(e,n)}):(e._state=!0,e._value=t,at(e)),n&&ut()}},it.bind(null,e))}catch(t){it(e,t)}}function it(e,t){if(Ye.push(t),e._state===null){var n=e._lib&<();t=Xe(t),e._state=!1,e._value=t,pt(e),at(e),n&&ut()}}function at(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)ot(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),$e===0&&(++$e,Ge(function(){--$e===0&&dt()},[]))}function ot(e,t){if(e._state===null)e._listeners.push(t);else{var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++$e,Ge(st,[n,e,t])}}function st(e,t,n){try{var r,i=t._value;!t._state&&Ye.length&&(Ye=[]),r=Ne&&t._consoleTask?t._consoleTask.run(function(){return e(i)}):e(i),!t._state&&Ye.indexOf(i)===-1&&mt(t),n.resolve(r)}catch(e){n.reject(e)}finally{--$e===0&&dt(),--n.psd.ref||n.psd.finalize()}}function ct(){jt(Ze,function(){lt()&&ut()})}function lt(){var e=Ke;return Ke=!1,qe=!1,e}function ut(){var e,t,n;do for(;Qe.length>0;)for(e=Qe,Qe=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(Qe.length>0);Ke=!0,qe=!0}function dt(){var e=Je;Je=[],e.forEach(function(e){e._PSD.onunhandled.call(null,e._value,e)});for(var t=et.slice(0),n=t.length;n;)t[--n]()}function ft(e){function t(){e(),et.splice(et.indexOf(t),1)}et.push(t),++$e,Ge(function(){--$e===0&&dt()},[])}function pt(e){Je.some(function(t){return t._value===e._value})||Je.push(e)}function mt(e){for(var t=Je.length;t;)if(Je[--t]._value===e._value){Je.splice(t,1);return}}function ht(e){return new P(Fe,!1,e)}function gt(e,t){var n=N;return function(){var r=lt(),i=N;try{return kt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{kt(i,!1),r&&ut()}}}var _t={awaits:0,echoes:0,id:0},vt=0,yt=[],bt=0,xt=0,St=0;function Ct(e,t,n,r){var i=N,a=Object.create(i);a.parent=i,a.ref=0,a.global=!1,a.id=++St,Ze.env,a.env=Ue?{Promise:P,PromiseProp:{value:P,configurable:!0,writable:!0},all:P.all,race:P.race,allSettled:P.allSettled,any:P.any,resolve:P.resolve,reject:P.reject}:{},t&&s(a,t),++i.ref,a.finalize=function(){--this.parent.ref||this.parent.finalize()};var o=jt(a,e,n,r);return a.ref===0&&a.finalize(),o}function wt(){return _t.id||=++vt,++_t.awaits,_t.echoes+=Ie,_t.id}function Tt(){return _t.awaits?(--_t.awaits===0&&(_t.id=0),_t.echoes=_t.awaits*Ie,!0):!1}(``+Ve).indexOf(`[native code]`)===-1&&(wt=Tt=j);function Et(e){return _t.echoes&&e&&e.constructor===He?(wt(),e.then(function(e){return Tt(),e},function(e){return Tt(),Pt(e)})):e}function Dt(e){++xt,_t.echoes&&--_t.echoes!==0||(_t.echoes=_t.awaits=_t.id=0),yt.push(N),kt(e,!0)}function Ot(){var e=yt[yt.length-1];yt.pop(),kt(e,!1)}function kt(e,t){var n=N;if((t?_t.echoes&&(!bt++||e!==N):bt&&(!--bt||e!==N))&&queueMicrotask(t?Dt.bind(null,e):Ot),e!==N&&(N=e,n===Ze&&(Ze.env=At()),Ue)){var r=Ze.env.Promise,a=e.env;(n.global||e.global)&&(Object.defineProperty(i,"Promise",a.PromiseProp),r.all=a.all,r.race=a.race,r.resolve=a.resolve,r.reject=a.reject,a.allSettled&&(r.allSettled=a.allSettled),a.any&&(r.any=a.any))}}function At(){var e=i.Promise;return Ue?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,`Promise`),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function jt(e,t,n,r,i){var a=N;try{return kt(e,!0),t(n,r,i)}finally{kt(a,!1)}}function Mt(e,t,n,r){return typeof e==`function`?function(){var i=N;n&&wt(),kt(t,!0);try{return e.apply(this,arguments)}finally{kt(i,!1),r&&queueMicrotask(Tt)}}:e}function Nt(e){Promise===He&&_t.echoes===0?bt===0?e():enqueueNativeMicroTask(e):setTimeout(e,0)}var Pt=P.reject;function Ft(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!N.letThrough&&!e._vip){if(e._state.openComplete)return Pt(new A.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._state.autoOpen)return Pt(new A.DatabaseClosed);e.open().catch(j)}return e._state.dbReadyPromise.then(function(){return Ft(e,t,n,r)})}var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(i){return i.name===k.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn(`Dexie: Need to reopen db`),e.close({disableAutoOpen:!1}),e.open().then(function(){return Ft(e,t,n,r)})):Pt(i)}return i._promise(t,function(e,t){return Ct(function(){return N.trans=i,r(e,t,i)})}).then(function(e){if(t===`readwrite`)try{i.idbtrans.commit()}catch{}return t===`readonly`?e:i._completion.then(function(){return e})})}var It=`4.4.7`,Lt=``,F=-1/0,Rt=`Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.`,zt=`String expected.`,Bt=1e3,Vt=`__dbnames`,Ht=`readonly`,Ut=`readwrite`;function Wt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var Gt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Kt(e){return typeof e==`string`&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=ae(t),delete t[e]),t}:function(e){return e}}function qt(){throw A.Type(`Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.`)}function I(e,t){try{var n=Xt(e),r=Xt(t);if(n!==r)return n===`Array`?1:r===`Array`?-1:n===`binary`?1:r===`binary`?-1:n===`string`?1:r===`string`?-1:n===`Date`?1:r===`Date`?-1:NaN;switch(n){case`number`:case`Date`:case`string`:return e>t?1:e<t?-1:0;case`binary`:return Yt(Zt(e),Zt(t));case`Array`:return Jt(e,t)}}catch{}return NaN}function Jt(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,a=0;a<i;++a){var o=I(e[a],t[a]);if(o!==0)return o}return n===r?0:n<r?-1:1}function Yt(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,a=0;a<i;++a)if(e[a]!==t[a])return e[a]<t[a]?-1:1;return n===r?0:n<r?-1:1}function Xt(e){var t=typeof e;if(t!==`object`)return t;if(ArrayBuffer.isView(e))return`binary`;var n=ce(e);return n===`ArrayBuffer`?`binary`:n}function Zt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function Qt(e,t,n){var r=e.schema.yProps;return r?(t&&n.numFailures>0&&(t=t.filter(function(e,t){return!n.failures[t]})),Promise.all(r.map(function(n){var r=n.updatesTable;return t?e.db.table(r).where(`k`).anyOf(t).delete():e.db.table(r).clear()})).then(function(){return n})):n}var $t=function(){function e(e){this[`@@propmod`]=e}return e.prototype.execute=function(e){var t=this[`@@propmod`];if(t.add!==void 0){var n=t.add;if(o(n))return r(r([],o(e)?e:[],!0),n,!0).sort();if(typeof n==`number`)return(Number(e)||0)+n;if(typeof n==`bigint`)try{return BigInt(e)+n}catch{return BigInt(0)+n}throw TypeError(`Invalid term ${n}`)}if(t.remove!==void 0){var i=t.remove;if(o(i))return o(e)?e.filter(function(e){return!i.includes(e)}).sort():[];if(typeof i==`number`)return Number(e)-i;if(typeof i==`bigint`)try{return BigInt(e)-i}catch{return BigInt(0)-i}throw TypeError(`Invalid subtrahend ${i}`)}var a=t.replacePrefix?.[0];return a&&typeof e==`string`&&e.startsWith(a)?t.replacePrefix[1]+e.substring(a.length):e},e}();function en(e,t){for(var n=a(t),r=n.length,i=!1,o=0;o<r;++o){var s=n[o],c=t[s],l=C(e,s);c instanceof $t?(w(e,s,c.execute(l)),i=!0):l!==c&&(w(e,s,c),i=!0)}return i}var tn=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||N.trans,i=this.name,a=Ne&&typeof console<`u`&&console.createTask&&console.createTask(`Dexie: ${e===`readonly`?`read`:`write`} ${this.name}`);function o(e,n,r){if(!r.schema[i])throw new A.NotFound(`Table `+i+` not part of transaction`);return t(r.idbtrans,r)}var s=lt();try{var c=r&&r.db._novip===this.db._novip?r===N.trans?r._promise(e,o,n):Ct(function(){return r._promise(e,o,n)},{trans:r,transless:N.transless||N}):Ft(this.db,e,[this.name],o);return a&&(c._consoleTask=a,c=c.catch(function(e){return console.trace(e),Pt(e)})),c}finally{s&&ut()}},e.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):e==null?Pt(new A.Type(`Invalid argument to Table.get()`)):this._trans(`readonly`,function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},e.prototype.where=function(e){if(typeof e==`string`)return new this.db.WhereClause(this,e);if(o(e))return new this.db.WhereClause(this,`[${e.join(`+`)}]`);var t=a(e);if(t.length===1)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(e){if(e.compound&&t.every(function(t){return e.keyPath.indexOf(t)>=0})){for(var n=0;n<t.length;++n)if(t.indexOf(e.keyPath[n])===-1)return!1;return!0}return!1}).sort(function(e,t){return e.keyPath.length-t.keyPath.length})[0];if(n&&this.db._maxKey!==Lt){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map(function(t){return e[t]}))}!n&&Ne&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit from a compound index [${t.join(`+`)}]`);var i=this.schema.idxByName;function s(e,t){return I(e,t)===0}var c=t.reduce(function(t,n){var r=t[0],a=t[1],c=i[n],l=e[n];return[r||c,r||!c?Wt(a,c&&c.multi?function(e){var t=C(e,n);return o(t)&&t.some(function(e){return s(l,e)})}:function(e){return s(l,C(e,n))}):a]},[null,null]),l=c[0],u=c[1];return l?this.where(l.name).equals(e[l.keyPath]).filter(u):n?this.filter(u):this.where(t).equals(``)},e.prototype.filter=function(e){return this.toCollection().and(e)},e.prototype.count=function(e){return this.toCollection().count(e)},e.prototype.offset=function(e){return this.toCollection().offset(e)},e.prototype.limit=function(e){return this.toCollection().limit(e)},e.prototype.each=function(e){return this.toCollection().each(e)},e.prototype.toArray=function(e){return this.toCollection().toArray(e)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,o(e)?`[${e.join(`+`)}]`:e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){var n=this,r=n.db,i=n.name;this.schema.mappedClass=e,e.prototype instanceof qt&&(e=function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return Object.defineProperty(n.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),n.prototype.table=function(){return i},n}(e));for(var a=new Set,o=e.prototype;o;o=c(o))Object.getOwnPropertyNames(o).forEach(function(e){return a.add(e)});var s=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(!a.has(r))try{n[r]=t[r]}catch{}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=s,this.hook(`reading`,s),e},e.prototype.defineClass=function(){function e(e){s(this,e)}return this.mapToClass(e)},e.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,a=r.keyPath,o=e;return a&&i&&(o=Kt(a)(e)),this._trans(`readwrite`,function(e){return n.core.mutate({trans:e,type:`add`,keys:t==null?null:[t],values:[o]})}).then(function(e){return e.numFailures?P.reject(e.failures[0]):e.lastResult}).then(function(t){if(a)try{w(e,a,t)}catch{}return t})},e.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans(`readwrite`,function(i){return n.core.get({trans:i,key:e}).then(function(a){var o=a??{};return en(o,t),r&&w(o,r,e),n.core.mutate({trans:i,type:`put`,values:[o],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then(function(e){return e.numFailures?P.reject(e.failures[0]):!!a})})})},e.prototype.update=function(e,t){if(typeof e==`object`&&!o(e)){var n=C(e,this.schema.primKey.keyPath);return n===void 0?Pt(new A.InvalidArgument(`Given object does not contain its primary key`)):this.where(`:id`).equals(n).modify(t)}return this.where(`:id`).equals(e).modify(t)},e.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,a=r.keyPath,o=e;return a&&i&&(o=Kt(a)(e)),this._trans(`readwrite`,function(e){return n.core.mutate({trans:e,type:`put`,values:[o],keys:t==null?null:[t]})}).then(function(e){return e.numFailures?P.reject(e.failures[0]):e.lastResult}).then(function(t){if(a)try{w(e,a,t)}catch{}return t})},e.prototype.delete=function(e){var t=this;return this._trans(`readwrite`,function(n){return t.core.mutate({trans:n,type:`delete`,keys:[e]}).then(function(n){return Qt(t,[e],n)}).then(function(e){return e.numFailures?P.reject(e.failures[0]):void 0})})},e.prototype.clear=function(){var e=this;return this._trans(`readwrite`,function(t){return e.core.mutate({trans:t,type:`deleteRange`,range:Gt}).then(function(t){return Qt(e,null,t)})}).then(function(e){return e.numFailures?P.reject(e.failures[0]):void 0})},e.prototype.bulkGet=function(e){var t=this;return this._trans(`readonly`,function(n){return t.core.getMany({keys:e,trans:n}).then(function(e){return e.map(function(e){return t.hook.reading.fire(e)})})})},e.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0;n||=i?void 0:t;var a=n?n.allKeys:void 0;return this._trans(`readwrite`,function(t){var n=r.schema.primKey,o=n.auto,s=n.keyPath;if(s&&i)throw new A.InvalidArgument(`bulkAdd(): keys argument invalid on tables with inbound keys`);if(i&&i.length!==e.length)throw new A.InvalidArgument(`Arguments objects and keys must have the same length`);var c=e.length,l=s&&o?e.map(Kt(s)):e;return r.core.mutate({trans:t,type:`add`,keys:i,values:l,wantResults:a}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,o=e.failures,s=a?n:i;if(t===0)return s;throw new xe(`${r.name}.bulkAdd(): ${t} of ${c} operations failed`,o)})})},e.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0;n||=i?void 0:t;var a=n?n.allKeys:void 0;return this._trans(`readwrite`,function(t){var n=r.schema.primKey,o=n.auto,s=n.keyPath;if(s&&i)throw new A.InvalidArgument(`bulkPut(): keys argument invalid on tables with inbound keys`);if(i&&i.length!==e.length)throw new A.InvalidArgument(`Arguments objects and keys must have the same length`);var c=e.length,l=s&&o?e.map(Kt(s)):e;return r.core.mutate({trans:t,type:`put`,keys:i,values:l,wantResults:a}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,o=e.failures,s=a?n:i;if(t===0)return s;throw new xe(`${r.name}.bulkPut(): ${t} of ${c} operations failed`,o)})})},e.prototype.bulkUpdate=function(e){var t=this,n=e.map(function(e){return e.key}),r=e.map(function(e){return e.changes}),i=[];return this._trans(`readwrite`,function(a){var o=t.core;return o.getMany({trans:a,keys:n,cache:`clone`}).then(function(s){var c=o.schema.primaryKey,l=c.outbound,u=c.extractKey,d=[],f=[];e.forEach(function(e,t){var n=e.key,r=e.changes,a=s[t];if(a){for(var o=0,c=Object.keys(r);o<c.length;o++){var p=c[o];w(a,p,r[p])}if(!l&&I(u(a),n)!==0)throw new A.Constraint(`Cannot update primary key in bulkUpdate()`);i.push(t),d.push(n),f.push(a)}});var p=d.length;return o.mutate({trans:a,type:`put`,keys:d,values:f,updates:{keys:n,changeSpecs:r}}).then(function(e){var n=e.numFailures,r=e.failures;if(n===0)return p;for(var a=0,o=Object.keys(r);a<o.length;a++){var s=o[a],c=i[Number(s)];if(c!=null){var l=r[s];delete r[s],r[c]=l}}throw new xe(`${t.name}.bulkUpdate(): ${n} of ${p} operations failed`,r)})})})},e.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans(`readwrite`,function(n){return t.core.mutate({trans:n,type:`delete`,keys:e}).then(function(n){return Qt(t,e,n)})}).then(function(e){var r=e.numFailures,i=e.lastResult,a=e.failures;if(r===0)return i;throw new xe(`${t.name}.bulkDelete(): ${r} of ${n} operations failed`,a)})},e}();function nn(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,a=Array(i-1);--i;)a[i-1]=arguments[i];return t[n].subscribe.apply(null,a),e}if(typeof n==`string`)return t[n]};n.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return n;function s(e,r,i){if(typeof e==`object`)return c(e);r||=je,i||=j;var a={subscribers:[],fire:i,subscribe:function(e){a.subscribers.indexOf(e)===-1&&(a.subscribers.push(e),a.fire=r(a.fire,e))},unsubscribe:function(e){a.subscribers=a.subscribers.filter(function(t){return t!==e}),a.fire=a.subscribers.reduce(r,i)}};return t[e]=n[e]=a,a}function c(e){a(e).forEach(function(t){var n=e[t];if(o(n))s(t,e[t][0],e[t][1]);else if(n===`asap`)var r=s(t,M,function(){for(var e=arguments.length,t=Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach(function(e){x(function(){e.apply(null,t)})})});else throw new A.InvalidArgument(`Invalid event config`)})}}function rn(e,t){return m(t).from({prototype:e}),t}function an(e){return rn(tn.prototype,function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:nn(null,{creating:[Oe,j],reading:[Ee,M],updating:[Ae,j],deleting:[ke,j]})})}function on(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function sn(e,t){e.filter=Wt(e.filter,t)}function cn(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Wt(r(),t())}:t,e.justLimit=n&&!r}function ln(e,t){e.isMatch=Wt(e.isMatch,t)}function un(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new A.Schema(`KeyPath `+e.index+` on object store `+t.name+` is not indexed`);return n}function dn(e,t,n){var r=un(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir===`prev`,unique:!!e.unique,query:{index:r,range:e.range}})}function fn(e,t,n,r){var i=e.replayFilter?Wt(e.filter,e.replayFilter()):e.filter;if(e.or){var a={},o=function(e,n,r){if(!i||i(n,r,function(e){return n.stop(e)},function(e){return n.fail(e)})){var o=n.primaryKey,s=``+o;s===`[object ArrayBuffer]`&&(s=``+new Uint8Array(o)),u(a,s)||(a[s]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),pn(dn(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return pn(dn(e,r,n),Wt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function pn(e,t,n,r){var i=gt(r?function(e,t,i){return n(r(e),t,i)}:n);return e.then(function(e){if(e)return e.start(function(){var n=function(){return e.continue()};(!t||t(e,function(e){return n=e},function(t){e.stop(t),n=j},function(t){e.fail(t),n=j}))&&i(e.value,e,function(e){return n=e}),n()})})}var mn=function(){function e(){}return e.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Pt.bind(null,n.error)):n.table._trans(`readonly`,e).then(t)},e.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Pt.bind(null,t.error)):t.table._trans(`readwrite`,e,`locked`)},e.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Wt(t.algorithm,e)},e.prototype._iterate=function(e,t){return fn(this._ctx,e,t,this._ctx.table.core)},e.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return fn(t,e,n,t.table.core)})},e.prototype.count=function(e){var t=this;return this._read(function(e){var n=t._ctx,r=n.table.core;if(on(n,!0))return r.count({trans:e,query:{index:un(n,r.schema),range:n.range}}).then(function(e){return Math.min(e,n.limit)});var i=0;return fn(n,function(){return++i,!1},e,r).then(function(){return i})}).then(e)},e.prototype.sortBy=function(e,t){var n=e.split(`.`).reverse(),r=n[0],i=n.length-1;function a(e,t){return t?a(e[n[t]],t-1):e[r]}var o=this._ctx.dir===`next`?1:-1;function s(e,t){return I(a(e,i),a(t,i))*o}return this.toArray(function(e){return e.slice().sort(s)}).then(t)},e.prototype.toArray=function(e){var t=this;return this._read(function(e){var n=t._ctx;if(on(n,!0)&&n.limit>0){var r=n.valueMapper,i=un(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,direction:n.dir===`prev`?`prev`:void 0,query:{index:i,range:n.range}}).then(function(e){var t=e.result;return r?t.map(r):t})}var a=[];return fn(n,function(e){return a.push(e)},e,n.table.core).then(function(){return a})},e)},e.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,on(t)?cn(t,function(){var t=e;return function(e,n){return t===0?!0:t===1?(--t,!1):(n(function(){e.advance(t),t=0}),!1)}}):cn(t,function(){var t=e;return function(){return--t<0}})),this},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),cn(this._ctx,function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}},!0),this},e.prototype.until=function(e,t){return sn(this._ctx,function(n,r,i){return!e(n.value)||(r(i),t)}),this},e.prototype.first=function(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)},e.prototype.last=function(e){return this.reverse().first(e)},e.prototype.filter=function(e){return sn(this._ctx,function(t){return e(t.value)}),ln(this._ctx,e),this},e.prototype.and=function(e){return this.filter(e)},e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},e.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir===`prev`?`next`:`prev`,this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})},e.prototype.eachUniqueKey=function(e){return this._ctx.unique=`unique`,this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})},e.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)},e.prototype.primaryKeys=function(e){var t=this._ctx;if(on(t,!0)&&t.limit>0)return this._read(function(e){var n=un(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,direction:t.dir===`prev`?`prev`:void 0,query:{index:n,range:t.range}})}).then(function(e){return e.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).then(e)},e.prototype.uniqueKeys=function(e){return this._ctx.unique=`unique`,this.keys(e)},e.prototype.firstKey=function(e){return this.limit(1).keys(function(e){return e[0]}).then(e)},e.prototype.lastKey=function(e){return this.reverse().firstKey(e)},e.prototype.distinct=function(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return sn(this._ctx,function(e){var t=e.primaryKey.toString(),r=u(n,t);return n[t]=!0,!r}),this},e.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){var i=typeof e==`function`?e:function(t){return en(t,e)},o=n.table.core,s=o.schema.primaryKey,c=s.outbound,l=s.extractKey,u=200,d=t.db._options.modifyChunkSize;d&&(u=typeof d==`object`?d[o.name]||d[`*`]||200:d);var f=[],p=0,m=[],h=function(e,t){var n=t.failures,r=t.numFailures;p+=e-r;for(var i=0,o=a(n);i<o.length;i++){var s=o[i];f.push(n[s])}},g=e===hn;return t.clone().primaryKeys().then(function(t){var a=on(n)&&n.limit===1/0&&(typeof e!=`function`||g)&&{index:n.index,range:n.range},s=function(d){var f=Math.min(u,t.length-d),p=t.slice(d,d+f);return(g?Promise.resolve([]):o.getMany({trans:r,keys:p,cache:`immutable`})).then(function(m){var _=[],v=[],y=c?[]:null,b=g?p:[];if(!g)for(var x=0;x<f;++x){var S=m[x],C={value:ae(S),primKey:t[d+x]};i.call(C,C.value,C)!==!1&&(C.value==null?b.push(t[d+x]):!c&&I(l(S),l(C.value))!==0?(b.push(t[d+x]),_.push(C.value)):(v.push(C.value),c&&y.push(t[d+x])))}return Promise.resolve(_.length>0&&o.mutate({trans:r,type:`add`,values:_}).then(function(e){for(var t in e.failures)b.splice(parseInt(t),1);h(_.length,e)})).then(function(){return(v.length>0||a&&typeof e==`object`)&&o.mutate({trans:r,type:`put`,keys:y,values:v,criteria:a,changeSpec:typeof e!=`function`&&e,isAdditionalChunk:d>0}).then(function(e){return h(v.length,e)})}).then(function(){return(b.length>0||a&&g)&&o.mutate({trans:r,type:`delete`,keys:b,criteria:a,isAdditionalChunk:d>0}).then(function(e){return Qt(n.table,b,e)}).then(function(e){return h(b.length,e)})}).then(function(){return t.length>d+f&&s(d+u)})})};return s(0).then(function(){if(f.length>0)throw new be(`Error modifying one or more objects`,f,p,m);return t.length})})})},e.prototype.delete=function(){var e=this._ctx,t=e.range;return on(e)&&!e.table.schema.yProps&&(e.isPrimKey||t.type===3)?this._write(function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then(function(t){return e.table.core.mutate({trans:n,type:`deleteRange`,range:i}).then(function(e){var n=e.failures,r=e.numFailures;if(r)throw new be(`Could not delete some values`,Object.keys(n).map(function(e){return n[e]}),t-r);return t-r})})}):this.modify(hn)},e}(),hn=function(e,t){return t.value=null};function gn(e){return rn(mn.prototype,function(t,n){this.db=e;var r=Gt,i=null;if(n)try{r=n()}catch(e){i=e}var a=t._ctx,o=a.table,s=o.hook.reading.fire;this._ctx={table:o,index:a.index,isPrimKey:!a.index||o.schema.primKey.keyPath&&a.index===o.schema.primKey.name,range:r,keysOnly:!1,dir:`next`,unique:``,algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:a.or,valueMapper:s===M?null:s}})}function _n(e,t){return e<t?-1:e===t?0:1}function vn(e,t){return e>t?-1:e===t?0:1}function yn(e,t,n){var r=e instanceof Dn?new e.Collection(e):e;return r._ctx.error=n?new n(t):TypeError(t),r}function bn(e){var t=new e.Collection(e,function(){return En(``)});return t._addAlgorithm(function(){return!1}),t}function xn(e){return e===`next`?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function Sn(e){return e===`next`?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function Cn(e,t,n,r,i,a){for(var o=Math.min(e.length,r.length),s=-1,c=0;c<o;++c){var l=t[c];if(l!==r[c])return i(e[c],n[c])<0?e.substr(0,c)+n[c]+n.substr(c+1):i(e[c],r[c])<0?e.substr(0,c)+r[c]+n.substr(c+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[c],l)<0&&(s=c)}return o<r.length&&a===`next`?e+n.substr(e.length):o<e.length&&a===`prev`?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}function wn(e,t,n,r){var i,a,o,s,c,l,u,d=n.length;if(!n.every(function(e){return typeof e==`string`}))return yn(e,zt);function f(e){i=xn(e),a=Sn(e),o=e===`next`?_n:vn;var t=n.map(function(e){return{lower:a(e),upper:i(e)}}).sort(function(e,t){return o(e.lower,t.lower)});s=t.map(function(e){return e.upper}),c=t.map(function(e){return e.lower}),l=e,u=e===`next`?``:r}f(`next`);var p=new e.Collection(e,function(){return Tn(s[0],c[d-1]+r)});p._ondirectionchange=function(e){f(e)};var m=0;return p._addAlgorithm(function(e,n,r){var i=e.key;if(typeof i!=`string`)return!1;var f=a(i);if(t(f,c,m))return!0;for(var p=null,h=m;h<d;++h){var g=Cn(i,f,s[h],c[h],o,l);g===null&&p===null?m=h+1:(p===null||o(p,g)>0)&&(p=g)}return n(p===null?r:function(){e.continue(p+u)}),!1}),p}function Tn(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function En(e){return{type:1,lower:e,upper:e}}var Dn=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(e,t,n,r){n=n!==!1,r=r===!0;try{return this._cmp(e,t)>0||this._cmp(e,t)===0&&(n||r)&&!(n&&r)?bn(this):new this.Collection(this,function(){return Tn(e,t,!n,!r)})}catch{return yn(this,Rt)}},e.prototype.equals=function(e){return e==null?yn(this,Rt):new this.Collection(this,function(){return En(e)})},e.prototype.above=function(e){return e==null?yn(this,Rt):new this.Collection(this,function(){return Tn(e,void 0,!0)})},e.prototype.aboveOrEqual=function(e){return e==null?yn(this,Rt):new this.Collection(this,function(){return Tn(e,void 0,!1)})},e.prototype.below=function(e){return e==null?yn(this,Rt):new this.Collection(this,function(){return Tn(void 0,e,!1,!0)})},e.prototype.belowOrEqual=function(e){return e==null?yn(this,Rt):new this.Collection(this,function(){return Tn(void 0,e)})},e.prototype.startsWith=function(e){return typeof e==`string`?this.between(e,e+Lt,!0,!0):yn(this,zt)},e.prototype.startsWithIgnoreCase=function(e){return e===``?this.startsWith(e):wn(this,function(e,t){return e.indexOf(t[0])===0},[e],Lt)},e.prototype.equalsIgnoreCase=function(e){return wn(this,function(e,t){return e===t[0]},[e],``)},e.prototype.anyOfIgnoreCase=function(){var e=fe.apply(O,arguments);return e.length===0?bn(this):wn(this,function(e,t){return t.indexOf(e)!==-1},e,``)},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=fe.apply(O,arguments);return e.length===0?bn(this):wn(this,function(e,t){return t.some(function(t){return e.indexOf(t)===0})},e,Lt)},e.prototype.anyOf=function(){var e=this,t=fe.apply(O,arguments),n=this._cmp;try{t.sort(n)}catch{return yn(this,Rt)}if(t.length===0)return bn(this);var r=new this.Collection(this,function(){return Tn(t[0],t[t.length-1])});r._ondirectionchange=function(r){n=r===`next`?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm(function(e,r,a){for(var o=e.key;n(o,t[i])>0;)if(++i,i===t.length)return r(a),!1;return n(o,t[i])===0||(r(function(){e.continue(t[i])}),!1)}),r},e.prototype.notEqual=function(e){return this.inAnyRange([[F,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=fe.apply(O,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return yn(this,Rt)}var t=e.reduce(function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[F,t]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,a=this._descending,o=this._min,s=this._max;if(e.length===0)return bn(this);if(!e.every(function(e){return e[0]!==void 0&&e[1]!==void 0&&i(e[0],e[1])<=0}))return yn(this,`First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower`,A.InvalidArgument);var c=!t||t.includeLowers!==!1,l=t&&t.includeUppers===!0;function u(e,t){for(var n=0,i=e.length;n<i;++n){var a=e[n];if(r(t[0],a[1])<0&&r(t[1],a[0])>0){a[0]=o(a[0],t[0]),a[1]=s(a[1],t[1]);break}}return n===i&&e.push(t),e}var d=i;function f(e,t){return d(e[0],t[0])}var p;try{p=e.reduce(u,[]),p.sort(f)}catch{return yn(this,Rt)}var m=0,h=l?function(e){return i(e,p[m][1])>0}:function(e){return i(e,p[m][1])>=0},g=c?function(e){return a(e,p[m][0])>0}:function(e){return a(e,p[m][0])>=0};function _(e){return!h(e)&&!g(e)}var v=h,y=new this.Collection(this,function(){return Tn(p[0][0],p[p.length-1][1],!c,!l)});return y._ondirectionchange=function(e){e===`next`?(v=h,d=i):(v=g,d=a),p.sort(f)},y._addAlgorithm(function(e,t,r){for(var a=e.key;v(a);)if(++m,m===p.length)return t(r),!1;return _(a)?!0:(n._cmp(a,p[m][1])===0||n._cmp(a,p[m][0])===0||t(function(){d===i?e.continue(p[m][0]):e.continue(p[m][1])}),!1)}),y},e.prototype.startsWithAnyOf=function(){var e=fe.apply(O,arguments);return e.every(function(e){return typeof e==`string`})?e.length===0?bn(this):this.inAnyRange(e.map(function(e){return[e,e+Lt]})):yn(this,`startsWithAnyOf() only works with strings`)},e}();function On(e){return rn(Dn.prototype,function(t,n,r){if(this.db=e,this._ctx={table:t,index:n===`:id`?null:n,or:r},this._cmp=this._ascending=I,this._descending=function(e,t){return I(t,e)},this._max=function(e,t){return I(e,t)>0?e:t},this._min=function(e,t){return I(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange,!this._IDBKeyRange)throw new A.MissingAPI})}function kn(e){return gt(function(t){return An(t),e(t.target.error),!1})}function An(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var jn=`storagemutated`,Mn=`x-storagemutated-1`,Nn=nn(null,jn),Pn=function(){function e(){}return e.prototype._lock=function(){return b(!N.global),++this._reculock,this._reculock===1&&!N.global&&(N.lockOwnerFor=this),this},e.prototype._unlock=function(){if(b(!N.global),--this._reculock===0)for(N.global||(N.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{jt(e[1],e[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&N.lockOwnerFor!==this},e.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!n)switch(r&&r.name){case`DatabaseClosedError`:throw new A.DatabaseClosed(r);case`MissingAPIError`:throw new A.MissingAPI(r.message,r);default:throw new A.OpenFailed(r)}if(!this.active)throw new A.TransactionInactive;return b(this._completion._state===null),e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),e.onerror=gt(function(n){An(n),t._reject(e.error)}),e.onabort=gt(function(n){An(n),t.active&&t._reject(new A.Abort(e.error)),t.active=!1,t.on(`abort`).fire(n)}),e.oncomplete=gt(function(){t.active=!1,t._resolve(),`mutatedParts`in e&&Nn.storagemutated.fire(e.mutatedParts)}),this},e.prototype._promise=function(e,t,n){var r=this;if(e===`readwrite`&&this.mode!==`readwrite`)return Pt(new A.ReadOnly(`Transaction is readonly`));if(!this.active)return Pt(new A.TransactionInactive);if(this._locked())return new P(function(i,a){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,a)},N])});if(n)return Ct(function(){var e=new P(function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)});return e.finally(function(){return r._unlock()}),e._lib=!0,e});var i=new P(function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)});return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var t=this._root(),n=P.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);(function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)})()}var i=t._waitingFor;return new P(function(e,r){n.then(function(n){return t._waitingQueue.push(gt(e.bind(null,n)))},function(e){return t._waitingQueue.push(gt(r.bind(null,e)))}).finally(function(){t._waitingFor===i&&(t._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new A.Abort))},e.prototype.table=function(e){var t=this._memoizedTables||={};if(u(t,e))return t[e];var n=this.schema[e];if(!n)throw new A.NotFound(`Table `+e+` not part of transaction`);var r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r},e}();function Fn(e){return rn(Pn.prototype,function(t,n,r,i,a){var o=this;t!==`readonly`&&n.forEach(function(e){var t=r[e]?.yProps;t&&(n=n.concat(t.map(function(e){return e.updatesTable})))}),this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=nn(this,`complete`,`error`,`abort`),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new P(function(e,t){o._resolve=e,o._reject=t}),this._completion.then(function(){o.active=!1,o.on.complete.fire()},function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),Pt(e)})})}function In(e,t,n,r,i,a,o,s){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:a,src:(n&&!o?`&`:``)+(r?`*`:``)+(i?`++`:``)+Ln(t),type:s}}function Ln(e){return typeof e==`string`?e:e?`[`+[].join.call(e,`+`)+`]`:``}function Rn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:S(n,function(e){return[e.name,e]})}}function zn(e){return e.length===1?e[0]:e}var Bn=function(e){try{return e.only([[]]),Bn=function(){return[[]]},[[]]}catch{return Bn=function(){return Lt},Lt}};function Vn(e){return e==null?function(){}:typeof e==`string`?Hn(e):function(t){return C(t,e)}}function Hn(e){return e.split(`.`).length===1?function(t){return t[e]}:function(t){return C(t,e)}}function Un(e){return[].slice.call(e)}var Wn=0;function Gn(e){return e==null?`:id`:typeof e==`string`?e:`[${e.join(`+`)}]`}function Kn(e,t,n){function r(e,t){var n=Un(e.objectStoreNames),r=n.length>0?t.objectStore(n[0]):{};return{schema:{name:e.name,tables:n.map(function(e){return t.objectStore(e)}).map(function(e){var t=e.keyPath,n=e.autoIncrement,r=o(t),i=t==null,a={},s={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Vn(t)},indexes:Un(e.indexNames).map(function(t){return e.index(t)}).map(function(e){var t=e.name,n=e.unique,r=e.multiEntry,i=e.keyPath,s={name:t,compound:o(i),keyPath:i,unique:n,multiEntry:r,extractKey:Vn(i)};return a[Gn(i)]=s,s}),getIndexByKeyPath:function(e){return a[Gn(e)]}};return a[`:id`]=s.primaryKey,t!=null&&(a[Gn(t)]=s.primaryKey),s})},hasGetAll:n.length>0&&`getAll`in r&&!(typeof navigator<`u`&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604),hasIdb3Features:`getAllRecords`in r}}function i(e){if(e.type===3)return null;if(e.type===4)throw Error(`Cannot convert never type to IDBKeyRange`);var n=e.lower,r=e.upper,i=e.lowerOpen,a=e.upperOpen;return n===void 0?r===void 0?null:t.upperBound(r,!!a):r===void 0?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!a)}function a(e){var t=e.name;function n(e){var n=e.trans,r=e.type,a=e.keys,o=e.values,s=e.range;return new Promise(function(e,c){e=gt(e);var l=n.objectStore(t),u=l.keyPath==null,d=r===`put`||r===`add`;if(!d&&r!==`delete`&&r!==`deleteRange`)throw Error(`Invalid operation type: `+r);var f=(a||o||{length:1}).length;if(a&&o&&a.length!==o.length)throw Error(`Given keys array must have same length as given values array.`);if(f===0)return e({numFailures:0,failures:{},results:[],lastResult:void 0});var p,m=[],h=[],g=0,_=function(e){++g,An(e)};if(r===`deleteRange`){if(s.type===4)return e({numFailures:g,failures:h,results:[],lastResult:void 0});s.type===3?m.push(p=l.clear()):m.push(p=l.delete(i(s)))}else{var v=d?u?[o,a]:[o,null]:[a,null],y=v[0],b=v[1];if(d)for(var x=0;x<f;++x)m.push(p=b&&b[x]!==void 0?l[r](y[x],b[x]):l[r](y[x])),p.onerror=_;else for(var x=0;x<f;++x)m.push(p=l[r](y[x])),p.onerror=_}var S=function(t){var n=t.target.result;m.forEach(function(e,t){return e.error!=null&&(h[t]=e.error)}),e({numFailures:g,failures:h,results:r===`delete`?a:m.map(function(e){return e.result}),lastResult:n})};p.onerror=function(e){_(e),S(e)},p.onsuccess=S})}function r(e){var n=e.trans,r=e.values,a=e.query,o=e.reverse,s=e.unique;return new Promise(function(e,c){e=gt(e);var l=a.index,u=a.range,d=n.objectStore(t),f=l.isPrimaryKey?d:d.index(l.name),p=o?s?`prevunique`:`prev`:s?`nextunique`:`next`,m=r||!(`openKeyCursor`in f)?f.openCursor(i(u),p):f.openKeyCursor(i(u),p);m.onerror=kn(c),m.onsuccess=gt(function(t){var r=m.result;if(!r)e(null);else{r.___id=++Wn,r.done=!1;var i=r.continue.bind(r),a=r.continuePrimaryKey;a&&=a.bind(r);var o=r.advance.bind(r),s=function(){throw Error(`Cursor not started`)},l=function(){throw Error(`Cursor not stopped`)};r.trans=n,r.stop=r.continue=r.continuePrimaryKey=r.advance=s,r.fail=gt(c),r.next=function(){var e=this,t=1;return this.start(function(){return t--?e.continue():e.stop()}).then(function(){return e})},r.start=function(e){var t=new Promise(function(e,t){e=gt(e),m.onerror=kn(t),r.fail=t,r.stop=function(t){r.stop=r.continue=r.continuePrimaryKey=r.advance=l,e(t)}}),n=function(){if(m.result)try{e()}catch(e){r.fail(e)}else r.done=!0,r.start=function(){throw Error(`Cursor behind last entry`)},r.stop()};return m.onsuccess=gt(function(e){m.onsuccess=n,n()}),r.continue=i,r.continuePrimaryKey=a,r.advance=o,n(),t},e(r)}},c)})}function a(e,n){return function(r){return new Promise(function(a,o){a=gt(a);var s=r.trans,c=r.values,l=r.limit,u=r.query,d=r.direction??`next`,f=l===1/0?void 0:l,p=u.index,m=u.range,h=s.objectStore(t),g=p.isPrimaryKey?h:h.index(p.name),_=i(m);if(l===0)return a({result:[]});if(n){var v={query:_,count:f,direction:d},y=c?g.getAll(v):g.getAllKeys(v);y.onsuccess=function(e){return a({result:e.target.result})},y.onerror=kn(o)}else if(e&&d===`next`){var y=c?g.getAll(_,f):g.getAllKeys(_,f);y.onsuccess=function(e){return a({result:e.target.result})},y.onerror=kn(o)}else{var b=0,x=c||!(`openKeyCursor`in g)?g.openCursor(_,d):g.openKeyCursor(_,d),S=[];x.onsuccess=function(){var e=x.result;if(!e||(S.push(c?e.value:e.primaryKey),++b===l))return a({result:S});e.continue()},x.onerror=kn(o)}})}}return{name:t,schema:e,mutate:n,getMany:function(e){var n=e.trans,r=e.keys;return new Promise(function(e,i){e=gt(e);for(var a=n.objectStore(t),o=r.length,s=Array(o),c=0,l=0,u,d=function(t){var n=t.target;s[n._pos]=n.result,++l===c&&e(s)},f=kn(i),p=0;p<o;++p)r[p]!=null&&(u=a.get(r[p]),u._pos=p,u.onsuccess=d,u.onerror=f,++c);c===0&&e(s)})},get:function(e){var n=e.trans,r=e.key;return new Promise(function(e,i){e=gt(e);var a=n.objectStore(t).get(r);a.onsuccess=function(t){return e(t.target.result)},a.onerror=kn(i)})},query:a(l,u),openCursor:r,count:function(e){var n=e.query,r=e.trans,a=n.index,o=n.range;return new Promise(function(e,n){var s=r.objectStore(t),c=a.isPrimaryKey?s:s.index(a.name),l=i(o),u=l?c.count(l):c.count();u.onsuccess=gt(function(t){return e(t.target.result)}),u.onerror=kn(n)})}}}var s=r(e,n),c=s.schema,l=s.hasGetAll,u=s.hasIdb3Features,d=c.tables.map(function(e){return a(e)}),f={};return d.forEach(function(e){return f[e.name]=e}),{stack:`dbcore`,transaction:e.transaction.bind(e),table:function(e){if(!f[e])throw Error(`Table '${e}' not found`);return f[e]},MIN_KEY:-1/0,MAX_KEY:Bn(t),schema:c}}function qn(e,t){return t.reduce(function(e,t){var r=t.create;return n(n({},e),r(e))},e)}function Jn(e,t,n,r){var i=n.IDBKeyRange;return n.indexedDB,{dbcore:qn(Kn(t,i,r),e.dbcore)}}function Yn(e,t){var n=t.db;e.core=Jn(e._middlewares,n,e._deps,t).dbcore,e.tables.forEach(function(t){var n=t.name;e.core.schema.tables.some(function(e){return e.name===n})&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))})}function Xn(e,t,n,r){n.forEach(function(n){var i=r[n];t.forEach(function(t){var r=g(t,n);(!r||`value`in r&&r.value===void 0)&&(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)},set:function(e){f(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))})})}function Zn(e,t){t.forEach(function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]})}function Qn(e,t){return e._cfg.version-t._cfg.version}function $n(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains(`$meta`)&&!i.$meta&&(i.$meta=Rn(`$meta`,dr(``)[0],[]),e._storeNames.push(`$meta`));var o=e._createTransaction(`readwrite`,e._storeNames,i);o.create(n),o._completion.catch(r);var s=o._reject.bind(o),c=N.transless||N;Ct(function(){if(N.trans=o,N.transless=c,t===0)a(i).forEach(function(e){ir(n,e,i[e].primKey,i[e].indexes)}),Yn(e,n),P.follow(function(){return e.on.populate.fire(o)}).catch(s);else return Yn(e,n),tr(e,o,t).then(function(t){return nr(e,t,o,n)}).catch(s)})}function er(e,t){ar(e._dbSchema,t),t.db.version%10==0&&!t.objectStoreNames.contains(`$meta`)&&t.db.createObjectStore(`$meta`).add(Math.ceil(t.db.version/10-1),`version`);var n=cr(e,e.idbdb,t);ur(e,e._dbSchema,t);for(var r=rr(n,e._dbSchema),i=function(e){if(e.change.length||e.recreate)return console.warn(`Unable to patch indexes of table ${e.name} because it has changes on the type of index or primary key.`),{value:void 0};var n=t.objectStore(e.name);e.add.forEach(function(t){Ne&&console.debug(`Dexie upgrade patch: Creating missing index ${e.name}.${t.src}`),sr(n,t)})},a=0,o=r.change;a<o.length;a++){var s=o[a],c=i(s);if(typeof c==`object`)return c.value}}function tr(e,t,n){return t.storeNames.includes(`$meta`)?t.table(`$meta`).get(`version`).then(function(e){return e??n}):P.resolve(n)}function nr(e,t,n,r){var i=[],o=e._versions,s=e._dbSchema=cr(e,e.idbdb,r),c=o.filter(function(e){return e._cfg.version>=t});if(c.length===0)return P.resolve();c.forEach(function(o){i.push(function(){var i=s,c=o._cfg.dbschema;ur(e,i,r),ur(e,c,r),s=e._dbSchema=c;var l=rr(i,c);l.add.forEach(function(e){ir(r,e[0],e[1].primKey,e[1].indexes)}),l.change.forEach(function(e){if(e.recreate)throw new A.Upgrade(`Not yet support for changing primary key`);var t=r.objectStore(e.name);e.add.forEach(function(e){return sr(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),sr(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var u=o._cfg.contentUpgrade;if(u&&o._cfg.version>t){Yn(e,r),n._memoizedTables={};var d=ee(c);l.del.forEach(function(e){d[e]=i[e]}),Zn(e,[e.Transaction.prototype]),Xn(e,[e.Transaction.prototype],a(d),d),n.schema=d;var f=pe(u);f&&wt();var p,m=P.follow(function(){if(p=u(n),p&&f){var e=Tt.bind(null,null);p.then(e,e)}});return p&&typeof p.then==`function`?P.resolve(p):m.then(function(){return p})}}),i.push(function(t){var r=o._cfg.dbschema;or(r,t),Zn(e,[e.Transaction.prototype]),Xn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema}),i.push(function(t){e.idbdb.objectStoreNames.contains(`$meta`)&&(Math.ceil(e.idbdb.version/10)===o._cfg.version?(e.idbdb.deleteObjectStore(`$meta`),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter(function(e){return e!==`$meta`})):t.objectStore(`$meta`).put(o._cfg.version,`version`))})});function l(){return i.length?P.resolve(i.shift()(n.idbtrans)).then(l):P.resolve()}return l().then(function(){ar(s,r)})}function rr(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],a=t[r];if(!i)n.add.push([r,a]);else{var o={name:r,def:a,recreate:!1,del:[],add:[],change:[]};if(``+(i.primKey.keyPath||``)!=``+(a.primKey.keyPath||``)||i.primKey.auto!==a.primKey.auto)o.recreate=!0,n.change.push(o);else{var s=i.idxByName,c=a.idxByName,l=void 0;for(l in s)c[l]||o.del.push(l);for(l in c){var u=s[l],d=c[l];u?u.src!==d.src&&o.change.push(d):o.add.push(d)}(o.del.length>0||o.add.length>0||o.change.length>0)&&n.change.push(o)}}}return n}function ir(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(e){return sr(i,e)}),i}function ar(e,t){a(e).forEach(function(n){t.db.objectStoreNames.contains(n)||(Ne&&console.debug(`Dexie: Creating missing table`,n),ir(t,n,e[n].primKey,e[n].indexes))})}function or(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function sr(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function cr(e,t,n){var r={};return v(t.objectStoreNames,0).forEach(function(e){for(var t=n.objectStore(e),i=t.keyPath,a=In(Ln(i),i||``,!0,!1,!!t.autoIncrement,i&&typeof i!=`string`,!0),o=[],s=0;s<t.indexNames.length;++s){var c=t.index(t.indexNames[s]);i=c.keyPath;var l=In(c.name,i,!!c.unique,!!c.multiEntry,!1,i&&typeof i!=`string`,!1);o.push(l)}r[e]=Rn(e,a,o)}),r}function L(e,t,n){e.verno=t.version/10;var r=e._dbSchema=cr(e,t,n);e._storeNames=v(t.objectStoreNames,0),Xn(e,[e._allTables],a(r),r)}function lr(e,t){var n=rr(cr(e,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some(function(e){return e.add.length||e.change.length}))}function ur(e,t,n){for(var r=n.db.objectStoreNames,a=0;a<r.length;++a){var o=r[a],s=n.objectStore(o);e._hasGetAll=`getAll`in s;for(var c=0;c<s.indexNames.length;++c){var l=s.indexNames[c],u=s.index(l).keyPath,d=typeof u==`string`?u:`[`+v(u).join(`+`)+`]`;if(t[o]){var f=t[o].idxByName[d];f&&(f.name=l,delete t[o].idxByName[d],t[o].idxByName[l]=f)}}}typeof navigator<`u`&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function dr(e){return e.split(`,`).map(function(e,t){var n=e.split(`:`),r=n[1]?.trim();e=n[0].trim();var i=e.replace(/([&*]|\+\+)/g,``),a=/^\[/.test(i)?i.match(/^\[(.*)\]$/)[1].split(`+`):i;return In(i,a||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),o(a),t===0,r)})}var fr=function(){function e(){}return e.prototype._createTableSchema=function(e,t,n){return Rn(e,t,n)},e.prototype._parseIndexSyntax=function(e){return dr(e)},e.prototype._parseStoresSpec=function(e,t){var n=this;a(e).forEach(function(r){if(e[r]!==null){var i=n._parseIndexSyntax(e[r]),a=i.shift();if(!a)throw new A.Schema(`Invalid schema for table `+r+`: `+e[r]);if(a.unique=!0,a.multi)throw new A.Schema(`Primary key cannot be multiEntry*`);i.forEach(function(e){if(e.auto)throw new A.Schema(`Only primary key can be marked as autoIncrement (++)`);if(!e.keyPath)throw new A.Schema(`Index must have a name and cannot be an empty string`)}),t[r]=n._createTableSchema(r,a,i)}})},e.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;var n=t._versions,r={},i={};return n.forEach(function(e){s(r,e._cfg.storesSource),i=e._cfg.dbschema={},e._parseStoresSpec(r,i)}),t._dbSchema=i,Zn(t,[t._allTables,t,t.Transaction.prototype]),Xn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],a(i),i),t._storeNames=a(i),this},e.prototype.upgrade=function(e){return this._cfg.contentUpgrade=Me(this._cfg.contentUpgrade||j,e),this},e}();function pr(e){return rn(fr.prototype,function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}var mr=hr();function hr(){if(typeof FinalizationRegistry<`u`&&typeof WeakRef<`u`){var e=new Set,t=new FinalizationRegistry(function(t){e.delete(t)}),n=function(){return Array.from(e).map(function(e){return e.deref()}).filter(function(e){return e!==void 0})},r=function(n){var r=new WeakRef(n._novip);if(e.add(r),t.register(n._novip,r,r),e.size>n._options.maxConnections){var i=e.values().next().value;e.delete(i),t.unregister(i)}},i=function(n){if(n)for(var r=e.values(),i=r.next();!i.done;){var a=i.value;if(a.deref()===n._novip){e.delete(a),t.unregister(a);return}i=r.next()}};return{toArray:n,add:r,remove:i}}var a=[],n=function(){return a},r=function(e){a.push(e._novip)},i=function(e){if(e){var t=a.indexOf(e._novip);t!==-1&&a.splice(t,1)}};return{toArray:n,add:r,remove:i}}function gr(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new hi(Vt,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:`name`})),n.table(`dbnames`)}function _r(e){return e&&typeof e.databases==`function`}function vr(e){var t=e.indexedDB,n=e.IDBKeyRange;return _r(t)?Promise.resolve(t.databases()).then(function(e){return e.map(function(e){return e.name}).filter(function(e){return e!==Vt})}):gr(t,n).toCollection().primaryKeys()}function yr(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!_r(n)&&t!==Vt&&gr(n,r).put({name:t}).catch(j)}function br(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!_r(n)&&t!==Vt&&gr(n,r).delete(t).catch(j)}function xr(e){return Ct(function(){return N.letThrough=!0,e()})}function Sr(){if(navigator.userAgentData||!/Safari\//.test(navigator.userAgent)||/Chrom(e|ium)\//.test(navigator.userAgent)||!indexedDB.databases)return Promise.resolve();var e;return new Promise(function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()}).finally(function(){return clearInterval(e)})}var Cr;function wr(e){return!(`from`in e)}var Tr=function(e,t){if(this)s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new Tr;return e&&`d`in e&&s(n,e),n}};d(Tr.prototype,(Cr={add:function(e){return Dr(this,e),this},addKey:function(e){return Er(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(e){return Er(t,e,e)}),this},hasKey:function(e){var t=kr(this).next(e).value;return t&&I(t.from,e)<=0&&I(t.to,e)>=0}},Cr[le]=function(){return kr(this)},Cr));function Er(e,t,n){var r=I(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(wr(e))return s(e,{from:t,to:n,d:1});var i=e.l,a=e.r;if(I(n,e.from)<0)return i?Er(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ar(e);if(I(t,e.to)>0)return a?Er(a,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ar(e);I(t,e.from)<0&&(e.from=t,e.l=null,e.d=a?a.d+1:1),I(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var o=!e.r;i&&!e.l&&Dr(e,i),a&&o&&Dr(e,a)}}function Dr(e,t){function n(e,t){var r=t.from,i=t.to,a=t.l,o=t.r;Er(e,r,i),a&&n(e,a),o&&n(e,o)}wr(t)||n(e,t)}function Or(e,t){var n=kr(t),r=n.next();if(r.done)return!1;for(var i=r.value,a=kr(e),o=a.next(i.from),s=o.value;!r.done&&!o.done;){if(I(s.from,i.to)<=0&&I(s.to,i.from)>=0)return!0;I(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(o=a.next(i.from)).value}return!1}function kr(e){var t=wr(e)?null:{s:0,n:e};return{next:function(e){for(var n=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&I(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||I(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Ar(e){var t=(e.r?.d||0)-(e.l?.d||0),r=t>1?`r`:t<-1?`l`:``;if(r){var i=r===`r`?`l`:`r`,a=n({},e),o=e[r];e.from=o.from,e.to=o.to,e[r]=o[r],a[r]=o[i],e[i]=a,a.d=jr(a)}e.d=jr(e)}function jr(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function Mr(e,t){return a(t).forEach(function(n){e[n]?Dr(e[n],t[n]):e[n]=re(t[n])}),e}function Nr(e,t){return e.all||t.all||Object.keys(e).some(function(n){return t[n]&&Or(t[n],e[n])})}var Pr={},Fr={},Ir=!1;function Lr(e,t){Mr(Fr,e),Ir||(Ir=!0,setTimeout(function(){Ir=!1;var e=Fr;Fr={},Rr(e,!1)},0))}function Rr(e,t){t===void 0&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(Pr);r<i.length;r++){var a=i[r];zr(a,e,n,t)}else for(var o in e){var s=/^idb\:\/\/(.*)\/(.*)\//.exec(o);if(s){var a=Pr[`idb://${s[1]}/${s[2]}`];a&&zr(a,e,n,t)}}n.forEach(function(e){return e()})}function zr(e,t,n,r){for(var i=[],a=0,o=Object.entries(e.queries.query);a<o.length;a++){for(var s=o[a],c=s[0],l=s[1],u=[],d=0,f=l;d<f.length;d++){var p=f[d];Nr(t,p.obsSet)?p.subscribers.forEach(function(e){return n.add(e)}):r&&u.push(p)}r&&i.push([c,u])}if(r)for(var m=0,h=i;m<h.length;m++){var g=h[m],c=g[0],u=g[1];e.queries.query[c]=u}}function Br(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?Pt(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,a=Math.round(e.verno*10),o=!1;function s(){if(t.openCanceller!==r)throw new A.DatabaseClosed(`db.open() was cancelled`)}var c=t.dbReadyResolve,l=null,u=!1,d=function(){return new P(function(r,i){if(s(),!n)throw new A.MissingAPI;var c=e.name,f=t.autoSchema||!a?n.open(c):n.open(c,a);if(!f)throw new A.MissingAPI;f.onerror=kn(i),f.onblocked=gt(e._fireOnBlocked),f.onupgradeneeded=gt(function(r){if(l=f.transaction,t.autoSchema&&!e._options.allowEmptyDB){f.onerror=An,l.abort(),f.result.close();var a=n.deleteDatabase(c);a.onsuccess=a.onerror=gt(function(){i(new A.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{l.onerror=kn(i);var s=r.oldVersion>2**62?0:r.oldVersion;u=s<1,e.idbdb=f.result,o&&er(e,l),$n(e,s/10,l,i)}},i),f.onsuccess=gt(function(){l=null;var n=e.idbdb=f.result,i=v(n.objectStoreNames);if(i.length>0)try{var s=n.transaction(zn(i),`readonly`);if(t.autoSchema)L(e,n,s);else if(ur(e,e._dbSchema,s),!lr(e,s)&&!o)return console.warn(`Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this.`),n.close(),a=n.version+1,o=!0,r(d());Yn(e,s)}catch{}mr.add(e),n.onversionchange=gt(function(n){t.vcFired=!0,e.on(`versionchange`).fire(n)}),n.onclose=gt(function(){e.close({disableAutoOpen:!1})}),u&&yr(e._deps,c),r()},i)}).catch(function(e){switch(e?.name){case`UnknownError`:if(t.PR1398_maxLoop>0)return t.PR1398_maxLoop--,console.warn(`Dexie: Workaround for Chrome UnknownError on open()`),d();break;case`VersionError`:if(a>0)return a=0,d()}return P.reject(e)})},f=typeof navigator<`u`&&!!n&&n===i.indexedDB;return P.race([r,(f?Sr():P.resolve()).then(d)]).then(function(){return s(),t.onReadyBeingFired=[],P.resolve(xr(function(){return e.on.ready.fire(e.vip)})).then(function n(){if(t.onReadyBeingFired.length>0){var r=t.onReadyBeingFired.reduce(Me,j);return t.onReadyBeingFired=[],P.resolve(xr(function(){return r(e.vip)})).then(n)}})}).finally(function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(n){t.dbOpenError=n;try{l&&l.abort()}catch{}return r===t.openCanceller&&e._close(),Pt(n)}).finally(function(){t.openComplete=!0,c()}).then(function(){if(u){var t={};e.tables.forEach(function(n){n.schema.indexes.forEach(function(r){r.name&&(t[`idb://${e.name}/${n.name}/${r.name}`]=new Tr(-1/0,[[[]]]))}),t[`idb://${e.name}/${n.name}/`]=t[`idb://${e.name}/${n.name}/:dels`]=new Tr(-1/0,[[[]]])}),Nn(jn).fire(t),Rr(t,!0)}return e})}function Vr(e){var t=function(t){return e.next(t)},n=function(t){return e.throw(t)},r=a(t),i=a(n);function a(e){return function(t){var n=e(t),a=n.value;return n.done?a:!a||typeof a.then!=`function`?o(a)?Promise.all(a).then(r,i):r(a):a.then(r,i)}}return a(t)()}function Hr(e,t,n){var r=arguments.length;if(r<2)throw new A.InvalidArgument(`Too few arguments`);for(var i=Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,D(i),n]}function R(e,t,n,r,i){return P.resolve().then(function(){var a=N.transless||N,o=e._createTransaction(t,n,e._dbSchema,r);o.explicit=!0;var s={trans:o,transless:a};if(r)o.idbtrans=r.idbtrans;else try{o.create(),o.idbtrans._explicit=!0,e._state.PR1398_maxLoop=3}catch(r){return r.name===k.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn(`Dexie: Need to reopen db`),e.close({disableAutoOpen:!1}),e.open().then(function(){return R(e,t,n,null,i)})):Pt(r)}var c=pe(i);c&&wt();var l,u=P.follow(function(){if(l=i.call(o,o),l){if(c){var e=Tt.bind(null,null);l.then(e,e)}else typeof l.next==`function`&&typeof l.throw==`function`&&(l=Vr(l))}},s);return(l&&typeof l.then==`function`?P.resolve(l).then(function(e){return o.active?e:Pt(new A.PrematureCommit(`Transaction committed too early. See http://bit.ly/2kdckMn`))}):u.then(function(){return l})).then(function(e){return r&&o._resolve(),o._completion.then(function(){return e})}).catch(function(e){return o._reject(e),Pt(e)})})}function Ur(e,t,n){for(var r=o(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Wr(e){return n(n({},e),{table:function(t){var r=e.table(t),i=r.schema,a=Object.create(null),o=[];function s(e,t,r){var i=Gn(e),c=a[i]=a[i]||[],l=e==null?0:typeof e==`string`?1:e.length,u=t>0,d=n(n({},r),{name:u?`${i}(virtual-from:${r.name})`:r.name,lowLevelIndex:r,isVirtual:u,keyTail:t,keyLength:l,extractKey:Vn(e),unique:!u&&r.unique});return c.push(d),d.isPrimaryKey||o.push(d),l>1&&s(l===2?e[0]:e.slice(0,l-1),t+1,r),c.sort(function(e,t){return e.keyTail-t.keyTail}),d}var c=s(i.primaryKey.keyPath,0,i.primaryKey);a[`:id`]=[c];for(var l=0,u=i.indexes;l<u.length;l++){var d=u[l];s(d.keyPath,0,d)}function f(e){var t=a[Gn(e)];return t&&t[0]}function p(t,n){return{type:t.type===1?2:t.type,lower:Ur(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,n),lowerOpen:!0,upper:Ur(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,n),upperOpen:!0}}function m(e){var t=e.query.index;return t.isVirtual?n(n({},e),{query:{index:t.lowLevelIndex,range:p(e.query.range,t.keyTail)}}):e}return n(n({},r),{schema:n(n({},i),{primaryKey:c,indexes:o,getIndexByKeyPath:f}),count:function(e){return r.count(m(e))},query:function(e){return r.query(m(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,a=n.isVirtual,o=n.keyLength;if(!a)return r.openCursor(t);function s(n){function r(r){r==null?t.unique?n.continue(n.key.slice(0,o).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue():n.continue(Ur(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i))}return Object.create(n,{continue:{value:r},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Ur(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return o===1?e[0]:e.slice(0,o)}},value:{get:function(){return n.value}}})}return r.openCursor(m(t)).then(function(e){return e&&s(e)})}})}})}var Gr={stack:`dbcore`,name:`VirtualIndexMiddleware`,level:1,create:Wr};function Kr(e,t,n,r){return n||={},r||=``,a(e).forEach(function(i){if(!u(t,i))n[r+i]=void 0;else{var a=e[i],o=t[i];if(typeof a==`object`&&typeof o==`object`&&a&&o){var s=ce(a);s===ce(o)?s===`Object`?Kr(a,o,n,r+i+`.`):a!==o&&(n[r+i]=t[i]):n[r+i]=t[i]}else a!==o&&(n[r+i]=t[i])}}),a(t).forEach(function(i){u(e,i)||(n[r+i]=t[i])}),n}function qr(e,t){return t.type===`delete`?t.keys:t.keys||t.values.map(e.extractKey)}var Jr={stack:`dbcore`,name:`HooksMiddleware`,level:2,create:function(e){return n(n({},e),{table:function(t){var i=e.table(t),a=i.schema.primaryKey;return n(n({},i),{mutate:function(e){var o=N.trans,s=o.table(t).hook,c=s.deleting,l=s.creating,d=s.updating;switch(e.type){case`add`:if(l.fire===j)break;return o._promise(`readwrite`,function(){return f(e)},!0);case`put`:if(l.fire===j&&d.fire===j)break;return o._promise(`readwrite`,function(){return f(e)},!0);case`delete`:if(c.fire===j)break;return o._promise(`readwrite`,function(){return f(e)},!0);case`deleteRange`:if(c.fire===j)break;return o._promise(`readwrite`,function(){return p(e)},!0)}return i.mutate(e);function f(e){var t=N.trans,o=e.keys||qr(a,e);if(!o)throw Error(`Keys missing`);return e=e.type===`add`||e.type===`put`?n(n({},e),{keys:o}):n({},e),e.type!==`delete`&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),Yr(i,e,o).then(function(n){var r=o.map(function(r,i){var o=n[i],s={onerror:null,onsuccess:null};if(e.type===`delete`)c.fire.call(s,r,o,t);else if(e.type===`add`||o===void 0){var f=l.fire.call(s,r,e.values[i],t);r==null&&f!=null&&(r=f,e.keys[i]=r,a.outbound||w(e.values[i],a.keyPath,r))}else{var p=Kr(o,e.values[i]),m=d.fire.call(s,p,r,o,t);if(m){var h=e.values[i];Object.keys(m).forEach(function(e){u(h,e)?h[e]=m[e]:w(h,e,m[e])})}}return s});return i.mutate(e).then(function(t){for(var i=t.failures,a=t.results,s=t.numFailures,c=t.lastResult,l=0;l<o.length;++l){var u=a?a[l]:o[l],d=r[l];u==null?d.onerror&&d.onerror(i[l]):d.onsuccess&&d.onsuccess(e.type===`put`&&n[l]?e.values[l]:u)}return{failures:i,results:a,numFailures:s,lastResult:c}}).catch(function(e){return r.forEach(function(t){return t.onerror&&t.onerror(e)}),Promise.reject(e)})})}function p(e){return m(e.trans,e.range,1e4)}function m(e,t,r){return i.query({trans:e,values:!1,query:{index:a,range:t},limit:r}).then(function(i){var a=i.result;return f({type:`delete`,keys:a,trans:e}).then(function(i){return i.numFailures>0?Promise.reject(i.failures[0]):a.length<r?{failures:[],numFailures:0,lastResult:void 0}:m(e,n(n({},t),{lower:a[a.length-1],lowerOpen:!0}),r)})})}}})}})}};function Yr(e,t,n){return t.type===`add`?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:`immutable`})}function z(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,a=0;i<t.keys.length&&a<e.length;++i)I(t.keys[i],e[a])===0&&(r.push(n?ae(t.values[i]):t.values[i]),++a);return r.length===e.length?r:null}catch{return null}}var Xr={stack:`dbcore`,level:-1,create:function(e){return{table:function(t){var r=e.table(t);return n(n({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=z(e.keys,e.trans._cache,e.cache===`clone`);return t?P.resolve(t):r.getMany(e).then(function(t){return e.trans._cache={keys:e.keys,values:e.cache===`clone`?ae(t):t},t})},mutate:function(e){return e.type!==`add`&&(e.trans._cache=null),r.mutate(e)}})}}}};function Zr(e,t){return e.trans.mode===`readonly`&&!!e.subscr&&!e.trans.explicit&&e.trans.db._options.cache!==`disabled`&&!t.schema.primaryKey.outbound}function Qr(e,t){switch(e){case`query`:return t.values&&!t.unique;case`get`:return!1;case`getMany`:return!1;case`count`:return!1;case`openCursor`:return!1}}var $r={stack:`dbcore`,level:0,name:`Observability`,create:function(e){var t=e.schema.name,r=new Tr(e.MIN_KEY,e.MAX_KEY);return n(n({},e),{transaction:function(t,n,r){if(N.subscr&&n!==`readonly`)throw new A.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${N.querier}`);return e.transaction(t,n,r)},table:function(i){var s=e.table(i),c=s.schema,l=c.primaryKey,u=c.indexes,d=l.extractKey,f=l.outbound,p=l.autoIncrement&&u.filter(function(e){return e.compound&&e.keyPath.includes(l.keyPath)}),m=n(n({},s),{mutate:function(n){var a=n.trans,u=n.mutatedParts||={},d=function(e){var n=`idb://${t}/${i}/${e}`;return u[n]||(u[n]=new Tr)},f=d(``),m=d(`:dels`),h=n.type,g=n.type===`deleteRange`?[n.range]:n.type===`delete`?[n.keys]:n.values.length<50?[qr(l,n).filter(function(e){return e!=null}),n.values]:[],_=g[0],v=g[1],y=n.trans._cache;if(o(_)){f.addKeys(_);var b=h===`delete`||_.length===v.length?z(_,y):null;b||m.addKeys(_),(b||v)&&ei(d,c,b,v)}else if(_){var x={from:_.lower??e.MIN_KEY,to:_.upper??e.MAX_KEY};m.add(x),f.add(x)}else f.add(r),m.add(r),c.indexes.forEach(function(e){return d(e.name).add(r)});return s.mutate(n).then(function(e){return _&&(n.type===`add`||n.type===`put`)&&(f.addKeys(e.results),p&&p.forEach(function(t){for(var r=n.values.map(function(e){return t.extractKey(e)}),i=t.keyPath.findIndex(function(e){return e===l.keyPath}),a=0,o=e.results.length;a<o;++a)r[a][i]=e.results[a];d(t.name).addKeys(r)})),a.mutatedParts=Mr(a.mutatedParts||{},u),e})}}),h=function(t){var n=t.query,r=n.index,i=n.range;return[r,new Tr(i.lower??e.MIN_KEY,i.upper??e.MAX_KEY)]},g={get:function(e){return[l,new Tr(e.key)]},getMany:function(e){return[l,new Tr().addKeys(e.keys)]},count:h,query:h,openCursor:h};return a(g).forEach(function(e){m[e]=function(a){var o=N.subscr,c=!!o,l=Zr(N,s)&&Qr(e,a)?a.obsSet={}:o;if(c){var u=function(e){var n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Tr)},p=u(``),m=u(`:dels`),h=g[e](a),_=h[0],v=h[1];if(e===`query`&&_.isPrimaryKey&&!a.values?m.add(v):u(_.name||``).add(v),!_.isPrimaryKey){if(e===`count`)m.add(r);else{var y=e===`query`&&f&&a.values&&s.query(n(n({},a),{values:!1}));return s[e].apply(this,arguments).then(function(t){if(e===`query`){if(f&&a.values)return y.then(function(e){var n=e.result;return p.addKeys(n),t});var n=a.values?t.result.map(d):t.result;a.values?p.addKeys(n):m.addKeys(n)}else if(e===`openCursor`){var r=t,i=a.values;return r&&Object.create(r,{key:{get:function(){return m.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return m.addKey(e),e}},value:{get:function(){return i&&p.addKey(r.primaryKey),r.value}}})}return t})}}}return s[e].apply(this,arguments)}}),m}})}};function ei(e,t,n,r){function i(t){var i=e(t.name||``);function a(e){return e==null?null:t.extractKey(e)}var s=function(e){return t.multiEntry&&o(e)?e.forEach(function(e){return i.addKey(e)}):i.addKey(e)};(n||r).forEach(function(e,t){var i=n&&a(n[t]),o=r&&a(r[t]);I(i,o)!==0&&(i!=null&&s(i),o!=null&&s(o))})}t.indexes.forEach(i)}function ti(e,t,r){if(r.numFailures===0)return t;if(t.type===`deleteRange`)return null;var i=t.keys?t.keys.length:`values`in t&&t.values?t.values.length:1;if(r.numFailures===i)return null;var a=n({},t);return o(a.keys)&&(a.keys=a.keys.filter(function(e,t){return!(t in r.failures)})),`values`in a&&o(a.values)&&(a.values=a.values.filter(function(e,t){return!(t in r.failures)})),a}function ni(e,t){return t.lower===void 0?!0:t.lowerOpen?I(e,t.lower)>0:I(e,t.lower)>=0}function ri(e,t){return t.upper===void 0?!0:t.upperOpen?I(e,t.upper)<0:I(e,t.upper)<=0}function ii(e,t){return ni(e,t)&&ri(e,t)}function ai(e,t,n,r,i,a){if(!n||n.length===0)return e;var s=t.query.index,c=s.multiEntry,l=t.query.range,u=r.schema.primaryKey.extractKey,d=s.extractKey,f=(s.lowLevelIndex||s).extractKey,p=n.reduce(function(e,n){var r=e,i=[];if(n.type===`add`||n.type===`put`)for(var a=new Tr,s=n.values.length-1;s>=0;--s){var f=n.values[s],p=u(f);if(!a.hasKey(p)){var m=d(f);(c&&o(m)?m.some(function(e){return ii(e,l)}):ii(m,l))&&(a.addKey(p),i.push(f))}}switch(n.type){case`add`:var h=new Tr().addKeys(t.values?e.map(function(e){return u(e)}):e);r=e.concat(t.values?i.filter(function(e){var t=u(e);return!h.hasKey(t)&&(h.addKey(t),!0)}):i.map(function(e){return u(e)}).filter(function(e){return!h.hasKey(e)&&(h.addKey(e),!0)}));break;case`put`:var g=new Tr().addKeys(n.values.map(function(e){return u(e)}));r=e.filter(function(e){return!g.hasKey(t.values?u(e):e)}).concat(t.values?i:i.map(function(e){return u(e)}));break;case`delete`:var _=new Tr().addKeys(n.keys);r=e.filter(function(e){return!_.hasKey(t.values?u(e):e)});break;case`deleteRange`:var v=n.range;r=e.filter(function(e){return!ii(u(e),v)})}return r},e);if(p===e)return e;var m=function(e,t){return I(f(e),f(t))||I(u(e),u(t))};return p.sort(t.direction===`prev`||t.direction===`prevunique`?function(e,t){return m(t,e)}:m),t.limit&&t.limit<1/0&&(p.length>t.limit?p.length=t.limit:e.length===t.limit&&p.length<t.limit&&(i.dirty=!0)),a?Object.freeze(p):p}function oi(e,t){return I(e.lower,t.lower)===0&&I(e.upper,t.upper)===0&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function si(e,t,n,r){if(e===void 0)return t===void 0?0:-1;if(t===void 0)return 1;var i=I(e,t);if(i===0){if(n&&r)return 0;if(n)return 1;if(r)return-1}return i}function ci(e,t,n,r){if(e===void 0)return t===void 0?0:1;if(t===void 0)return-1;var i=I(e,t);if(i===0){if(n&&r)return 0;if(n)return-1;if(r)return 1}return i}function li(e,t){return si(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&ci(e.upper,t.upper,e.upperOpen,t.upperOpen)>=0}function ui(e,t,n,r){var i=Pr[`idb://${e}/${t}`];if(!i)return[];var a=i.queries[n];if(!a)return[null,!1,i,null];var o=a[(r.query?r.query.index.name:null)||``];if(!o)return[null,!1,i,null];switch(n){case`query`:var s=r.direction??`next`,c=o.find(function(e){return e.req.limit===r.limit&&e.req.values===r.values&&(e.req.direction??`next`)===s&&oi(e.req.query.range,r.query.range)});return c?[c,!0,i,o]:[o.find(function(e){return(`limit`in e.req?e.req.limit:1/0)>=r.limit&&(e.req.direction??`next`)===s&&(!r.values||e.req.values)&&li(e.req.query.range,r.query.range)}),!1,i,o];case`count`:var l=o.find(function(e){return oi(e.req.query.range,r.query.range)});return[l,!!l,i,o]}}function di(e,t,n,r){e.subscribers.add(n),r.addEventListener(`abort`,function(){e.subscribers.delete(n),e.subscribers.size===0&&fi(e,t)})}function fi(e,t){setTimeout(function(){e.subscribers.size===0&&de(t,e)},3e3)}var pi={stack:`dbcore`,level:0,name:`Cache`,create:function(e){var t=e.schema.name;return n(n({},e),{transaction:function(n,r,i){var a=e.transaction(n,r,i);if(r===`readwrite`){var o=new AbortController,s=o.signal,c=function(i){return function(){if(o.abort(),r===`readwrite`){for(var s=new Set,c=0,l=n;c<l.length;c++){var u=l[c],d=Pr[`idb://${t}/${u}`];if(d){var f=e.table(u),p=d.optimisticOps.filter(function(e){return e.trans===a});if(a._explicit&&i&&a.mutatedParts)for(var m=0,h=Object.values(d.queries.query);m<h.length;m++)for(var g=h[m],_=0,v=g.slice();_<v.length;_++){var y=v[_];Nr(y.obsSet,a.mutatedParts)&&(de(g,y),y.subscribers.forEach(function(e){return s.add(e)}))}else if(p.length>0){d.optimisticOps=d.optimisticOps.filter(function(e){return e.trans!==a});for(var b=0,x=Object.values(d.queries.query);b<x.length;b++)for(var g=x[b],S=0,C=g.slice();S<C.length;S++){var y=C[S];if(y.res!=null&&a.mutatedParts){if(i&&!y.dirty){var w=Object.isFrozen(y.res),T=ai(y.res,y.req,p,f,y,w);y.dirty?(de(g,y),y.subscribers.forEach(function(e){return s.add(e)})):T!==y.res&&(y.res=T,y.promise=P.resolve({result:T}))}else y.dirty&&de(g,y),y.subscribers.forEach(function(e){return s.add(e)})}}}}}s.forEach(function(e){return e()})}}};a.addEventListener(`abort`,c(!1),{signal:s}),a.addEventListener(`error`,c(!1),{signal:s}),a.addEventListener(`complete`,c(!0),{signal:s})}return a},table:function(r){var i=e.table(r),a=i.schema.primaryKey;return n(n({},i),{mutate:function(e){var o=N.trans;if(a.outbound||o.db._options.cache===`disabled`||o.explicit||o.idbtrans.mode!==`readwrite`)return i.mutate(e);var s=Pr[`idb://${t}/${r}`];if(!s)return i.mutate(e);var c=i.mutate(e);return(e.type===`add`||e.type===`put`)&&(e.values.length>=50||qr(a,e).some(function(e){return e==null}))?c.then(function(t){var r=ti(s,n(n({},e),{values:e.values.map(function(e,r){if(t.failures[r])return e;var i=a.keyPath?.includes(`.`)?ae(e):n({},e);return w(i,a.keyPath,t.results[r]),i})}),t);s.optimisticOps.push(r),queueMicrotask(function(){return e.mutatedParts&&Lr(e.mutatedParts)})}):(s.optimisticOps.push(e),e.mutatedParts&&Lr(e.mutatedParts),c.then(function(t){if(t.numFailures>0){de(s.optimisticOps,e);var n=ti(s,e,t);n&&s.optimisticOps.push(n),e.mutatedParts&&Lr(e.mutatedParts)}}),c.catch(function(){de(s.optimisticOps,e),e.mutatedParts&&Lr(e.mutatedParts)})),c},query:function(e){if(!Zr(N,i)||!Qr(`query`,e))return i.query(e);var n=N.trans?.db._options.cache===`immutable`,a=N,o=a.requery,s=a.signal,c=ui(t,r,`query`,e),l=c[0],u=c[1],d=c[2],f=c[3];if(l&&u)l.obsSet=e.obsSet;else{var p=i.query(e).then(function(e){var t=e.result;if(l&&(l.res=t),n){for(var r=0,i=t.length;r<i;++r)Object.freeze(t[r]);Object.freeze(t)}return e}).catch(function(e){return f&&l&&de(f,l),Promise.reject(e)});l={obsSet:e.obsSet,promise:p,subscribers:new Set,type:`query`,req:e,dirty:!1},f?f.push(l):(f=[l],d||=Pr[`idb://${t}/${r}`]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}},d.queries.query[e.query.index.name||``]=f)}return di(l,f,o,s),l.promise.then(function(t){var r=ai(t.result,e,d?.optimisticOps,i,l,n);return{result:n?r:ae(r)}})}})}})}};function mi(e,t){return new Proxy(e,{get:function(e,n,r){return n===`db`?t:Reflect.get(e,n,r)}})}var hi=function(){function e(t,r){var i=this;this._middlewares={},this.verno=0;var a=e.dependencies;this._options=r=n({addons:e.addons,autoOpen:!0,indexedDB:a.indexedDB,IDBKeyRange:a.IDBKeyRange,cache:`cloned`,maxConnections:Bt},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};var o=r.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:j,dbReadyPromise:null,cancelOpen:j,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:r.autoOpen};s.dbReadyPromise=new P(function(e){s.dbReadyResolve=e}),s.openCanceller=new P(function(e,t){s.cancelOpen=t}),this._state=s,this.name=t,this.on=nn(this,`populate`,`blocked`,`versionchange`,`close`,{ready:[Me,j]}),this.once=function(e,t){var n=function(){var r=[...arguments];i.on(e).unsubscribe(n),t.apply(i,r)};return i.on(e,n)},this.on.ready.subscribe=y(this.on.ready.subscribe,function(t){return function(n,r){e.vip(function(){var e=i._state;if(e.openComplete)e.dbOpenError||P.resolve().then(n),r&&t(n);else if(e.onReadyBeingFired)e.onReadyBeingFired.push(n),r&&t(n);else{t(n);var a=i;r||t(function e(){a.on.ready.unsubscribe(n),a.on.ready.unsubscribe(e)})}})}}),this.Collection=gn(this),this.Table=an(this),this.Transaction=Fn(this),this.Version=pr(this),this.WhereClause=On(this),this.on(`versionchange`,function(e){e.newVersion>0?console.warn(`Another connection wants to upgrade database '${i.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${i.name}'. Closing db now to resume the delete request.`),i.close({disableAutoOpen:!1})}),this.on(`blocked`,function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${i.name}') was blocked`):console.warn(`Upgrade '${i.name}' blocked by other connection holding version ${e.oldVersion/10}`)}),this._maxKey=Bn(r.IDBKeyRange),this._createTransaction=function(e,t,n,r){return new i.Transaction(e,t,n,i._options.chromeTransactionDurability,r)},this._fireOnBlocked=function(e){i.on(`blocked`).fire(e),mr.toArray().filter(function(e){return e.name===i.name&&e!==i&&!e._state.vcFired}).map(function(t){return t.on(`versionchange`).fire(e)})},this.use(Xr),this.use(pi),this.use($r),this.use(Gr),this.use(Jr);var c=new Proxy(this,{get:function(e,t,n){if(t===`_vip`)return!0;if(t===`table`)return function(e){return mi(i.table(e),c)};var r=Reflect.get(e,t,n);return r instanceof tn?mi(r,c):t===`tables`?r.map(function(e){return mi(e,c)}):t===`_createTransaction`?function(){return mi(r.apply(this,arguments),c)}:r}});this.vip=c,o.forEach(function(e){return e(i)})}return e.prototype.version=function(e){if(isNaN(e)||e<.1)throw new A.Type(`Given version is not a positive number`);if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new A.Schema(`Cannot add version when database is open`);this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(t){return t._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(Qn),n.stores({}),this._state.autoSchema=!1,n)},e.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||N.letThrough||this._vip)?e():new P(function(e,n){if(t._state.openComplete)return n(new A.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen){n(new A.DatabaseClosed);return}t.open().catch(j)}t._state.dbReadyPromise.then(e,n)}).then(e)},e.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;i&&this.unuse({stack:t,name:i});var a=this._middlewares[t]||(this._middlewares[t]=[]);return a.push({stack:t,create:n,level:r??10,name:i}),a.sort(function(e,t){return e.level-t.level}),this},e.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(e){return r?e.create!==r:n?e.name!==n:!1})),this},e.prototype.open=function(){var e=this;return jt(Ze,function(){return Br(e)})},e.prototype._close=function(){this.on.close.fire(new CustomEvent(`close`));var e=this._state;if(mr.remove(this),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new P(function(t){e.dbReadyResolve=t}),e.openCanceller=new P(function(t,n){e.cancelOpen=n}))},e.prototype.close=function(e){var t=(e===void 0?{disableAutoOpen:!0}:e).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new A.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new A.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},e.prototype.delete=function(e){var t=this;e===void 0&&(e={disableAutoOpen:!0});var n=arguments.length>0&&typeof arguments[0]!=`object`,r=this._state;return new P(function(i,a){var o=function(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=gt(function(){br(t._deps,t.name),i()}),n.onerror=kn(a),n.onblocked=t._fireOnBlocked};if(n)throw new A.InvalidArgument(`Invalid closeOptions argument to db.delete()`);r.isBeingOpened?r.dbReadyPromise.then(o):o()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return this.idbdb!==null},e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name===`DatabaseClosedError`},e.prototype.hasFailed=function(){return this._state.dbOpenError!==null},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var e=this;return a(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var e=Hr.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,t,n){var r=this,i=N.trans;i&&i.db===this&&e.indexOf(`!`)===-1||(i=null);var a=e.indexOf(`?`)!==-1;e=e.replace(`!`,``).replace(`?`,``);var o,s;try{if(s=t.map(function(e){var t=e instanceof r.Table?e.name:e;if(typeof t!=`string`)throw TypeError(`Invalid table argument to Dexie.transaction(). Only Table or String are allowed`);return t}),e==`r`||e===Ht)o=Ht;else if(e==`rw`||e==Ut)o=Ut;else throw new A.InvalidArgument(`Invalid transaction mode: `+e);if(i){if(i.mode===Ht&&o===Ut){if(a)i=null;else throw new A.SubTransaction(`Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY`)}i&&s.forEach(function(e){if(i&&i.storeNames.indexOf(e)===-1){if(a)i=null;else throw new A.SubTransaction(`Table `+e+` not included in parent transaction.`)}}),a&&i&&!i.active&&(i=null)}}catch(e){return i?i._promise(null,function(t,n){n(e)}):Pt(e)}var c=R.bind(null,this,o,s,i,n);return i?i._promise(o,c,`lock`):N.trans?jt(N.transless,function(){return r._whenReady(c)}):this._whenReady(c)},e.prototype.table=function(e){if(!u(this._allTables,e))throw new A.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]},e}(),gi=typeof Symbol<`u`&&`observable`in Symbol?Symbol.observable:`@@observable`,_i=function(){function e(e){this._subscribe=e}return e.prototype.subscribe=function(e,t,n){return this._subscribe(!e||typeof e==`function`?{next:e,error:t,complete:n}:e)},e.prototype[gi]=function(){return this},e}(),vi;try{vi={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch{vi={indexedDB:null,IDBKeyRange:null}}function yi(e){var t=!1,n,r=new _i(function(r){var i=pe(e);function a(t){var n=lt();try{i&&wt();var r=Ct(e,t);return i&&(r=r.finally(Tt)),r}finally{n&&ut()}}var o=!1,s,c={},l={},u={get closed(){return o},unsubscribe:function(){o||(o=!0,s&&s.abort(),d&&Nn.storagemutated.unsubscribe(m))}};r.start&&r.start(u);var d=!1,f=function(){return Nt(h)};function p(){return Nr(l,c)}var m=function(e){Mr(c,e),p()&&f()},h=function(){if(!o&&vi.indexedDB){c={};var i={};s&&s.abort(),s=new AbortController;var u={subscr:i,signal:s.signal,requery:f,querier:e,trans:null},h=a(u);d||=(Nn.storagemutated.subscribe(m),!0),Promise.resolve(h).then(function(e){t=!0,n=e,o||u.signal.aborted||(p()?f():(l=i,p()?f():(c={},Nt(function(){return!o&&r.next&&r.next(e)}))))},function(e){o||u.signal.aborted||(t=!1,[`DatabaseClosedError`,`AbortError`].includes(e?.name)||o||Nt(function(){o||r.error&&r.error(e)}))})}};return setTimeout(f,0),u});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var bi=hi;d(bi,n(n({},Te),{delete:function(e){return new bi(e,{addons:[]}).delete()},exists:function(e){return new bi(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch(`NoSuchDatabaseError`,function(){return!1})},getDatabaseNames:function(e){try{return vr(bi.dependencies).then(e)}catch{return Pt(new A.MissingAPI)}},defineClass:function(){function e(e){s(this,e)}return e},ignoreTransaction:function(e){return N.trans?jt(N.transless||Ze,e):e()},vip:xr,async:function(e){return function(){try{var t=Vr(e.apply(this,arguments));return!t||typeof t.then!=`function`?P.resolve(t):t}catch(e){return Pt(e)}}},spawn:function(e,t,n){try{var r=Vr(e.apply(n,t||[]));return!r||typeof r.then!=`function`?P.resolve(r):r}catch(e){return Pt(e)}},currentTransaction:{get:function(){return N.trans||null}},waitFor:function(e,t){var n=P.resolve(typeof e==`function`?bi.ignoreTransaction(e):e).timeout(t||6e4);return N.trans?N.trans.waitFor(n):n},Promise:P,debug:{get:function(){return Ne},set:function(e){Pe(e)}},derive:m,extend:s,props:d,override:y,Events:nn,on:Nn,liveQuery:yi,extendObservabilitySet:Mr,getByKeyPath:C,setByKeyPath:w,delByKeyPath:T,shallowClone:ee,deepClone:ae,getObjectDiff:Kr,cmp:I,asap:x,minKey:F,addons:[],connections:{get:mr.toArray},errnames:k,dependencies:vi,cache:Pr,semVer:It,version:It.split(`.`).map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/10**(n*2)})})),bi.maxKey=Bn(bi.dependencies.IDBKeyRange),typeof dispatchEvent<`u`&&typeof addEventListener<`u`&&(Nn(jn,function(e){if(!Si){var t=new CustomEvent(Mn,{detail:e});Si=!0,dispatchEvent(t),Si=!1}}),addEventListener(Mn,function(e){var t=e.detail;Si||xi(t)}));function xi(e){var t=Si;try{Si=!0,Nn.storagemutated.fire(e),Rr(e,!0)}finally{Si=t}}var Si=!1,Ci,wi=function(){};typeof BroadcastChannel<`u`&&(wi=function(){Ci=new BroadcastChannel(Mn),Ci.onmessage=function(e){return e.data&&xi(e.data)}},wi(),typeof Ci.unref==`function`&&Ci.unref(),Nn(jn,function(e){Si||Ci.postMessage(e)})),typeof addEventListener<`u`&&(addEventListener(`pagehide`,function(e){if(!hi.disableBfCache&&e.persisted){Ne&&console.debug(`Dexie: handling persisted pagehide`),Ci?.close();for(var t=0,n=mr.toArray();t<n.length;t++)n[t].close({disableAutoOpen:!1})}}),addEventListener(`pageshow`,function(e){!hi.disableBfCache&&e.persisted&&(Ne&&console.debug(`Dexie: handling persisted pageshow`),wi(),xi({all:new Tr(-1/0,[[]])}))}));function Ti(e){return new $t({add:e})}function Ei(e){return new $t({remove:e})}function Di(e,t){return new $t({replacePrefix:[e,t]})}return P.rejectionMapper=we,Pe(Ne),n(hi,Object.freeze({__proto__:null,DEFAULT_MAX_CONNECTIONS:Bt,Dexie:hi,Entity:qt,PropModification:$t,RangeSet:Tr,add:Ti,cmp:I,default:hi,liveQuery:yi,mergeRanges:Dr,rangesOverlap:Or,remove:Ei,replacePrefix:Di}),{default:hi}),hi}))}))(),1),Zt=Symbol.for(`Dexie`),Qt=globalThis[Zt]||(globalThis[Zt]=Xt.default);if(Xt.default.semVer!==Qt.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${Xt.default.semVer} and ${Qt.semVer}`);var{liveQuery:$t,mergeRanges:en,rangesOverlap:tn,RangeSet:nn,cmp:rn,Entity:an,PropModification:on,replacePrefix:sn,add:cn,remove:ln,DexieYProvider:un}=Qt,dn=e=>e===null||typeof e==`string`?e:new Uint8Array(e),fn=e=>({path:e.path,content:dn(e.content),sha:e.sha,updatedAt:e.updatedAt}),pn=(e,t)=>e.path<t.path?-1:+(e.path>t.path);function mn(e={}){if(!e.indexedDB&&globalThis.indexedDB===void 0)return hn();let t=e.indexedDB?{indexedDB:e.indexedDB,IDBKeyRange:e.IDBKeyRange}:{},n=new Qt(e.name??`editlet-github`,t);return n.version(1).stores({blobs:`sha`,pending:`[scope+path], scope`}),{async getBlobs(e){let t=new Map;try{let r=await n.blobs.bulkGet(e);for(let e of r)e&&t.set(e.sha,new Uint8Array(e.bytes))}catch{}return t},async putBlobs(e){try{await n.blobs.bulkPut(e.map(e=>({sha:e.sha,bytes:new Uint8Array(e.bytes)})))}catch{}},pending(e){return{async list(){return(await n.pending.where(`scope`).equals(e).toArray()).map(fn).toSorted(pn)},async get(t){let r=await n.pending.get([e,t]);return r?fn(r):void 0},async put(t){await n.pending.put({scope:e,path:t.path,content:dn(t.content),sha:t.sha,updatedAt:Date.now()})},async remove(t){await n.pending.bulkDelete(t.map(t=>[e,t]))},async clear(){await n.pending.where(`scope`).equals(e).delete()}}},async clear(){await Promise.all([n.blobs.clear(),n.pending.clear()])},async close(){n.close()}}}function hn(){let e=new Map,t=new Map,n=e=>{let n=t.get(e);return n||t.set(e,n=new Map),n};return{async getBlobs(t){let n=new Map;for(let r of t){let t=e.get(r);t&&n.set(r,new Uint8Array(t))}return n},async putBlobs(t){for(let n of t)e.set(n.sha,new Uint8Array(n.bytes))},pending(e){return{async list(){return[...n(e).values()].map(fn).toSorted(pn)},async get(t){let r=n(e).get(t);return r?fn(r):void 0},async put(t){n(e).set(t.path,{scope:e,path:t.path,content:dn(t.content),sha:t.sha,updatedAt:Date.now()})},async remove(t){let r=n(e);for(let e of t)r.delete(e)},async clear(){n(e).clear()}}},async clear(){e.clear(),t.clear()}}}var gn=24576;function _n(e){let t=``;for(let n=0;n<e.length;n+=gn)t+=btoa(String.fromCharCode(...e.subarray(n,n+gn)));return t}function vn(e){let t;try{t=new URL(e).protocol}catch{throw TypeError(`Deploy hook URL must be https`)}if(t!==`https:`)throw TypeError(`Deploy hook URL must be https`)}async function yn(e,t={}){vn(e);let n=t.fetch??globalThis.fetch;try{let t=await n(e,{method:`POST`});return{ok:t.ok,status:t.status}}catch{return{ok:null,status:null}}}var bn=class extends Error{issues;constructor(e,t){super(t??e.map(e=>e.path?`${e.path}: ${e.message}`:e.message).join(`; `)),this.name=`EditletError`,this.issues=e}},xn=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Sn(e){return xn.test(e)}function Cn(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function wn(e,t){return Object.hasOwn(e.collections,t)}function Tn(e,t,n){let r=wn(e,t)&&e.collections[t].singleton;return`${e.contentDir}/${t}/${r?`index`:n}.md`}function En(e){return e===``||/[\\\0:]/.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}function Dn(e,t){let n=`${e.contentDir}/`;return(t.startsWith(n)?t.slice(n.length):t).split(`/`).some(e=>e.startsWith(`.`))}function On(e,t){let n=`${e.contentDir}/`;if(!t.startsWith(n)||!En(t))return null;let r=t.slice(n.length).split(`/`);if(r.length!==2)return null;let[i,a]=r;if(!wn(e,i)||!a.endsWith(`.md`))return null;let o=a.slice(0,-3);return o===``?null:e.collections[i].singleton?a===`index.md`?{collection:i,slug:`index`}:null:{collection:i,slug:o}}function kn(e,t,n){if(n===``||n.startsWith(`/`)||n.includes(`\\`)||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return null;let r=n.split(`/`),i=r[r.length-1];if(i===``||i===`.`||i===`..`)return null;let a=t.split(`/`).slice(0,-1);for(let e of r)if(e!==``&&e!==`.`){if(e===`..`){if(a.length===0)return null;a.pop()}else a.push(e)}let o=a.join(`/`);return o.startsWith(`${e.contentDir}/`)?o:null}function An(e,t){let n=e.split(`/`).slice(0,-1),r=t.split(`/`),i=0;for(;i<n.length&&i<r.length-1&&n[i]===r[i];)i++;return`../`.repeat(n.length-i)+r.slice(i).join(`/`)}function jn(e,t){return`${e}/${t}`}function Mn(e){let t=e.split(`/`);if(t.length!==2)return null;let[n,r]=t;return n===``||!Sn(r)?null:{collection:n,slug:r}}var Nn=[`webp`,`png`,`jpg`,`jpeg`,`avif`,`gif`,`svg`];function Pn(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0&&Nn.includes(t.slice(n+1).toLowerCase())}function Fn(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 In(e,t=`|`){return e.map(e=>lr(e)).join(t)}function Ln(e,t){return typeof t==`bigint`?t.toString():t}var Rn=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 zn(e){return new Rn(e)}function Bn(e){return e==null}function Vn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Hn(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Un=Symbol(`evaluating`);function Wn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Un)return r===void 0&&(r=Un,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Gn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Kn(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function qn(e){return Kn(e._zod.def)??e._zod.def.shape}function Jn(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Gn(this,t,e),e},enumerable:!0,configurable:!0})}function Yn(e,t,n){t in e?Gn(e,t,n):e[t]=n}function Xn(e,t,n,r){let i=qn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Jn(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Yn(e,a,r?r(n.value,a):n.value))}}function Zn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Jn(e,n,()=>t[n]):Yn(e,n,r.value))}}function Qn(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function $n(e){return JSON.stringify(e)}function er(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var tr=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function nr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rr=zn(()=>{if(Qr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ir(e){if(nr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return nr(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ar(e){return ir(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var or=new Set([`string`,`number`,`symbol`]);function sr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function cr(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(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 lr(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ur(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var dr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fr={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function pr(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 Xn(i,e,mr(e,t)),cr(e,Qn(n,{shape:i,checks:[]}))}function mr(e,t){let n=qn(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 hr(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(mr(e,t)),a={};return Xn(a,e,Reflect.ownKeys(qn(e)).filter(e=>!i.has(e))),cr(e,Qn(n,{shape:a,checks:[]}))}function gr(e,t){if(!ir(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=qn(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 cr(e,Qn(e._zod.def,{shape:_r(e,t)}))}function _r(e,t){let n={};return Xn(n,e,Reflect.ownKeys(qn(e))),Zn(n,t),n}function vr(e,t){if(!ir(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return cr(e,Qn(e._zod.def,{shape:_r(e,t)}))}function yr(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 Xn(n,e,Reflect.ownKeys(qn(e))),Xn(n,t,Reflect.ownKeys(qn(t))),cr(e,Qn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function br(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(mr(t,n)):void 0,o={};return Xn(o,t,Reflect.ownKeys(qn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),cr(t,Qn(t._zod.def,{shape:o,checks:[]}))}function xr(e,t,n){let r=n?new Set(mr(t,n)):void 0,i={};return Xn(i,t,Reflect.ownKeys(qn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),cr(t,Qn(t._zod.def,{shape:i}))}function Sr(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 Cr(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 wr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tr(e){return typeof e==`string`?e:e?.message}function Er(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 Dr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Or(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:Tr(e.inst?._zod.def?.error?.(e))??Tr(a?.(e))??Tr(t?.error?.(e))??Tr(n.customError?.(e))??Tr(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 kr=/[\uD800-\uDBFF]/;function Ar(e){let t=e.length;if(!kr.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 jr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Mr(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 Nr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Pr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Rr(e,n,r.value)}}function Fr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ir(e,t,n){return Fr(e,t,n,!1)}function Lr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Fr(this,n,r(this))},set(e){Fr(this,n,e)}})}return t}function Rr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Fr(this,t,n.bind(this))},set(e){Fr(this,t,e)}})}function zr(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Br,Vr=!1,Hr={configurable:!0,get(){Vr=!0}};function R(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Br!==e._zod?Br=void 0:(Br=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Hr);let e=Vr;Vr=!1;try{let r=n(this);return Vr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Vr||=e,r}catch(n){throw delete this[t],Vr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Ur(e,t,n,r){let i=zr(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 Wr=`~constantCatch`;function Gr(e){let t=()=>e;return t[Wr]=!0,t}var Kr,qr={value:void 0,enumerable:!1},Jr=`captureStackTrace`in Error?Error:null;function Yr(e){let t=Jr;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Jr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function z(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){qr.value=new a(r);try{Object.defineProperty(n,"_zod",qr)}finally{qr.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),Pr(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?Yr(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 Xr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Zr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Kr=globalThis).__zod_globalConfig??(Kr.__zod_globalConfig={});var Qr=globalThis.__zod_globalConfig;function $r(e){return e&&Object.assign(Qr,e),Qr}function ei(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ln,2),e.message}function ti(e){this._zod.message=e}var ni={get:ei,set:ti,enumerable:!0,configurable:!0},ri={value:void 0,enumerable:!1},ii=new WeakSet([Object.prototype,Error.prototype]),ai=z(`$ZodError`,(e,t)=>{e.name=`$ZodError`,ri.value=t,Object.defineProperty(e,"issues",ri),ri.value=void 0,Object.defineProperty(e,"message",ni);let n=Object.getPrototypeOf(e);ii.has(n)||(ii.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 oi(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 si(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?oi(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ci(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 li(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ui=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 Xr;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Or(e,o,$r())));throw tr(n,a?.callee??t),n}return s.value};return t},di=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=>Or(e,o,$r())));throw tr(n,a?.callee??t),n}return s.value};return t},fi=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 Xr;return a.issues.length?pi(e,a.issues,i):{success:!0,data:a.value}};function pi(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Or(e,n,$r()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var mi=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?pi(e,a.issues,i):{success:!0,data:a.value}},hi=Symbol.for(`zod.compile.invalid`),gi=Symbol.for(`zod.compile.fallback`),_i=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==hi)return!0;if(r.definite===!0&&n===void 0)return!1}return vi(e,t,n)});function vi(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[gi]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Xr;return a.issues.length===0}var yi=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},bi=e=>{let t=ui(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,li(n,a))};return n},xi=e=>{let t=ui(e),n=(e,r,i,a)=>t(e,r,i,li(n,a));return n},Si=e=>{let t=di(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,li(n,a))};return n},Ci=e=>{let t=di(e),n=async(e,r,i,a)=>await t(e,r,i,li(n,a));return n},wi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fi(e)(t,n,i)},Ti=e=>(t,n,r)=>fi(e)(t,n,r),Ei=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mi(e)(t,n,i)},Di=e=>async(t,n,r)=>mi(e)(t,n,r),Oi=/^[cC][0-9a-z]{6,}$/,ki=/^[0-9a-z]+$/,Ai=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ji=/^[0-9a-vA-V]{20}$/,Mi=/^[A-Za-z0-9]{27}$/,Ni=/^[a-zA-Z0-9_-]{21}$/;function Pi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Fi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ii=/^([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})$/,Li=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)$/,Ri=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,zi=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Bi(){return new RegExp(zi,`u`)}var Vi=/^(?:(?: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])$/,Hi=/^(([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}|:))$/,Ui=/^((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])$/,Wi=/^(([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])$/,Gi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ki=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,qi=/^https?$/,Ji=/^\+[1-9]\d{6,14}$/,Yi=`(?:(?:\\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 Xi(e){return RegExp(`^${e}$`)}var Zi=Xi(Yi);function Qi(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 $i(e){return RegExp(`^${Qi(e)}$`)}function ea(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Qi({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Qi({precision:e.precision})}`:n;return RegExp(`^${Yi}T(?:${r})$`)}var ta=/^[\s\S]{0,}$/,na=/^-?\d+$/,ra=/^-?\d+(?:\.\d+)?$/,ia=/^(?:true|false)$/i,B=/^[^A-Z]*$/,aa=/^[^a-z]*$/,oa=z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sa=e=>{let t=e.value;return!Bn(t)&&t.length!==void 0},ca={number:`number`,bigint:`bigint`,object:`date`},la=z(`$ZodCheckLessThan`,(e,t)=>{oa.init(e,t);let n=ca[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:ca[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})}}),ua=z(`$ZodCheckGreaterThan`,(e,t)=>{oa.init(e,t);let n=ca[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:ca[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})}}),da=z(`$ZodCheckMultipleOf`,(e,t)=>{oa.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):Hn(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})}}),fa=z(`$ZodCheckNumberFormat`,(e,t)=>{oa.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=dr[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})}}),pa=z(`$ZodCheckMaxLength`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=sa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ar(r):i)<=t.maximum)return;let a=jr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ma=z(`$ZodCheckMinLength`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=sa),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ar(r):i)>=t.minimum)return;let a=jr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ha=z(`$ZodCheckLengthEquals`,(e,t)=>{var n;oa.init(e,t),(n=e._zod.def).when??(n.when=sa),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ar(r):i;if(a===t.length)return;let o=jr(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})}}),ga=z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;oa.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_a=z(`$ZodCheckRegex`,(e,t)=>{ga.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})}}),va=z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=B,ga.init(e,t)}),ya=z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=aa,ga.init(e,t)}),ba=z(`$ZodCheckIncludes`,(e,t)=>{oa.init(e,t);let n=sr(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})}}),xa=z(`$ZodCheckStartsWith`,(e,t)=>{oa.init(e,t);let n=RegExp(`^${sr(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})}}),Sa=z(`$ZodCheckEndsWith`,(e,t)=>{oa.init(e,t);let n=RegExp(`.*${sr(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})}}),Ca=z(`$ZodCheckOverwrite`,(e,t)=>{oa.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),wa=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(`
|
|
13
|
+
`).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(`
|
|
14
|
+
`)}\n};`)(...Object.values(this.closed))}},Ta={major:4,minor:6,patch:7},Ea=z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ta;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=Sr(t),a;for(let o of n){if(o._zod.def.when){if(Cr(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 Xr;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Dr(t.issues,n,e),i||=Sr(t,n))});else{if(t.issues.length===n)continue;Dr(t.issues,n,e),i||=Sr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Sr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Xr;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 Xr;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ir(this,`~standard`,ka(this))},set"~standard"(e){Fr(this,`~standard`,e)}}),Da=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Or(e,t,$r()))}:{value:e.value};async function Oa(e,t){let n={async:!0};return Da(await e._zod.run({value:t,issues:[]},n),n)}function ka(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Da(r,n)}catch{}return Oa(e,t)},vendor:`zod`,version:1}}var Aa=z(`$ZodString`,(e,t)=>{Ea.init(e,t),e._zod.pattern=t.pattern??ta,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}}),V=z(`$ZodStringFormat`,(e,t)=>{ga.init(e,t),Aa.init(e,t)}),ja=z(`$ZodGUID`,(e,t)=>{t.pattern??=Ii,V.init(e,t)}),Ma=z(`$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??=Li(e)}else t.pattern??=Li();V.init(e,t)}),Na=z(`$ZodEmail`,(e,t)=>{t.pattern??=Ri,V.init(e,t)});function Pa(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Fa(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Pa(e)||2:Ia(e,t)}function Ia(e,t){if(!t.normalize&&t.protocol?.source===qi.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 La=/[\t\n\r]/g;function Ra(e){return e.replace(La,``)}function za(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ba(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Va=z(`$ZodURL`,(e,t)=>{V.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Fa(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=Ra(r);return}t.hostname&&!za(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&&!Ba(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:Ra(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ha=z(`$ZodEmoji`,(e,t)=>{t.pattern??=Bi(),V.init(e,t)}),Ua=z(`$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?Ni:Pi(t.length),V.init(e,t)}),Wa=z(`$ZodCUID`,(e,t)=>{t.pattern??=Oi,V.init(e,t)}),Ga=z(`$ZodCUID2`,(e,t)=>{t.pattern??=ki,V.init(e,t)}),Ka=z(`$ZodULID`,(e,t)=>{t.pattern??=Ai,V.init(e,t)}),qa=z(`$ZodXID`,(e,t)=>{t.pattern??=ji,V.init(e,t)}),Ja=z(`$ZodKSUID`,(e,t)=>{t.pattern??=Mi,V.init(e,t)}),Ya=z(`$ZodISODateTime`,(e,t)=>{t.pattern??=ea(t),V.init(e,t)}),Xa=z(`$ZodISODate`,(e,t)=>{t.pattern??=Zi,V.init(e,t)}),Za=z(`$ZodISOTime`,(e,t)=>{t.pattern??=$i(t),V.init(e,t)}),Qa=z(`$ZodISODuration`,(e,t)=>{t.pattern??=Fi,V.init(e,t)}),$a=z(`$ZodIPv4`,(e,t)=>{t.pattern??=Vi,V.init(e,t)}),eo=/^[0-9a-fA-F:.]+$/;function to(e){return eo.test(e)?Pa(`http://[${e}]`):!1}var no=z(`$ZodIPv6`,(e,t)=>{t.pattern??=Hi,V.init(e,t),e._zod.check=n=>{to(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ro=z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ui,V.init(e,t)});function io(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:to(n)}var ao=z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Wi,V.init(e,t),e._zod.check=n=>{io(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function oo(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var so=/^[0-9a-zA-Z+/]*={0,2}$/,co=z(`$ZodBase64`,(e,t)=>{t.pattern??=so,V.init(e,t),e._zod.check=n=>{oo(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),lo=/^[A-Za-z0-9_-]*$/;function uo(e){if(!lo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return oo(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var fo=z(`$ZodBase64URL`,(e,t)=>{t.pattern??=lo,V.init(e,t),e._zod.check=n=>{uo(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),po=z(`$ZodE164`,(e,t)=>{t.pattern??=Ji,V.init(e,t)});function mo(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 ho=z(`$ZodJWT`,(e,t)=>{V.init(e,t),e._zod.check=n=>{mo(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),go=z(`$ZodNumber`,(e,t)=>{Ea.init(e,t),e._zod.pattern=ra,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}}),_o=z(`$ZodNumberFormat`,(e,t)=>{fa.init(e,t),go.init(e,t)}),vo=z(`$ZodBoolean`,(e,t)=>{Ea.init(e,t),e._zod.pattern=ia,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}}),yo=z(`$ZodUnknown`,(e,t)=>{Ea.init(e,t),e._zod.parse=e=>e}),bo=z(`$ZodNever`,(e,t)=>{Ea.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function xo(e,t){let n=Er(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 Er(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,Dr(n.issues,t,e),n}}return i(n,a)}}var So=e=>Array.isArray(e)?e.length:-1;function Co(e,t,n){e.issues.length&&t.issues.push(...wr(n,e.issues)),t.value[n]=e.value}var wo=z(`$ZodArray`,(e,t)=>{Ea.init(e,t);let n=Qr.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=>Co(t,r,e)));else if(Co(c,r,e),s&&c.issues.length!==0&&Sr(c))break}return o.length?Promise.all(o).then(()=>r):r},xo(e,So)});function To(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(...wr(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 Eo=[];function Do(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Eo,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=ur(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Oo(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(Sr(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=>To(e,n,i,t,d,f))):To(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 ko=z(`$ZodObject`,(e,t)=>{Ea.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=zn(()=>Do(t));R(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)||Gn(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=nr,o=t.catchall,s,c=Qr.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(Sr(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=>To(n,t,e,r,a,o))):To(s,t,e,r,a,o)}return o?Oo(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ao=z(`$ZodObjectJIT`,(e,t)=>{ko.init(e,t);let n=e._zod.parse,r=zn(()=>Do(t)),i=Qr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new wa([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
15
|
+
let ${e}_ab = false;
|
|
16
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
17
|
+
const iss = ${e}.issues[i];
|
|
18
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
19
|
+
payload.issues.push(iss);
|
|
20
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
21
|
+
}
|
|
22
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
23
|
+
payload.value = newResult;
|
|
24
|
+
return payload;
|
|
25
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:$n(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
26
|
+
const ${n}_present = ${i};
|
|
27
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
28
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (${e}) {
|
|
32
|
+
newResult[${r}] = ${n}.value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
`)}else f?(o.write(`
|
|
37
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
38
|
+
}
|
|
39
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
40
|
+
if (${n}.value !== undefined || ${i}) {
|
|
41
|
+
newResult[${r}] = ${n}.value;
|
|
42
|
+
}
|
|
43
|
+
`)):o.write(`
|
|
44
|
+
const ${n}_present = ${i};
|
|
45
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
46
|
+
}
|
|
47
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
48
|
+
payload.issues.push({
|
|
49
|
+
code: "invalid_type",
|
|
50
|
+
expected: "nonoptional",
|
|
51
|
+
input: undefined,
|
|
52
|
+
path: [${r}]
|
|
53
|
+
});
|
|
54
|
+
if (ctx && ctx.abortEarly) {
|
|
55
|
+
payload.value = newResult;
|
|
56
|
+
return payload;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (${n}_present) {
|
|
61
|
+
newResult[${r}] = ${n}.value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=nr,c=!Qr.jitless,l=c&&rr.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?Oo([],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 jo(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=>!Sr(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=>Or(e,r,$r())))}),t)}var Mo=z(`$ZodUnion`,(e,t)=>{Ea.init(e,t),R(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),R(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(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)))}),R(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=>Vn(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=>jo(t,r,e,i)):jo(o,r,e,i)}});function No(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 Po=z(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mo.init(e,t);let n=e._zod.parse;R(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)||Gn(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=Kn(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=zn(()=>No(t));e._zod.parse=(i,a)=>{let o=i.value;if(!nr(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)}}),Fo=z(`$ZodIntersection`,(e,t)=>{Ea.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])=>Lo(e,t,n)):Lo(e,i,a)}});function Io(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ir(e)&&ir(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=Io(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=Io(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 Lo(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=Io(t.value,n.value);if(!c.valid){if(Sr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ro=z(`$ZodRecord`,(e,t)=>{Ea.init(e,t);let n=Qr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ir(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Or(e,i,$r())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...wr(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...wr(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&ra.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Or(e,i,$r())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...wr(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...wr(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),zo=z(`$ZodEnum`,(e,t)=>{Ea.init(e,t);let n=Fn(t.entries),r=new Set(n);e._zod.values=r,R(e,`pattern`,e=>{let t=Fn(e.def.entries).filter(e=>or.has(typeof e));return RegExp(t.length?`^(${t.map(e=>sr(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}}),Bo=z(`$ZodLiteral`,(e,t)=>{Ea.init(e,t);let n=new Set(t.values);e._zod.values=n,R(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?sr(e):e?sr(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}}),Vo=z(`$ZodTransform`,(e,t)=>{Ea.init(e,t),e._zod.optin=`optional`,Qr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zr(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 Xr;return n.value=i,n}});function H(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ho=z(`$ZodOptional`,(e,t)=>{Ea.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Vn(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=>H(e,t)):H(e,r)}return t.innerType._zod.run(e,n)}}),Uo=z(`$ZodExactOptional`,(e,t)=>{Ho.init(e,t),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wo=z(`$ZodNullable`,(e,t)=>{Ea.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin),R(e,`optout`,e=>e.def.innerType._zod.optout),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Vn(t.source)}|null)$`):void 0}),R(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)}),Go=z(`$ZodDefault`,(e,t)=>{Ea.init(e,t),e._zod.optin=`defaulted`,R(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=>Ko(e,t)):Ko(r,t)}});function Ko(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qo=z(`$ZodPrefault`,(e,t)=>{Ea.init(e,t),e._zod.optin=`defaulted`,R(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))}),Jo=z(`$ZodNonOptional`,(e,t)=>{Ea.init(e,t),R(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=>Yo(t,e)):Yo(i,e)}});function Yo(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 Xo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Or(e,r,$r()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Zo=z(`$ZodCatch`,(e,t)=>{Ea.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),R(e,`optout`,e=>e.def.innerType._zod.optout),R(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=>Xo(e,r,t,n)):Xo(e,r,t,n)}}),Qo=z(`$ZodPipe`,(e,t)=>{Ea.init(e,t),R(e,`values`,e=>e.def.in._zod.values),R(e,`optin`,e=>e.def.in._zod.optin),R(e,`optout`,e=>e.def.out._zod.optout),R(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=>$o(e,t.in,n)):$o(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$o(e,t.out,n)):$o(r,t.out,n)}});function $o(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 es=z(`$ZodReadonly`,(e,t)=>{Ea.init(e,t),R(e,`propValues`,e=>e.def.innerType._zod.propValues),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`optin`,e=>e.def.innerType?._zod?.optin),R(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(ts):ts(r)}});function ts(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ns=z(`$ZodLazy`,(e,t)=>{Ea.init(e,t),Wn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),R(e,`pattern`,e=>e.innerType?._zod?.pattern),R(e,`propValues`,e=>e.innerType?._zod?.propValues),R(e,`optin`,e=>e.innerType?._zod?.optin??void 0),R(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),rs=z(`$ZodCustom`,(e,t)=>{oa.init(e,t),Ea.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=>is(t,n,r,e));is(i,n,r,e)}});function is(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(Nr(e))}}var as=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},os=`~memo`,ss=[];function cs(e){return typeof e==`object`&&!!e}function ls(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var us=new WeakMap,ds=0,fs=1,ps=2;function ms(e,t,n){let r=us.get(e);if(r!==void 0)return r?ps:ds;if(t.has(e))return ps;t.add(e);let i=ds,a=e=>{if(i!==ps&&e?._zod){let r=ms(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=ds;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?fs:o.value?._zod?ms(o.value,t,n):ds;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Kn(c);s(e?o(e,!0):fs),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?ms(r,t,!1):fs);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),hs(e,i)}function hs(e,t){return t!==fs&&us.set(e,t===ps),t}function gs(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var _s,vs=[],ys={alloc(e,t,n){let r=_s;if(!r)return n;_s=void 0;let i={value:n,issues:null};return r.set(t.value,i),vs.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`&&xs(n,e.value))throw new as;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=ms(e,new Set,!1);if(i===ds)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===ps||r?n=!0:r=!0}let l=s.value;if(!cs(l))return t(s,c);let u=c[os];u||(u={buckets:new WeakMap,backEdges:void 0},c[os]=u);let d;i===c?d=a:(d=gs(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(...ls(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;_s=d;let p=vs.length,m=t(s,c);_s=void 0;let h=vs.length>p?vs.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ls(e.issues):ss),e)):(h&&(h.issues=m.issues.length?ls(m.issues):ss),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function bs(){return ys}function xs(e,t){let n=e[os]?.backEdges;return n!==void 0&&cs(t)&&n.has(t)}var Ss=()=>{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(Mr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${lr(e.values[0])}`:`Invalid option: expected one of ${In(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`:``}: ${In(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 Cs(){return{localeError:Ss()}}var ws,Ts=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 Es(){return new Ts}(ws=globalThis).__zod_globalRegistry??(ws.__zod_globalRegistry=Es());var Ds=globalThis.__zod_globalRegistry;function Os(e){return e.checks&&=[...e.checks],e}function ks(e,t){return new e(Os({type:`string`,...L(t)}))}function As(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function js(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function Ms(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Ns(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function Ps(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function Fs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Is(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Ls(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Rs(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function zs(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Bs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Vs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function Hs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function Us(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Ws(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function Gs(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Ks(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function qs(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Js(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Ys(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Xs(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function Zs(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function Qs(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function $s(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function ec(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function tc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function nc(e,t){return new e(Os({type:`number`,checks:[],...L(t)}))}function rc(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function ic(e,t){return new e({type:`boolean`,...L(t)})}function ac(e){return new e({type:`unknown`})}function oc(e,t){return new e({type:`never`,...L(t)})}function sc(e,t){return new la({check:`less_than`,...L(t),value:e,inclusive:!1})}function cc(e,t){return new la({check:`less_than`,...L(t),value:e,inclusive:!0})}function lc(e,t){return new ua({check:`greater_than`,...L(t),value:e,inclusive:!1})}function uc(e,t){return new ua({check:`greater_than`,...L(t),value:e,inclusive:!0})}function dc(e,t){return new da({check:`multiple_of`,...L(t),value:e})}function fc(e,t){return new pa({check:`max_length`,...L(t),maximum:e})}function pc(e,t){return new ma({check:`min_length`,...L(t),minimum:e})}function mc(e,t){return new ha({check:`length_equals`,...L(t),length:e})}function hc(e,t){return new _a({check:`string_format`,format:`regex`,...L(t),pattern:e})}function gc(e){return new va({check:`string_format`,format:`lowercase`,...L(e)})}function _c(e){return new ya({check:`string_format`,format:`uppercase`,...L(e)})}function vc(e,t){return new ba({check:`string_format`,format:`includes`,...L(t),includes:e})}function yc(e,t){return new xa({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function bc(e,t){return new Sa({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function xc(e){return new Ca({check:`overwrite`,tx:e})}function Sc(e){return xc(t=>t.normalize(e))}function Cc(){return xc(e=>e.trim())}function wc(){return xc(e=>e.toLowerCase())}function Tc(){return xc(e=>e.toUpperCase())}function Ec(){return xc(e=>er(e))}function Dc(e,t,n){return new e({type:`array`,element:t,...L(n)})}function Oc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function kc(e,t){let n=Ac(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Nr(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(Nr(r))}},e(t.value,t)),t);return n}function Ac(e,t){let n=new oa({check:`custom`,...L(t)});return n._zod.check=e,n}function jc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Gn(e,t,n[t]);return e}function Mc(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??Ds,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 Nc(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 U(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,U(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&jc(o.schema,c),t.io===`input`&&Uc(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 Pc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Fc(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}/${Pc(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+Pc(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>
|
|
65
|
+
|
|
66
|
+
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 Ic(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;Ic(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 Lc=new Set([`type`,`properties`,`required`,`additionalProperties`]),Rc=[`oneOf`,`anyOf`];function zc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Bc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Lc.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]??zc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Gn(n,r,e.length===1?e[0]:Bc(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=zc(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 Vc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Lc)if(t in e)return;let n=t.filter(e=>Rc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Bc(t);else{let e=n[0],i=Rc.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=>Bc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,jc(e,r))}function Hc(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)):jc(i,s),jc(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())Ic(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)??[])Vc(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)}jc(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,Gn(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:Gc(t,`input`,e.processors),output:Gc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Uc(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 Uc(r.element,n);if(r.type===`set`)return Uc(r.valueType,n);if(r.type===`lazy`)return Uc(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 Uc(r.innerType,n);if(r.type===`intersection`)return Uc(r.left,n)||Uc(r.right,n);if(r.type===`record`||r.type===`map`)return Uc(r.keyType,n)||Uc(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Uc(r.in,n)||Uc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Uc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Uc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Uc(e,n))return!0;return!!(r.rest&&Uc(r.rest,n))}return!1}var Wc=(e,t={})=>n=>{let r=Mc({...n,processors:t});return U(e,r),Fc(r,e),Hc(r,e)},Gc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Mc({...i??{},target:a,io:t,processors:n});return U(e,o),Fc(o,e),Hc(o,e)},Kc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},qc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Jc=(e,t)=>{Kc(e,`minimum`,t),qc(e,`maximum`,t)},Yc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Xc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Zc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Qc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},$c=(e,t)=>Kc(e,`minimum`,t.minimum),el=(e,t)=>qc(e,`maximum`,t.maximum),tl=e=>(t,n)=>{Qc(t,n.format);let[r,i]=e[n.format];Kc(t,`minimum`,r),qc(t,`maximum`,i)},nl={greater_than:(e,t)=>Kc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>qc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Yc(e,t.value),number_format:tl(dr),bigint_format:tl(fr),min_length:$c,max_length:el,length_equals:(e,t)=>Jc(e,t.length),min_size:$c,max_size:el,size_equals:(e,t)=>Jc(e,t.size),string_format:(e,t)=>{Qc(e,t.format),t.pattern&&Xc(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)=>Zc(e,t.mime)};function rl(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)nl[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Kc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Kc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&qc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&qc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Yc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Zc(t,i.mime);for(let e of i.patterns??[])Xc(t,e);return t}var il={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},al=new Map([[so,Gi],[lo,Ki]]),ol=e=>al.get(e)??e,sl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=rl(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=il[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(ol);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}))])}},cl=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=rl(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)):Nc(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}))])}},ll=(e,t,n,r)=>{n.type=`boolean`},ul=(e,t,n,r)=>{n.not={}},dl=(e,t,n,r)=>{let i=e._zod.def,a=Fn(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)},fl=(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(Nc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Nc(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}},pl=(e,t,n,r)=>{Nc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ml=(e,t,n,r)=>{Nc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},hl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=rl(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=U(a.element,t,{...r,path:[...r.path,`items`]})};function gl(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?gl(t.out):t.type===`catch`?gl(t.innerType):e._zod.optin}var _l=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Nc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Gn(i.properties,e,U(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`?gl(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=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},vl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},yl=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(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)};function bl(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=bl(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>bl(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?ra:na).source)),p}var xl=new WeakMap;function Sl(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of xl.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=bl(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Cl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=rl(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=U(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Gn(i.patternProperties,ol(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=U(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=xl.get(t);n||(n=[],xl.set(t,n),t.deferred.push(()=>Sl(t))),n.push(e)}i.additionalProperties=U(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&gl(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},wl=(e,t,n,r)=>{let i=e._zod.def,a=U(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`}]},Tl=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},El=Symbol();function Dl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Nc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),El):JSON.parse(o)}var Ol=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Dl(i.defaultValue,e,t,n,r);o!==El&&(n.default=o)},kl=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Dl(i.defaultValue,e,t,n,r);o!==El&&(n._prefault=o)},Al=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Nc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},jl=(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;U(o,t,r);let s=t.seen.get(e);s.ref=o},Ml=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Nl=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Pl=(e,t,n,r)=>{let i=e._zod.innerType;U(i,t,r);let a=t.seen.get(e);a.ref=i},Fl=new WeakSet([Object.prototype,Error.prototype]);function Il(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 Ll=z(`ZodError`,(e,t)=>{ai.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Fl.has(n)||(Fl.add(n),Il(n,`format`,e=>t=>ci(e,t)),Il(n,`flatten`,e=>t=>si(e,t)),Il(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ln,2)}),Il(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ln,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Rl=ui(Ll),zl=di(Ll),Bl=fi(Ll),Vl=mi(Ll),Hl=bi(Ll),Ul=xi(Ll),Wl=Si(Ll),Gl=Ci(Ll),Kl=wi(Ll),ql=Ti(Ll),Jl=Ei(Ll),Yl=Di(Ll);function Xl(){Qr.localeError||$r(Cs())}function Zl(){Qr.memoizer||$r({memoizer:bs()})}var Ql=z(`ZodType`,(e,t)=>(Xl(),Ea.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Qn(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 cr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_d(e,t))},superRefine(e,t){return this.check(vd(e,t))},overwrite(e){return this.check(xc(e))},optional(){return $u(this)},exactOptional(){return td(this)},nullable(){return q(this)},nullish(){return $u(q(this))},nonoptional(e){return sd(this,e)},array(){return Iu(this)},or(e){return zu([this,e])},and(e){return Uu(this,e)},transform(e){return dd(this,Zu(e))},default(e){return rd(this,e)},prefault(e){return ad(this,e)},catch(e){return ld(this,e)},pipe(e){return dd(this,e)},readonly(){return pd(this)},describe(e){let t=this.clone();return Ds.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ds.get(this);let t=this.clone();return Ds.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 Ir(this,`~standard`,{...ka(this),jsonSchema:{input:Gc(this,`input`),output:Gc(this,`output`)}})},set"~standard"(e){Fr(this,`~standard`,e)},parse:function e(t,n){return Rl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await zl(this,t,n,{callee:e})},safeParse(e,t){return Bl(this,e,t)},async safeParseAsync(e,t){return Vl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Fr(this,`spa`,e)},validate(e,t){return _i(this,e,t)},validateAsync(e,t){return yi(this,e,t)},encode:function e(t,n){return Hl(this,t,n,{callee:e})},decode:function e(t,n){return Ul(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Wl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Gl(this,t,n,{callee:e})},safeEncode(e,t){return Kl(this,e,t)},safeDecode(e,t){return ql(this,e,t)},async safeEncodeAsync(e,t){return Jl(this,e,t)},async safeDecodeAsync(e,t){return Yl(this,e,t)},toJSONSchema(e){return Wc(this,{})(e)},get description(){return Ds.get(this)?.description},get _def(){return this._zod.def}}),$l=z(`_ZodString`,(e,t)=>{Aa.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r)},Lr({format:e=>rl(e).format??null,minLength:e=>rl(e).minimum??null,maxLength:e=>rl(e).maximum??null},{regex(...e){return this.check(hc(...e))},includes(...e){return this.check(vc(...e))},startsWith(...e){return this.check(yc(...e))},endsWith(...e){return this.check(bc(...e))},min(...e){return this.check(pc(...e))},max(...e){return this.check(fc(...e))},length(...e){return this.check(mc(...e))},nonempty(...e){return this.check(pc(1,...e))},lowercase(e){return this.check(gc(e))},uppercase(e){return this.check(_c(e))},trim(){return this.check(Cc())},normalize(...e){return this.check(Sc(...e))},toLowerCase(){return this.check(wc())},toUpperCase(){return this.check(Tc())},slugify(){return this.check(Ec())}})),eu=z(`ZodString`,(e,t)=>{Aa.init(e,t),$l.init(e,t)},{email(e){return this.check(As(ou,e))},url(e){return this.check(Is(lu,e))},jwt(e){return this.check(Zs(wu,e))},emoji(e){return this.check(Ls(uu,e))},guid(e){return this.check(js(su,e))},uuid(e){return this.check(Ms(cu,e))},uuidv4(e){return this.check(Ns(cu,e))},uuidv6(e){return this.check(Ps(cu,e))},uuidv7(e){return this.check(Fs(cu,e))},nanoid(e){return this.check(Rs(du,e))},cuid(e){return this.check(zs(fu,e))},cuid2(e){return this.check(Bs(pu,e))},ulid(e){return this.check(Vs(mu,e))},base64(e){return this.check(Js(xu,e))},base64url(e){return this.check(Ys(Su,e))},xid(e){return this.check(Hs(hu,e))},ksuid(e){return this.check(Us(gu,e))},ipv4(e){return this.check(Ws(_u,e))},ipv6(e){return this.check(Gs(vu,e))},cidrv4(e){return this.check(Ks(yu,e))},cidrv6(e){return this.check(qs(bu,e))},e164(e){return this.check(Xs(Cu,e))},datetime(e){return this.check(Qs(nu,e))},date(e){return this.check($s(ru,e))},time(e){return this.check(ec(iu,e))},duration(e){return this.check(tc(au,e))}});function W(e){return ks(eu,e)}var tu=z(`ZodStringFormat`,(e,t)=>{V.init(e,t),$l.init(e,t)}),nu=z(`ZodISODateTime`,(e,t)=>{Ya.init(e,t),tu.init(e,t)}),ru=z(`ZodISODate`,(e,t)=>{Xa.init(e,t),tu.init(e,t)}),iu=z(`ZodISOTime`,(e,t)=>{Za.init(e,t),tu.init(e,t)}),au=z(`ZodISODuration`,(e,t)=>{Qa.init(e,t),tu.init(e,t)}),ou=z(`ZodEmail`,(e,t)=>{Na.init(e,t),tu.init(e,t)}),su=z(`ZodGUID`,(e,t)=>{ja.init(e,t),tu.init(e,t)}),cu=z(`ZodUUID`,(e,t)=>{Ma.init(e,t),tu.init(e,t)}),lu=z(`ZodURL`,(e,t)=>{Va.init(e,t),tu.init(e,t)}),uu=z(`ZodEmoji`,(e,t)=>{Ha.init(e,t),tu.init(e,t)}),du=z(`ZodNanoID`,(e,t)=>{Ua.init(e,t),tu.init(e,t)}),fu=z(`ZodCUID`,(e,t)=>{Wa.init(e,t),tu.init(e,t)}),pu=z(`ZodCUID2`,(e,t)=>{Ga.init(e,t),tu.init(e,t)}),mu=z(`ZodULID`,(e,t)=>{Ka.init(e,t),tu.init(e,t)}),hu=z(`ZodXID`,(e,t)=>{qa.init(e,t),tu.init(e,t)}),gu=z(`ZodKSUID`,(e,t)=>{Ja.init(e,t),tu.init(e,t)}),_u=z(`ZodIPv4`,(e,t)=>{$a.init(e,t),tu.init(e,t)}),vu=z(`ZodIPv6`,(e,t)=>{no.init(e,t),tu.init(e,t)}),yu=z(`ZodCIDRv4`,(e,t)=>{ro.init(e,t),tu.init(e,t)}),bu=z(`ZodCIDRv6`,(e,t)=>{ao.init(e,t),tu.init(e,t)}),xu=z(`ZodBase64`,(e,t)=>{co.init(e,t),tu.init(e,t)}),Su=z(`ZodBase64URL`,(e,t)=>{fo.init(e,t),tu.init(e,t)}),Cu=z(`ZodE164`,(e,t)=>{po.init(e,t),tu.init(e,t)}),wu=z(`ZodJWT`,(e,t)=>{ho.init(e,t),tu.init(e,t)}),Tu=z(`ZodNumber`,(e,t)=>{go.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.isFinite=!0},Lr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=rl(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=rl(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=rl(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>rl(e).format??null},{gt(e,t){return this.check(lc(e,t))},gte(e,t){return this.check(uc(e,t))},min(e,t){return this.check(uc(e,t))},lt(e,t){return this.check(sc(e,t))},lte(e,t){return this.check(cc(e,t))},max(e,t){return this.check(cc(e,t))},int(e){return this.check(Ou(e))},safe(e){return this.check(Ou(e))},positive(e){return this.check(lc(0,e))},nonnegative(e){return this.check(uc(0,e))},negative(e){return this.check(sc(0,e))},nonpositive(e){return this.check(cc(0,e))},multipleOf(e,t){return this.check(dc(e,t))},step(e,t){return this.check(dc(e,t))},finite(){return this}}));function Eu(e){return nc(Tu,e)}var Du=z(`ZodNumberFormat`,(e,t)=>{_o.init(e,t),Tu.init(e,t)});function Ou(e){return rc(Du,e)}var ku=z(`ZodBoolean`,(e,t)=>{vo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r)});function Au(e){return ic(ku,e)}var ju=z(`ZodUnknown`,(e,t)=>{yo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Mu(){return ac(ju)}var Nu=z(`ZodNever`,(e,t)=>{bo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ul(e,t,n,r)});function Pu(e){return oc(Nu,e)}var Fu=z(`ZodArray`,(e,t)=>{Zl(),wo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r),e.element=t.element},{min(e,t){return this.check(pc(e,t))},nonempty(e){return this.check(pc(1,e))},max(e,t){return this.check(fc(e,t))},length(e,t){return this.check(mc(e,t))},unwrap(){return this.element}});function Iu(e,t){return Dc(Fu,e,t)}var Lu=z(`ZodObject`,(e,t)=>{Zl(),Ao.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r),Ur(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return qu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Qn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Qn(this._zod.def,{catchall:Mu()}))},loose(){return this.clone(Qn(this._zod.def,{catchall:Mu()}))},strict(){return this.clone(Qn(this._zod.def,{catchall:Pu()}))},strip(){return this.clone(Qn(this._zod.def,{catchall:void 0}))},extend(e){return gr(this,e)},safeExtend(e){return vr(this,e)},merge(e){return yr(this,e)},pick(e){return pr(this,e)},omit(e){return hr(this,e)},partial(...e){return br(Qu,this,e[0])},exactPartial(...e){return br(ed,this,e[0],`exactPartial`)},required(...e){return xr(od,this,e[0])}});function G(e,t){return new Lu({type:`object`,shape:e,catchall:Pu(),...L(t)})}var Ru=z(`ZodUnion`,(e,t)=>{Mo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r),e.options=t.options});function zu(e,t){return new Ru({type:`union`,options:e,...L(t)})}var Bu=z(`ZodDiscriminatedUnion`,(e,t)=>{Ru.init(e,t),Po.init(e,t)});function Vu(e,t,n){return new Bu({type:`union`,options:t,discriminator:e,...L(n)})}var Hu=z(`ZodIntersection`,(e,t)=>{Fo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r)});function Uu(e,t){return new Hu({type:`intersection`,left:e,right:t})}var Wu=z(`ZodRecord`,(e,t)=>{Zl(),Ro.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Gu(e,t,n){return!t||!t._zod?new Wu({type:`record`,keyType:W(),valueType:e,...L(t)}):new Wu({type:`record`,keyType:e,valueType:t,...L(n)})}var Ku=z(`ZodEnum`,(e,t)=>{zo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dl(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 Ku({...t,checks:[],...L(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 Ku({...t,checks:[],...L(r),entries:i})}});function qu(e,t){return new Ku({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var Ju=z(`ZodLiteral`,(e,t)=>{Bo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(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 Yu(e,t){return new Ju({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var Xu=z(`ZodTransform`,(e,t)=>{Zl(),Vo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ml(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Nr(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(Nr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Zu(e){return new Xu({type:`transform`,transform:e})}var Qu=z(`ZodOptional`,(e,t)=>{Ho.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new Qu({type:`optional`,innerType:e})}var ed=z(`ZodExactOptional`,(e,t)=>{Uo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function td(e){return new ed({type:`optional`,innerType:e})}var K=z(`ZodNullable`,(e,t)=>{Wo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function q(e){return new K({type:`nullable`,innerType:e})}var nd=z(`ZodDefault`,(e,t)=>{Go.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rd(e,t){return new nd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ar(t)}})}var id=z(`ZodPrefault`,(e,t)=>{qo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ad(e,t){return new id({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ar(t)}})}var od=z(`ZodNonOptional`,(e,t)=>{Jo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e,t){return new od({type:`nonoptional`,innerType:e,...L(t)})}var cd=z(`ZodCatch`,(e,t)=>{Zo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ld(e,t){return new cd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Gr(t)})}var ud=z(`ZodPipe`,(e,t)=>{Qo.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.in=t.in,e.out=t.out});function dd(e,t){return new ud({type:`pipe`,in:e,out:t})}var fd=z(`ZodReadonly`,(e,t)=>{es.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pd(e){return new fd({type:`readonly`,innerType:e})}var md=z(`ZodLazy`,(e,t)=>{ns.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function hd(e){return new md({type:`lazy`,getter:e})}var gd=z(`ZodCustom`,(e,t)=>{rs.init(e,t),Ql.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pl(e,t,n,r)});function _d(e,t={}){return Oc(gd,e,t)}function vd(e,t){return kc(e,t)}function yd(e){return Qs(nu,e)}function bd(e){return $s(ru,e)}function xd(e){switch(e.type){case`string`:return!e.list;case`select`:case`reference`:return!e.multiple;case`text`:case`datetime`:case`url`:case`color`:return!0;default:return!1}}function Sd(e,t){return t==null||t===``&&xd(e)}function Cd(e,t){return n=>e.required&&Sd(e,n.input)?`Required`:t}function wd(e,t,n){return e.required?t:xd(e)?zu([t,Yu(``)],{error:n}).nullish():t.nullish()}function Td(e){return e.startsWith(`/`)||URL.canParse(e)}function Ed(e){return(t,n)=>{let r=new Set;t.forEach((t,i)=>{r.has(t)&&n.addIssue({code:`custom`,path:[i],message:e(t)}),r.add(t)})}}function Dd(e,t,n,r,i){let a=Math.max(+!!e.required,n),o=Iu(t,{error:Cd(e,`Expected a list`)});return a>0&&(o=o.min(a,{error:t=>Array.isArray(t.input)&&t.input.length===0&&e.required?`Required`:`Must have at least ${a}`})),r!==void 0&&(o=o.max(r,{error:`Must have at most ${r}`})),wd(e,i?o.superRefine(Ed(i)):o,`Expected a list`)}var Od=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function kd(e){let t={};for(let[n,r]of Object.entries(e))t[n]=Ad(r);return t}function Ad(e){if(e.type!==`markdown`)return jd(e);let t=W({error:Cd(e,`Expected text`)});return e.required?t.regex(/\S/,`Required`):t.nullish()}function jd(e){switch(e.type){case`markdown`:return null;case`object`:{let t=G(kd(e.fields),{error:Cd(e,`Expected an object`)});return e.list?Dd(e,t,e.min??0,e.max):wd(e,t,``)}case`blocks`:{let t=`Expected ${Md}: ${Object.keys(e.blocks).join(`, `)}`;return Dd(e,Vu(Md,Object.entries(e.blocks).map(([e,t])=>G({[Md]:Yu(e),...kd(t.fields)})),{error:t}),e.min??0,e.max)}case`string`:case`text`:{if(e.type===`string`&&e.list)return Dd(e,W({error:`Expected text`}),0);let t=W({error:Cd(e,`Expected text`)});return e.required?t.regex(/\S/,`Required`):t.nullish()}case`boolean`:return wd(e,Au({error:Cd(e,`Expected true or false`)}),``);case`select`:{let t=e.options.map(e=>e.value),n=`Expected one of: ${t.join(`, `)}`;return e.multiple?Dd(e,qu(t,{error:n}),0):wd(e,qu(t,{error:Cd(e,n)}),n)}case`number`:{let t=Eu({error:Cd(e,`Expected a number`)});return e.integer&&(t=t.int(`Must be a whole number`)),e.min!==void 0&&(t=t.min(e.min,`Must be at least ${e.min}`)),e.max!==void 0&&(t=t.max(e.max,`Must be at most ${e.max}`)),wd(e,t,``)}case`datetime`:return wd(e,e.dateOnly?bd({error:Cd(e,`Invalid date`)}):yd({offset:!0,local:!0,error:Cd(e,`Invalid date`)}),`Invalid date`);case`json`:return e.required?zu([W(),Eu(),Au(),Iu(Mu()),Gu(W(),Mu())],{error:`Required`}):Mu().optional();case`url`:{let t=`Must be an http(s) URL or start with /`;return wd(e,W({error:Cd(e,`Expected text`)}).regex(/^(?:https?:\/\/|\/(?!\/))/i,{error:Cd(e,t)}).refine(Td,{error:t}),t)}case`color`:{let t=`Must be a hex color like #a1b2c3`;return wd(e,W({error:Cd(e,`Expected text`)}).regex(/^#[0-9a-fA-F]{6}$/,{error:Cd(e,t)}),t)}case`image`:{let t=W({error:e=>e.input===void 0||e.input===null?`Required`:`Expected text`}).regex(/\S/,`Required`);return wd(e,G({src:t,alt:t},{error:Cd(e,`Expected { src, alt }`)}),``)}case`reference`:{let t=`Must reference an entry in: ${e.collections.join(`, `)}`,n=xn.source.slice(1,-1),r=W({error:Cd(e,`Expected a reference like "collection/slug"`)}).regex(RegExp(`^(?:${e.collections.map(Od).join(`|`)})/${n}$`),{error:Cd(e,t)});return e.multiple?Dd(e,r,e.min??0,e.max,e=>`Duplicate reference: ${e}`):wd(e,r,t)}}}var Md=`block`,Nd=[`action`,`Action`,`collection`,`slug`,`target`],Pd=[`branch`,`name`,`login`],Fd=/^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;function Id(e){return Fd.test(e)&&!e.includes(`..`)&&!e.split(`/`).some(e=>e.endsWith(`.lock`))}function Ld(e,t){return W().trim().min(1).max(t).refine(e=>!/[\r\n]/.test(e),`must be one line`).superRefine((t,n)=>{for(let[,r]of t.matchAll(/\{([^{}]*)\}/g))e.includes(r)||n.addIssue({code:`custom`,message:`unknown placeholder "{${r}}" (use ${e.map(e=>`{${e}}`).join(`, `)})`})})}var Rd=G({baseBranch:W().min(1),branchPrefix:W().refine(e=>e.endsWith(`/`)&&Id(e.slice(0,-1)),`must be branch name segments ending in "/", for example "editlet/"`).optional(),commitMessage:Ld(Nd,200).optional(),pullRequest:G({title:Ld(Pd,256).optional(),labels:Iu(W().trim().min(1).max(50).refine(e=>!e.includes(`,`),`must not contain ","`)).max(10).optional(),draft:Au().optional()}).optional()}),zd=/^[a-zA-Z][a-zA-Z0-9]*$/,Bd=`must start with a letter and contain only letters and digits`,Vd={label:W(),hint:W().optional(),required:Au().optional()},Hd=zu([W(),Iu(W())]),Ud=hd(()=>Gu(W().regex(zd,`field key ${Bd}`),Wd).refine(e=>Object.keys(e).length>0,`fields must not be empty`)),Wd=Vu(`type`,[G({...Vd,type:Yu(`string`),list:Au().optional(),default:Hd.optional()}),G({...Vd,type:Yu(`text`),rows:Eu().int().positive().optional(),default:W().optional()}),G({...Vd,type:Yu(`markdown`)}),G({...Vd,type:Yu(`boolean`),default:Au().optional(),labels:G({true:W(),false:W()}).optional()}),G({...Vd,type:Yu(`select`),options:Iu(G({label:W(),value:W()})).min(1,`options must not be empty`),multiple:Au().optional(),default:Hd.optional()}),G({...Vd,type:Yu(`number`),min:Eu().optional(),max:Eu().optional(),step:Eu().optional(),integer:Au().optional(),default:Eu().optional()}),G({...Vd,type:Yu(`datetime`),dateOnly:Au().optional(),defaultNow:Au().optional()}),G({...Vd,type:Yu(`json`)}),G({...Vd,type:Yu(`url`)}),G({...Vd,type:Yu(`color`),default:W().optional()}),G({...Vd,type:Yu(`image`)}),G({...Vd,type:Yu(`reference`),collections:Iu(W()).min(1,`collections must not be empty`),multiple:Au().optional(),min:Eu().int().nonnegative().optional(),max:Eu().int().nonnegative().optional()}),G({...Vd,type:Yu(`object`),fields:Ud,list:Au().optional(),min:Eu().int().nonnegative().optional(),max:Eu().int().nonnegative().optional()}),G({...Vd,type:Yu(`blocks`),blocks:Gu(W().regex(zd,`block key ${Bd}`),G({label:W(),fields:Ud})).refine(e=>Object.keys(e).length>0,`blocks must not be empty`),min:Eu().int().nonnegative().optional(),max:Eu().int().nonnegative().optional()})]),Gd=G({label:W(),singleton:Au().optional(),titleField:W().optional(),slugFrom:W().optional(),fields:Gu(W().regex(zd,`field key ${Bd}`),Wd)});function Kd(e,t,n,r,i){for(let[a,o]of Object.entries(t)){let t=[...n,a];if(a===`draft`&&!r&&i(t,`field key "draft" is reserved for the draft flag`),`default`in o&&o.default!==void 0){let e=jd(o)?.safeParse(o.default);for(let n of e?.success===!1?e.error.issues:[])i([...t,`default`,...n.path.map(String)],`default: ${n.message}`)}if(o.type===`reference`&&(o.collections.forEach((n,r)=>{Object.hasOwn(e.collections,n)||i([...t,`collections`,r],`unknown collection "${n}"`)}),o.multiple||o.min===void 0&&o.max===void 0||i(t,`min/max require multiple: true`)),o.type===`object`&&(o.list||o.min===void 0&&o.max===void 0||i(t,`min/max require list: true`),Kd(e,o.fields,[...t,`fields`],!0,i)),o.type===`blocks`)for(let[n,r]of Object.entries(o.blocks))Object.hasOwn(r.fields,`block`)&&i([...t,`blocks`,n,`fields`,Md],`field key "${Md}" is reserved for the block type`),Kd(e,r.fields,[...t,`blocks`,n,`fields`],!0,i);(o.type===`reference`||o.type===`object`||o.type===`blocks`)&&o.min!==void 0&&o.max!==void 0&&o.min>o.max&&i([...t,`min`],`min must not exceed max`)}}var qd=G({$schema:W().optional(),contentDir:W().min(1).refine(En,`must be a relative posix path without empty, "." or ".." segments, backslashes, NUL or ":"`),git:Rd,collections:Gu(W().regex(zd,`collection key ${Bd}`),Gd)}).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:e,message:n}),{baseBranch:r,branchPrefix:i}=e.git;i!==void 0&&(r.startsWith(i)||i.startsWith(`${r}/`))&&n([`git`,`branchPrefix`],`branchPrefix "${i}" clashes with the base branch "${r}"`);let a=new Map;for(let[t,r]of Object.entries(e.collections)){let i=a.get(t.toLowerCase());i===void 0?a.set(t.toLowerCase(),t):n([`collections`,t],`collection key "${t}" differs from "${i}" only in case`),Object.entries(r.fields).filter(([,e])=>e.type===`markdown`).length>1&&n([`collections`,t,`fields`],`a collection can have at most one markdown field`),r.titleField!==void 0&&!Object.hasOwn(r.fields,r.titleField)&&n([`collections`,t,`titleField`],`titleField "${r.titleField}" is not a field of ${t}`),r.slugFrom!==void 0&&!Object.hasOwn(r.fields,r.slugFrom)&&n([`collections`,t,`slugFrom`],`slugFrom "${r.slugFrom}" is not a field of ${t}`),Kd(e,r.fields,[`collections`,t,`fields`],!1,n)}});function Jd(e){let t=[];for(let n of e.issues){let e=n.path.map(String),r=n.message;if(n.code===`invalid_union`&&(`discriminator`in n||e.at(-1)!==`type`)&&(e.at(-1)!==`type`&&(e=[...e,`type`]),r=`unknown field type`),n.code===`unrecognized_keys`)for(let r of n.keys)t.push({path:[...e,r].join(`.`),message:`unknown key "${r}"`});else t.push({path:e.join(`.`),message:r})}return t}function Yd(e){let t=qd.safeParse(e);if(!t.success)throw new bn(Jd(t.error));return t.data}function Xd(e,t){let n;try{n=JSON.parse(e)}catch(e){throw new bn([{file:t,path:``,message:`Invalid JSON: ${e instanceof Error?e.message:e}`}])}try{return Yd(n)}catch(e){throw e instanceof bn?new bn(e.issues.map(e=>({...e,file:t}))):e}}function Zd(e){return Object.entries(e.fields).find(([,e])=>e.type===`markdown`)?.[0]}var Qd=`editlet/`,$d=[`editlet`],ef=`Editlet-Source`,tf=`<!-- editlet:start -->`,nf=`<!-- editlet:end -->`;function rf(e){return{branchPrefix:e?.branchPrefix??`editlet/`,commitMessage:e?.commitMessage??`{Action} {target}`,pullRequest:{title:e?.pullRequest?.title??`Update {branch}`,labels:[...e?.pullRequest?.labels??$d],draft:e?.pullRequest?.draft??!1}}}function af(e,t=Qd){return e.length>t.length&&e.startsWith(t)&&Id(e)}function of(e,t,n){return{action:e,collection:t,slug:n,target:`${t}/${n}`}}function sf(e,t,n){return{action:`rename`,collection:e,slug:n,target:`${e}/${t} → ${e}/${n}`}}function cf(e,t){let[n,...r]=t;if(!n)return{action:e,collection:`content`,slug:``,target:`content`};if(r.length===0)return of(e,n.collection,n.slug);let i=r.every(e=>e.collection===n.collection)?n.collection:`content`,a=` +${r.length}`;return{action:e,collection:i,slug:`${n.slug}${a}`,target:`${n.collection}/${n.slug}${a}`}}function lf(e,t,n){let r=new Set(n.map(t=>{let n=t.startsWith(`${e.contentDir}/`)?t.slice(e.contentDir.length+1):``,r=n.split(`/`)[0]??``;return n.includes(`/`)&&Object.hasOwn(e.collections,r)?r:`media`})),i=r.size===1?[...r][0]:`media`;if(n.length===1){let e=n[0].split(`/`).pop();return{action:t,collection:i,slug:e,target:`${i}/${e}`}}let a=`${n.length} images`;return{action:t,collection:i,slug:a,target:a}}function uf(e,t){return e.replace(/\{([A-Za-z]+)\}/g,(e,n)=>Object.hasOwn(t,n)?t[n]:e).replace(/\s+/g,` `).trim()}function df(e,t){let n=t.action.charAt(0).toUpperCase()+t.action.slice(1);return uf(e.commitMessage,{...t,Action:n})}function ff(e,t){return`${e}\n\n${ef}: ${t}`}function pf(e,t){return t.startsWith(e.branchPrefix)?t.slice(e.branchPrefix.length):t}function mf(e,t){return uf(e.pullRequest.title,{...t,name:pf(e,t.branch)})}var hf={added:`created`,modified:`updated`,removed:`deleted`};function gf(e,t){let n=[],r=[];for(let i of t){let t=hf[i.status],a=e?On(e,i.path):null;a?n.push({label:e.collections[a.collection].label,name:a.slug,status:t}):r.push({label:null,name:i.path,status:t})}return[...n,...r]}var _f=30;function vf(e){let t=e.changes.slice(0,_f).map(e=>`- ${e.label===null?`\`${e.name}\``:`${e.label} · ${e.name}`} — ${e.status}`);return e.changes.length>_f&&t.push(`- …and ${e.changes.length-_f} more`),[tf,`Opened in Editlet by @${e.login}.`,``,`**Changes**`,...t.length>0?t:[`- none yet`],...e.reviewUrl?[``,`Review on the site: ${e.reviewUrl}`]:[],nf].join(`
|
|
67
|
+
`)}function yf(e,t){if(e===null||e.trim()===``)return t;let n=e.indexOf(tf),r=e.indexOf(nf,n);return n<0||r<0?null:e.slice(0,n)+t+e.slice(r+20)}function bf(e,t){if(!af(e,t))throw new F(`invalid_branch`,`Branch names must look like ${t}<name>: "${e}"`)}var xf=e=>`query Branches($owner: String!, $name: String!, $base: String!, $after: String) {
|
|
68
|
+
repository(owner: $owner, name: $name) {
|
|
69
|
+
refs(refPrefix: "refs/heads/${e}", first: 100, after: $after) {
|
|
70
|
+
pageInfo { hasNextPage endCursor }
|
|
71
|
+
nodes {
|
|
72
|
+
name
|
|
73
|
+
target { oid ... on Commit { committedDate } }
|
|
74
|
+
associatedPullRequests(first: 1, states: [OPEN], baseRefName: $base) {
|
|
75
|
+
nodes { number url title isDraft headRefOid }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}`,Sf=e=>({number:e.number,url:e.html_url,title:e.title,isDraft:e.draft===!0,headOid:e.head.sha}),Cf=`query PullState($owner: String!, $name: String!, $number: Int!) {
|
|
81
|
+
repository(owner: $owner, name: $name) {
|
|
82
|
+
pullRequest(number: $number) { id isDraft mergeable mergeStateStatus headRefOid }
|
|
83
|
+
}
|
|
84
|
+
}`,wf=`query PullReview($owner: String!, $name: String!, $number: Int!) {
|
|
85
|
+
repository(owner: $owner, name: $name) {
|
|
86
|
+
pullRequest(number: $number) {
|
|
87
|
+
reviewDecision
|
|
88
|
+
reviewRequests(first: 20) {
|
|
89
|
+
nodes { requestedReviewer { ... on User { login } ... on Team { slug organization { login } } } }
|
|
90
|
+
}
|
|
91
|
+
latestOpinionatedReviews(first: 20) { nodes { state author { login } } }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}`,Tf=`mutation Ready($id: ID!) {
|
|
95
|
+
markPullRequestReadyForReview(input: { pullRequestId: $id }) { pullRequest { isDraft } }
|
|
96
|
+
}`,Ef=new Set([`CLEAN`,`HAS_HOOKS`,`UNSTABLE`]),Df=5,Of=e=>e instanceof F&&e.status===422,kf=300;function Af(e){return e===`unchanged`?null:e===`copied`||e===`changed`?`modified`:e}function jf(e){let{ctx:t,branch:n}=e,r=`/repos/${t.owner}/${t.repo}`;async function i(){try{return await e.baseBranch()}catch(e){if(e instanceof F&&e.code===`not_found`)return null;throw e}}async function a(e){return(await t.client.rest(`GET`,`${r}/pulls`,{query:{head:`${t.owner}:${n}`,base:e,state:`open`},fresh:!0}))[0]??null}async function o(e){let t=await a(e);return t?Sf(t):null}let s=async t=>bf(t,await e.branchPrefix());async function c(t){let n=await e.repoQuery(Cf,{number:t});if(!n.pullRequest)throw new F(`not_found`,`Pull request not found: #${t}`);return n.pullRequest}async function l(e){e.deployHookUrl!==void 0&&vn(e.deployHookUrl),await s(n);let i=await d.openPullRequest({title:e.title??`Publish ${n}`}),a=(e,t)=>t===void 0?{status:`blocked`,reason:e,pullRequest:i}:{status:`blocked`,reason:e,pullRequest:i,message:t},o=await c(i.number);if(e.headOid!==o.headRefOid)return a(`stale`);o.isDraft&&(await t.client.graphql(Tf,{id:o.id}),o=await c(i.number));for(let e=1;o.mergeStateStatus===`UNKNOWN`&&e<=Df;e++)await t.client.sleep(1e3*e),o=await c(i.number);if(o.mergeStateStatus===`UNKNOWN`)return a(`pending`);if(e.headOid!==o.headRefOid)return a(`stale`);if(!Ef.has(o.mergeStateStatus))return o.mergeStateStatus===`BEHIND`?a(`behind`):o.mergeStateStatus===`DIRTY`?a(`conflict`):a(`protected`);let l;try{l=(await t.client.rest(`PUT`,`${r}/pulls/${i.number}/merge`,{body:{merge_method:e.mergeMethod??`merge`,sha:o.headRefOid}})).sha}catch(e){if(e instanceof F&&e.status===405)return a(`protected`,e.message);if(e instanceof F&&e.status===409)return a(`stale`,e.message);throw e}let u=!1;if(e.deleteBranch!==!1)try{u=await d.deleteBranch()}catch{u=!1}let f={status:`merged`,pullRequest:i,mergeOid:l,branchDeleted:u};return e.deployHookUrl!==void 0&&(f.deployHook=await yn(e.deployHookUrl)),f}async function u(e=n){let i=await t.client.rest(`GET`,`${r}/git/ref/heads/${Rt(e)}`,{fresh:!0}),a=e=>t.client.rest(`GET`,`${r}/deployments`,{query:{...e,per_page:10},fresh:!0}),o=await a({sha:i.object.sha});o.length===0&&(o=await a({ref:e}));let s=o[0];if(!s)return null;let c=(await t.client.rest(`GET`,`${r}/deployments/${s.id}/statuses`,{query:{per_page:1},fresh:!0}))[0];return{id:s.id,sha:s.sha,ref:s.ref,environment:s.environment,state:c?.state??`pending`,url:c?.environment_url||null,logUrl:c?.log_url||null,createdAt:s.created_at,updatedAt:s.updated_at}}let d={publish:l,latestDeployment:u,async listBranches(){let[t,n]=await Promise.all([e.baseBranch(),e.branchPrefix()]),r=xf(n),i=[],a=null;for(;;){let o=await e.repoQuery(r,{base:t,after:a});for(let e of o.refs.nodes){let t=e.associatedPullRequests.nodes[0];i.push({name:`${n}${e.name}`,headOid:e.target.oid,committedAt:e.target.committedDate??null,pullRequest:t?{number:t.number,url:t.url,title:t.title,isDraft:t.isDraft,headOid:t.headRefOid}:null})}if(!o.refs.pageInfo.hasNextPage)return i;a=o.refs.pageInfo.endCursor}},async createBranch(n){await s(n);let i=await e.baseBranch();if(n===i)throw new F(`invalid_branch`,`"${n}" is the base branch`);let a=await t.client.rest(`GET`,`${r}/git/ref/heads/${Rt(i)}`,{fresh:!0});try{await t.client.rest(`POST`,`${r}/git/refs`,{body:{ref:`refs/heads/${n}`,sha:a.object.sha}})}catch(e){throw Of(e)&&/already exists/i.test(e.message)?new F(`branch_exists`,`Branch already exists: ${n}`,{status:422}):e}return e.withBranch(n)},async renameBranch(a){if(await s(n),await s(a),a===await i())throw new F(`invalid_branch`,`"${a}" is the base branch`);try{await t.client.rest(`POST`,`${r}/branches/${Rt(n)}/rename`,{body:{new_name:a}})}catch(e){throw Of(e)&&/already exists/i.test(e.message)?new F(`branch_exists`,`Branch already exists: ${a}`,{status:422}):e}return e.withBranch(a)},async deleteBranch(){if(await s(n),n===await i())throw new F(`invalid_branch`,`"${n}" is the base branch`);try{return await t.client.rest(`DELETE`,`${r}/git/refs/heads/${Rt(n)}`),!0}catch(e){if(e instanceof F&&e.code===`not_found`||Of(e)&&/does not exist/i.test(e.message))return!1;throw e}},async pullRequest(){return o(await e.baseBranch())},async openPullRequest({title:i,body:a,draft:c,labels:l}){await s(n);let u=await e.baseBranch(),d=await o(u);if(d)return d;let f;try{f=Sf(await t.client.rest(`POST`,`${r}/pulls`,{body:{title:i,head:n,base:u,...a===void 0?{}:{body:a},...c?{draft:!0}:{}}}))}catch(e){if(!Of(e))throw e;if(/already exists/i.test(e.message)){let e=await o(u);if(e)return e}else if(/no commits between/i.test(e.message))throw new F(`no_changes`,`No changes between ${u} and ${n}`,{status:422});throw e}if(!l||l.length===0)return f;try{return await t.client.rest(`POST`,`${r}/issues/${f.number}/labels`,{body:{labels:l}}),f}catch(e){return{...f,labelError:e instanceof Error?e.message:String(e)}}},async refreshPullRequestBody(n){let i=await a(await e.baseBranch());if(!i)return`none`;let o=yf(i.body??null,n);return o===null||o===(i.body??``)?`unchanged`:(await t.client.rest(`PATCH`,`${r}/pulls/${i.number}`,{body:{body:o}}),`updated`)},async pullRequestReview(t){let n=(await e.repoQuery(wf,{number:t})).pullRequest;if(!n)return null;let r=n.reviewRequests.nodes.flatMap(({requestedReviewer:e})=>e?.login?[`@${e.login}`]:e?.slug&&e.organization?[`@${e.organization.login}/${e.slug}`]:[]),i=e=>n.latestOpinionatedReviews.nodes.flatMap(t=>t.state===e&&t.author?[t.author.login]:[]);return{decision:n.reviewDecision,requested:r,approvedBy:i(`APPROVED`),changesRequestedBy:i(`CHANGES_REQUESTED`)}},async compare(){let i=await e.baseBranch(),a=await t.client.rest(`GET`,`${r}/compare/${Rt(i)}...${Rt(n)}`,{query:{per_page:1},fresh:!0}),o=a.merge_base_commit.sha,[s,c]=await Promise.all([e.loadSnapshot(n),e.loadSnapshotAt(o)]),l=[];for(let e of new Set([...s.files.keys(),...c.files.keys()])){let t=Nf(s,e),n=Nf(c,e);t!==n&&l.push({path:e,status:n===null?`added`:t===null?`removed`:`modified`,sha:t,baseSha:n})}l.sort((e,t)=>e.path<t.path?-1:+(e.path>t.path));let u=new Set(l.map(e=>e.path)),d=[];for(let e of a.files??[]){let t=Af(e.status);t!==null&&!u.has(e.filename)&&d.push({path:e.filename,status:t})}return d.sort((e,t)=>e.path<t.path?-1:+(e.path>t.path)),{status:a.status,aheadBy:a.ahead_by,behindBy:a.behind_by,mergeBaseOid:o,headOid:s.headOid,files:l,otherFiles:d,complete:(a.files??[]).length<kf}}};return d}function Mf(e,t){let n=`${e.contentDir}/`;return(t.startsWith(n)?t.slice(n.length):t).split(`/`).some(e=>e.startsWith(`.`))}function Nf(e,t){let n=e.files.get(t);return n===void 0?null:t===e.schemaPath?n:e.schema===null||Mf(e,t)?null:n}var Pf=Symbol.for(`yaml.alias`),Ff=Symbol.for(`yaml.document`),If=Symbol.for(`yaml.map`),Lf=Symbol.for(`yaml.pair`),Rf=Symbol.for(`yaml.scalar`),zf=Symbol.for(`yaml.seq`),Bf=Symbol.for(`yaml.node.type`),Vf=e=>!!e&&typeof e==`object`&&e[Bf]===Pf,Hf=e=>!!e&&typeof e==`object`&&e[Bf]===Ff,Uf=e=>!!e&&typeof e==`object`&&e[Bf]===If,Wf=e=>!!e&&typeof e==`object`&&e[Bf]===Lf,Gf=e=>!!e&&typeof e==`object`&&e[Bf]===Rf,J=e=>!!e&&typeof e==`object`&&e[Bf]===zf;function Kf(e){if(e&&typeof e==`object`)switch(e[Bf]){case If:case zf:return!0}return!1}function qf(e){if(e&&typeof e==`object`)switch(e[Bf]){case Pf:case If:case Rf:case zf:return!0}return!1}var Jf=e=>(Gf(e)||Kf(e))&&!!e.anchor,Yf=Symbol(`break visit`),Xf=Symbol(`skip children`),Zf=Symbol(`remove node`);function Qf(e,t){let n=ep(t);Hf(e)?$f(null,e.contents,n,Object.freeze([e]))===Zf&&(e.contents=null):$f(null,e,n,Object.freeze([]))}Qf.BREAK=Yf,Qf.SKIP=Xf,Qf.REMOVE=Zf;function $f(e,t,n,r){let i=tp(e,t,n,r);if(qf(i)||Wf(i))return np(e,r,i),$f(e,i,n,r);if(typeof i!=`symbol`){if(Kf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=$f(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Yf)return Yf;else i===Zf&&(t.items.splice(e,1),--e)}}else if(Wf(t)){r=Object.freeze(r.concat(t));let e=$f(`key`,t.key,n,r);if(e===Yf)return Yf;e===Zf&&(t.key=null);let i=$f(`value`,t.value,n,r);if(i===Yf)return Yf;i===Zf&&(t.value=null)}}return i}function ep(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function tp(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Uf(t))return n.Map?.(e,t,r);if(J(t))return n.Seq?.(e,t,r);if(Wf(t))return n.Pair?.(e,t,r);if(Gf(t))return n.Scalar?.(e,t,r);if(Vf(t))return n.Alias?.(e,t,r)}function np(e,t,n){let r=t[t.length-1];if(Kf(r))r.items[e]=n;else if(Wf(r))e===`key`?r.key=n:r.value=n;else if(Hf(r))r.contents=n;else{let e=Vf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var rp={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ip=e=>e.replace(/[!,[\]{}]/g,e=>rp[e]),Y=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ip(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&qf(e.contents)){let t={};Qf(e.contents,(e,n)=>{qf(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
97
|
+
`)}};Y.defaultYaml={explicit:!1,version:`1.2`},Y.defaultTags={"!!":`tag:yaml.org,2002:`};function ap(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function op(e){let t=new Set;return Qf(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function sp(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function cp(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=op(e);let a=sp(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Gf(t.node)||Kf(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function lp(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=lp(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=lp(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=lp(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=lp(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function up(e,t,n){if(Array.isArray(e))return e.map((e,t)=>up(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Jf(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var dp=class{constructor(e){Object.defineProperty(this,Bf,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Hf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=up(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?lp(i,{"":o},``,o):o}},fp=class extends dp{constructor(e){super(Pf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Qf(e,{Node:(e,t)=>{(Vf(t)||Jf(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(up(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=pp(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ap(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function pp(e,t,n){if(Vf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Kf(t)){let r=0;for(let i of t.items){let t=pp(e,i,n);t>r&&(r=t)}return r}if(Wf(t)){let r=pp(e,t.key,n),i=pp(e,t.value,n);return Math.max(r,i)}return 1}var mp=e=>!e||typeof e!=`function`&&typeof e!=`object`,X=class extends dp{constructor(e){super(Rf),this.value=e}toJSON(e,t){return t?.keep?this.value:up(this.value,e,t)}toString(){return String(this.value)}};X.BLOCK_FOLDED=`BLOCK_FOLDED`,X.BLOCK_LITERAL=`BLOCK_LITERAL`,X.PLAIN=`PLAIN`,X.QUOTE_DOUBLE=`QUOTE_DOUBLE`,X.QUOTE_SINGLE=`QUOTE_SINGLE`;var hp=`tag:yaml.org,2002:`;function gp(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function _p(e,t,n){if(Hf(e)&&(e=e.contents),qf(e))return e;if(Wf(e)){let t=n.schema[If].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new fp(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=hp+t.slice(2));let l=gp(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new X(e);return c&&(c.node=t),t}l=e instanceof Map?o[If]:Symbol.iterator in Object(e)?o[zf]:o[If]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new X(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function vp(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return _p(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var yp=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,bp=class extends dp{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>qf(t)||Wf(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(yp(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Kf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,vp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Kf(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Gf(i)?i.value:i:Kf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Wf(t))return!1;let n=t.value;return n==null||e&&Gf(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Kf(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Kf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,vp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},xp=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Sp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Cp=(e,t,n)=>e.endsWith(`
|
|
98
|
+
`)?Sp(n,t):n.includes(`
|
|
99
|
+
`)?`
|
|
100
|
+
`+Sp(n,t):(e.endsWith(` `)?``:` `)+n,wp=`flow`,Tp=`block`,Ep=`quoted`;function Dp(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Op(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
101
|
+
`)n===`block`&&(h=Op(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
102
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
103
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Op(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
104
|
+
`);r=t,i=t+1,a=e[i]}return r}var kp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ap=e=>/^(%|---|\.\.\.)/m.test(e);function jp(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
105
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Mp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ap(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
106
|
+
|
|
107
|
+
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
108
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Dp(o,a,Ep,kp(t,!1))}function Np(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
109
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Mp(e,t);let n=t.indent||(Ap(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Dp(r,n,wp,kp(t,!1))}function Pp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Mp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Np:i&&!t?Mp:n?Np:Mp}return r(e,t)}var Fp;try{Fp=RegExp(`(^|(?<!
|
|
110
|
+
))
|
|
111
|
+
+(?!
|
|
112
|
+
|$)`,`g`)}catch{Fp=/\n+(?!\n|$)/g}function Ip({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Pp(n,r);let l=r.indent||(r.forceBlockIndent||Ap(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===X.BLOCK_FOLDED?!1:t===X.BLOCK_LITERAL||!jp(n,c,l.length);if(!n)return u?`|
|
|
113
|
+
`:`>
|
|
114
|
+
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
115
|
+
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
116
|
+
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
117
|
+
`&&(p=p.slice(0,-1)),p.replace(Fp,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
118
|
+
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
119
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=kp(r,!0);o!==`folded`&&t!==X.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Dp(`${v}${e}${p}`,l,Tp,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Lp(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
120
|
+
`)||u&&/[[\]{},]/.test(a))return Pp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
121
|
+
`)?Pp(a,t):Ip(e,t,n,r);if(!s&&!u&&i!==X.PLAIN&&a.includes(`
|
|
122
|
+
`))return Ip(e,t,n,r);if(Ap(a)){if(c===``)return t.forceBlockIndent=!0,Ip(e,t,n,r);if(s&&c===l)return Pp(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Pp(a,t)}return s?d:Dp(d,c,wp,kp(t,!1))}function Rp(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==X.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=X.QUOTE_DOUBLE);let c=e=>{switch(e){case X.BLOCK_FOLDED:case X.BLOCK_LITERAL:return i||a?Pp(o.value,t):Ip(o,t,n,r);case X.QUOTE_DOUBLE:return Mp(o.value,t);case X.QUOTE_SINGLE:return Np(o.value,t);case X.PLAIN:return Lp(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function zp(e,t){let n=Object.assign({blockQuote:!0,commentString:xp,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Bp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Gf(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Vp(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Gf(e)||Kf(e))&&e.anchor;a&&ap(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Hp(e,t,n,r){if(Wf(e))return e.toString(t,n,r);if(Vf(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=qf(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Bp(t.doc.schema.tags,a);let o=Vp(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Gf(a)?Rp(a,t,n,r):a.toString(t,n,r);return o?Gf(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Up({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=qf(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Kf(e)||!qf(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Kf(e)||(Gf(e)?e.type===X.BLOCK_FOLDED||e.type===X.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Hp(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Cp(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Cp(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Cp(g,n.indent,l(f))));let _,v,y;qf(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Gf(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&J(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Hp(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
123
|
+
`:``,v){let e=l(v);S+=`\n${Sp(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
124
|
+
`&&y&&(S=`
|
|
125
|
+
|
|
126
|
+
`):S+=`\n${n.indent}`}else if(!p&&Kf(t)){let e=x[0],r=x.indexOf(`
|
|
127
|
+
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
128
|
+
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=Cp(g,n.indent,l(y)):h&&i&&i(),g}function Wp(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Gp=`<<`,Kp={identify:e=>e===Gp||typeof e==`symbol`&&e.description===Gp,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new X(Symbol(Gp)),{addToJSMap:Jp}),stringify:()=>Gp},qp=(e,t)=>(Kp.identify(t)||Gf(t)&&(!t.type||t.type===X.PLAIN)&&Kp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Kp.tag&&e.default);function Jp(e,t,n){let r=Xp(e,n);if(J(r))for(let n of r.items)Yp(e,t,n);else if(Array.isArray(r))for(let n of r)Yp(e,t,n);else Yp(e,t,r)}function Yp(e,t,n){let r=Xp(e,n);if(!Uf(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Xp(e,t){return e&&Vf(t)?t.resolve(e.doc,e):t}function Zp(e,t,{key:n,value:r}){if(qf(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(qp(e,n))Jp(e,t,r);else{let i=up(n,``,e);if(t instanceof Map)t.set(i,up(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Qp(n,i,e),o=up(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Qp(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(qf(e)&&n?.doc){let t=zp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Wp(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function $p(e,t,n){return new em(_p(e,void 0,n),_p(t,void 0,n))}var em=class e{constructor(e,t=null){Object.defineProperty(this,Bf,{value:Lf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return qf(n)&&(n=n.clone(t)),qf(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Zp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Up(this,e,t,n):JSON.stringify(this)}};function tm(e,t,n){return(t.inFlow??e.flow?rm:nm)(e,t,n)}function nm({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(qf(i))!d&&i.spaceBefore&&f.push(``),im(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Wf(i)){let e=qf(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),im(n,f,e.commentBefore,d))}d=!1;let s=Hp(i,u,()=>o=null,()=>d=!0);o&&(s+=Cp(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
129
|
+
`}}return e?(p+=`
|
|
130
|
+
`+Sp(l(e),c),s&&s()):d&&o&&o(),p}function rm({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(qf(i))i.spaceBefore&&d.push(``),im(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Wf(i)){let e=qf(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),im(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=qf(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Hp(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
131
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Cp(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
132
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function im({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Sp(t(r),e);n.push(i.trimStart())}}function am(e,t){let n=Gf(t)?t.value:t;for(let r of e)if(Wf(r)&&(r.key===t||r.key===n||Gf(r.key)&&r.key.value===n))return r}var om=class extends bp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(If,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push($p(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Wf(e)?e:!e||typeof e!=`object`||!(`key`in e)?new em(e,e?.value):new em(e.key,e.value);let r=am(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Gf(r.value)&&mp(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=am(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=am(this.items,e)?.value;return(!t&&Gf(n)?n.value:n)??void 0}has(e){return!!am(this.items,e)}set(e,t){this.add(new em(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Zp(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Wf(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),tm(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},sm={collection:`map`,default:!0,nodeClass:om,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Uf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>om.from(e,t,n)},cm=class extends bp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(zf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=lm(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=lm(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Gf(r)?r.value:r}has(e){let t=lm(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=lm(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Gf(r)&&mp(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(up(e,String(r++),t));return n}toString(e,t,n){return e?tm(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(_p(a,void 0,n))}}return i}};function lm(e){let t=Gf(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var um={collection:`seq`,default:!0,nodeClass:cm,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return J(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>cm.from(e,t,n)},dm={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Rp(e,t,n,r)}},fm={identify:e=>e==null,createNode:()=>new X(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new X(null),stringify:({source:e},t)=>typeof e==`string`&&fm.test.test(e)?e:t.options.nullStr},pm={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new X(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&pm.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function mm({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var hm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:mm},gm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():mm(e)}},_m={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new X(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:mm},vm=e=>typeof e==`bigint`||Number.isInteger(e),ym=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function bm(e,t,n){let{value:r}=e;return vm(r)&&r>=0?n+r.toString(t):mm(e)}var xm={identify:e=>vm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>ym(e,2,8,n),stringify:e=>bm(e,8,`0o`)},Sm={identify:vm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>ym(e,0,10,n),stringify:mm},Cm={identify:e=>vm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>ym(e,2,16,n),stringify:e=>bm(e,16,`0x`)},wm=[sm,um,dm,fm,pm,xm,Sm,Cm,hm,gm,_m];function Tm(e){return typeof e==`bigint`||Number.isInteger(e)}var Em=({value:e})=>JSON.stringify(e),Dm=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Em},{identify:e=>e==null,createNode:()=>new X(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Em},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Em},{identify:Tm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Tm(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Em}],Om=[sm,um].concat(Dm,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),km={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=X.BLOCK_LITERAL,t!==X.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===X.BLOCK_LITERAL?`
|
|
133
|
+
`:` `)}return Rp({comment:e,type:t,value:s},r,i,a)}};function Am(e,t){if(J(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Wf(r)){if(Uf(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new em(new X(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=Wf(r)?r:new em(r)}}else t(`Expected a sequence for this tag`);return e}function jm(e,t,n){let{replacer:r}=n,i=new cm(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push($p(o,s,n))}return i}var Mm={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Am,createNode:jm},Nm=class e extends cm{constructor(){super(),this.add=om.prototype.add.bind(this),this.delete=om.prototype.delete.bind(this),this.get=om.prototype.get.bind(this),this.has=om.prototype.has.bind(this),this.set=om.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Wf(e)?(r=up(e.key,``,t),i=up(e.value,r,t)):r=up(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=jm(e,t,n),i=new this;return i.items=r.items,i}};Nm.tag=`tag:yaml.org,2002:omap`;var Pm={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Nm,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Am(e,t),r=[];for(let{key:e}of n.items)Gf(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Nm,n)},createNode:(e,t,n)=>Nm.from(e,t,n)};function Fm({value:e,source:t},n){return t&&(e?Im:Lm).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Im={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new X(!0),stringify:Fm},Lm={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new X(!1),stringify:Fm},Rm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:mm},zm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():mm(e)}},Bm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new X(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:mm},Vm=e=>typeof e==`bigint`||Number.isInteger(e);function Hm(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Um(e,t,n){let{value:r}=e;if(Vm(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return mm(e)}var Wm={identify:Vm,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Hm(e,2,2,n),stringify:e=>Um(e,2,`0b`)},Gm={identify:Vm,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Hm(e,1,8,n),stringify:e=>Um(e,8,`0`)},Km={identify:Vm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Hm(e,0,10,n),stringify:mm},qm={identify:Vm,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Hm(e,2,16,n),stringify:e=>Um(e,16,`0x`)},Jm=class e extends om{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Wf(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new em(e.key,null):new em(e,null),am(this.items,t.key)||this.items.push(t)}get(e,t){let n=am(this.items,e);return!t&&Wf(n)?Gf(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=am(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new em(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push($p(e,null,n));return i}};Jm.tag=`tag:yaml.org,2002:set`;var Ym={collection:`map`,identify:e=>e instanceof Set,nodeClass:Jm,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Jm.from(e,t,n),resolve(e,t){if(Uf(e)){if(e.hasAllNullValues(!0))return Object.assign(new Jm,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Xm(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Zm(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return mm(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Qm={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Xm(e,n),stringify:Zm},$m={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Xm(e,!1),stringify:Zm},eh={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(eh.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Xm(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},th=[sm,um,dm,fm,Im,Lm,Wm,Gm,Km,qm,Rm,zm,Bm,km,Kp,Pm,Mm,Ym,Qm,$m,eh],nh=new Map([[`core`,wm],[`failsafe`,[sm,um,dm]],[`json`,Om],[`yaml11`,th],[`yaml-1.1`,th]]),rh={binary:km,bool:pm,float:_m,floatExp:gm,floatNaN:hm,floatTime:$m,int:Sm,intHex:Cm,intOct:xm,intTime:Qm,map:sm,merge:Kp,null:fm,omap:Pm,pairs:Mm,seq:um,set:Ym,timestamp:eh},ih={"tag:yaml.org,2002:binary":km,"tag:yaml.org,2002:merge":Kp,"tag:yaml.org,2002:omap":Pm,"tag:yaml.org,2002:pairs":Mm,"tag:yaml.org,2002:set":Ym,"tag:yaml.org,2002:timestamp":eh};function ah(e,t,n){let r=nh.get(t);if(r&&!e)return n&&!r.includes(Kp)?r.concat(Kp):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(nh.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Kp)),i.reduce((e,t)=>{let n=typeof t==`string`?rh[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(rh).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var oh=(e,t)=>e.key<t.key?-1:+(e.key>t.key),sh=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?ah(e,`compat`):e?ah(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?ih:{},this.tags=ah(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,If,{value:sm}),Object.defineProperty(this,Rf,{value:dm}),Object.defineProperty(this,zf,{value:um}),this.sortMapEntries=typeof a==`function`?a:a===!0?oh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function ch(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=zp(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Sp(t,``))}let o=!1,s=null;if(e.contents){if(qf(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Sp(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Hp(e.contents,i,()=>s=null,t);s&&(c+=Cp(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Hp(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
|
|
134
|
+
`)?(n.push(`...`),n.push(Sp(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(Sp(a(t),``)))}return n.join(`
|
|
135
|
+
`)+`
|
|
136
|
+
`}var lh=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Bf,{value:Ff});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Y({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Bf]:{value:Ff}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=qf(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){uh(this.contents)&&this.contents.add(e)}addIn(e,t){uh(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=op(this);e.anchor=!t||n.has(t)?sp(t||`a`,n):t}return new fp(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=cp(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=_p(e,l,p);return o&&Kf(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new em(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return uh(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yp(e)?this.contents!=null&&(this.contents=null,!0):uh(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Kf(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return yp(e)?!t&&Gf(this.contents)?this.contents.value:this.contents:Kf(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Kf(this.contents)?this.contents.has(e):!1}hasIn(e){return yp(e)?this.contents!==void 0:Kf(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=vp(this.schema,[e],t):uh(this.contents)&&this.contents.set(e,t)}setIn(e,t){yp(e)?this.contents=t:this.contents==null?this.contents=vp(this.schema,Array.from(e),t):uh(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new Y({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new Y({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new sh(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=up(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?lp(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return ch(this,e)}};function uh(e){if(Kf(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var dh=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},fh=class extends dh{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},ph=class extends dh{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},mh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
137
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function hh(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:b&&n===`seq-item-ind`||(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function gh(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
138
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(gh(t.key)||gh(t.value))return!0}return!1;default:return!0}}function _h(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&gh(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function vh(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Gf(e)&&Gf(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var yh=`All mapping items must start at the same column`;function bh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??om)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=hh(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,yh)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
139
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||gh(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,yh);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&_h(r.indent,u,i),n.atKey=!1,vh(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=hh(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&_h(r.indent,f,i),s=c.range[2];let l=new em(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
140
|
+
`+_.comment:g.comment=_.comment);let e=new em(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function xh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??cm)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=hh(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&_h(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Sh(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Ch=`Block collections are not allowed within flow collections`,wh=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Th({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?om:cm))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=hh(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
141
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&gh(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];Wf(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
142
|
+
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],wh(m)&&i(r.range,`BLOCK_IN_FLOW`,Ch)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);wh(f)&&i(g.range,`BLOCK_IN_FLOW`,Ch),n.atKey=!1;let _=hh(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?wh(m)&&i(v.range,`BLOCK_IN_FLOW`,Ch):_.comment&&(g.comment?g.comment+=`
|
|
143
|
+
`+_.comment:g.comment=_.comment);let y=new em(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;vh(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new om(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=Sh(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
144
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Eh(e,t,n,r,i,a){let o=n.type===`block-map`?bh(e,t,n,r,a):n.type===`block-seq`?xh(e,t,n,r,a):Th(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Dh(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===om.tagName&&s===`map`||o===cm.tagName&&s===`seq`)return Eh(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Eh(e,t,n,i,o)}let l=Eh(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=qf(u)?u:new X(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Oh(e,t,n){let r=t.offset,i=kh(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?X.BLOCK_FOLDED:X.BLOCK_LITERAL,o=t.source?Ah(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
145
|
+
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
146
|
+
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===X.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
147
|
+
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
148
|
+
`:!p&&f===`
|
|
149
|
+
`&&(f=`
|
|
150
|
+
|
|
151
|
+
`),d+=f+t.slice(c)+r,f=`
|
|
152
|
+
`,p=!0):r===``?f===`
|
|
153
|
+
`?d+=`
|
|
154
|
+
`:f=`
|
|
155
|
+
`:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
|
|
156
|
+
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
157
|
+
`&&(d+=`
|
|
158
|
+
`);break;default:d+=`
|
|
159
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function kh({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Ah(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function jh(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=X.PLAIN,c=Mh(a,l);break;case`single-quoted-scalar`:s=X.QUOTE_SINGLE,c=Nh(a,l);break;case`double-quoted-scalar`:s=X.QUOTE_DOUBLE,c=Fh(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=Sh(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Mh(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Ph(e)}function Nh(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Ph(e.slice(1,-1)).replace(/''/g,`'`)}function Ph(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
|
|
160
|
+
`?a+=o:o=`
|
|
161
|
+
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function Fh(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
162
|
+
`){if(i===`
|
|
163
|
+
`){let{fold:t,offset:i}=Ih(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Lh[i];if(a)n+=a;else if(i===`
|
|
164
|
+
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
165
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Rh(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
166
|
+
`&&(a!==`\r`||e[r+2]!==`
|
|
167
|
+
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Ih(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
168
|
+
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
|
|
169
|
+
`);)r===`
|
|
170
|
+
`&&(n+=`
|
|
171
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Lh={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
172
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Rh(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function zh(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Oh(e,t,r):jh(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Rf]:c?Bh(e.schema,i,c,n,r):t.type===`scalar`?Vh(e,i,t,r):e.schema[Rf];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Gf(a)?a:new X(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new X(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Bh(e,t,n,r,i){if(n===`!`)return e[Rf];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Rf])}function Vh({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Rf];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Rf];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Hh(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Uh={composeNode:Wh,composeEmptyNode:Gh};function Wh(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Kh(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=zh(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Dh(Uh,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Gh(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!Gf(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Gh(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=zh(e,{type:`scalar`,offset:Hh(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Kh({options:e},{offset:t,source:n,end:r},i){let a=new fp(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=Sh(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function qh(e,t,{offset:n,start:r,value:i,end:a},o){let s=new lh(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=hh(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Wh(c,i,l,o):Gh(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Sh(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Jh(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Yh(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
173
|
+
|
|
174
|
+
`:`
|
|
175
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Xh=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Jh(e);r?this.warnings.push(new ph(i,t,n)):this.errors.push(new fh(i,t,n))},this.directives=new Y({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Yh(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Kf(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Wf(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Yh(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Jh(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=qh(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new fh(Jh(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new fh(Jh(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Sh(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new fh(Jh(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new lh(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Zh=Symbol(`break visit`),Qh=Symbol(`skip children`),$h=Symbol(`remove item`);function eg(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),tg(Object.freeze([]),e,t)}eg.BREAK=Zh,eg.SKIP=Qh,eg.REMOVE=$h,eg.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},eg.parentCollection=(e,t)=>{let n=eg.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function tg(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=tg(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Zh)return Zh;else r===$h&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function ng(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
176
|
+
`:case`\r
|
|
177
|
+
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function rg(e){switch(e){case void 0:case` `:case`
|
|
178
|
+
`:case`\r`:case` `:return!0;default:return!1}}var ig=new Set(`0123456789ABCDEFabcdef`),ag=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),og=new Set(`,[]{}`),sg=new Set(` ,[]{}
|
|
179
|
+
\r `),cg=e=>!e||sg.has(e),lg=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
180
|
+
`||t===`\r`&&this.buffer[e+1]===`
|
|
181
|
+
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
182
|
+
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
183
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&rg(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
184
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&rg(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!rg(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&rg(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(cg),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&rg(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(cg),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||rg(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
185
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
186
|
+
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>rg(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
187
|
+
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
188
|
+
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
189
|
+
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
190
|
+
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
191
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(rg(r)||e&&og.has(r))break;t=n}else if(rg(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
192
|
+
`?(n+=1,r=`
|
|
193
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&og.has(i))break;if(r===`
|
|
194
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&og.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(cg),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(rg(n)||t&&og.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!rg(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(ag.has(t))t=this.buffer[++e];else if(t===`%`&&ig.has(this.buffer[e+1])&&ig.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
195
|
+
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
196
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},ug=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function dg(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function fg(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function pg(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function mg(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function hg(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function gg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function _g(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!dg(t.start,`explicit-key-ind`)&&!dg(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,pg(t.value)?t.value.end?gg(t.value.end,t.sep):t.value.end=t.sep:gg(t.start,t.sep),delete t.sep)}var vg=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new lg,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=ng(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&_g(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&fg(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:fg(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=hg(mg(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
197
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
198
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){gg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(dg(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=hg(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(dg(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(pg(t.key)&&!dg(t.sep,`newline`)){let e=hg(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):dg(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!dg(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){gg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||dg(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=hg(mg(t));_g(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
199
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
200
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=hg(mg(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=hg(mg(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function yg(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new ug||null,prettyErrors:t}}function bg(e,t={}){let{lineCounter:n,prettyErrors:r}=yg(t),i=new vg(n?.addNewLine),a=new Xh(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new fh(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(mh(e,n)),o.warnings.forEach(mh(e,n))),o}function xg(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=bg(e,n);if(!i)return null;if(i.warnings.forEach(e=>Wp(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Sg(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return Hf(e)&&!r?e.toString(n):new lh(e,r,n).toString(n)}var Cg=new sh({schema:`yaml-1.1`}).tags.filter(e=>!e.collection);function wg(e){throw new bn([{path:``,message:e}])}var Tg=new TextDecoder(`utf-8`,{fatal:!0});function Eg(e,t){if(typeof e==`string`)return{text:e};try{return{text:Tg.decode(e)}}catch{return{issue:{file:t,path:``,message:`File is not valid UTF-8`}}}}function Dg(e){let t=e.startsWith(``)?e.slice(1):e;if(t=t.replace(/\r\n/g,`
|
|
201
|
+
`),!t.startsWith(`---
|
|
202
|
+
`))return{data:{},body:t};let n=t.slice(4).split(`
|
|
203
|
+
`),r=n.indexOf(`---`);r===-1&&wg(`Frontmatter is not closed with a "---" line`);let i=n.slice(0,r).join(`
|
|
204
|
+
`),a=n.slice(r+1).join(`
|
|
205
|
+
`);a.startsWith(`
|
|
206
|
+
`)&&(a=a.slice(1));let o;try{o=xg(i,{schema:`core`,logLevel:`error`})}catch(e){wg(`Invalid YAML frontmatter: ${e instanceof Error?e.message:String(e)}`)}return o??={},(typeof o!=`object`||Array.isArray(o))&&wg(`Frontmatter must be a YAML mapping`),{data:o,body:a}}function Og(e,t=[]){let n=Object.keys(e.data).filter(t=>e.data[t]!==void 0),r=e=>{let n=t.indexOf(e);return n===-1?1/0:n};n.sort((e,t)=>{let n=r(e)-r(t);return n!==0&&(r(e)!==1/0||r(t)!==1/0)?n:e<t?-1:+(e>t)});let i={};for(let t of n)i[t]=e.data[t];let a=`---\n${n.length===0?``:Sg(i,{version:`1.1`,schema:`core`,customTags:e=>[...e,...Cg],lineWidth:0,logLevel:`error`})}---\n`;return e.body===``?a:`${a}\n${e.body}`}var kg=new TextEncoder;async function Ag(e){let t=typeof e==`string`?kg.encode(e):e,n=kg.encode(`blob ${t.byteLength}\0`),r=new Uint8Array(n.byteLength+t.byteLength);r.set(n),r.set(t,n.byteLength);let i=new Uint8Array(await crypto.subtle.digest(`SHA-1`,r));return Array.from(i,e=>e.toString(16).padStart(2,`0`)).join(``)}var jg=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Mg(e,t){if(!jg(t))return;let n=t[Md];return typeof n==`string`&&Object.hasOwn(e.blocks,n)?e.blocks[n].fields:void 0}function Ng(e,t,n){return e.type===`object`?e.list?Array.isArray(t)?t.flatMap((t,r)=>jg(t)?[[e.fields,t,[...n,r]]]:[]):[]:jg(t)?[[e.fields,t,n]]:[]:e.type===`blocks`&&Array.isArray(t)?t.flatMap((t,r)=>{let i=Mg(e,t);return i?[[i,t,[...n,r]]]:[]}):[]}var Pg=e=>e.type===`object`||e.type===`blocks`;function Fg(e,t,n,r=[]){for(let[i,a]of Object.entries(e)){if(!Object.hasOwn(t,i))continue;let e=[...r,i];if(!Pg(a))n(a,t[i],e);else for(let[r,o,s]of Ng(a,t[i],e))Fg(r,o,n,s)}}function Ig(e,t,n,r=[]){let i={...t};for(let[a,o]of Object.entries(e)){if(!Object.hasOwn(t,a))continue;let e=[...r,a],s=t[a],c;c=o.type===`object`&&!o.list?jg(s)?Ig(o.fields,s,n,e):s:o.type===`object`&&Array.isArray(s)?s.map((t,r)=>jg(t)?Ig(o.fields,t,n,[...e,r]):t):o.type===`blocks`&&Array.isArray(s)?s.map((t,r)=>{let i=Mg(o,t);return i?Ig(i,t,n,[...e,r]):t}):Pg(o)?s:n(o,s,e),c===void 0?delete i[a]:i[a]=c}return i}function Lg(e,t=[]){let n=[];for(let[r,i]of Object.entries(e)){let e=[...t,r];if(n.push([e,i]),i.type===`object`&&n.push(...Lg(i.fields,e)),i.type===`blocks`)for(let[t,r]of Object.entries(i.blocks))n.push(...Lg(r.fields,[...e,t]))}return n}function Rg(e){let t={};for(let[n,r]of Object.entries(e.fields)){let e=jd(r);e&&(t[n]=e)}return t.draft=Au({error:`Expected true or false`}).optional(),G(t)}function zg(e,t){let n=[];for(let r of e.issues){let e=r.path.map(String);if(r.code===`unrecognized_keys`)for(let i of r.keys)n.push({file:t,path:[...e,i].join(`.`),message:`Unknown field`});else n.push({file:t,path:e.join(`.`),message:r.message})}return n}function Bg(e,t,n={}){if(!Object.hasOwn(e.collections,t.collection))return[{path:``,message:`Unknown collection "${t.collection}"`}];let r=e.collections[t.collection],i=Tn(e,t.collection,t.slug);if(r.singleton?t.slug!==`index`:!Sn(t.slug))return[{file:i,path:``,message:r.singleton?`Slug of a singleton must be "index"`:`Invalid slug "${t.slug}": use lowercase letters, digits and single hyphens`}];if(typeof t.data!=`object`||t.data===null||Array.isArray(t.data))return[{file:i,path:``,message:`Entry data must be an object`}];let a=Rg(r).safeParse(t.data),o=a.success?[]:zg(a.error,i),s=Zd(r);s===void 0?t.body.trim()!==``&&o.push({file:i,path:``,message:`This collection has no markdown field, but the entry has body content`}):r.fields[s].required&&t.body.trim()===``&&o.push({file:i,path:s,message:`Required`});let c=[...o],l=e=>c.some(t=>t.path===e||t.path.startsWith(`${e}.`)||e.startsWith(`${t.path}.`));return Fg(r.fields,t.data,(t,r,a)=>{let s=a.join(`.`);if(!l(s)){if(t.type===`image`&&r!=null){let t=r.src,a=kn(e,i,t);a===null?o.push({file:i,path:`${s}.src`,message:`Image path points outside the content directory`}):Pn(a)?Dn(e,a)?o.push({file:i,path:`${s}.src`,message:`Image path must not be hidden (a segment starts with ".")`}):n.fileExists?.(a)===!1&&o.push({file:i,path:`${s}.src`,message:`Image file not found: ${a}`}):o.push({file:i,path:`${s}.src`,message:`Image path must end in an image extension`})}else t.type===`reference`&&!Sd(t,r)&&(Array.isArray(r)?r:[r]).forEach((e,t)=>{n.entryExists?.(e)===!1&&o.push({file:i,path:Array.isArray(r)?`${s}.${t}`:s,message:`Referenced entry not found: ${e}`})})}}),o}function Vg(e,t){return Ug(e.fields,t)}var Hg=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Ug(e,t){let n={};for(let[r,i]of Object.entries(t)){let t=Object.hasOwn(e,r)?e[r]:void 0;i===null||t!==void 0&&Sd(t,i)||(n[r]=t===void 0?i:Wg(t,i))}return n}function Wg(e,t){if(e.type===`object`){let n=t=>Hg(t)?Ug(e.fields,t):t;return e.list&&Array.isArray(t)?t.map(n):n(t)}return e.type===`blocks`&&Array.isArray(t)?t.map(t=>{let n=Mg(e,t);if(!n)return t;let{[Md]:r,...i}=t;return{[Md]:r,...Ug(n,i)}}):t}function Gg(e,t=new Date){let n={};for(let[r,i]of Object.entries(e.fields))i.type===`datetime`?i.defaultNow&&(n[r]=i.dateOnly?t.toISOString().slice(0,10):t.toISOString()):`default`in i&&i.default!==void 0&&(n[r]=structuredClone(i.default));return n.draft=!0,n}function Kg(e,t,n){return En(n)?n===t?!0:!n.startsWith(`${e.contentDir}/`)||Dn(e,n)?!1:n.endsWith(`.md`)?On(e,n)!==null:Pn(n):!1}function qg(e,t){if(!(e instanceof bn))throw e;return e.issues.map(e=>({...e,file:e.file??t}))}var Jg=e=>`${e.file}|${e.path}|${e.message}`;function Yg(e,t){return n=>{let r=Mn(n);if(!r||!Object.hasOwn(e.collections,r.collection))return!1;let{collection:i,slug:a}=r;if(e.collections[i].singleton&&a!==`index`)return!1;let o=Tn(e,i,a);return On(e,o)!==null&&t(o)}}function Xg(e,t,n,r){let i=Eg(r,t);if(`issue`in i)return[i.issue];let a;try{a=Dg(i.text)}catch(e){return qg(e,t)}let{schema:o,...s}=e;return Bg(o,{...n,data:a.data,body:a.body},s)}function Zg(e,t){let{schemaPath:n}=e,r=new Map,i=new Set;for(let e of t)r.has(e.path)&&i.add(e.path),r.set(e.path,e.content);if(i.size>0)return[...i].map(e=>({file:e,path:``,message:`Duplicate path in changes`}));let a=e.schema;if(r.has(n)){let e=r.get(n)??null;if(e===null)return[{file:n,path:``,message:`The schema file cannot be deleted`}];let t=Eg(e,n);if(`issue`in t)return[t.issue];try{a=Xd(t.text,n)}catch(e){return qg(e,n)}}let o=[];if(e.schema===null){for(let e of r.keys())e!==n&&o.push({file:e,path:``,message:`The schema (${n}) is invalid; fix it first`});return o}let s=e.schema,c=a??s,l=t=>r.has(t)?r.get(t)!==null:e.exists(t),u={schema:c,fileExists:l,entryExists:Yg(c,l)};for(let[e,t]of r){if(e===n)continue;if(!Kg(c,n,e)){o.push({file:e,path:``,message:`Path not writable`});continue}let r=t===null?null:On(c,e);t!==null&&r!==null&&o.push(...Xg(u,e,r,t))}let{read:d,list:f}=e;if(!(r.has(n)||[...r.values()].includes(null))||d===void 0||f===void 0)return o;let p={schema:s,fileExists:e.exists,entryExists:Yg(s,e.exists)};for(let e of f()){if(r.has(e)||e===n||!e.endsWith(`.md`))continue;let t=[c,s].find(t=>e.startsWith(`${t.contentDir}/`));if(t===void 0||Dn(t,e))continue;let i=On(s,e),a=On(c,e);if(a===null){i!==null&&o.push({file:e,path:``,message:`Not an entry file`});continue}let l=d(e);if(l===void 0)continue;let f=new Set(i===null?[]:Xg(p,e,i,l).map(Jg));o.push(...Xg(u,e,a,l).filter(e=>!f.has(Jg(e))))}return o}function Qg(e,t,n){let r=Zg(e,t);return n.trim()===``&&r.push({path:``,message:`Commit message is required`}),r}var $g=50,e_=`application/vnd.github.raw+json`,t_=/^[0-9a-f]{40}$/,n_=`120000`,r_=new TextEncoder,i_=(e,t)=>e.path<t.path?-1:+(e.path>t.path);function a_(e){return new bn(e.map(e=>({file:e,path:``,message:`File not found: ${e}`})))}function o_(e){return`query Blobs($owner: String!, $name: String!) {\n repository(owner: $owner, name: $name) {\n ${e.map((e,t)=>`b${t}: object(oid: "${e}") { ... on Blob { text isBinary isTruncated } }`).join(`
|
|
207
|
+
`)}\n }\n}`}async function s_(e,t){let n=[...new Set(t)];for(let e of n)if(!t_.test(e))throw new F(`not_found`,`Blob not found: ${e}`);let r=await e.cache.getBlobs(n),i=n.filter(e=>!r.has(e));if(i.length===0)return r;let a=[],o=[],s=[];for(let e=0;e<i.length;e+=$g)s.push(i.slice(e,e+$g));await Promise.all(s.map(async t=>{let n=await e.client.graphql(o_(t),{owner:e.owner,name:e.repo});await Promise.all(t.map(async(e,t)=>{let r=n.repository?.[`b${t}`];if(r&&!r.isBinary&&!r.isTruncated&&typeof r.text==`string`){let t=r_.encode(r.text);if(await Ag(t)===e){a.push({sha:e,bytes:t});return}}o.push(e)}))})),await Promise.all(o.map(async t=>{let n=await e.client.rest(`GET`,`/repos/${e.owner}/${e.repo}/git/blobs/${t}`,{raw:!0,accept:e_}),r=new Uint8Array(n);if(await Ag(r)!==t)throw new F(`http_error`,`Blob sha mismatch`);a.push({sha:t,bytes:r})})),await e.cache.putBlobs(a);for(let{sha:e,bytes:t}of a)r.set(e,t);return r}var c_=`query Snapshot($owner: String!, $name: String!, $ref: String!, $schemaPath: String!) {
|
|
208
|
+
repository(owner: $owner, name: $name) {
|
|
209
|
+
ref(qualifiedName: $ref) {
|
|
210
|
+
target {
|
|
211
|
+
oid
|
|
212
|
+
... on Commit { schema: file(path: $schemaPath) { oid } }
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}`,l_=`query Dir($owner: String!, $name: String!, $oid: GitObjectID!, $path: String!) {
|
|
217
|
+
repository(owner: $owner, name: $name) {
|
|
218
|
+
object(oid: $oid) {
|
|
219
|
+
... on Commit { file(path: $path) { oid type } }
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}`;async function u_(e,t,n){let r;try{r=await e.client.graphql(t,{owner:e.owner,name:e.repo,...n})}catch(t){throw t instanceof F&&t.code===`graphql_error`&&t.graphqlErrors?.length&&t.graphqlErrors.every(e=>e.type===`NOT_FOUND`)?new F(`not_found`,`Repository not found: ${e.owner}/${e.repo}`):t}if(!r.repository)throw new F(`not_found`,`Repository not found: ${e.owner}/${e.repo}`);return r.repository}async function d_(e,t,n){let r=await u_(e,l_,{oid:t,path:n});if(!r.object)throw new F(`not_found`,`Commit not found: ${t}`);return r.object.file??null}function f_(e,t,n){let r=[];for(let i of n)i.type===`tree`?r.push(i):i.type===`blob`&&i.mode!==n_&&e.set(`${t}/${i.path}`,i.sha);return r}function p_(e,t,n){return e.client.rest(`GET`,`/repos/${e.owner}/${e.repo}/git/trees/${t}`,{query:n?{recursive:1}:void 0})}async function m_(e,t,n,r){let i=await p_(e,t,!1);if(i.truncated)throw new F(`http_error`,`Tree listing truncated: ${n}`);let a=f_(r,n,i.tree);await Promise.all(a.map(t=>m_(e,t.sha,`${n}/${t.path}`,r)))}async function h_(e,t,n,r){let i=await p_(e,t,!0);if(!i.truncated){f_(r,n,i.tree);return}let a=new Map;await m_(e,t,n,a);for(let[e,t]of a)r.set(e,t)}async function g_(e,t,n){let r=new Map,i={headOid:t,schemaPath:e.schemaPath,schemaSha:n,schema:null,contentDir:null,files:r};if(n===null)return i;r.set(e.schemaPath,n);let a=Eg((await s_(e,[n])).get(n),e.schemaPath);if(!(`text`in a))return i;try{i.schema=Xd(a.text,e.schemaPath)}catch(e){if(e instanceof bn)return i;throw e}let o=i.schema.contentDir;i.contentDir=o;let s=await d_(e,t,o);return s?.type===`tree`&&await h_(e,s.oid,o,r),r.set(e.schemaPath,n),i}async function __(e,t){let n=await u_(e,c_,{ref:`refs/heads/${t}`,schemaPath:e.schemaPath});if(!n.ref)throw new F(`not_found`,`Branch not found: ${t}`);return g_(e,n.ref.target.oid,n.ref.target.schema?.oid??null)}async function v_(e,t){let n=await d_(e,t,e.schemaPath);return g_(e,t,n?.type===`blob`?n.oid:null)}var y_=20971520,b_=3,x_=`query History($owner: String!, $name: String!, $ref: String!, $path: String!) {
|
|
223
|
+
repository(owner: $owner, name: $name) {
|
|
224
|
+
ref(qualifiedName: $ref) {
|
|
225
|
+
target { ... on Commit { history(first: 1, path: $path) { totalCount nodes {
|
|
226
|
+
url messageHeadline committedDate author { name user { login avatarUrl } }
|
|
227
|
+
} } } }
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}`;function S_(e){let t=e.author?.user;return{actor:{name:e.author?.name??t?.login??`Unknown`,login:t?.login,avatarUrl:t?.avatarUrl},date:e.committedDate,message:e.messageHeadline,url:e.url}}function C_(e){return{actor:{name:e.commit.author?.name??e.author?.login??`Unknown`,login:e.author?.login,avatarUrl:e.author?.avatar_url},date:e.commit.author?.date??``,message:e.commit.message.split(`
|
|
231
|
+
`)[0]??``,url:e.html_url}}var w_=`Changed on GitHub since it was read; reload and review`,T_=`mutation Commit($input: CreateCommitOnBranchInput!) {
|
|
232
|
+
createCommitOnBranch(input: $input) {
|
|
233
|
+
commit { oid url }
|
|
234
|
+
}
|
|
235
|
+
}`;async function E_(e,t,n){let{path:r,content:i}=e,a=i===null?null:typeof i==`string`?r_.encode(i):new Uint8Array(i);return{path:r,bytes:a,expected:e.sha===void 0?t.get(r)??n.files.get(r)??null:e.sha,next:a===null?null:await Ag(a)}}function D_(e){let[t=``,...n]=e.trim().split(/\r?\n/),r=n.join(`
|
|
236
|
+
`).trim();return r===``?{headline:t.trim()}:{headline:t.trim(),body:r}}var O_=e=>e instanceof F&&(e.graphqlErrors??[]).some(e=>e.type===`STALE_DATA`);function k_(e,t){let n=t.find(t=>t.path===e)?.bytes;if(!n)return null;let r=Eg(n,e);if(!(`text`in r))return null;try{return Xd(r.text,e)}catch(e){if(e instanceof bn)return null;throw e}}async function A_(e,t,n){if(n===null||n.contentDir===t.contentDir)return t;let r=new Map(t.files),i=await d_(e,t.headOid,n.contentDir);return i?.type===`tree`&&await h_(e,i.oid,n.contentDir,r),{...t,files:r}}async function j_(e,t,n){let r=new Map,i=[...t.files.keys()].filter(e=>e.endsWith(`.md`)&&n.some(t=>e.startsWith(`${t.contentDir}/`)&&!Dn(t,e))),a=await s_(e,i.map(e=>t.files.get(e)));for(let e of i){let n=Eg(a.get(t.files.get(e)),e);`text`in n&&r.set(e,n.text)}return r}async function M_(e,t,n,r,i){let a=n.some(e=>e.bytes===null||e.path===t.schemaPath)?await j_(e,t,[t.schema,i].filter(e=>e!==null)):new Map,o=Qg({schema:t.schema,schemaPath:t.schemaPath,exists:e=>t.files.has(e),read:e=>a.get(e),list:()=>t.files.keys()},n.map(e=>({path:e.path,content:e.bytes})),r);for(let e of n)e.bytes===null&&!t.files.has(e.path)&&o.push({file:e.path,path:``,message:`File not found`});return n.reduce((e,t)=>e+(t.bytes?.byteLength??0),0)>y_&&o.push({path:``,message:`Changes are too large for one commit (max 20 MB)`}),o}function N_(e,t,n){let r=new Map(e.files);for(let e of t)e.next===null?r.delete(e.path):r.set(e.path,e.next);let i={...e,headOid:n,files:r},a=t.find(t=>t.path===e.schemaPath);if(a?.bytes){let t=Eg(a.bytes,e.schemaPath);if(i.schema=`text`in t?Xd(t.text,e.schemaPath):null,i.schemaSha=a.next,i.contentDir=i.schema?.contentDir??null,i.contentDir!==e.contentDir)return null}return i}function P_(e){if(e.token===void 0==(e.client===void 0))throw TypeError("createGitHubSource: pass exactly one of `token` or `client`");return F_({client:e.client??Yt({token:e.token}),cache:e.cache??mn(),owner:e.owner,repo:e.repo,schemaPath:e.schemaPath??`cms/schema.json`,baseBranch:e.baseBranch,branchPrefix:e.branchPrefix},e.branch)}function F_(e,t){let n=null,r=null,i=0,a=new Map;function o(){let a=++i,o=__(e,t).then(e=>(a===i&&(n=e,r=null),e),e=>{throw a===i&&(r=null),e});return r=o,o}function s(){return n?Promise.resolve(n):r??o()}async function c(t){let n=await s(),r=t.filter(e=>!n.files.has(e));if(r.length>0)throw a_([...new Set(r)]);let i=await s_(e,t.map(e=>n.files.get(e))),o=new Map;for(let e of t){let t=n.files.get(e);o.set(e,i.get(t).slice()),a.set(e,t)}return o}async function l(){if(e.baseBranch!==void 0)return e.baseBranch;let t=(await s()).schema?.git.baseBranch;if(t===void 0)throw new F(`not_found`,`Base branch unknown: schema missing or invalid`);return t}async function u(){return e.branchPrefix===void 0?rf((await s()).schema?.git).branchPrefix:e.branchPrefix}let d=t=>F_(e,t);return{kind:`github`,owner:e.owner,repo:e.repo,branch:t,pending:e.cache.pending(`${e.owner}/${e.repo}#${t}`),async listFiles(){let e=await o(),t=[];for(let[n,r]of e.files)(n===e.schemaPath||e.schema&&!Dn(e.schema,n))&&t.push({path:n,sha:r});return t.toSorted(i_)},async readFile(e){return(await c([e])).get(e)},readFiles:c,async readBlob(t){return(await s_(e,[t])).get(t).slice()},async head(){return(await s()).headOid},async commit(c,l){let u=await s(),d=e.branchPrefix??rf(u.schema?.git).branchPrefix,f={issues:[{path:``,message:`Commits must go to a branch named ${d}*, not "${t}"`}]};if(!t.startsWith(d)||t===(e.baseBranch??u.schema?.git.baseBranch))return f;let p=new Set,m=new Set;for(let{path:e}of c)(p.has(e)?m:p).add(e);if(m.size>0)return{issues:[...m].map(e=>({file:e,path:``,message:`Duplicate path in changes`}))};let h=await Promise.all(c.map(e=>E_(e,a,u))),g=()=>{for(let e of h)e.next===null?a.delete(e.path):a.set(e.path,e.next)},_=k_(u.schemaPath,h),v=u;for(let a=1;;a++){let s=await A_(e,v,_),c=[],u=[];for(let e of h){let t=s.files.get(e.path)??null;(e.next===null||t!==e.next)&&(t===e.expected?u.push(e):t!==e.next&&c.push({file:e.path,path:``,message:w_}))}if(c.length>0)return{issues:c};if(u.length===0)return g(),{issues:[]};let d=await M_(e,s,u,l,_);if(d.length>0)return{issues:d};let f={branch:{repositoryNameWithOwner:`${e.owner}/${e.repo}`,branchName:t},expectedHeadOid:v.headOid,message:D_(l),fileChanges:{additions:u.flatMap(e=>e.bytes===null?[]:[{path:e.path,contents:_n(e.bytes)}]),deletions:u.flatMap(e=>e.bytes===null?[{path:e.path}]:[])}},p;try{p=(await e.client.graphql(T_,{input:f})).createCommitOnBranch.commit}catch(e){if(!O_(e))throw e;if(a>=b_)return{issues:[{path:``,message:`Branch keeps changing; try again`}]};v=await o();continue}++i,r=null,n=N_(v,u,p.oid);let m=u.flatMap(e=>e.bytes===null?[]:[{sha:e.next,bytes:e.bytes}]);return await e.cache.putBlobs(m).catch(()=>void 0),g(),{issues:[],commit:{oid:p.oid,url:p.url}}}},async history(n){let r=(await u_(e,x_,{ref:`refs/heads/${t}`,path:n})).ref?.target?.history,[i]=r?.nodes??[];if(!r||!i)return{updated:null,created:null,commits:0};let a=r.totalCount,o=S_(i);if(a>1){let r=new URLSearchParams({sha:t,path:n,per_page:`1`,page:String(a)}),[i]=await e.client.rest(`GET`,`/repos/${e.owner}/${e.repo}/commits?${r}`);i&&(o=C_(i))}return{updated:S_(i),created:o,commits:a}},baseBranch:l,branchPrefix:u,withBranch:d,...jf({ctx:e,branch:t,baseBranch:l,branchPrefix:u,withBranch:d,repoQuery:(t,n)=>u_(e,t,n),loadSnapshot:t=>__(e,t),loadSnapshotAt:t=>v_(e,t)})}}var I_=[`.github/CODEOWNERS`,`CODEOWNERS`,`docs/CODEOWNERS`],L_=e=>e.replace(/[.+^${}()|\\]/g,`\\$&`);function R_(e){if(e.startsWith(`!`)||/[[\]\\]/.test(e))return null;let t=e,n=t.endsWith(`/`);n&&(t=t.slice(0,-1));let r=t.includes(`/`);if(t.startsWith(`/`)&&(t=t.slice(1)),t===``)return null;let i=``;for(let e=0;e<t.length;)t.startsWith(`**/`,e)?(i+=`(?:.*/)?`,e+=3):t.startsWith(`/**`,e)&&e+3===t.length?(i+=`(?:/.*)?`,e+=3):t.startsWith(`**`,e)?(i+=`.*`,e+=2):t[e]===`*`?(i+=`[^/]*`,e+=1):t[e]===`?`?(i+=`[^/]`,e+=1):(i+=L_(t[e]),e+=1);let a=!/[*?]/.test(t.split(`/`).pop());return RegExp(`^${r?``:`(?:.*/)?`}${i}${n?`/.*`:a?`(?:/.*)?`:``}$`)}function z_(e){let t=[];return e.split(/\r?\n/).forEach((e,n)=>{let[r,...i]=e.trim().split(/\s+/);if(!r||r.startsWith(`#`))return;let a=R_(r);if(!a)return;let o=i.findIndex(e=>e.startsWith(`#`)),s=(o<0?i:i.slice(0,o)).filter(e=>e.includes(`@`));t.push({pattern:r,owners:s,line:n+1,regex:a})}),t}function B_(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].regex.test(t))return e[n].owners;return null}function V_(e,t){return[...new Set(t.flatMap(t=>B_(e,t)??[]))]}async function H_(e,t,n,r){for(let i of I_)try{let a=await e.rest(`GET`,`/repos/${t}/${n}/contents/${i}`,{query:{ref:r},raw:!0,accept:`application/vnd.github.raw+json`});return{path:i,text:new TextDecoder().decode(a)}}catch(e){if(e instanceof F&&e.code===`not_found`)continue;throw e}return null}var U_=`Your GitHub session expired. Sign in again.`,W_=`GitHub didn't accept this token.`;function G_(e){return`Your session ended after ${e} minute${e===1?``:`s`} without activity. Sign in again.`}var K_=e=>String(e).padStart(2,`0`);function q_(e){let t=new Date(e);return`${K_(t.getHours())}:${K_(t.getMinutes())}`}function J_(e,t={}){if(e instanceof Ot){if(e.code===`forbidden`)return`Your GitHub account can't write to ${t.repo??`this repository`}`;if(e.code===`unauthorized`)return U_}if(e instanceof F){if(e.code===`rate_limited`)return e.retryAt===void 0?`GitHub rate limit reached. Try again later`:`GitHub rate limit reached. Try again at ${q_(e.retryAt)}`;if(e.code===`network_error`)return`Can't reach GitHub`}return e instanceof Error?e.message:String(e)}var Y_=`${c}:session:v2`,X_=`octocms:session:v1`,Z_=e=>e===null||typeof e==`number`;function Q_(e,t=Date.now()){try{let n=e.getItem(Y_);if(!n)return null;let r=JSON.parse(n);return typeof r!=`object`||!r||typeof r.accessToken!=`string`||!r.accessToken||typeof r.tokenType!=`string`||!Z_(r.expiresAt)||typeof r.lastActiveAt!=`number`||r.method!==`oauth`&&r.method!==`token`?null:{accessToken:r.accessToken,tokenType:r.tokenType,expiresAt:r.expiresAt??null,refreshToken:null,refreshTokenExpiresAt:null,method:r.method,lastActiveAt:Math.min(r.lastActiveAt,t)}}catch{return null}}function $_(e,t){let{accessToken:n,tokenType:r,expiresAt:i,method:a,lastActiveAt:o}=t;e.setItem(Y_,JSON.stringify({accessToken:n,tokenType:r,expiresAt:i,method:a,lastActiveAt:o}))}function ev(e){e.removeItem(Y_)}function tv(e,t=Date.now()){return{accessToken:e,tokenType:`bearer`,expiresAt:null,refreshToken:null,refreshTokenExpiresAt:null,method:`token`,lastActiveAt:t}}function nv(e,t,n=Date.now()){return n-e.lastActiveAt>t*6e4}function rv(e,t){return async(n,r)=>{let i=await e(n,r);if(i.status!==401)return i;let a=await t.onRefresh();if(!a)return t.onUnauthorized(),i;let o=new Headers(r?.headers??(n instanceof Request?n.headers:void 0));o.set(`Authorization`,`Bearer ${a}`);let s=await e(n,{...r,headers:o});return s.status===401&&t.onUnauthorized(),s}}var iv=`config.json`,av=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,ov=/^([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)$/;function sv(e){if(e.startsWith(`/`))return!e.startsWith(`//`);let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`||t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`)}var cv=1440;function lv(e){return typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=cv}function uv(e,t){let n=ov.exec(e);return n?{owner:n[1],repo:n[2],baseBranch:t}:null}var dv=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function fv(e){if(!dv(e))return null;let t={},{github:n,authUrl:r,sessionMinutes:i,preview:a,param:o}=e;if(dv(n)&&typeof n.owner==`string`&&typeof n.repo==`string`){let e=typeof n.baseBranch==`string`&&n.baseBranch?n.baseBranch:null,r=e?uv(`${n.owner}/${n.repo}`,e):null;r&&(t.github=r)}return typeof r==`string`&&sv(r)&&(t.authUrl=r),lv(i)&&(t.sessionMinutes=i),a===!0&&(t.preview=!0),typeof o==`string`&&av.test(o)&&o!==`editlet`&&(t.param=o),t}var pv=(0,E.createContext)(null),mv=(...e)=>globalThis.fetch(...e);function hv(){let e=new Map;return{get length(){return e.size},clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>[...e.keys()][t]??null,removeItem:t=>void e.delete(t),setItem:(t,n)=>void e.set(t,String(n))}}function gv(){try{return window.sessionStorage}catch{return hv()}}var _v=6e4,vv=3e4,yv=[`pointerdown`,`keydown`,`wheel`],bv=new Set([`network_error`,`token_request_failed`,`server_misconfigured`]);function xv(e){return!(e instanceof Ot)||bv.has(e.code)}function Sv(e){return new URL(e,window.location.origin).toString()}function Cv(e,t,n){return{...e,refreshToken:null,refreshTokenExpiresAt:null,method:t,lastActiveAt:n}}function wv({authUrl:e,fetch:t=mv,storage:n,sessionMinutes:r=60,children:i}){let a=ne(),o=(0,E.useMemo)(()=>n??gv(),[n]),[s,c]=(0,E.useState)(()=>{let e=Q_(o);if(e&&nv(e,r)){try{ev(o)}catch{}return{session:null,notice:G_(r),lapsed:!0}}return{session:e,notice:null,lapsed:!1}}),l=(0,E.useRef)(s.session),u=(0,E.useRef)(s.session?.lastActiveAt??0),d=(0,E.useRef)(null),f=(0,E.useRef)(null),p=(0,E.useRef)(!1);(0,E.useEffect)(()=>{try{window.localStorage.removeItem(X_)}catch{}},[]);let m=(0,E.useCallback)(e=>{try{$_(o,e)}catch{}},[o]),h=(0,E.useCallback)((e,t,n={})=>{let r=n.lastActiveAt??Date.now(),i=Cv(e,t,r);return d.current=e.refreshToken,p.current=n.unverified===!0,u.current=r,l.current=i,m(i),c({session:i,notice:null,lapsed:!1}),i},[m]),g=(0,E.useCallback)((e,t)=>{try{ev(o)}catch{}l.current=null,d.current=null,f.current=null,p.current=!1,c({session:null,notice:e,lapsed:t}),t||a.clear()},[o,a]),_=(0,E.useCallback)(e=>g(e??null,!1),[g]),v=(0,E.useCallback)(e=>g(e,!0),[g]),y=(0,E.useCallback)(()=>{let e=l.current;return!e||!nv({...e,lastActiveAt:u.current},r)?!1:(v(G_(r)),!0)},[r,v]),b=(0,E.useCallback)(()=>{let e=l.current;if(!e)return;let t=Date.now();if(u.current=t,t-e.lastActiveAt<_v)return;let n={...e,lastActiveAt:t};l.current=n,m(n)},[m]),x=(0,E.useCallback)(()=>{let e=l.current;if(!e||e.lastActiveAt===u.current)return;let t={...e,lastActiveAt:u.current};l.current=t,m(t)},[m]),S=s.session!==null;(0,E.useEffect)(()=>{if(!S)return;let e=setInterval(y,vv),t={capture:!0,passive:!0};for(let e of yv)window.addEventListener(e,b,t);let n=()=>{document.visibilityState===`hidden`&&x()};return window.addEventListener(`pagehide`,x),document.addEventListener(`visibilitychange`,n),()=>{clearInterval(e);for(let e of yv)window.removeEventListener(e,b,t);window.removeEventListener(`pagehide`,x),document.removeEventListener(`visibilitychange`,n)}},[S,y,b,x]);let C=(0,E.useCallback)(()=>{if(f.current)return f.current;let t=d.current,n=(async()=>{if(!e)throw new Ot(`invalid_worker_url`);if(!t)throw new Ot(`bad_refresh_token`);return It({workerUrl:Sv(e),refreshToken:t})})().then(e=>f.current===n?(f.current=null,h(e,`oauth`,{lastActiveAt:u.current})):Cv(e,`oauth`,u.current),e=>{let t=xv(e);throw f.current===n&&(f.current=null,t||v(U_)),t?new F(`network_error`,`Can't reach the sign-in service to refresh the session`):new Ot(`unauthorized`,U_)});return f.current=n,n},[e,h,v]),w=(0,E.useCallback)(async()=>{let e=l.current;if(!e)throw new Ot(`unauthorized`,U_);if(y())throw new Ot(`unauthorized`,G_(r));if(e.method===`token`||!Lt(e))return e.accessToken;if(d.current)return(await C()).accessToken;if(e.expiresAt!==null&&Date.now()<e.expiresAt)return e.accessToken;throw v(U_),new Ot(`unauthorized`,U_)},[y,r,C,v]),T=(0,E.useMemo)(()=>rv(async(e,n)=>{let r=await t(e,n);return r.status!==401&&(p.current=!1),r},{async onRefresh(){let e=l.current;if(!e||e.method===`token`||!d.current)return null;try{return(await C()).accessToken}catch(e){if(e instanceof F)throw e;return null}},onUnauthorized:()=>v(p.current?W_:U_)}),[t,C,v]),ee=(0,E.useCallback)((e,t={})=>{let n;try{n=Sv(e)}catch{return Promise.reject(new Ot(`invalid_worker_url`))}return Ft({workerUrl:n}).then(e=>{t.signal?.aborted||h(e,`oauth`)})},[h]),te=(0,E.useCallback)(e=>{let t=e.trim();t&&h(tv(t),`token`,{unverified:!0})},[h]),re=(0,E.useMemo)(()=>({session:s.session,notice:s.notice,lapsed:s.lapsed,signIn:ee,signInWithToken:te,signOut:_,getToken:w,fetch:T}),[s,ee,te,_,w,T]);return(0,D.jsx)(pv.Provider,{value:re,children:i})}function Tv(){let e=(0,E.useContext)(pv);if(!e)throw Error(`useAuth must be used inside <AuthProvider>`);return e}function Ev(e,t){if(e){if(typeof e==`string`||typeof e==`number`)t.push(String(e));else if(Array.isArray(e))for(let n of e)Ev(n,t);else if(typeof e==`object`)for(let n in e)e[n]&&t.push(n)}}function Dv(...e){let t=[];for(let n of e)Ev(n,t);return t.join(` `)}function Ov({variant:e=`default`,size:t=`md`,iconOnly:n=!1,className:r}={}){return Dv(`editlet-button`,`editlet-button--${e}`,t===`sm`&&`editlet-button--sm`,n&&`editlet-button--icon`,r)}var Z=E.forwardRef(({className:e,variant:t=`default`,size:n=`md`,iconOnly:r,type:i=`button`,icon:a,iconRight:o,children:s,...c},l)=>(0,D.jsxs)(`button`,{ref:l,type:i,className:Ov({variant:t,size:n,iconOnly:r,className:e}),...c,children:[a?(0,D.jsx)(`span`,{className:`editlet-button__icon`,children:a}):null,s,o?(0,D.jsx)(`span`,{className:`editlet-button__icon`,children:o}):null]}));Z.displayName=`Button`;var kv={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};function Av(e){return`aria-label`in e||`aria-labelledby`in e||`role`in e}function Q(e,t){let n=(0,E.forwardRef)(({color:n,size:r,strokeWidth:i,className:a,children:o,...s},c)=>{let l=r??kv.width;return(0,E.createElement)(`svg`,{ref:c,...kv,width:l,height:l,stroke:n??kv.stroke,strokeWidth:i??kv.strokeWidth,className:a||void 0,"data-icon":e,...!o&&!Av(s)?{"aria-hidden":`true`}:{},...s},[...t.map(([e,t])=>(0,E.createElement)(e,t)),...Array.isArray(o)?o:[o]])});return n.displayName=e,n}var jv=Q(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Mv=Q(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Nv=Q(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pv=Q(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Fv=Q(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Iv=Q(`calendar`,[[`path`,{d:`M8 2v4`,key:`cal1`}],[`path`,{d:`M16 2v4`,key:`cal2`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`cal3`}],[`path`,{d:`M3 10h18`,key:`cal4`}]]),Lv=Q(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`zi1`}],[`path`,{d:`m21 21-4.3-4.3`,key:`zi2`}],[`path`,{d:`M11 8v6`,key:`zi3`}],[`path`,{d:`M8 11h6`,key:`zi4`}]]),Rv=Q(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),zv=Q(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Bv=Q(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Vv=Q(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Hv=Q(`file`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Uv=Q(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Wv=Q(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gv=Q(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),Kv=Q(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),qv=Q(`move`,[[`path`,{d:`M12 2v20`,key:`mv1`}],[`path`,{d:`M2 12h20`,key:`mv2`}],[`path`,{d:`m15 19-3 3-3-3`,key:`mv3`}],[`path`,{d:`m19 9 3 3-3 3`,key:`mv4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`mv5`}],[`path`,{d:`m9 5 3-3 3 3`,key:`mv6`}]]),Jv=Q(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Yv=Q(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`sn0`}],[`path`,{d:`M12 2v2`,key:`sn1`}],[`path`,{d:`M12 20v2`,key:`sn2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`sn3`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`sn4`}],[`path`,{d:`M2 12h2`,key:`sn5`}],[`path`,{d:`M20 12h2`,key:`sn6`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`sn7`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`sn8`}]]),Xv=Q(`moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`mn1`}]]),Zv=Q(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`pe1`}],[`path`,{d:`m15 5 4 4`,key:`pe2`}]]),$={Plus:jv,X:Mv,Check:Nv,Trash:Pv,Image:Fv,Calendar:Iv,Upload:Rv,ZoomIn:Lv,ExternalLink:zv,ArrowLeft:Bv,ChevronRight:Vv,File:Hv,Folder:Uv,Eye:Wv,Home:Gv,ChevronDown:Kv,Move:qv,Minimize:Jv,Sun:Yv,Moon:Xv,Undo:Q(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`u1`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`u2`}]]),Pencil:Zv,Alert:Q(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),GitBranch:Q(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`zgfqzp`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),LogOut:Q(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Bold:Q(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`bold1`}]]),Italic:Q(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`it1`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`it2`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`it3`}]]),Strikethrough:Q(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`st1`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`st2`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`st3`}]]),Code:Q(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`co1`}],[`path`,{d:`m8 6-6 6 6 6`,key:`co2`}]]),Link:Q(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`ln1`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`ln2`}]]),List:Q(`list`,[[`path`,{d:`M3 6h.01`,key:`li1`}],[`path`,{d:`M3 12h.01`,key:`li2`}],[`path`,{d:`M3 18h.01`,key:`li3`}],[`path`,{d:`M8 6h13`,key:`li4`}],[`path`,{d:`M8 12h13`,key:`li5`}],[`path`,{d:`M8 18h13`,key:`li6`}]]),ListOrdered:Q(`list-ordered`,[[`path`,{d:`M10 6h11`,key:`lo1`}],[`path`,{d:`M10 12h11`,key:`lo2`}],[`path`,{d:`M10 18h11`,key:`lo3`}],[`path`,{d:`M4 6h1v4`,key:`lo4`}],[`path`,{d:`M4 10h2`,key:`lo5`}],[`path`,{d:`M6 18H4c0-1 2-2 2-3s-1-1.5-2-1`,key:`lo6`}]]),Quote:Q(`text-quote`,[[`path`,{d:`M17 6H3`,key:`qu1`}],[`path`,{d:`M21 12H8`,key:`qu2`}],[`path`,{d:`M21 18H8`,key:`qu3`}],[`path`,{d:`M3 12v6`,key:`qu4`}]]),CodeBlock:Q(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`cb1`}],[`path`,{d:`m14 15 3-3-3-3`,key:`cb2`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`cb3`}]]),Minus:Q(`minus`,[[`path`,{d:`M5 12h14`,key:`mi1`}]]),Table:Q(`table`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`tb1`}],[`path`,{d:`M12 3v18`,key:`tb2`}],[`path`,{d:`M3 9h18`,key:`tb3`}],[`path`,{d:`M3 15h18`,key:`tb4`}]])},Qv=E.createContext(null),$v=E.createContext({open:!1,setOpen:()=>{},titleId:``,descriptionId:``});function ey({open:e,onOpenChange:t,children:n}){let r=E.useId(),i=E.useMemo(()=>({open:e,setOpen:t,titleId:`${r}-title`,descriptionId:`${r}-desc`}),[e,t,r]);return(0,D.jsx)($v.Provider,{value:i,children:n})}function ty({className:e,children:t,onClick:n,closable:r=!0,...i}){let{open:a,setOpen:o,titleId:s,descriptionId:c}=E.useContext($v),l=E.useContext(Qv),u=i.role===`alertdialog`,d=r&&!u,f=E.useRef(null);return E.useLayoutEffect(()=>{if(!a)return;let e=f.current;if(e){if(typeof e.showModal==`function`){try{e.open&&e.close(),e.showModal()}catch{}e.open||e.setAttribute(`open`,``)}else e.setAttribute(`open`,``);return()=>{try{e.open&&typeof e.close==`function`&&e.close()}catch{}}}},[a]),E.useEffect(()=>{if(!a)return;let e=f.current;if(!e)return;let t=e=>e.preventDefault();return e.addEventListener(`cancel`,t),()=>e.removeEventListener(`cancel`,t)},[a]),E.useEffect(()=>{if(!a||!r)return;let e=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,o,r]),a?(0,D.jsxs)(`dialog`,{ref:f,className:Dv(`editlet-dialog__content`,e),"data-state":`open`,"aria-modal":`true`,"aria-labelledby":s,"aria-describedby":c,onClick:e=>{let t=e.target;d&&(t===e.currentTarget||t.matches(`.editlet-dialog__panel, .editlet-dialog__scroll`))&&o(!1),n?.(e)},...i,children:[(0,D.jsxs)(`div`,{className:`editlet-dialog__panel`,children:[(0,D.jsx)(`div`,{className:`editlet-dialog__scroll`,children:(0,D.jsx)(`div`,{className:`editlet-dialog__inner`,children:t})}),r&&!u?(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,className:`editlet-dialog__close`,onClick:()=>o(!1),"aria-label":`Close`,children:(0,D.jsx)($.X,{size:16})}):null]}),l]}):null}function ny({className:e,...t}){return(0,D.jsx)(`div`,{className:Dv(`editlet-dialog__header`,e),...t})}function ry({className:e,...t}){return(0,D.jsx)(`div`,{className:Dv(`editlet-dialog__footer`,e),...t})}function iy({className:e,children:t,...n}){let{titleId:r}=E.useContext($v);return(0,D.jsx)(`h2`,{id:r,className:Dv(`editlet-dialog__title`,e),...n,children:t})}function ay({className:e,...t}){let{descriptionId:n}=E.useContext($v);return(0,D.jsx)(`p`,{id:n,className:Dv(`editlet-dialog__description`,e),...t})}function oy(e,t,n){let r=[t?`${e}-hint`:null,n?`${e}-error`:null].filter(Boolean);return r.length>0?r.join(` `):void 0}function sy({label:e,hint:t,error:n,required:r,htmlFor:i,describedById:a,className:o,children:s}){let c=a??i;return(0,D.jsxs)(`div`,{className:Dv(`editlet-field`,o),children:[(0,D.jsxs)(`label`,{htmlFor:i,className:`editlet-field__head`,children:[(0,D.jsxs)(`span`,{className:`editlet-field__label`,children:[e,r?(0,D.jsx)(`span`,{className:`editlet-field__required`,"aria-hidden":`true`,children:`*`}):null]}),t?(0,D.jsx)(`span`,{id:c?`${c}-hint`:void 0,className:`editlet-field__hint`,"aria-hidden":`true`,children:t}):null]}),s,n?(0,D.jsxs)(`div`,{id:c?`${c}-error`:void 0,className:`editlet-field__error`,role:`alert`,children:[(0,D.jsx)($.X,{size:11}),n]}):null]})}var cy=`editlet-input`,ly=`field-textarea editlet-textarea`;function uy({prefix:e,...t}){return(0,D.jsxs)(`label`,{className:`editlet-input editlet-input--affixed`,children:[(0,D.jsx)(`span`,{className:`editlet-input__affix`,"aria-hidden":`true`,children:e}),(0,D.jsx)(`input`,{...t,className:`editlet-input__inner`})]})}var dy=`https://github.com/settings/personal-access-tokens/new`;function fy(e){switch(e){case`popup_blocked`:return{text:`Your browser blocked the sign-in window.`,retry:!0};case`access_denied`:return{text:`GitHub sign-in was cancelled.`,retry:!0};case`origin_not_allowed`:return{text:`This site isn't set up for sign-in yet. Add ${window.location.origin} to ALLOWED_ORIGINS of the auth handler.`,retry:!1};default:return{text:`Sign-in failed (${e}).`,retry:!0}}}function py({repo:e,primary:t,onUse:n}){let[r,i]=(0,E.useState)(``),a=(0,E.useId)(),o=(0,E.useId)();return(0,D.jsxs)(`form`,{className:`editlet-sign-in__token`,onSubmit:e=>{e.preventDefault(),n(r)},children:[(0,D.jsx)(sy,{label:`Personal access token`,htmlFor:a,children:(0,D.jsx)(`input`,{id:a,type:`password`,className:cy,value:r,onChange:e=>i(e.target.value),autoComplete:`off`,spellCheck:!1,"aria-describedby":o})}),(0,D.jsxs)(`p`,{id:o,className:`editlet-sign-in__hint`,children:[`Fine-grained token for `,e,` with Contents and Pull requests read/write and Deployments read.`,` `,(0,D.jsx)(`a`,{className:`editlet-link editlet-u-text-brand`,href:dy,target:`_blank`,rel:`noreferrer`,children:`Create a token`})]}),(0,D.jsx)(Z,{type:`submit`,variant:t?`primary`:`outline`,disabled:!r.trim(),children:`Use token`})]})}function my({authUrl:e,repo:t,dialog:n=!1}){let r=Tv(),[i,a]=(0,E.useState)({kind:`idle`}),[o,s]=(0,E.useState)(!e),c=(0,E.useRef)(0),l=(0,E.useRef)(null),u=(0,E.useId)(),d=()=>{c.current+=1,l.current?.abort(),l.current=null};(0,E.useEffect)(()=>{let e=c,t=l;return()=>{e.current+=1,t.current?.abort()}},[]);let f=()=>{if(!e)return;d();let t=c.current,n=new AbortController;l.current=n;let i=r.signIn(e,{signal:n.signal});a({kind:`waiting`}),i.then(()=>{t===c.current&&a({kind:`idle`})},e=>{if(t!==c.current)return;let n=e instanceof Ot?e.code:`unknown_error`;a(n===`popup_closed`?{kind:`idle`}:{kind:`failed`,code:n})})},p=()=>{d(),a({kind:`idle`})},m=i.kind===`failed`?fy(i.code):null,h=(0,D.jsxs)(D.Fragment,{children:[r.notice?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:r.notice})]}):null,i.kind===`waiting`?(0,D.jsxs)(`div`,{className:`editlet-sign-in__actions`,children:[(0,D.jsx)(`p`,{className:`editlet-sign-in__text`,role:`status`,children:`Finish signing in in the GitHub window…`}),(0,D.jsx)(Z,{variant:`outline`,onClick:p,children:`Cancel`})]}):(0,D.jsxs)(D.Fragment,{children:[m?(0,D.jsx)(`p`,{className:`editlet-sign-in__error`,role:`alert`,children:m.text}):null,e&&(!m||m.retry)?(0,D.jsx)(`div`,{className:`editlet-sign-in__actions`,children:(0,D.jsx)(Z,{variant:`primary`,onClick:f,children:m?`Try again`:`Sign in with GitHub`})}):null,o?(0,D.jsx)(py,{repo:t,primary:!e,onUse:r.signInWithToken}):(0,D.jsx)(Z,{variant:`ghost`,onClick:()=>s(!0),children:`Use a personal access token`})]})]});return n?h:(0,D.jsx)(`div`,{className:`editlet-layout__sign-in`,children:(0,D.jsxs)(`section`,{className:`editlet-sign-in`,"aria-labelledby":u,children:[(0,D.jsxs)(`div`,{className:`editlet-sign-in__header`,children:[(0,D.jsx)(`h1`,{id:u,className:`editlet-sign-in__title`,children:`Sign in to edit`}),(0,D.jsxs)(`p`,{className:`editlet-sign-in__text`,children:[`Your edits are saved as commits to `,t,` on GitHub.`]})]}),h]})})}function hy({authUrl:e,repo:t,login:n,checking:r}){return(0,D.jsx)(ey,{open:!0,onOpenChange:()=>void 0,children:(0,D.jsxs)(ty,{closable:!1,children:[(0,D.jsxs)(ny,{children:[(0,D.jsx)(iy,{children:`Sign in again`}),(0,D.jsxs)(ay,{children:[`Your open edits are kept. Sign in as `,n,` to go on.`]})]}),r?(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Checking your account…`}):(0,D.jsx)(my,{authUrl:e,repo:t,dialog:!0})]})})}var gy=(0,E.createContext)(null);function _y(){return(0,E.useContext)(gy)}var vy=(0,E.createContext)(null);function yy({source:e,children:t}){return(0,D.jsx)(vy.Provider,{value:e,children:t})}function by(){let e=(0,E.useContext)(vy);if(!e)throw Error(`useSource must be used inside <SourceProvider>`);return e}function xy(e){return`branch`in e?String(e.branch):e.kind}var Sy=[`files`];function Cy(e){return[...Sy,xy(e)]}var wy=[`branches`],Ty=1e4;function Ey(e,t){return`${c}:branch:${e}/${t}`}function Dy(){try{return window.localStorage}catch{return}}function Oy(e,t,n,r){try{let i=e?.getItem(t);if(i&&(i===n||af(i,r)))return i}catch{}return n}function ky(e,t,n){try{e?.setItem(t,n)}catch{}}function Ay(e){return{queryKey:wy,queryFn:()=>e.listBranches(),staleTime:Ty}}var jy=rf(null),My=(0,E.createContext)(null);function Ny({config:e,style:t=jy,param:n=u,client:r,storage:i,children:a}){let o=ne(),{owner:s,repo:c,baseBranch:l}=e,d=i??Dy(),f=Ey(s,c),p=t.branchPrefix,m=(0,E.useMemo)(()=>new Map([[l,P_({owner:s,repo:c,branch:l,client:r,baseBranch:l,branchPrefix:p})]]),[s,c,l,r,p]),h=(0,E.useCallback)(e=>{let t=m.get(e);return t||(t=m.get(l).withBranch(e),m.set(e,t)),t},[m,l]),[g,_]=(0,E.useState)(()=>{let e=Oy(d,f,l,p);return{active:e,notice:null,restoring:e!==l,switches:0}}),v=(0,E.useCallback)((e,t)=>{if(e!==l&&!af(e,p))throw TypeError(`Not the base branch or a ${p}* branch: "${e}"`);ky(d,f,e),_(n=>({active:e,notice:null,restoring:!1,switches:t?n.switches+1:n.switches}))},[l,p,d,f]),y=(0,E.useCallback)((e,t)=>v(e,!t?.keepScreen),[v]),b=(0,E.useCallback)(async(e,t)=>{let n=await m.get(l).createBranch(e);return m.set(e,n),await o.prefetchQuery({queryKey:Cy(n),queryFn:()=>n.listFiles()}),v(e,!t?.keepScreen),o.invalidateQueries({queryKey:wy}),n},[m,l,v,o]),x=xt(Ay(m.get(l)));(0,E.useEffect)(()=>{if(!g.restoring)return;if(x.error)return _(e=>({...e,restoring:!1}));if(!x.data)return;let e=g.active;x.data.some(t=>t.name===e)?_(e=>({...e,restoring:!1})):(ky(d,f,l),_(t=>({active:l,notice:`Branch ${e} no longer exists. Showing ${l}.`,restoring:!1,switches:t.switches+1})))},[g.restoring,g.active,x.data,x.error,d,f,l]);let S=(0,E.useMemo)(()=>({config:e,base:l,style:t,prefix:p,param:n,client:r,active:g.active,onBase:g.active===l,source:h(g.active),sourceFor:h,switchTo:y,createBranch:b,fallbackNotice:g.notice,restoring:g.restoring,switches:g.switches}),[e,l,t,p,n,r,g,h,y,b]);return(0,D.jsx)(My.Provider,{value:S,children:(0,D.jsx)(yy,{source:S.source,children:a})})}function Py(){return(0,E.useContext)(My)}function Fy(){let e=Py(),t=e?.sourceFor(e.base);return xt({queryKey:wy,queryFn:()=>t.listBranches(),staleTime:Ty,enabled:t!==void 0})}var Iy=`draft`,Ly=`__body`,Ry=`__extra`,zy=`__key`,By=0,Vy=()=>`i${++By}`;function Hy(e){switch(e.type){case`string`:return e.list?`list`:`string`;case`select`:case`reference`:return e.multiple?`list`:`string`;case`boolean`:case`number`:case`json`:case`image`:case`markdown`:return e.type;case`object`:return e.list?`items`:`object`;case`blocks`:return`items`;default:return`string`}}var Uy=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Wy=e=>e==null;function Gy(e){return Uy(e)&&Object.entries(e).every(([e,t])=>(e===`src`||e===`alt`)&&(typeof t==`string`||t===void 0))}function Ky(e,t){switch(Hy(e)){case`string`:return Wy(t)?``:t;case`list`:return Wy(t)?[]:t;case`boolean`:return Wy(t)?void 0:t;case`number`:return Wy(t)?``:typeof t==`number`?String(t):t;case`json`:return Wy(t)?``:JSON.stringify(t,null,2);case`image`:return Wy(t)?{src:``,alt:``}:Gy(t)?{src:t.src??``,alt:t.alt??``}:t;case`markdown`:return;case`object`:return Wy(t)?Yy(e.fields,{}):Uy(t)?Yy(e.fields,t):t;case`items`:return Wy(t)?[]:Array.isArray(t)?t.map(t=>Jy(e,t)):t}}function qy(e,t){if(e.type===`object`)return e.fields;if(e.type===`blocks`)return Mg(e,t)}function Jy(e,t){let n=qy(e,t);return!n||!Uy(t)?t:{[zy]:Vy(),...Yy(n,t)}}function Yy(e,t){let n={...t};for(let[r,i]of Object.entries(e))n[r]=i.type===`markdown`?typeof t[r]==`string`?t[r]:``:Ky(i,t[r]);return n}function Xy(e,t){return Jy(e,e.type===`blocks`&&t!==void 0?{[Md]:t}:{})}function Zy(e,t){let n={};for(let[r,i]of Object.entries(e.fields))i.type!==`markdown`&&(n[r]=Ky(i,t.data[r]));n[Iy]=t.data.draft===!0,(Zd(e)!==void 0||t.body!==``)&&(n[Ly]=t.body);let r={};for(let[n,i]of Object.entries(t.data))n!==`draft`&&!Object.hasOwn(e.fields,n)&&(r[n]=i);return n[Ry]=r,n}function Qy(e,t,n,r){switch(Hy(e)){case`string`:case`boolean`:return n;case`list`:return Array.isArray(n)&&n.length===0?void 0:n;case`number`:{if(typeof n!=`string`)return n;let e=n.trim();if(e===``)return;let t=Number(e);return Number.isFinite(t)?t:n}case`json`:if(typeof n!=`string`)return n;if(n.trim()===``)return;try{return JSON.parse(n)}catch{r.push({path:t,message:`Invalid JSON`});return}case`image`:if(Gy(n)){let e=n.src??``,t=n.alt??``;return e===``&&t===``?void 0:{src:e,alt:t}}return n;case`markdown`:return;case`object`:{if(!Uy(n))return n;let i=e.fields,a=Vg({label:``,fields:i},$y(i,t,n,r));return Object.keys(a).length===0?void 0:a}case`items`:return Array.isArray(n)?n.length===0?void 0:n.map((n,i)=>{let a=qy(e,n);return!a||!Uy(n)?n:$y(a,`${t}.${i}`,n,r)}):n}}function $y(e,t,n,r){let i={};for(let[a,o]of Object.entries(n)){if(a===`__key`)continue;let n=Object.hasOwn(e,a)?e[a]:void 0,s=o;n?.type===`markdown`?s=o===``?void 0:o:n&&(s=Qy(n,`${t}.${a}`,o,r)),s!==void 0&&(i[a]=s)}return i}function eb(e,t){let n=[],r={};for(let[i,a]of Object.entries(e.fields)){if(a.type===`markdown`)continue;let e=Qy(a,i,t[i],n);e!==void 0&&(r[i]=e)}t.draft===!0&&(r[Iy]=!0);let i=Vg(e,r),a=t[Ry];if(Uy(a))for(let[t,n]of Object.entries(a))t!==`draft`&&!Object.hasOwn(e.fields,t)&&n!==void 0&&(i[t]=n);return{data:i,body:typeof t.__body==`string`?t[Ly]:``,issues:n}}function tb(e,t,n,r){let i=[...new Set([...r,...Object.keys(e.fields),Iy])].filter(e=>Object.hasOwn(t,e));return Og({data:t,body:n},i)}function nb(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>nb(e,t[n]));if(!Uy(e)||!Uy(t))return!1;let n=Object.keys(e).filter(t=>e[t]!==void 0),r=Object.keys(t).filter(e=>t[e]!==void 0);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&nb(e[n],t[n]))}var rb=e=>e.replace(/\r\n/g,`
|
|
237
|
+
`);function ib(e,t){return!nb(e.data,t.data)||rb(e.body)!==rb(t.body)}var ab={stale:!0},ob=e=>e==null?``:String(e);function sb(e){return typeof e==`object`&&!!e&&typeof e.src==`string`}function cb(e){switch(e.type){case`string`:return!e.list;case`select`:return!e.multiple;case`text`:case`url`:case`color`:case`datetime`:case`number`:return!0;default:return!1}}async function lb(e,t,n,r,i){if(!sb(r))return ab;let a=kn(e,t,r.src);if(a===null)return ab;let o=await i(a);if(o===null)return ab;let s=`${e.contentDir}/`,c=``;if(sb(n)){let r=kn(e,t,n.src);r!==null&&(c=r.slice(s.length))}let l={from:sb(n)?ob(n.alt):``,to:ob(r.alt)};return l.from===l.to?{image:{from:c,to:o}}:{image:{from:c,to:o,alt:l}}}async function ub(e,t,n,r,i,a){let o=e.collections[t],s=r??{data:{},body:``},c={},l=e=>e.replace(/\r\n/g,`
|
|
238
|
+
`);l(s.body)!==l(i.body)&&(c[Zd(o)??`body`]=ab);for(let[t,r]of Object.entries(o.fields)){if(r.type===`markdown`)continue;let o=s.data[t],l=i.data[t];nb(o,l)||(c[t]=cb(r)?{text:{from:ob(o),to:ob(l)}}:r.type===`image`?await lb(e,n,o,l,a):ab)}return c}function db(e,t){let n={};for(let t of Object.keys(e))n[t]={...e[t]};for(let[e,r]of Object.entries(t)){let t=n[e]??={};for(let[e,n]of Object.entries(r)){let r=t[e];t[e]=`text`in n&&r&&`text`in r?{text:{from:r.text.from,to:n.text.to}}:`image`in n&&r&&`image`in r?{image:{...n.image,from:r.image.from}}:n}}return n}function fb(e,t,n,r=Date.now()){return{v:1,branch:e,expiresAt:r+n*6e4,entries:t}}function pb(e,t){let i=e.parent!==e,a=null,o=n=>{if(n.source!==e.parent||!r(n.data))return;if(a===null){if(n.data.type!==`init`||n.origin!==e.location.origin)return;a=n.origin}else if(n.origin!==a)return;let i=n.data;i.type===`init`?t.onInit(i.route):i.type===`navigate`?t.onNavigate(i.route):t.onCloseRequest()};return i&&(e.addEventListener(`message`,o),e.parent.postMessage(n({type:`ready`}),`*`)),{embedded:i,connected:()=>a!==null,send(t){i&&a!==null&&e.parent.postMessage(n(t),a)},destroy(){i&&e.removeEventListener(`message`,o)}}}var mb=`branch:`;function hb(e){if(e===null||e===``)return{kind:`home`};if(e===`schema`)return{kind:`schema`};if(e===`media`)return{kind:`media`};if(e.startsWith(mb)){let t=e.slice(7);return t===``?{kind:`unknown`,raw:e}:{kind:`branch`,name:t}}let t=e.split(`/`);return t.some(e=>e===``)?{kind:`unknown`,raw:e}:t.length===1?{kind:`collection`,collection:t[0]}:t.length===2?{kind:`entry`,collection:t[0],slug:t[1]}:{kind:`unknown`,raw:e}}function gb(e){switch(e.kind){case`home`:return null;case`entry`:return{kind:`collection`,collection:e.collection};case`collection`:case`schema`:case`media`:case`branch`:case`unknown`:return{kind:`home`}}}function _b(e){switch(e.kind){case`home`:return``;case`collection`:return e.collection;case`entry`:return`${e.collection}/${e.slug}`;case`schema`:return`schema`;case`media`:return`media`;case`branch`:return`${mb}${e.name}`;case`unknown`:return e.raw}}var vb=3e3,yb=1e3;function bb(e){return e.current?.()??!0}var xb=(0,E.createContext)(null);function Sb(){let e=(0,E.useContext)(xb);if(!e)throw Error(`useRoute/useBridge must be used inside <BridgeProvider>`);return e}function Cb({children:e,win:t=window}){let n=t.parent!==t,[r,a]=(0,E.useState)(()=>i(t.location.href)??``),[o,c]=(0,E.useState)(n?`pending`:`standalone`),l=(0,E.useRef)(r),u=(0,E.useRef)(null),d=(0,E.useRef)(null),f=(0,E.useRef)(null),p=(0,E.useCallback)(e=>{let t=[f.current?.()??null,e?.()??null].filter(e=>e!==null);if(t.length===0)return d.current?.send({type:`close`});let n,r=new Promise(e=>n=setTimeout(e,yb)),i=Promise.all(t.map(e=>e.catch(()=>{})));Promise.race([i,r]).then(()=>{clearTimeout(n),d.current?.send({type:`close`})})},[]),m=(0,E.useCallback)(e=>{l.current=e,a(e),t.history.replaceState(t.history.state,``,s(t.location.href,e))},[t]);(0,E.useEffect)(()=>{let e=!1,n=e=>{bb(u)?m(e):r.send({type:`navigate`,route:l.current})},r=pb(t,{onInit(t){if(e)return n(t);e=!0,m(t),c(`connected`)},onNavigate:n,onCloseRequest(){bb(u)&&p()}});d.current=r;let i;return r.embedded&&(i=setTimeout(()=>{r.connected()||c(`disconnected`)},vb)),()=>{r.destroy(),d.current===r&&(d.current=null),clearTimeout(i)}},[t,m,p]);let h=(0,E.useCallback)(e=>{let t=typeof e==`string`?e:_b(e);t!==l.current&&bb(u)&&(m(t),d.current?.send({type:`navigate`,route:t}))},[m]),g=(0,E.useCallback)(e=>d.current?.send(e),[]),_=(0,E.useCallback)(e=>{d.current?.connected()&&bb(u)&&p(e?.exit)},[p]),v=(0,E.useCallback)(e=>{u.current=e},[]),y=(0,E.useCallback)(()=>bb(u),[]),b=(0,E.useCallback)(e=>{f.current=e},[]),x=(0,E.useMemo)(()=>({status:o,raw:r,navigate:h,send:g,close:_,setGuard:v,canLeave:y,setBeforeClose:b}),[o,r,h,g,_,v,y,b]);return(0,E.createElement)(xb.Provider,{value:x},e)}function wb(){let{raw:e,navigate:t}=Sb();return{route:(0,E.useMemo)(()=>hb(e),[e]),raw:e,navigate:t}}function Tb(){let{status:e,send:t,close:n,setGuard:r,canLeave:i,setBeforeClose:a}=Sb();return{status:e,send:t,close:n,setGuard:r,canLeave:i,setBeforeClose:a}}var Eb=()=>{},Db=(0,E.createContext)({setFormPreview:Eb,setBranchPreview:Eb,setRefreshSite:Eb,setNotice:Eb,refreshRef:{current:null}}),Ob=(0,E.createContext)(null);function kb({flag:e,sessionMinutes:t=60,children:n}){let r=(0,E.useRef)({branch:null,branchEntries:null,form:{}}),i=(0,E.useRef)({flag:e,sessionMinutes:t});i.current={flag:e,sessionMinutes:t};let a=(0,E.useRef)(void 0),o=(0,E.useRef)(Promise.resolve()),s=(0,E.useRef)(null),[c,l]=(0,E.useState)(null),u=(0,E.useCallback)(async()=>{let{branch:e,branchEntries:t,form:n}=r.current,{flag:a,sessionMinutes:o}=i.current,s=db(t??{},n),c=e??`local`;t===null?(a&&m(null),Object.keys(s).length>0?await p(fb(c,s,o)):await h(),g()):(await p(fb(c,s,o)),g(),a&&m(c))},[]),d=(0,E.useRef)(!0),f=(0,E.useCallback)(()=>{clearTimeout(a.current),d.current&&(a.current=setTimeout(()=>{o.current=o.current.then(u,u)},100))},[u]);(0,E.useEffect)(()=>(d.current=!0,f(),()=>{d.current=!1,clearTimeout(a.current)}),[f]);let{setBeforeClose:_}=Tb();(0,E.useEffect)(()=>(_(()=>Object.keys(r.current.form).length===0?null:(clearTimeout(a.current),r.current.form={},o.current=o.current.then(u,u),o.current)),()=>_(null)),[_,u]);let v=(0,E.useCallback)((e,t)=>{let n=r.current.form;if(t===null||Object.keys(t).length===0){if(!Object.hasOwn(n,e))return;let t={...n};delete t[e],r.current.form=t}else r.current.form={...n,[e]:t};f()},[f]),y=(0,E.useCallback)((e,t)=>{let n=r.current;(n.branch!==e||n.branchEntries!==null||t!==null)&&(r.current={...n,branch:e,branchEntries:t},f())},[f]),b=(0,E.useCallback)(e=>{s.current=e},[]),x=(0,E.useMemo)(()=>({setFormPreview:v,setBranchPreview:y,setRefreshSite:b,setNotice:l,refreshRef:s}),[v,y,b]);return(0,D.jsx)(Db.Provider,{value:x,children:(0,D.jsx)(Ob.Provider,{value:c,children:n})})}function Ab(){let{setFormPreview:e,setBranchPreview:t,setRefreshSite:n,setNotice:r}=(0,E.useContext)(Db);return(0,E.useMemo)(()=>({setFormPreview:e,setBranchPreview:t,setRefreshSite:n,setNotice:r}),[e,t,n,r])}function jb(){return(0,E.useContext)(Ob)}function Mb(){let{refreshRef:e}=(0,E.useContext)(Db),{send:t}=Tb();return(0,E.useCallback)(async()=>{if(e.current)return e.current();t({type:`refresh`})},[e,t])}var Nb=(...e)=>globalThis.fetch(...e),Pb=1e4;async function Fb({branch:e,sha:t,token:n,fetch:r=Nb}){try{return(await r(f,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},body:JSON.stringify({branch:e,sha:t}),signal:AbortSignal.timeout(Pb)})).status===204}catch{return!1}}async function Ib(e=Nb){try{await e(f,{method:`DELETE`,credentials:`same-origin`,signal:AbortSignal.timeout(Pb)})}catch{}}function Lb(e){return Lg(e.fields).filter(e=>e[1].type===`reference`).map(([e,t])=>[e.join(`.`),t])}function Rb(e,t){return Lb(e).some(([,e])=>e.collections.includes(t))}function zb(e,t){let n=[];return Fg(e.fields,t,(e,t,r)=>{if(e.type===`reference`)for(let e of Array.isArray(t)?t:[t])typeof e==`string`&&e!==``&&n.push({field:r.join(`.`),ref:e})}),n}function Bb(e,t,n,r){let i=!1,a=Ig(e.fields,t,(e,t)=>{if(e.type!==`reference`)return t;if(Array.isArray(t)){if(!t.includes(n))return t;if(i=!0,r!==null)return t.map(e=>e===n?r:e);let e=t.filter(e=>e!==n);return e.length>0?e:void 0}return t===n?(i=!0,r??void 0):t});return i?a:null}function Vb(e,t,n){let r=[];for(let i of t){if(!Object.hasOwn(e.collections,i.collection))continue;let t=zb(e.collections[i.collection],i.data).filter(e=>e.ref===n).map(e=>e.field);t.length>0&&r.push({entry:i,fields:[...new Set(t)]})}return r}function Hb(e,t){return e.startsWith(t)?e:`${t}${e}`}function Ub(e,t){return e.startsWith(t)?e.slice(t.length):e}function Wb(e,t){let n=e.trim().toLowerCase();return n.startsWith(t)&&(n=n.slice(t.length)),n.replace(/[\s_]+/g,`-`)}function Gb(e,t,n,r,i){let a=`${e}${Cn(r?t:`${t}-${n}`)||`edit`}`,o=new Set(i);if(!o.has(a))return a;let s=2;for(;o.has(`${a}-${s}`);)s++;return`${a}-${s}`}function Kb(){let e=Py();return(0,E.useCallback)((t,n=``)=>{let r=df(e?.style??rf(null),t)+n;return e?ff(r,`admin`):r},[e])}function qb(e,t){try{return`${window.location.origin}/?${e.param}=branch:${Ub(t,e.prefix)}`}catch{return null}}function Jb(e,t,n,r,i){return vf({login:i,changes:gf(n,r),reviewUrl:qb(e,t)})}async function Yb(e,t,n,r,i){if(e.getQueryData(wy)?.find(e=>e.name===n.branch)?.pullRequest)try{let e=await n.compare();await n.refreshPullRequestBody(Jb(t,n.branch,r,e.files,i))}catch{}}function Xb(){let e=Py(),t=_y(),n=ne();return(0,E.useCallback)((r,i)=>{if(!e||!t)return;let a=r;a.kind===`github`&&a.branch!==e.base&&Yb(n,e,a,i,t.login)},[e,t,n])}var Zb=3e5;function Qb(){let e=Py();return xt({queryKey:[`codeowners`,e?.config.owner,e?.config.repo,e?.base],queryFn:async()=>{let{owner:t,repo:n}=e.config,r=await H_(e.client,t,n,e.base);return r?z_(r.text):[]},enabled:e!==null,staleTime:Zb,retry:!1}).data??null}function $b({paths:e,rules:t}){let n=t?V_(t,e):[];return n.length===0?null:(0,D.jsxs)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,"data-testid":`approval-note`,children:[`Needs approval from `,n.join(`, `),` on GitHub.`]})}var ex=class extends Error{issues;constructor(e){super(e.map(e=>e.path?`${e.path}: ${e.message}`:e.message).join(`; `)),this.name=`IssuesError`,this.issues=e}},tx=2e3;function nx(){let e=by();return xt({queryKey:Cy(e),queryFn:()=>e.listFiles(),refetchInterval:e.kind===`local`&&tx})}var rx=`cms/schema.json`;function ix(e){return e.find(e=>e.path===`cms/schema.json`)??e.find(e=>e.path.endsWith(`schema.json`))}async function ax(e,t){let n=Eg(await e.readFile(t),t);if(`issue`in n)throw new bn([n.issue]);return n.text}function ox(e,t){return{queryKey:[`file`,t?.path??null,t?.sha??null],enabled:t!==void 0,staleTime:1/0,queryFn:async()=>{let{path:n,sha:r}=t,i=await ax(e,n),a;try{a=Dg(i)}catch(e){throw e instanceof bn?new bn(e.issues.map(e=>({...e,file:n}))):e}return{file:a,sha:r,keyOrder:Object.keys(a.data)}}}}var sx=new WeakMap;function cx(){let e=by(),t=ne(),n=nx(),r=n.data?ix(n.data):void 0,i=xt({queryKey:[`schema`,r?.sha??null],enabled:r!==void 0,staleTime:1/0,placeholderData:Ce,queryFn:async()=>{let{path:t}=r;return{schema:Xd(await ax(e,t),t),schemaPath:t}}});if(!n.data)return{data:void 0,error:n.error,isPending:!n.error,refreshError:null};let a=i.error;if(r||(a=new bn([{file:rx,path:``,message:`No schema.json found`}])),!a&&i.data)return i.isPlaceholderData||sx.set(t,i.data),{data:i.data,error:null,isPending:!1,refreshError:null};let o=sx.get(t);return a?o?{data:o,error:null,isPending:!1,refreshError:a}:{data:void 0,error:a,isPending:!1,refreshError:null}:{data:o,error:null,isPending:o===void 0,refreshError:null}}function lx(e){let t=by(),n=nx(),r=e===null?void 0:n.data?.find(t=>t.path===e),i=xt(ox(t,r));return e===null?{data:null,error:null,isPending:!1}:n.data?r?{data:i.data,error:i.data?null:i.error,isPending:i.isPending}:{data:null,error:null,isPending:!1}:{data:void 0,error:n.error,isPending:!n.error}}function ux(e,t,n){let r=[];for(let i of t){if(Dn(e,i.path))continue;let t=On(e,i.path);t?.collection===n&&r.push({...i,slug:t.slug})}return r}function dx(e){let t=by(),n=nx(),r=cx(),i=(0,E.useMemo)(()=>r.data&&n.data?ux(r.data.schema,n.data,e):[],[r.data,n.data,e]),a=yt({queries:i.map(e=>ox(t,e))}),o=(n.data?null:n.error)??r.error;if(o)return{data:void 0,error:o,isPending:!1};if(!r.data||!n.data||a.some(e=>e.isPending))return{data:void 0,error:null,isPending:!0};let s=r.data.schema.collections[e]?.titleField,c=i.map((e,t)=>{let n=a[t]?.data?.file.data,r=s===void 0?void 0:n?.[s],i=typeof r==`string`&&r.trim()!==``?r:e.slug;return{slug:e.slug,path:e.path,title:i,draft:n?.draft===!0}});return c.sort((e,t)=>e.title.localeCompare(t.title)||e.slug.localeCompare(t.slug)),{data:c,error:null,isPending:!1}}function fx(e){let t=by(),n=nx(),r=cx(),i=e.join(`\0`),a=(0,E.useMemo)(()=>{if(!r.data||!n.data)return[];let e=r.data.schema;return i.split(`\0`).filter(t=>t!==``&&Object.hasOwn(e.collections,t)).flatMap(t=>ux(e,n.data,t).map(e=>({...e,collection:t})))},[r.data,n.data,i]),o=yt({queries:a.map(e=>ox(t,e))}),s=r.data?.schema.collections,c=a.map((e,t)=>{let n=s?.[e.collection]?.titleField,r=n===void 0?void 0:o[t]?.data?.file.data[n],i=typeof r==`string`&&r.trim()!==``?r:e.slug;return{collection:e.collection,ref:`${e.collection}/${e.slug}`,title:i}}),l=new Map(a.map((e,t)=>[e.collection,t]));return c.sort((e,t)=>(l.get(e.collection)??0)-(l.get(t.collection)??0)||e.title.localeCompare(t.title)||e.ref.localeCompare(t.ref)),c.map(({ref:e,title:t})=>({ref:e,title:t}))}function px(e){let t=by(),n=nx(),r=cx(),i=e.slice(0,e.indexOf(`/`)),a=(0,E.useMemo)(()=>{if(!r.data||!n.data)return[];let e=r.data.schema;return Object.entries(e.collections).filter(([,e])=>Rb(e,i)).flatMap(([t])=>ux(e,n.data,t).map(e=>({...e,collection:t})))},[r.data,n.data,i]),o=yt({queries:a.map(e=>ox(t,e))}),s=(n.data?null:n.error)??r.error??o.find(e=>e.error)?.error??null;if(s)return{data:void 0,error:s,isPending:!1};if(!r.data||!n.data||o.some(e=>e.isPending))return{data:void 0,error:null,isPending:!0};let c=r.data.schema,l=Vb(c,a.map((e,t)=>{let{file:n,sha:r,keyOrder:i}=o[t].data;return{collection:e.collection,slug:e.slug,data:n.data,body:n.body,path:e.path,sha:r,keyOrder:i}}),e).map(({entry:e,fields:t})=>{let n=c.collections[e.collection]?.titleField,r=n===void 0?void 0:e.data[n],i=typeof r==`string`&&r.trim()!==``?r:e.slug;return{ref:`${e.collection}/${e.slug}`,title:i,fields:t,entry:e}});return l.sort((e,t)=>e.title.localeCompare(t.title)||e.ref.localeCompare(t.ref)),{data:l,error:null,isPending:!1}}function mx(e){return e.invalidateQueries({queryKey:Sy})}function hx(){let e=by(),t=Py(),n=ne(),r=cx().data?.schema??null,i=Xb();return Et({mutationFn:async({changes:n,message:r,newBranch:i})=>{if(i&&!t)throw Error(`A new branch needs the GitHub workspace`);let a=i?await t.createBranch(i,{keepScreen:!0}):e,{issues:o}=await a.commit(n,r);if(o.length>0)throw new ex(o);return a},onSuccess:e=>(i(e,r),mx(n))})}function gx({url:e,alt:t,className:n,openable:r}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`img`,{src:e,alt:t,className:n}),r?(0,D.jsx)(`a`,{className:Dv(Ov({variant:`outline`,size:`sm`,iconOnly:!0}),`editlet-ff-image__open`),href:e,target:`_blank`,rel:`noopener`,"aria-label":`Open image in a new window`,title:`Open image in a new window`,children:(0,D.jsx)($.ZoomIn,{size:20})}):null]})}var _x={webp:`image/webp`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,avif:`image/avif`,gif:`image/gif`,svg:`image/svg+xml`};function vx(e){return _x[e.split(`.`).pop()?.toLowerCase()??``]??`application/octet-stream`}function yx(e){let t=0,n=[];return async r=>{t>=e&&await new Promise(e=>n.push(e)),t++;try{return await r()}finally{t--,n.shift()?.()}}}var bx=yx(4);function xx(e){let t=by(),n=nx(),r=e===null?void 0:n.data?.find(t=>t.path===e),{data:i}=xt({queryKey:[`asset`,r?.path??null,r?.sha??null],enabled:r!==void 0,staleTime:1/0,queryFn:async()=>{let e=await bx(()=>t.readFile(r.path));return new Blob([e],{type:vx(r.path)})}});return r?i:void 0}function Sx(e){let[t,n]=(0,E.useState)(null);return(0,E.useEffect)(()=>{if(!e||typeof URL.createObjectURL!=`function`){n(null);return}let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),t}function Cx(e){return Sx(xx(e))}var wx=e=>e!==null&&vx(e)!==`image/svg+xml`;function Tx({path:e,alt:t,className:n,openable:r}){let i=Cx(e);return i?(0,E.createElement)(gx,{url:i,alt:t,className:n,openable:r&&wx(e)}):(0,E.createElement)(`div`,{className:Dv(`editlet-ff-image__empty`,n),role:`img`,"aria-label":t||`No image`},(0,E.createElement)($.Image,{size:16}))}function Ex(e,t){let n=Eg(e,t);if(`issue`in n)return null;try{return Dg(n.text)}catch{return null}}async function Dx(e,t){let n=await e.compare(),r=async t=>{try{let n=await e.readFile(t);return new Blob([n],{type:vx(t)})}catch{return null}},i={};return await Promise.all(n.files.map(async n=>{let a=On(t,n.path);if(!a||n.sha===null)return;let[o,s]=await Promise.all([n.baseSha===null?null:e.readBlob(n.baseSha).then(e=>Ex(e,n.path)),e.readBlob(n.sha).then(e=>Ex(e,n.path))]);if(!s)return;let c=await ub(t,a.collection,n.path,o,s,r);Object.keys(c).length>0&&(i[`${a.collection}/${a.slug}`]=c)})),i}var Ox=`Preview could not update; the page shows the last saved state`,kx=Promise.resolve();function Ax(e){let t=kx.then(e,e);return kx=t.catch(()=>void 0),t}function jx({preview:e=!1,fetch:t}={}){let n=Py(),{session:r,getToken:i}=Tv(),{setBranchPreview:a,setRefreshSite:o,setNotice:s}=Ab(),{send:c}=Tb(),l=nx(),u=cx().data?.schema,d=n?.active??null,f=n?.source,p=n!==null&&!n.onBase&&r!==null,g=xt({queryKey:[`preview`,d,`head`,l.dataUpdatedAt],queryFn:()=>f.head(),enabled:p&&l.data!==void 0,placeholderData:(e,t)=>t?.queryKey[1]===d?e:void 0}).data,_=xt({queryKey:[`preview`,d,g],queryFn:()=>Dx(f,u),enabled:p&&g!==void 0&&u!==void 0,staleTime:1/0,placeholderData:(e,t)=>t?.queryKey[1]===d?e:void 0});(0,E.useEffect)(()=>{d!==null&&(p?(a(d,_.data??{}),m(d)):(a(d,null),m(null),h()))},[d,p,_.data,a]),(0,E.useEffect)(()=>{if(d!==null)return()=>{a(d,null),m(null),h()}},[d,a]);let v=(0,E.useRef)(null),y=(0,E.useRef)({branch:d,source:f,live:p});y.current={branch:d,source:f,live:p};let b=(0,E.useCallback)((e,n)=>{let r=`${e}@${n}`,a=v.current;if(a===`deleted`&&!y.current.live)return Promise.resolve(!1);if(a!==null&&a!==`deleted`&&a.key===r)return a.done;let o=Ax(async()=>{try{return await Fb({branch:e,sha:n,token:await i(),fetch:t})}catch{return!1}}).then(e=>{let t=v.current;return t!==null&&t!==`deleted`&&t.key===r&&(e||(v.current=null),s(e?null:Ox)),e});return v.current={key:r,done:o},o},[i,t,s]),x=(0,E.useCallback)(()=>{v.current!==`deleted`&&(v.current=`deleted`,s(null),Ax(()=>Ib(t)))},[t,s]);(0,E.useEffect)(()=>{e&&d!==null&&(p?g!==void 0&&b(d,g):x())},[e,d,p,g,b,x]);let S=(0,E.useRef)(null);return S.current=e?x:null,(0,E.useEffect)(()=>()=>S.current?.(),[]),(0,E.useEffect)(()=>{if(e)return o(async()=>{let e=y.current;if(e.live&&e.branch!==null&&e.source){let t;try{let n=await e.source.head(),r=y.current;t=r.live&&r.branch===e.branch?await b(e.branch,n):null}catch{t=!1}t===!1&&s(Ox)}c({type:`refresh`})}),()=>o(null)},[e,b,c,o,s]),null}function Mx({title:e,text:t,children:n}){return(0,D.jsx)(`div`,{className:`editlet-layout__sign-in`,children:(0,D.jsxs)(`div`,{className:`editlet-layout__sign-in-inner`,children:[(0,D.jsx)(`h1`,{className:`editlet-layout__sign-in-title`,children:e}),(0,D.jsx)(`p`,{className:`editlet-layout__sign-in-subtitle`,children:t}),n?(0,D.jsx)(`div`,{className:`editlet-unavailable__actions`,children:n}):null]})})}function Nx(e){return e==null?``:typeof e==`string`?e:typeof e==`object`?Sg(e,{lineWidth:0}).replace(/\n$/,``):String(e)}function Px(e,t,n){let r=t??{data:{},body:``},i=[],a=(e,t,n,r,a)=>{nb(r,a)||i.push({key:e,label:t,type:n,before:Nx(r),after:Nx(a)})};for(let[t,i]of Object.entries(e.fields))i.type===`markdown`?a(t,i.label,`markdown`,r.body,n.body):a(t,i.label,i.type,r.data[t],n.data[t]);Zd(e)===void 0&&a(`__body`,`Body`,`markdown`,r.body,n.body);let o=new Set([...Object.keys(r.data),...Object.keys(n.data)].filter(t=>t!==`draft`&&!Object.hasOwn(e.fields,t)));for(let e of[...o].toSorted())a(e,e,`unknown`,r.data[e],n.data[e]);return a(`draft`,`Draft`,`boolean`,r.data.draft,n.data.draft),i}function Fx(e,t){if(e===null)return``;let n=Eg(e,t);return`text`in n?n.text:void 0}function Ix(e,t){if(e===null)return null;try{return Dg(t)}catch(e){if(e instanceof bn)return;throw e}}function Lx(e,t,n,r,i){if(Pn(t)&&!t.toLowerCase().endsWith(`.svg`))return{kind:`binary`,path:t,status:n,image:!0};let a=Fx(r,t),o=Fx(i,t);if(a===void 0||o===void 0)return{kind:`binary`,path:t,status:n,image:Pn(t)};let s=On(e,t);if(s){let c=Ix(r,a),l=Ix(i,o);if(c!==void 0&&l!==void 0){let r=Px(e.collections[s.collection],c,l??{data:{},body:``});return{kind:`entry`,path:t,status:n,ref:jn(s.collection,s.slug),rows:r}}}return{kind:`text`,path:t,status:n,before:a,after:o}}var Rx=1e4,zx=`No preview yet. The build may still be starting, or the host doesn't report deployments to GitHub. Review the diff below.`;function Bx(e,t){return e===null?`none`:e.state===`failure`||e.state===`error`?`failed`:e.state===`success`&&e.sha===t?`ready`:`building`}function Vx(e,t,n){return xt({queryKey:[`deployment`,t],queryFn:()=>e.latestDeployment(t),refetchInterval:e=>{let t=e.state.data===void 0?`none`:Bx(e.state.data,n);return t===`ready`||t===`failed`?!1:Rx}})}function Hx(e){if(!e)return null;try{let{protocol:t}=new URL(e);return t===`https:`||t===`http:`?e:null}catch{return null}}function Ux({href:e,children:t}){return(0,D.jsx)(`a`,{className:`editlet-link editlet-deploy-status__link`,href:e,target:`_blank`,rel:`noreferrer`,children:t})}function Wx({deployment:e,expectSha:t,previewRoute:n,param:r}){let i,a=null;if(e===void 0)i=`Checking deployments…`;else{let o=Hx(e?.url),c=Hx(e?.logUrl);switch(Bx(e,t)){case`none`:i=zx;break;case`failed`:i=`Preview build failed`,c&&(a=(0,D.jsx)(Ux,{href:c,children:`Build log`}));break;case`ready`:i=`Preview ready`,o&&(a=(0,D.jsx)(Ux,{href:s(o,n,r),children:`Open preview`}));break;case`building`:i=`Build in progress`,o&&(a=(0,D.jsx)(Ux,{href:s(o,n,r),children:`Older preview`}))}}return(0,D.jsxs)(`section`,{className:`editlet-card editlet-deploy-status`,"aria-label":`Preview`,children:[(0,D.jsx)(`div`,{className:`editlet-card__header`,children:(0,D.jsx)(`h2`,{className:`editlet-card__title`,children:`Preview`})}),(0,D.jsxs)(`div`,{className:`editlet-card__content editlet-deploy-status__body`,"aria-live":`polite`,children:[(0,D.jsx)(`span`,{children:i}),a]})]})}var Gx=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Gx{};function Kx(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function qx(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Jx(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Yx(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Xx(e,t){return Jx(e,t,``)}function Zx(e,t){return Yx(e,t,``)}function Qx(e,t){return t.slice(0,$x(e,t))}function $x(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function eS(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function tS(e,t){if(t)return rS(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function nS(e,t){if(t)return rS(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function rS(e,t){if(!t)return[nS(e),tS(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=eS(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var iS=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,aS=RegExp(`[${iS}]+|\\s+|[^${iS}]`,`ug`);new class extends Gx{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=eS(e,r)}else n=e.match(aS)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&oS(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&oS(n,i,r,null,t.intlSegmenter),e}};function oS(e,t,n,r,i){if(t&&n){let[a,o]=rS(t.value,i),[s,c]=rS(n.value,i);if(e){let r=Kx(a,s);e.value=Yx(e.value,s,r),t.value=Xx(t.value,r),n.value=Xx(n.value,r)}if(r){let e=qx(o,c);r.value=Jx(r.value,c,e),t.value=Zx(t.value,e),n.value=Zx(n.value,e)}}else if(n){if(e){let e=nS(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=nS(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=nS(r.value,i),[a,o]=rS(t.value,i),s=Kx(n,a);t.value=Xx(t.value,s);let c=qx(Xx(n,s),o);t.value=Zx(t.value,c),r.value=Jx(r.value,n,c),e.value=Yx(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=nS(r.value,i),n=Qx(tS(t.value,i),e);t.value=Zx(t.value,n)}else if(e){let n=Qx(tS(e.value,i),nS(t.value,i));t.value=Xx(t.value,n)}}new class extends Gx{tokenize(e){let t=RegExp(`(\\r?\\n)|[${iS}]+|[^\\S\\n\\r]+|[^${iS}]`,`ug`);return e.match(t)||[]}};var sS=new class extends Gx{constructor(){super(...arguments),this.tokenize=lS}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
|
|
239
|
+
`)||(e=e.trim()),n.newlineIsToken&&t.includes(`
|
|
240
|
+
`)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
241
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
242
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function cS(e,t,n){return sS.diff(e,t,n)}function lS(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
243
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function uS(e){return e==`.`||e==`!`||e==`?`}new class extends Gx{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(uS(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Gx{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Gx{constructor(){super(...arguments),this.tokenize=lS}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(dS(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function dS(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=dS(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=dS(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Gx{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function fS({before:e,after:t,showLineNumbers:n=!1,className:r}){let i=(0,E.useMemo)(()=>pS(e,t),[e,t]);return i.length===0?(0,D.jsx)(`div`,{className:`editlet-diff-hunk__lines editlet-diff-hunk__lines--empty${r?` ${r}`:``}`,children:`No content`}):(0,D.jsx)(`div`,{className:`editlet-diff-hunk__lines${r?` ${r}`:``}`,children:i.map((e,t)=>(0,D.jsxs)(`div`,{className:`editlet-diff-hunk__line editlet-diff-hunk__line--${e.kind}`,children:[n&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`editlet-diff-hunk__line-num`,children:e.beforeNum??``}),(0,D.jsx)(`span`,{className:`editlet-diff-hunk__line-num`,children:e.afterNum??``})]}),(0,D.jsx)(`span`,{className:`editlet-diff-hunk__line-sign`,children:e.kind===`add`?`+`:e.kind===`del`?`−`:` `}),(0,D.jsx)(`span`,{className:`editlet-diff-hunk__line-text`,children:e.text===``?`\xA0`:e.text})]},t))})}function pS(e,t){if(e===t)return e.split(`
|
|
244
|
+
`).map((e,t)=>({kind:`ctx`,text:e,beforeNum:t+1,afterNum:t+1}));let n=cS(e,t,{newlineIsToken:!1}),r=[],i=1,a=1;for(let e of n){let t=e.value.split(`
|
|
245
|
+
`);if(t.length>0&&t[t.length-1]===``&&t.pop(),e.added)for(let e of t)r.push({kind:`add`,text:e,beforeNum:null,afterNum:a}),a++;else if(e.removed)for(let e of t)r.push({kind:`del`,text:e,beforeNum:i,afterNum:null}),i++;else for(let e of t)r.push({kind:`ctx`,text:e,beforeNum:i,afterNum:a}),i++,a++}return r}function mS({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i,onConfirm:a,pending:o,confirmDisabled:s,children:c}){return(0,D.jsx)(ey,{open:e,onOpenChange:t,children:(0,D.jsxs)(ty,{role:`alertdialog`,children:[(0,D.jsxs)(ny,{children:[(0,D.jsx)(iy,{children:n}),(0,D.jsx)(ay,{children:r})]}),c,(0,D.jsxs)(ry,{children:[(0,D.jsx)(Z,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,D.jsx)(Z,{variant:`destructive`,disabled:s||o,onClick:()=>{o===void 0&&t(!1),a()},children:i})]})]})})}var hS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:Dv(`editlet-card`,e),...t}));hS.displayName=`Card`;var gS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:Dv(`editlet-card__header`,e),...t}));gS.displayName=`CardHeader`;var _S=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsx)(`h3`,{ref:r,className:Dv(`editlet-card__title`,e),...n,children:t}));_S.displayName=`CardTitle`;var vS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:Dv(`editlet-card__content`,e),...t}));vS.displayName=`CardContent`;function yS({draft:e,showPublished:t,size:n=`md`,className:r}){if(!e&&!t)return null;let i=e?`draft`:`published`;return(0,D.jsxs)(`span`,{className:Dv(`editlet-chip editlet-chip--status`,`editlet-chip--status-${n}`,`editlet-chip--${i}`,r),title:e?`Not live on the site`:`Live on the site`,children:[(0,D.jsx)(`span`,{className:`editlet-chip__status-dot`}),e?`Draft`:`Published`]})}function bS(e){return t=>{let n=t.currentTarget,r=Array.from(n.querySelectorAll(`[role="tab"]:not([disabled])`));if(r.length===0){e?.(t);return}let i=r.findIndex(e=>e===document.activeElement),a=i;if(t.key===`ArrowRight`)t.preventDefault(),a=(i+1)%r.length;else if(t.key===`ArrowLeft`)t.preventDefault(),a=(i-1+r.length)%r.length;else if(t.key===`Home`)t.preventDefault(),a=0;else if(t.key===`End`)t.preventDefault(),a=r.length-1;else{e?.(t);return}let o=r[a];o&&(o.focus(),o.click()),e?.(t)}}var xS=E.forwardRef(({className:e,onKeyDown:t,children:n,...r},i)=>{let a=bS(t);return(0,D.jsx)(`div`,{ref:i,role:`tablist`,className:Dv(`editlet-switcher`,e),onKeyDown:a,...r,children:E.Children.toArray(n)})});xS.displayName=`Switcher`;var SS=E.forwardRef(({className:e,active:t=!1,icon:n=!1,disabled:r,type:i=`button`,...a},o)=>(0,D.jsx)(`button`,{ref:o,type:i,role:`tab`,"aria-selected":t,"data-state":t?`active`:`inactive`,disabled:r,...r?{"data-disabled":``}:{},className:Dv(`editlet-switcher__item`,n&&`editlet-switcher__item--icon`,e),...a}));SS.displayName=`SwitcherItem`;var CS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{className:`editlet-table__wrapper`,children:(0,D.jsx)(`table`,{ref:n,className:Dv(`editlet-table`,e),...t})}));CS.displayName=`Table`;var wS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`thead`,{ref:n,className:Dv(`editlet-table__head`,e),...t}));wS.displayName=`TableHeader`;var TS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`tbody`,{ref:n,className:Dv(`editlet-table__body`,e),...t}));TS.displayName=`TableBody`;var ES=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`tfoot`,{ref:n,className:Dv(`editlet-table__foot`,e),...t}));ES.displayName=`TableFooter`;var DS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`tr`,{ref:n,className:Dv(`editlet-table__row`,e),...t}));DS.displayName=`TableRow`;var OS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`th`,{ref:n,className:Dv(`editlet-table__header`,e),...t}));OS.displayName=`TableHead`;var kS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`td`,{ref:n,className:Dv(`editlet-table__cell`,e),...t}));kS.displayName=`TableCell`;var AS=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`caption`,{ref:n,className:Dv(`editlet-table__caption`,e),...t}));AS.displayName=`TableCaption`;function jS({rows:e}){return(0,D.jsx)(D.Fragment,{children:e.map(e=>(0,D.jsxs)(`section`,{className:`editlet-diff-hunk`,"aria-label":e.label,children:[(0,D.jsxs)(`div`,{className:`editlet-diff-hunk__header`,children:[(0,D.jsx)(`span`,{className:`editlet-diff-hunk__header-label`,children:e.label}),(0,D.jsx)(`span`,{className:`editlet-diff-hunk__header-format`,children:e.type}),(0,D.jsx)(`span`,{className:`editlet-diff-hunk__header-spacer`}),(0,D.jsx)(`code`,{className:`editlet-diff-hunk__header-key`,children:e.key})]}),(0,D.jsx)(`div`,{className:`editlet-diff-hunk__body`,children:(0,D.jsx)(fS,{before:e.before,after:e.after,showLineNumbers:e.type===`markdown`})})]},e.key))})}function MS({open:e,onOpenChange:t,rows:n,newFiles:r,confirmLabel:i=`Save`,busy:a,confirmDisabled:o,children:s,onConfirm:c}){return(0,D.jsx)(ey,{open:e,onOpenChange:t,children:(0,D.jsxs)(ty,{className:`editlet-review-dialog`,children:[(0,D.jsxs)(ny,{children:[(0,D.jsx)(iy,{children:`Review changes`}),(0,D.jsx)(ay,{children:n.length===0&&r.length===0?`No changes.`:`These changes are saved in one commit.`})]}),(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-3 editlet-review-dialog__body`,children:[(0,D.jsx)(jS,{rows:n}),r.length>0?(0,D.jsxs)(`section`,{className:`editlet-diff-hunk`,"aria-label":`New files`,children:[(0,D.jsx)(`div`,{className:`editlet-diff-hunk__header`,children:(0,D.jsx)(`span`,{className:`editlet-diff-hunk__header-label`,children:`New files`})}),(0,D.jsx)(`ul`,{className:`editlet-diff-hunk__body editlet-review-dialog__files`,children:r.map(e=>(0,D.jsxs)(`li`,{className:`editlet-u-mono editlet-u-text-xs`,children:[`+ `,e]},e))})]}):null]}),s,(0,D.jsxs)(ry,{children:[(0,D.jsx)(Z,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,D.jsx)(Z,{variant:`primary`,disabled:a||o,onClick:c,children:i})]})]})})}function NS({title:e,children:t}){return(0,D.jsxs)(`div`,{className:`editlet-page-top`,children:[(0,D.jsx)(`div`,{className:`editlet-page-top__title-area`,children:(0,D.jsx)(`div`,{className:`editlet-page-top__title-row`,children:(0,D.jsx)(`h1`,{className:`editlet-page-top__title`,children:e})})}),t?(0,D.jsx)(`div`,{className:`editlet-page-top__right`,children:t}):null]})}function PS({title:e,text:t}){return(0,D.jsxs)(`section`,{className:`editlet-screen`,children:[(0,D.jsx)(NS,{title:e}),(0,D.jsx)(`div`,{className:`editlet-card editlet-card--empty`,children:(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,children:t})})]})}var FS={added:`Added`,modified:`Modified`,removed:`Removed`,renamed:`Renamed`},IS={added:`added`,modified:`changed`,removed:`removed`},LS=(e,t)=>`${e} ${t}${e===1?``:`s`}`;async function RS(e,t){let n=ix(await e.listFiles());if(!n)throw new bn([{file:t,path:``,message:`No schema.json found`}]);let r=Eg(await e.readFile(n.path),n.path);if(`issue`in r)throw new bn([r.issue]);let i=Xd(r.text,n.path),a=await e.compare();return{diff:a,files:await Promise.all(a.files.map(async t=>{let[n,r]=await Promise.all([t.baseSha===null?null:e.readBlob(t.baseSha),t.sha===null?null:e.readBlob(t.sha)]);return Lx(i,t.path,t.status,n,r)})),schema:i}}async function zS(e,t,n){let r=e.sourceFor(n);await t.prefetchQuery({queryKey:Cy(r),queryFn:()=>r.listFiles()}),e.switchTo(n,{keepScreen:!0})}function BS({src:e,pullRequest:t}){let n=xt({queryKey:[`pull-request-review`,e.branch,t.number],queryFn:()=>e.pullRequestReview(t.number),retry:!1});if(t.isDraft)return(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:`Code owners are asked to review when the pull request is ready for review.`});let r=n.data;if(!r)return null;let i=[];return r.approvedBy.length>0&&i.push(`Approved by ${r.approvedBy.map(e=>`@${e}`).join(`, `)}`),r.changesRequestedBy.length>0&&i.push(`Changes requested by ${r.changesRequestedBy.map(e=>`@${e}`).join(`, `)}`),r.requested.length>0&&i.push(`Waiting for ${r.requested.join(`, `)}`),i.length===0&&r.decision===`REVIEW_REQUIRED`&&i.push(`Review required`),i.length===0?null:(0,D.jsx)(`p`,{className:`editlet-u-text-sm`,"data-testid":`reviewers`,children:i.join(` · `)})}function VS({src:e,pullRequest:t}){return(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-1`,children:[(0,D.jsxs)(`div`,{className:`editlet-u-row editlet-u-gap-2`,children:[(0,D.jsxs)(`a`,{className:`editlet-link editlet-branch-screen__pr`,href:t.url,target:`_blank`,rel:`noreferrer`,children:[`Pull request #`,t.number]}),(0,D.jsx)(yS,{draft:t.isDraft,size:`sm`})]}),(0,D.jsx)(BS,{src:e,pullRequest:t}),(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:`A developer merges it on GitHub.`})]})}function HS({status:e}){return(0,D.jsx)(`span`,{className:`editlet-file-status editlet-file-status--${e}`,children:FS[e]})}function US({file:e}){let t;return t=e.kind===`entry`?e.rows.length===0?(0,D.jsx)(`p`,{className:`editlet-u-text-muted editlet-u-text-sm`,children:`No field changes`}):(0,D.jsx)(`div`,{className:`editlet-u-stack editlet-u-gap-3`,children:(0,D.jsx)(jS,{rows:e.rows})}):e.kind===`text`?(0,D.jsx)(fS,{before:e.before,after:e.after,showLineNumbers:!0}):(0,D.jsxs)(`p`,{className:`editlet-u-text-muted editlet-u-text-sm`,children:[e.image?`Image`:`Binary file`,` `,IS[e.status]]}),(0,D.jsxs)(`section`,{className:`editlet-branch-file`,"aria-label":e.path,children:[(0,D.jsxs)(`div`,{className:`editlet-branch-file__header`,children:[(0,D.jsx)(`code`,{className:`editlet-branch-file__path`,children:e.path}),(0,D.jsx)(HS,{status:e.status})]}),(0,D.jsx)(`div`,{className:`editlet-branch-file__body`,children:t})]})}function WS({src:e,branch:t,headOid:n,prefix:r,param:i}){let a=Vx(e,t,n);return(0,D.jsx)(Wx,{deployment:a.data,expectSha:n,previewRoute:`branch:${Ub(t,r)}`,param:i})}function GS({diff:e,rules:t}){let n=[...e.files.map(e=>e.path),...e.otherFiles.map(e=>e.path)];return(0,D.jsx)($b,{paths:n,rules:t})}function KS({diff:e,collapsed:t}){if(e.otherFiles.length===0&&e.complete)return null;let n=`Other files this merge brings in`,r=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:`Merging the pull request brings these in too.`}),e.complete?null:(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:`GitHub listed only the first 300 files.`}),(0,D.jsx)(`ul`,{className:`editlet-branch-screen__other`,"aria-label":`Other files`,children:e.otherFiles.map(e=>(0,D.jsxs)(`li`,{className:`editlet-branch-screen__other-item`,children:[(0,D.jsx)(`code`,{className:`editlet-branch-file__path`,children:e.path}),(0,D.jsx)(HS,{status:e.status})]},e.path))})]});return t?(0,D.jsxs)(`details`,{className:`editlet-u-stack editlet-u-gap-2 editlet-branch-screen__other-details`,children:[(0,D.jsxs)(`summary`,{className:`editlet-branch-screen__heading`,children:[n,` (`,e.otherFiles.length,`)`]}),r]}):(0,D.jsxs)(`section`,{className:`editlet-u-stack editlet-u-gap-2`,"aria-labelledby":`editlet-branch-other`,children:[(0,D.jsx)(`h2`,{id:`editlet-branch-other`,className:`editlet-branch-screen__heading`,children:n}),r]})}function qS(e){return e.files.length>0||e.otherFiles.length>0||e.aheadBy>0}function JS(e,t){let n=[];return(e.status===`behind`||e.status===`diverged`)&&n.push(`${t} has ${LS(e.behindBy,`newer commit`)}.`),qS(e)||n.push(`No changes on this branch yet.`),n}function YS({workspace:e,branch:t}){let n=ne(),{canLeave:r}=Tb(),i=e.sourceFor(t),a=`${e.config.owner}/${e.config.repo}`,[o,s]=(0,E.useState)(null),[c,l]=(0,E.useState)(null),[u,d]=(0,E.useState)(null),f=_y(),p=Qb(),m=cx().data?.schemaPath??`cms/schema.json`,h=xt({queryKey:[`branch-diff`,t],queryFn:()=>RS(i,m)}),g=xt({queryKey:[`pull-request`,t],queryFn:()=>i.pullRequest()}),_=async(e,t)=>{s(e),l(null);try{await t()}catch(e){l(J_(e,{repo:a}))}finally{s(null)}},v=r=>_(`create`,async()=>{let a=f?.login??``,{style:o}=e,s=await i.openPullRequest({title:mf(o,{branch:t,login:a}),body:Jb(e,t,r.schema,r.diff.files,a),draft:o.pullRequest.draft,labels:o.pullRequest.labels});d(s.labelError?`Labels weren't added: ${s.labelError}`:null),n.setQueryData([`pull-request`,t],s),n.invalidateQueries({queryKey:[`pull-request`,t]}),n.invalidateQueries({queryKey:wy})}),y=()=>{r()&&_(`edit`,()=>zS(e,n,t))},b=(0,D.jsx)(NS,{title:t}),x=h.data,S=h.error instanceof F&&h.error.code===`not_found`;if(!x||S)return(0,D.jsxs)(`section`,{className:`editlet-screen editlet-branch-screen`,children:[b,h.error?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-card--banner-danger`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:S?`Branch ${t} doesn't exist. It may have been merged or deleted.`:J_(h.error,{repo:a})})]}):(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`})]});let{diff:C,files:w}=x,T=g.data;return(0,D.jsxs)(`section`,{className:`editlet-screen editlet-branch-screen`,children:[(0,D.jsx)(NS,{title:t,children:e.active===t?null:(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.GitBranch,{}),disabled:o!==null,onClick:y,children:`Edit on this branch`})}),h.error?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-card--banner-danger`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:J_(h.error,{repo:a})})]}):null,g.error?(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-danger`,children:J_(g.error,{repo:a})}):null,(0,D.jsx)(WS,{src:i,branch:t,headOid:C.headOid,prefix:e.prefix,param:e.param}),T?(0,D.jsx)(VS,{src:i,pullRequest:T}):T===null?(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-1`,children:[(0,D.jsx)(`div`,{className:`editlet-u-row editlet-u-gap-2`,children:(0,D.jsx)(Z,{variant:`primary`,disabled:!qS(C)||o!==null,onClick:()=>void v(x),children:o===`create`?`Creating…`:`Create pull request`})}),(0,D.jsx)(GS,{diff:C,rules:p})]}):null,u?(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:u}):null,c?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-card--banner-danger`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:c})]}):null,JS(C,e.base).map(e=>(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:e},e)),(0,D.jsxs)(`section`,{className:`editlet-u-stack editlet-u-gap-3`,"aria-labelledby":`editlet-branch-changes`,children:[(0,D.jsx)(`h2`,{id:`editlet-branch-changes`,className:`editlet-branch-screen__heading`,children:`Changes`}),w.length===0?(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:`No content files changed.`}):null,w.map(e=>(0,D.jsx)(US,{file:e},e.path))]}),(0,D.jsx)(KS,{diff:C,collapsed:f?.role===`editor`})]})}function XS({name:e}){let t=Py(),n=t?.prefix??``,r=Hb(e,n);return!t||!af(r,n)||r===t.base?(0,D.jsx)(PS,{title:`Not a CMS branch`,text:`${r} is not a branch the CMS edits.`}):(0,D.jsx)(YS,{workspace:t,branch:r},r)}var ZS=`http://www.w3.org/2000/svg`,QS=new Set([`script`,`foreignobject`,`iframe`,`embed`,`object`,`handler`,`listener`]),$S=new Set([`set`,`animate`,`animatemotion`,`animatetransform`]),eC=e=>{let t=e.trim().toLowerCase();return t.startsWith(`#`)||/^data:image\/(png|jpe?g|gif|webp|avif);/.test(t)&&!t.includes(`svg`)};function tC(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`),n=t.documentElement;if(t.getElementsByTagName(`parsererror`).length>0||n.localName!==`svg`||n.namespaceURI!==ZS)throw Error(`Not a valid SVG file`);let r=!1;for(let e of[n,...Array.from(n.getElementsByTagName(`*`))]){if(!e.isConnected)continue;let t=e.localName.toLowerCase(),n=e.getAttribute(`attributeName`)?.toLowerCase()??``;if(QS.has(t)||$S.has(t)&&(n.endsWith(`href`)||n.startsWith(`on`)))e.remove(),r=!0;else for(let t of Array.from(e.attributes)){let n=t.localName.toLowerCase();(n.startsWith(`on`)||n===`href`&&!eC(t.value))&&(e.removeAttributeNode(t),r=!0)}}return r?new XMLSerializer().serializeToString(t):e}function nC(e){let t=[],n=e.split(`
|
|
246
|
+
`),r=0,i=null,a=null,o=!0;for(let e of n){let n=r+e.length,s=e.trim()===``;if(i){let r=/^ {0,3}(`{3,}|~{3,})\s*$/.exec(e);r&&r[1][0]===i.char&&r[1].length>=i.length&&(t.push([i.start,n]),i=null)}else{let n=/^ {0,3}(`{3,}|~{3,})/.exec(e),c=/^(?: {4}|\t)/.test(e)&&!s;a!==null&&!c&&!s&&(t.push([a,r]),a=null),n&&a===null?i={char:n[1][0],length:n[1].length,start:r}:c&&a===null&&o&&(a=r)}o=s,r=n+1}i&&t.push([i.start,e.length]),a!==null&&t.push([a,e.length]);let s=e=>t.some(([t,n])=>e>=t&&e<n),c=[],l=/(`+)|<!--/g,u;for(;u=l.exec(e);){if(s(u.index))continue;if(u[0]===`<!--`){let t=e.indexOf(`-->`,u.index+4),n=t===-1?e.length:t+3;c.push([u.index,n]),l.lastIndex=n;continue}let t=u[1],n=RegExp(`(?<!\`)${t}(?!\`)`,`g`);n.lastIndex=u.index+t.length;let r=n.exec(e);r&&(c.push([u.index,r.index+t.length]),l.lastIndex=r.index+t.length)}return[...t,...c]}function rC(e){let t=e;for(let[n,r]of nC(e))t=t.slice(0,n)+t.slice(n,r).replace(/[^\n]/g,` `)+t.slice(r);return t}var iC=(e,t)=>{let n=0;for(;t-1-n>=0&&e[t-1-n]===`\\`;)n++;return n%2==1},aC=e=>e.replace(/\\([!-/:-@[-`{-~])/g,`$1`),oC=e=>e.replace(/&(quot|amp|lt|gt|#39|apos);/g,(e,t)=>t===`quot`?`"`:t===`amp`?`&`:t===`lt`?`<`:t===`gt`?`>`:`'`),sC=e=>e.trim().replace(/\s+/g,` `).toLowerCase();function cC(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`
|
|
247
|
+
`&&e[r+1]===`
|
|
248
|
+
`)return-1;if(!iC(e,r)){if(t===`[`)n++;else if(t===`]`&&--n===0)return r}}return-1}function lC(e,t){let n=t+1;for(;e[n]===` `||e[n]===` `||e[n]===`
|
|
249
|
+
`;)n++;let r=n,i;if(e[n]===`<`){let t=e.indexOf(`>`,n);if(t===-1||e.slice(n,t).includes(`
|
|
250
|
+
`))return null;r=n+1,i=t,n=t+1}else{let t=0;for(;n<e.length&&!/\s/.test(e[n]);){if(e[n]===`(`&&!iC(e,n))t++;else if(e[n]===`)`&&!iC(e,n)){if(t===0)break;t--}n++}i=n}for(;e[n]===` `||e[n]===` `||e[n]===`
|
|
251
|
+
`;)n++;let a=e[n];if(a===`"`||a===`'`||a===`(`){let t=a===`(`?`)`:a,r=n+1;for(;r<e.length&&(e[r]!==t||iC(e,r));)r++;if(r>=e.length)return null;for(n=r+1;e[n]===` `||e[n]===` `||e[n]===`
|
|
252
|
+
`;)n++}return e[n]===`)`?{range:[r,i],src:aC(e.slice(r,i)),end:n+1}:null}function uC(e){let t=new Map,n=/^ {0,3}\[((?:\\.|[^\]\\])+)\]:[ \t]*(?:\n[ \t]*)?(<[^>\n]*>|\S+)/gm,r;for(;r=n.exec(e);){let n=sC(r[1]);if(n===``||t.has(n))continue;let i=r[2],a=r.index+r[0].length-i.length,o=i.startsWith(`<`),s=o?a+1:a,c=o?a+i.length-1:a+i.length;t.set(n,{range:[s,c],src:aC(e.slice(s,c))})}return t}function dC(e,t){let n=[],r=0;for(;;){let i=e.indexOf(`![`,r);if(i===-1)return n;if(r=i+2,iC(e,i))continue;let a=cC(e,i+1);if(a===-1)continue;let o=[i+2,a],s=e.slice(i+2,a),c=aC(s),l=e[a+1];if(l===`(`){let t=lC(e,a+1);if(t){n.push({kind:`inline`,src:t.src,alt:c,range:[i,t.end],altRange:o,srcRange:t.range}),r=t.end;continue}}let u,d=a+1;if(l===`[`){let t=cC(e,a+1);if(t!==-1){let n=e.slice(a+2,t);u=n.trim()===``?{text:s,form:`collapsed`}:{text:n,form:`full`},d=t+1}}u??={text:s,form:`shortcut`};let f=t.get(sC(u.text));f&&(n.push({kind:`reference`,src:f.src,alt:c,range:[i,d],altRange:o,srcRange:f.range,label:u}),r=d)}}function fC(e){let t=[],n=/<img\b[^>]*>/gi,r;for(;r=n.exec(e);){let e=r[0],n=/\s(src|alt)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/gi,i,a,o;for(;o=n.exec(e);){let e=o[2]??o[3]??o[4]??``,t=o[2]!==void 0||o[3]!==void 0,n=r.index+o.index+o[0].length-e.length-+!!t,s={range:[n,n+e.length],value:oC(e)};o[1].toLowerCase()===`src`?i??=s:a??=s}i&&t.push({kind:`html`,src:i.value,alt:a?.value??``,range:[r.index,r.index+e.length],altRange:a?.range??null,srcRange:i.range})}return t}function pC(e){let t=rC(e);return[...dC(t,uC(t)),...fC(t)].toSorted((e,t)=>e.range[0]-t.range[0])}function mC(e,t,n,r,i){let a=[];Fg(t.fields,r,(t,r,i)=>{let o=i.length>1?{at:i,label:`${t.label} (${i.slice(0,-1).join(`.`)})`}:{};if(t.type===`markdown`&&typeof r==`string`){for(let t of pC(r)){let r={src:t.src,alt:t.alt,path:kn(e,n,t.src),body:t};a.push({field:i.join(`.`),...o,at:i,...r})}return}if(t.type!==`image`||typeof r!=`object`||!r)return;let{src:s,alt:c}=r;typeof s==`string`&&s!==``&&a.push({field:i.join(`.`),...o,src:s,alt:typeof c==`string`?c:``,path:kn(e,n,s)})});let o=Zd(t)??`body`;for(let t of pC(i))a.push({field:o,src:t.src,alt:t.alt,path:kn(e,n,t.src),body:t});return a}var hC=e=>e.replace(/[\\[\]]/g,`\\$&`),gC=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`),_C=e=>/[\s()<>]/.test(e)?`<${e.replace(/[<>]/g,`\\$&`)}>`:e;function vC(e,t){if(e.kind===`html`){if(e.altRange)return{range:e.altRange,text:gC(t)};let n=e.range[0]+4;return{range:[n,n],text:` alt="${gC(t)}"`}}return e.kind===`reference`&&e.label&&e.label.form!==`full`?{range:e.range,text:`![${hC(t)}][${e.label.text}]`}:{range:e.altRange,text:hC(t)}}function yC(e,t,n){if(t.kind===`html`)return{range:t.srcRange,text:gC(n)};let[r,i]=t.srcRange,a=e[r-1]===`<`&&e[i]===`>`?n.replace(/[<>]/g,`\\$&`):_C(n);return{range:t.srcRange,text:a}}function bC(e,t){let n=new Map;for(let{image:r,alt:i,src:a}of t)for(let t of[i===void 0?null:vC(r,i),a===void 0?null:yC(e,r,a)])t&&n.set(`${t.range[0]}:${t.range[1]}`,t);let r=[...n.values()].toSorted((e,t)=>t.range[0]-e.range[0]||t.range[1]-e.range[1]),i=e,a=1/0;for(let{range:e,text:t}of r)e[1]>a||(i=i.slice(0,e[0])+t+i.slice(e[1]),a=e[0]);return i}function xC(e,t){return t.reduce((e,t)=>typeof e==`object`&&e?e[t]:void 0,e)}function SC(e,t,n){if(t.length===0)return n;let[r,...i]=t,a=Array.isArray(e)?[...e]:{...e};return a[r]=SC(a[r],i,n),a}function CC(e,t,n){let r={...e},i=[],a=new Map;for(let{use:e,alt:t,src:o}of n)if(e.body&&e.at){let n=e.at.join(`.`),r=a.get(n)??{at:e.at,edits:[]};r.edits.push({image:e.body,alt:t,src:o}),a.set(n,r)}else if(e.body)i.push({image:e.body,alt:t,src:o});else{let n=e.at??[e.field],i={...xC(r,n),...o===void 0?{}:{src:o},...t===void 0?{}:{alt:t}};r=SC(r,n,i)}for(let{at:e,edits:t}of a.values())r=SC(r,e,bC(String(xC(r,e)),t));return{data:r,body:i.length>0?bC(t,i):t}}function wC(e){let t={},n=[];for(let r of e){if(r.path===``){n.push(r.message);continue}if(r.message===`Unknown field`){n.push(`${r.path}: ${r.message}`);continue}let e=r.path.indexOf(`.`),i=e===-1?r.path:r.path.slice(0,e),a=e===-1?r.message:`${r.path.slice(e+1)}: ${r.message}`;(t[i]??=[]).push(a)}return{fields:t,general:n}}function TC(e,t,n){let r=n.lastIndexOf(`.`),i=r>0?n.slice(0,r):n,a=r>0?`.${n.slice(r+1).toLowerCase()}`:``,o=Cn(i)||`image`,s=new Set([...e].map(e=>e.toLowerCase()));for(let e=1;;e++){let n=`${t}/${e===1?o:`${o}-${e}`}${a}`;if(!s.has(n.toLowerCase()))return n}}var EC=An,DC=10485760,OC=2097152,kC=e=>e.slice(e.lastIndexOf(`.`)+1).toLowerCase();function AC(e){return Pn(e.name)?e.size>8388608?`${e.name}: images larger than 8 MB are not uploaded`:null:`${e.name}: only image files can be uploaded`}function jC(e){return typeof e.arrayBuffer==`function`?e.arrayBuffer():new Response(e).arrayBuffer()}async function MC(e){let t=new Uint8Array(await jC(e));if(kC(e.name)!==`svg`)return t;let n=Eg(t,e.name);if(`issue`in n)throw Error(`${e.name}: not a valid SVG file`);try{return new TextEncoder().encode(tC(n.text))}catch{throw Error(`${e.name}: not a valid SVG file`)}}function NC(e,t,n){let r=new Set(e);return n.map(({name:e,bytes:n})=>{let i=TC(r,t,e);return r.add(i),{path:i,content:n,sha:null}})}function PC(e,t=DC){let n=[],r=[],i=0;for(let a of e){let e=a.content.byteLength;r.length>0&&i+e>t&&(n.push(r),r=[],i=0),r.push(a),i+=e}return r.length>0&&n.push(r),n}function FC(e,t,n){let r=new Map;for(let e of n)r.set(e.use.entryPath,[...r.get(e.use.entryPath)??[],e]);let i=[];for(let[n,a]of r){let r=t.entries.get(n);if(!r)throw Error(`${n} is not loaded`);let o=e.collections[a[0].use.collection],{data:s,body:c}=CC(r.file.data,r.file.body,a);i.push({path:n,content:tb(o,s,c,r.keyOrder),sha:r.sha})}return i}function IC(e,t,n,r){if(kC(r.name)===kC(n.path))return{changes:[{path:n.path,content:r.bytes,sha:n.sha}],path:n.path};if(t.incomplete)throw Error(`Not every entry could be read, so not every use can be pointed at the new file`);let i=n.name.slice(0,n.name.lastIndexOf(`.`)),a=new Set(t.images.map(e=>e.path));a.delete(n.path);let o=TC(a,n.folder,`${i}.${kC(r.name)}`),s=FC(e,t,n.uses.map(e=>({use:e,src:EC(e.entryPath,o)})));return{changes:[{path:o,content:r.bytes,sha:null},{path:n.path,content:null,sha:n.sha},...s],path:o}}function LC(e,t){if(e.incomplete)throw Error(`Not every entry could be read, so images in use cannot be told apart`);let n=new Map(e.images.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e);if(!t)throw Error(`${e} is not in the repository any more`);if(t.uses.length>0)throw Error(`${e} is used by ${t.uses[0].entryPath}`);return{path:e,content:null,sha:t.sha}})}function RC({children:e}){let t=(0,E.useRef)(null),[n,r]=(0,E.useState)(()=>typeof IntersectionObserver>`u`);return(0,E.useEffect)(()=>{let e=t.current;if(n||!e)return;let i=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r(!0),i.disconnect())},{rootMargin:`200px`});return i.observe(e),()=>i.disconnect()},[n]),(0,D.jsx)(`div`,{ref:t,className:`editlet-media-grid__img-wrap`,children:n?e:null})}var zC=e=>`${e.contentDir}/media`,BC=e=>e.slice(0,e.lastIndexOf(`/`));function VC(e,t){let n=[];for(let r of t){if(Dn(e,r.path))continue;let t=On(e,r.path);t&&n.push({...r,...t})}return n}function HC(e,t,n){let r=`${e.contentDir}/`,i=t.filter(t=>t.path.startsWith(r)&&Pn(t.path)&&!Dn(e,t.path)).map(e=>({path:e.path,sha:e.sha,name:e.path.slice(e.path.lastIndexOf(`/`)+1),folder:BC(e.path),uses:[]})).toSorted((e,t)=>e.path.localeCompare(t.path)),a=new Map(i.map(e=>[e.path,e])),o=new Map,s=!1;for(let r of VC(e,t)){let t=n.get(r.path);if(!t){s=!0;continue}o.set(r.path,t);let i=e.collections[r.collection],c=i.titleField===void 0?void 0:t.file.data[i.titleField],l=typeof c==`string`&&c.trim()!==``?c:r.slug;for(let n of mC(e,i,r.path,t.file.data,t.file.body))(n.path===null?void 0:a.get(n.path))?.uses.push({...n,entryPath:r.path,collection:r.collection,slug:r.slug,title:l})}return{images:i,folders:[...new Set(i.map(e=>e.folder))].toSorted(),entries:o,incomplete:s}}var UC=e=>e.uses.length>0,WC=e=>e.uses.some(e=>e.alt.trim()===``);function GC(e,t){switch(t){case`all`:return!0;case`used`:return UC(e);case`unused`:return!UC(e);case`missing-alt`:return WC(e)}}function KC(e,t){let n=t.trim().toLowerCase();return n===``||e.path.toLowerCase().includes(n)||e.uses.some(e=>e.alt.toLowerCase().includes(n))}function qC(e){return{all:e.length,used:e.filter(UC).length,unused:e.filter(e=>!UC(e)).length,"missing-alt":e.filter(WC).length}}var JC=e=>e.map(e=>e.data);function YC(e){let t=by(),n=nx(),r=(0,E.useMemo)(()=>n.data?VC(e,n.data):[],[e,n.data]),i=yt({queries:r.map(e=>ox(t,e)),combine:JC}),a=n.data;return(0,E.useMemo)(()=>{if(!a)return;let t=new Map(r.map((e,t)=>[e.path,i[t]]));return HC(e,a,t)},[e,a,r,i])}async function XC(e,t,n){let r=await e.fetchQuery({queryKey:Cy(t),queryFn:()=>t.listFiles(),staleTime:0}),i=VC(n,r),a=await Promise.all(i.map(n=>e.fetchQuery(ox(t,n))));return HC(n,r,new Map(i.map((e,t)=>[e.path,a[t]])))}function ZC(e,t,n){let r=Py(),i=Fy(),[a,o]=(0,E.useState)(null),s=r?.onBase===!0,c=r?.prefix??`editlet/`,l=i.data?.map(e=>e.name)??[],u=a??Ub(Gb(c,e,t,n,l),c),d=`${c}${Wb(u,c)}`,f=null;af(d,c)?l.includes(d)&&(f=`A branch with this name already exists`):f=`Use letters, digits and dashes`;let p=i.data!==void 0||i.error!==null;return{needed:s,value:u,setValue:o,branch:s&&f===null&&p?d:void 0,error:s?f:null}}function QC({needed:e,value:t,setValue:n,error:r}){let i=Py(),a=(0,E.useId)();return!e||!i?null:(0,D.jsx)(sy,{label:`New branch`,htmlFor:a,error:r,hint:`${i.base} is the live site. This change goes to a new branch; create a pull request from the branch screen.`,children:(0,D.jsx)(uy,{id:a,prefix:i.prefix,value:t,onChange:e=>n(e.target.value),spellCheck:!1,autoComplete:`off`,"aria-invalid":r!==null||void 0,"aria-describedby":oy(a,!0,r)})})}var $C=e=>e instanceof F&&e.code===`branch_exists`;function ew(){let e=by(),t=Py(),n=ne(),r=Mb(),i=ZC(`media`,`index`,!0),a=Kb(),o=Xb(),s=cx().data?.schema??null,[c,l]=(0,E.useState)(null),[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)(null),m=e=>e instanceof ex?e.message:t?J_(e,{repo:`${t.config.owner}/${t.config.repo}`}):e instanceof Error?e.message:String(e),h=async c=>{if(i.needed&&i.branch===void 0)return;d(!0),p(null);let u=0,f=0;try{let n=(await c.build()).filter(e=>e.length>0);f=n.length;let d=i.branch?await t.createBranch(i.branch,{keepScreen:!0}):e;for(let[e,t]of n.entries()){let n=a(c.subject,f>1?` (${e+1}/${f})`:``),{issues:r}=await d.commit(t,n);if(r.length>0)throw new ex(r);u++}l(null),o(d,s),c.onDone?.(),r()}catch(e){if($C(e)){n.invalidateQueries({queryKey:wy});return}l(null),p(u>0?`${u} of ${f} commits went through. ${m(e)}`:m(e))}finally{d(!1),mx(n)}},g=e=>{p(null),e.confirm||i.needed?l(e):h(e)},_=c?.confirm;return{request:g,busy:u,error:f,clearError:()=>p(null),dialog:(0,D.jsx)(ey,{open:c!==null,onOpenChange:e=>!e&&!u&&l(null),children:(0,D.jsxs)(ty,{role:_?.destructive?`alertdialog`:`dialog`,children:[(0,D.jsxs)(ny,{children:[(0,D.jsx)(iy,{children:_?.title??c?.message}),(0,D.jsx)(ay,{children:_?.description??`The change is committed to a new branch.`})]}),(0,D.jsx)(QC,{...i}),(0,D.jsxs)(ry,{children:[(0,D.jsx)(Z,{variant:`outline`,disabled:u,onClick:()=>l(null),children:`Cancel`}),(0,D.jsx)(Z,{variant:_?.destructive?`destructive`:`primary`,disabled:u||i.needed&&i.branch===void 0,onClick:()=>c&&void h(c),children:(_?.label??`Commit`)+(i.needed?` on branch`:``)})]})]})})}}function tw({to:e,onClick:t,children:n,...r}){let{navigate:i}=wb(),a=typeof e==`string`?e:_b(e),o=s(window.location.href,a);return(0,D.jsx)(`a`,{href:o,onClick:e=>{t?.(e),e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),i(a))},...r,children:n})}var nw=[{key:`all`,label:`All`},{key:`used`,label:`Used`},{key:`unused`,label:`Unused`},{key:`missing-alt`,label:`Missing alt`}],rw=e=>Array.from(e.dataTransfer?.types??[]).includes(`Files`);function iw(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var aw=(e,t)=>`${t.startsWith(`${e.contentDir}/`)?t.slice(e.contentDir.length+1):t}/`;function ow(e,t,n){let r=nx(),[i,a]=(0,E.useState)(!1);return{preparing:i,async upload(i,o){n(null),t.clearError();let s=i.map(AC).filter(e=>e!==null),c=i.filter(e=>AC(e)===null);a(!0);let l;try{l=await Promise.all(c.map(async e=>({name:e.name,bytes:await MC(e)})))}catch(e){n(e instanceof Error?e.message:String(e));return}finally{a(!1)}let u=c.filter(e=>e.size>OC).map(e=>`${e.name} (${iw(e.size)})`),d=[s.length>0?`Skipped ${s.join(`; `)}.`:null,u.length>0?`Large files stay in the repository's history for good: ${u.join(`, `)}.`:null].filter(Boolean);if(n(d.length>0?d.join(` `):null),l.length===0)return;let f=NC((r.data??[]).map(e=>e.path),o,l);t.request({message:f.length===1?`Upload ${f[0].path.split(`/`).pop()}`:`Upload ${f.length} images`,subject:lf(e,`upload`,f.map(e=>e.path)),build:()=>PC(f)})}}}function sw(e){let[t,n]=(0,E.useState)(!1),r=(0,E.useRef)(0);return{over:t,handlers:{onDragEnter(e){rw(e)&&(e.preventDefault(),e.stopPropagation(),r.current+=1,n(!0))},onDragOver(e){rw(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`)},onDragLeave(e){rw(e)&&(e.stopPropagation(),r.current=Math.max(0,r.current-1),r.current===0&&n(!1))},onDrop(t){rw(t)&&(t.preventDefault(),t.stopPropagation(),r.current=0,n(!1),e(Array.from(t.dataTransfer.files)))}}}}function cw({image:e,selecting:t,selected:n,active:r,incomplete:i,onClick:a}){let o=UC(e),s=t&&(o||i),c=o?`Used in ${e.uses.length}`:i?`Checking…`:`Unused`;return(0,D.jsxs)(`button`,{type:`button`,className:Dv(`editlet-media-grid__card`,(n||r)&&`editlet-media-grid__card--selected`),title:s&&o?`Used by ${e.uses[0].entryPath}`:e.path,"aria-pressed":t?n:void 0,"aria-current":!t&&r?`true`:void 0,disabled:s,onClick:a,children:[(0,D.jsx)(RC,{children:(0,D.jsx)(Tx,{path:e.path,alt:``,className:`editlet-media-grid__img`})}),t&&!s?(0,D.jsx)(`span`,{className:`editlet-media__check`,"aria-hidden":`true`,children:n?(0,D.jsx)($.Check,{size:14}):null}):null,(0,D.jsxs)(`div`,{className:`editlet-media-grid__info`,children:[(0,D.jsx)(`div`,{className:`editlet-media-grid__name`,children:e.name}),(0,D.jsxs)(`div`,{className:`editlet-media-grid__meta`,children:[c,WC(e)?` · No alt`:``]})]})]})}function lw({schema:e,folder:t,count:n,onFiles:r,children:i}){let a=sw(e=>r(e,t));return(0,D.jsxs)(`details`,{className:`editlet-media__group`,open:!0,"aria-label":aw(e,t),"data-dragging":a.over?`true`:void 0,...a.handlers,children:[(0,D.jsxs)(`summary`,{className:`editlet-media__folder`,children:[(0,D.jsx)(`span`,{className:`editlet-u-mono`,children:aw(e,t)}),(0,D.jsx)(`span`,{className:`editlet-u-text-muted`,children:n})]}),(0,D.jsx)(`div`,{className:`editlet-media-grid editlet-media-grid--auto`,children:i})]})}function uw({schema:e,index:t,image:n,commit:r,onClose:i,onDelete:a}){let o=xx(n.path),s=Sx(o),[c,l]=(0,E.useState)(null),[u,d]=(0,E.useState)({}),[f,p]=(0,E.useState)(null),m=(0,E.useRef)(null),h=e=>u[e]??n.uses[e].alt,g=n.uses.map((e,t)=>({use:e,alt:h(t)})).filter(({use:e,alt:t})=>t!==e.alt),_=UC(n),v=()=>r.request({message:`Update alt text of ${n.name}`,subject:cf(`update`,[...new Map(g.map(({use:e})=>[e.entryPath,{collection:e.collection,slug:e.slug}])).values()]),build:()=>[FC(e,t,g)],onDone:()=>d({})}),y=async i=>{p(null);let a=AC(i);if(a)return p(a);try{let a=await MC(i),{changes:o}=IC(e,t,n,{name:i.name,bytes:a});r.request({message:`Replace ${n.name}`,subject:lf(e,`update`,[n.path]),build:()=>[o]})}catch(e){p(e instanceof Error?e.message:String(e))}},b=[o?iw(o.size):null,c?`${c.w}×${c.h}`:null,vx(n.path)].filter(Boolean);return(0,D.jsxs)(`aside`,{className:`editlet-media__detail`,"aria-label":n.name,children:[(0,D.jsxs)(`div`,{className:`editlet-media__detail-head`,children:[(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,icon:(0,D.jsx)($.ArrowLeft,{size:14}),onClick:i,children:`All media`}),(0,D.jsxs)(`div`,{className:`editlet-u-row editlet-u-gap-2`,children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Upload,{size:14}),disabled:r.busy,onClick:()=>m.current?.click(),children:`Replace`}),(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Trash,{size:14}),disabled:_||t.incomplete||r.busy,title:_?`Used by an entry: remove it there first`:void 0,onClick:()=>a([n.path]),children:`Delete`})]}),(0,D.jsx)(`input`,{ref:m,type:`file`,accept:`image/*`,className:`editlet-u-hidden`,"data-testid":`media-replace-file`,"aria-label":`Replacement image file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&y(t)}})]}),(0,D.jsx)(`h2`,{className:`editlet-media__title`,children:n.name}),(0,D.jsx)(`div`,{className:`editlet-media__preview`,children:s?(0,D.jsx)(`img`,{src:s,alt:n.uses[0]?.alt??``,onLoad:e=>l({w:e.currentTarget.naturalWidth,h:e.currentTarget.naturalHeight})}):(0,D.jsx)($.Image,{size:28})}),(0,D.jsx)(`code`,{className:`editlet-u-mono editlet-u-word-break-all editlet-u-text-sm`,children:n.path}),(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:b.join(` · `)}),f?(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-danger`,role:`alert`,children:f}):null,(0,D.jsx)(`h3`,{className:`editlet-media__heading`,children:_?`Used in ${n.uses.length} ${n.uses.length===1?`place`:`places`}`:`Not used`}),_?(0,D.jsx)(`ul`,{className:`editlet-media__uses`,children:n.uses.map((t,n)=>{let r=e.collections[t.collection],i=t.label??r?.fields[t.field]?.label??`Body`,a=`editlet-media-alt-${n}`;return(0,D.jsxs)(`li`,{className:`editlet-media__use`,children:[(0,D.jsxs)(`label`,{htmlFor:a,className:`editlet-u-text-sm`,children:[(0,D.jsxs)(tw,{to:r?.singleton?{kind:`collection`,collection:t.collection}:{kind:`entry`,collection:t.collection,slug:t.slug},className:`editlet-link`,children:[r?.label??t.collection,` · `,t.title]}),` `,`· `,i]}),(0,D.jsx)(`input`,{id:a,className:cy,value:h(n),placeholder:`No alt text`,"aria-label":`Alt text in ${t.title}, ${i}`,onChange:e=>d(t=>({...t,[n]:e.target.value}))})]},n)})}):(0,D.jsx)(`p`,{className:`editlet-u-text-sm editlet-u-text-muted`,children:t.incomplete?`Still reading the entries…`:`Not used by any entry. The site's code may still use it.`}),_?(0,D.jsxs)(`div`,{className:`editlet-u-row editlet-u-gap-2 editlet-media__alt-actions`,children:[n.uses.length>1?(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>d(Object.fromEntries(n.uses.map((e,t)=>[t,h(0)]))),children:`Apply first alt to all`}):null,(0,D.jsx)(Z,{variant:`primary`,size:`sm`,disabled:g.length===0||r.busy,onClick:v,children:g.length>0?`Save alt changes (${g.length})`:`Save alt changes`})]}):null]})}function dw({schema:e}){let t=e.schema,n=YC(t),r=by(),i=ne(),a=ew(),[o,s]=(0,E.useState)(null),c=ow(t,a,s),[l,u]=(0,E.useState)(``),[d,f]=(0,E.useState)(`all`),[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(!1),[_,v]=(0,E.useState)(new Set),y=(0,E.useRef)(null),b=zC(t),x=sw(e=>void c.upload(e,b)),S=n?.images??[],C=(0,E.useMemo)(()=>qC(n?.images??[]),[n]),w=S.filter(e=>GC(e,d)&&KC(e,l)),T=[...new Set(w.map(e=>e.folder))],ee=p===null?void 0:S.find(e=>e.path===p),te=e=>a.request({message:e.length===1?`Delete ${e[0].split(`/`).pop()}`:`Delete ${e.length} images`,subject:lf(t,`delete`,e),build:async()=>[LC(await XC(i,r,t),e)],confirm:{title:e.length===1?`Delete ${e[0].split(`/`).pop()}?`:`Delete ${e.length} images?`,description:`Not used by any entry. The site's code may still use them. Git history keeps the old files.`,label:`Delete`,destructive:!0},onDone:()=>{v(new Set),g(!1),m(null)}}),re=e=>v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ie=a.busy||c.preparing;return(0,D.jsxs)(`section`,{className:Dv(`editlet-screen editlet-media`,ee&&`editlet-media--detail`),"data-dragging":x.over?`true`:void 0,...x.handlers,children:[(0,D.jsx)(NS,{title:`Media`,children:(0,D.jsx)(Z,{variant:`primary`,size:`sm`,icon:(0,D.jsx)($.Upload,{size:14}),disabled:ie,onClick:()=>y.current?.click(),children:ie?`Uploading…`:`Upload`})}),(0,D.jsx)(`input`,{ref:y,type:`file`,accept:`image/*`,multiple:!0,className:`editlet-u-hidden`,"data-testid":`media-upload-file`,"aria-label":`Image files to upload`,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,t.length>0&&c.upload(t,ee?.folder??b)}}),a.error||o?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:[a.error,o].filter(Boolean).join(` `)})]}):null,(0,D.jsxs)(`div`,{className:`editlet-media__layout`,children:[(0,D.jsxs)(`div`,{className:`editlet-media__list`,children:[(0,D.jsxs)(`div`,{className:`editlet-media__toolbar`,children:[(0,D.jsx)(`input`,{type:`search`,className:cy,placeholder:`Search by name, path or alt…`,"aria-label":`Search images`,value:l,onChange:e=>u(e.target.value)}),(0,D.jsx)(xS,{"aria-label":`Filter images`,children:nw.map(e=>(0,D.jsxs)(SS,{active:d===e.key,onClick:()=>f(e.key),children:[e.label,` `,C[e.key]]},e.key))})]}),n?S.length===0?(0,D.jsxs)(`p`,{className:`editlet-ff-image__none`,children:[`No images under `,t.contentDir,`/ yet. Upload or drop files here: they go to`,` `,aw(t,b),`.`]}):w.length===0?(0,D.jsx)(`p`,{className:`editlet-ff-image__none`,children:`No images match.`}):T.map(e=>{let r=w.filter(t=>t.folder===e);return(0,D.jsx)(lw,{schema:t,folder:e,count:r.length,onFiles:(e,t)=>void c.upload(e,t),children:r.map(e=>(0,D.jsx)(cw,{image:e,selecting:h,selected:_.has(e.path),active:e.path===p,incomplete:n.incomplete,onClick:()=>h?re(e.path):m(e.path)},e.path))},e)}):(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`}),S.length>0?(0,D.jsxs)(`div`,{className:`editlet-media__selectbar`,children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,"aria-pressed":h,onClick:()=>{g(e=>!e),v(new Set)},children:h?`Done`:`Select`}),h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`editlet-u-text-sm editlet-u-text-muted editlet-u-flex-1`,children:[_.size,` selected · only unused images can be selected`]}),(0,D.jsx)(Z,{variant:`destructive`,size:`sm`,icon:(0,D.jsx)($.Trash,{size:14}),disabled:_.size===0||ie,onClick:()=>te([..._]),children:`Delete`})]}):null]}):null]}),ee&&n?(0,D.jsx)(uw,{schema:t,index:n,image:ee,commit:a,onClose:()=>m(null),onDelete:te},ee.path):null]}),a.dialog]})}var fw=2e3;function pw({text:e,label:t=`Copy`,describedBy:n}){let[r,i]=(0,E.useState)(`idle`);(0,E.useEffect)(()=>{if(r===`idle`)return;let e=setTimeout(()=>i(`idle`),fw);return()=>clearTimeout(e)},[r]);let a=async()=>{try{await navigator.clipboard.writeText(e),i(`copied`)}catch{i(`failed`)}},o=r===`copied`?`Copied`:r===`failed`?`Copy failed`:t;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:r===`copied`?(0,D.jsx)($.Check,{}):void 0,onClick:a,"aria-describedby":n,children:o}),(0,D.jsx)(`span`,{role:`status`,className:`editlet-sr-only`,children:r===`copied`?`Copied to clipboard`:r===`failed`?`Copy failed`:``})]})}function mw(e){let t=[e.type];return e.type===`string`&&e.list&&t.push(`list`),e.type===`select`&&e.multiple&&t.push(`multiple`),e.type===`object`&&e.list&&t.push(`list`),t.join(`, `)}function hw(e){let t=[];if(e.type===`select`){let n=e.options.map(e=>e.label===e.value?e.value:`${e.label} (${e.value})`);t.push(`options: ${n.join(`, `)}`)}e.type===`object`&&t.push(`fields: ${Object.keys(e.fields).join(`, `)}`),e.type===`blocks`&&t.push(`blocks: ${Object.entries(e.blocks).map(([e,t])=>t.label===e?e:`${t.label} (${e})`).join(`, `)}`);let n=e.type===`number`||e.type===`reference`||e.type===`object`||e.type===`blocks`;return n&&e.min!==void 0&&t.push(`min: ${e.min}`),n&&e.max!==void 0&&t.push(`max: ${e.max}`),e.type===`number`&&e.step!==void 0&&t.push(`step: ${e.step}`),e.type===`number`&&e.integer&&t.push(`integer`),e.type===`text`&&e.rows!==void 0&&t.push(`rows: ${e.rows}`),e.type===`datetime`&&e.dateOnly&&t.push(`date only`),e.type===`datetime`&&e.defaultNow&&t.push(`default now`),e.type===`boolean`&&e.labels&&t.push(`labels: ${e.labels.true} / ${e.labels.false}`),`default`in e&&e.default!==void 0&&t.push(`default: ${JSON.stringify(e.default)}`),t}function gw(e){return Lg(e.fields).map(([t,n])=>{let r=t.join(`.`),i=[];return e.titleField===r&&i.push(`title`),e.slugFrom===r&&i.push(`slugSource`),n.type===`markdown`&&i.push(`body`),{key:r,label:n.label,...n.hint===void 0?{}:{hint:n.hint},required:n.required===!0,type:mw(n),targets:n.type===`reference`?[...n.collections]:[],many:n.type===`reference`&&n.multiple===!0,details:hw(n),badges:i}})}function _w(e){let t=[];for(let[n,r]of Object.entries(e.collections))for(let[e,i]of Lb(r))for(let r of i.collections)t.push({from:n,field:e,to:r,many:i.multiple===!0});return t}function vw(e,t){return e.filter(e=>e.from===t)}function yw(e,t){return e.filter(e=>e.to===t)}function bw(e){return Array.isArray(e)?`[${e.map(bw).join(`,`)}]`:typeof e==`object`&&e?`{${Object.entries(e).filter(([,e])=>e!==void 0).toSorted(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${bw(t)}`).join(`,`)}}`:JSON.stringify(e)??`null`}function xw(e,t){let n={collections:new Map,fields:new Map,removed:[]};for(let r of Object.keys(e.collections))Object.hasOwn(t.collections,r)||n.removed.push(r);for(let[r,i]of Object.entries(t.collections)){let t=Object.hasOwn(e.collections,r)?e.collections[r]:void 0;if(!t){n.collections.set(r,`new`);continue}let a=!1,{fields:o,...s}=i,{fields:c,...l}=t;bw(s)!==bw(l)&&(a=!0);let u=new Map;for(let[e,t]of Object.entries(o))Object.hasOwn(c,e)?bw(t)!==bw(c[e])&&u.set(e,`changed`):u.set(e,`new`);for(let e of Object.keys(c))Object.hasOwn(o,e)||(n.removed.push(`${r}.${e}`),a=!0);u.size>0&&(n.fields.set(r,u),a=!0),a&&n.collections.set(r,`changed`)}return n.removed.sort(),n}var Sw=e=>e.charAt(0).toUpperCase()+e.slice(1);function Cw(e,t){return e.find(e=>!t(e))??`${e[0]}New`}var ww={tag:`tags`,category:`categories`,topic:`topics`};function Tw(e,t,n){let r=Object.entries(e.collections),i=(r.find(([,e])=>!e.singleton)??r[0])?.[0]??`post`,a=Object.entries(e.collections[i]?.fields??{}).filter(([,e])=>e.type!==`markdown`),o=e.collections[i]?.fields??{},s=[],c=Cw([`subtitle`,`summary`,`note`],e=>Object.hasOwn(o,e));s.push({id:`add-field`,title:`Add a field`,text:`Add an optional string field "${c}" (label "${Sw(c)}") to the "${i}" collection in ${t}.`});let l=a[0]?.[0];if(l!==void 0){let e=Object.hasOwn(o,`headline`)?`${l}New`:`headline`;s.push({id:`rename-field`,title:`Rename a field`,text:`Rename field "${l}" in "${i}" to "${e}" and update every entry. Dry-run first and show me the plan.`})}let u=a.findLast(([e])=>e!==l)?.[0];u!==void 0&&s.push({id:`remove-field`,title:`Remove a field`,text:`Remove field "${u}" from "${i}". Dry-run first and tell me which entries lose data.`});let d=a.find(([,e])=>!e.required)?.[0];d!==void 0&&s.push({id:`require-field`,title:`Make a field required`,text:`Make "${d}" in "${i}" required. First check which entries would fail.`});let f=Cw([`tag`,`category`,`topic`],t=>Object.hasOwn(e.collections,t));return s.push({id:`add-collection`,title:`Add a collection`,text:`Add a collection "${f}" (label "${Sw(f)}") with a required string field "name", and let "${i}" reference many ${ww[f]??`${f}s`}.`}),n.hasProblems&&s.push({id:`fix-problems`,title:`Fix the problems`,text:`Run the content validation and fix the problems shown in the content model.`}),s}var Ew=e=>`editlet-model-c-${e}`;function Dw(e){document.getElementById(Ew(e))?.scrollIntoView({block:`start`}),document.getElementById(`${Ew(e)}-title`)?.focus({preventScroll:!0})}function Ow({to:e,children:t}){return(0,D.jsx)(`button`,{type:`button`,className:`editlet-model__jump`,onClick:()=>Dw(e),children:t})}function kw({children:e,mark:t}){return(0,D.jsx)(`span`,{className:`editlet-chip editlet-model__badge${t?` editlet-model__badge--${t}`:``}`,children:e})}var Aw={title:`Title`,slugSource:`Slug source`,body:`Body`};function jw({schema:e,files:t,removed:n}){let r=Object.entries(e.collections);if(r.length===0)return(0,D.jsx)(`div`,{className:`editlet-card editlet-card--empty`,children:(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,children:`No collections`})});let i=(n,r)=>{if(!t)return`…`;let i=ux(e,t,n).length;return r.singleton?i>0?`—`:`missing`:String(i)};return(0,D.jsxs)(D.Fragment,{children:[n.length>0?(0,D.jsxs)(`p`,{className:`editlet-model__removed`,children:[`Removed: `,n.join(`, `)]}):null,(0,D.jsxs)(CS,{children:[(0,D.jsx)(wS,{children:(0,D.jsxs)(DS,{children:[(0,D.jsx)(OS,{children:`Collection`}),(0,D.jsx)(OS,{children:`Kind`}),(0,D.jsx)(OS,{children:`Entries`}),(0,D.jsx)(OS,{children:`Fields`})]})}),(0,D.jsx)(TS,{children:r.map(([e,t])=>(0,D.jsxs)(DS,{children:[(0,D.jsxs)(kS,{children:[(0,D.jsx)(Ow,{to:e,children:t.label}),` `,(0,D.jsx)(`span`,{className:`editlet-u-mono editlet-u-text-muted editlet-model__key`,children:e})]}),(0,D.jsx)(kS,{children:t.singleton?`Singleton`:`Collection`}),(0,D.jsx)(kS,{children:i(e,t)}),(0,D.jsx)(kS,{children:Object.keys(t.fields).length})]},e))})]})]})}function Mw({out:e,inc:t,label:n}){return e.length===0&&t.length===0?(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,children:`No references`}):(0,D.jsxs)(`div`,{className:`editlet-model__refs`,children:[e.length>0?(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h4`,{className:`editlet-model__refs-title`,children:`References →`}),(0,D.jsx)(`ul`,{children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`editlet-u-mono`,children:e.field}),` → `,(0,D.jsx)(Ow,{to:e.to,children:n(e.to)}),` (`,e.many?`many`:`one`,`)`]},`${e.field}>${e.to}`))})]}):null,t.length>0?(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h4`,{className:`editlet-model__refs-title`,children:`Referenced by ←`}),(0,D.jsx)(`ul`,{children:t.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(Ow,{to:e.from,children:n(e.from)}),(0,D.jsxs)(`span`,{className:`editlet-u-mono`,children:[`.`,e.field]}),` (`,e.many?`many`:`one`,`)`]},`${e.from}.${e.field}`))})]}):null]})}function Nw({schema:e,collectionKey:t,edges:n,changes:r,count:i}){let a=e.collections[t],o=r?.collections.get(t),s=r?.fields.get(t),c=`${Ew(t)}-title`,l=t=>e.collections[t]?.label??t;return(0,D.jsx)(`section`,{id:Ew(t),"aria-labelledby":c,className:`editlet-model__collection`,children:(0,D.jsxs)(hS,{children:[(0,D.jsxs)(gS,{className:`editlet-model__card-header`,children:[(0,D.jsx)(_S,{id:c,tabIndex:-1,children:a.label}),(0,D.jsx)(`span`,{className:`editlet-u-mono editlet-u-text-muted editlet-model__key`,children:t}),a.singleton?(0,D.jsx)(kw,{children:`Singleton`}):null,o?(0,D.jsx)(kw,{mark:o,children:o===`new`?`New`:`Changed`}):null,!a.singleton&&i!==void 0?(0,D.jsx)(`span`,{className:`editlet-u-text-muted editlet-u-text-sm`,children:i===1?`1 entry`:`${i} entries`}):null,(0,D.jsx)(tw,{to:{kind:`collection`,collection:t},className:`editlet-link editlet-model__open`,children:`Open entries`})]}),(0,D.jsxs)(vS,{className:`editlet-u-stack editlet-u-gap-3`,children:[(0,D.jsxs)(`p`,{className:`editlet-u-text-muted editlet-u-text-sm editlet-model__meta`,children:[(0,D.jsxs)(`span`,{className:`editlet-u-mono`,children:[e.contentDir,`/`,t,`/`]}),a.titleField?(0,D.jsxs)(D.Fragment,{children:[` · title field: `,a.titleField]}):null,a.slugFrom?(0,D.jsxs)(D.Fragment,{children:[` · slug source: `,a.slugFrom]}):null]}),(0,D.jsxs)(CS,{children:[(0,D.jsx)(wS,{children:(0,D.jsxs)(DS,{children:[(0,D.jsx)(OS,{children:`Field`}),(0,D.jsx)(OS,{children:`Type`}),(0,D.jsx)(OS,{children:`Required`}),(0,D.jsx)(OS,{children:`Details`})]})}),(0,D.jsx)(TS,{children:gw(a).map(e=>{let t=s?.get(e.key);return(0,D.jsxs)(DS,{children:[(0,D.jsxs)(kS,{children:[(0,D.jsxs)(`div`,{className:`editlet-model__field`,children:[(0,D.jsx)(`span`,{children:e.label}),(0,D.jsx)(`span`,{className:`editlet-u-mono editlet-u-text-muted editlet-model__key`,children:e.key}),e.badges.map(e=>(0,D.jsx)(kw,{children:Aw[e]},e)),t?(0,D.jsx)(kw,{mark:t,children:t===`new`?`New`:`Changed`}):null]}),e.hint?(0,D.jsx)(`div`,{className:`editlet-u-text-muted editlet-u-text-sm`,children:e.hint}):null]}),(0,D.jsxs)(kS,{children:[e.type,e.targets.length>0?(0,D.jsxs)(D.Fragment,{children:[` → `,e.targets.map((e,t)=>(0,D.jsxs)(`span`,{children:[t>0?`, `:null,(0,D.jsx)(Ow,{to:e,children:l(e)})]},e)),e.many?`, many`:null]}):null]}),(0,D.jsx)(kS,{children:e.required?(0,D.jsx)($.Check,{role:`img`,"aria-label":`Required`,size:16}):(0,D.jsx)(`span`,{className:`editlet-sr-only`,children:`Optional`})}),(0,D.jsx)(kS,{className:`editlet-u-text-sm editlet-model__details`,children:e.details.map(e=>(0,D.jsx)(`div`,{children:e},e))})]},e.key)})})]}),(0,D.jsx)(Mw,{out:vw(n,t),inc:yw(n,t),label:l})]})]})})}function Pw(e,t,n){let r=`${e.contentDir}/`;return n.filter(n=>n.path.startsWith(r)&&n.path!==t&&!Dn(e,n.path)&&!Pn(n.path)).map(t=>({...t,entry:t.path.endsWith(`.md`)?On(e,t.path):null}))}function Fw(e,t,n,r){let i=new Set(n.flatMap(e=>e.entry?[jn(e.entry.collection,e.entry.slug)]:[])),a=new Set(t.map(e=>e.path)),o={entryExists:e=>i.has(e),fileExists:e=>a.has(e)},s=[],c=!1;return n.forEach((t,n)=>{let{path:i,entry:a}=t;if(!a){s.push({file:i,entry:a,issues:[{file:i,path:``,message:`Not an entry file`}]});return}let l=r[n];if(!l){c=!0;return}let u=`issues`in l?l.issues:Bg(e,{...a,data:l.file.data,body:l.file.body},o);u.length>0&&s.push({file:i,entry:a,issues:u})}),{problems:s.toSorted((e,t)=>e.file.localeCompare(t.file)),pending:c}}var Iw=3e4;function Lw(){let e=by(),t=ne(),n=e.kind===`github`;(0,E.useEffect)(()=>{if(!n)return;let e=setInterval(()=>{document.hidden||mx(t)},Iw);return()=>clearInterval(e)},[n,t])}var Rw=e=>e.map(e=>({data:e.data,error:e.error}));function zw(e){let t=by(),n=nx(),{schema:r,schemaPath:i}=e,a=(0,E.useMemo)(()=>n.data?Pw(r,i,n.data):[],[r,i,n.data]),o=(0,E.useMemo)(()=>a.filter(e=>e.entry),[a]),s=yt({queries:o.map(e=>ox(t,e)),combine:Rw}),c=n.data;return(0,E.useMemo)(()=>{if(!c)return{problems:[],pending:!n.error};let e=new Map(o.map((e,t)=>[e.path,s[t]])),t=a.map(t=>{if(!t.entry)return{issues:[]};let n=e.get(t.path);if(n?.data)return{file:n.data.file};if(n?.error){let e=n.error;return{issues:e instanceof bn?e.issues:[{file:t.path,path:``,message:e.message}]}}});return Fw(r,c,a,t)},[r,c,n.error,a,o,s])}function Bw(e){let t=(0,E.useRef)(e),[n,r]=(0,E.useState)({changes:null,updatedAt:null});return(0,E.useEffect)(()=>{t.current!==e&&(r({changes:xw(t.current,e),updatedAt:new Date}),t.current=e)},[e]),n}function Vw(e){let t=[e.file,e.path].filter(Boolean).join(`: `);return t?`${t}: ${e.message}`:e.message}function Hw({issues:e}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h1`,{className:`editlet-layout__sign-in-title`,children:`The schema has errors`}),(0,D.jsx)(`p`,{className:`editlet-layout__sign-in-subtitle`,children:`Fix these problems in the schema file.`}),(0,D.jsx)(`ul`,{className:`editlet-issues`,role:`alert`,children:e.map((e,t)=>(0,D.jsx)(`li`,{className:`editlet-issues__item`,children:Vw(e)},t))})]})}function Uw({issues:e}){return(0,D.jsx)(`div`,{className:`editlet-layout__sign-in`,children:(0,D.jsx)(`div`,{className:`editlet-layout__sign-in-inner`,children:(0,D.jsx)(Hw,{issues:e})})})}var Ww=e=>e.path?`${e.path} — ${e.message}`:e.message;function Gw({schemaIssues:e,problems:t,pending:n}){let r=!e&&t.length===0;return(0,D.jsxs)(`section`,{"aria-labelledby":`editlet-model-problems`,className:`editlet-u-stack editlet-u-gap-2`,children:[(0,D.jsx)(`h2`,{id:`editlet-model-problems`,className:`editlet-model__heading`,children:`Problems`}),e?(0,D.jsx)(`div`,{className:`editlet-card editlet-card--banner`,children:(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-1`,children:[(0,D.jsx)(`strong`,{children:`The schema file has errors. Showing the last valid version.`}),(0,D.jsx)(`ul`,{className:`editlet-u-stack editlet-u-gap-1`,children:e.map((e,t)=>(0,D.jsx)(`li`,{children:Vw(e)},t))})]})}):null,t.map(e=>(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-1`,children:[e.entry?(0,D.jsx)(tw,{to:{kind:`entry`,collection:e.entry.collection,slug:e.entry.slug},className:`editlet-link editlet-u-mono editlet-u-word-break-all editlet-model__problem-file`,children:e.file}):(0,D.jsx)(`span`,{className:`editlet-u-mono editlet-u-word-break-all editlet-model__problem-file`,children:e.file}),(0,D.jsx)(`ul`,{className:`editlet-model__issues`,children:e.issues.map((e,t)=>(0,D.jsx)(`li`,{children:Ww(e)},t))})]},e.file)),(0,D.jsx)(`p`,{className:`editlet-u-text-muted editlet-model__status`,role:`status`,children:n?`Checking entries…`:r?`No problems`:``})]})}function Kw({prompts:e}){return(0,D.jsx)(`section`,{"aria-labelledby":`editlet-model-prompts`,children:(0,D.jsxs)(hS,{children:[(0,D.jsx)(gS,{children:(0,D.jsx)(`h2`,{id:`editlet-model-prompts`,className:`editlet-model__heading`,children:`Ask Claude Code`})}),(0,D.jsx)(vS,{children:(0,D.jsx)(`ul`,{className:`editlet-model__prompts`,children:e.map(e=>(0,D.jsxs)(`li`,{className:`editlet-model__prompt`,children:[(0,D.jsxs)(`div`,{className:`editlet-u-row editlet-u-gap-2`,children:[(0,D.jsx)(`strong`,{id:`editlet-model-prompt-${e.id}`,className:`editlet-u-flex-1`,children:e.title}),(0,D.jsx)(pw,{text:e.text,describedBy:`editlet-model-prompt-${e.id}`})]}),(0,D.jsx)(`code`,{className:`editlet-model__prompt-text`,children:e.text})]},e.id))})})]})})}function qw({schema:e}){Lw();let t=ne(),n=nx(),{refreshError:r}=cx(),{problems:i,pending:a}=zw(e),{changes:o,updatedAt:s}=Bw(e.schema),{schema:c,schemaPath:l}=e,u=r?r instanceof bn?r.issues:[{path:``,message:r.message}]:null,d=_w(c),f=Tw(c,l,{hasProblems:i.length>0||u!==null});return(0,D.jsxs)(`section`,{className:`editlet-screen editlet-model`,children:[(0,D.jsxs)(NS,{title:`Content model`,children:[s?(0,D.jsxs)(`span`,{className:`editlet-u-text-muted editlet-u-text-sm`,children:[`Updated `,s.toLocaleTimeString()]}):null,(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void mx(t),children:`Refresh`}),(0,D.jsx)(pw,{text:JSON.stringify(c,null,2),label:`Copy schema`})]}),(0,D.jsx)(Gw,{schemaIssues:u,problems:i,pending:a}),(0,D.jsxs)(`section`,{"aria-labelledby":`editlet-model-collections`,className:`editlet-u-stack editlet-u-gap-2`,children:[(0,D.jsx)(`h2`,{id:`editlet-model-collections`,className:`editlet-model__heading`,children:`Collections`}),(0,D.jsx)(jw,{schema:c,files:n.data,removed:o?.removed??[]})]}),Object.keys(c.collections).map(e=>(0,D.jsx)(Nw,{schema:c,collectionKey:e,edges:d,changes:o,count:n.data?ux(c,n.data,e).length:void 0},e)),(0,D.jsx)(Kw,{prompts:f})]})}var Jw=new Map;function Yw(e,t){let n=e.schema.collections[t];return n?.slugFrom??n?.titleField}function Xw({collection:e,schema:t,onOpenChange:n}){let r=(0,E.useId)(),{navigate:i}=wb(),a=nx(),o=Yw(t,e),s=t.schema.collections[e],[c,l]=(0,E.useState)(``),[u,d]=(0,E.useState)(null),f=u??Cn(c),p=new Set(a.data?ux(t.schema,a.data,e).map(e=>e.slug):[]),m=f===``?void 0:Sn(f)?p.has(f)?`Slug already exists`:void 0:`Invalid slug`,h=f!==``&&m===void 0&&a.data!==void 0,g=()=>{if(!h)return;let t={};c.trim()!==``&&(s?.titleField!==void 0&&(t[s.titleField]=c),s?.slugFrom!==void 0&&(t[s.slugFrom]=c)),Jw.set(`${e}/${f}`,t),n(!1),i({kind:`entry`,collection:e,slug:f})};return(0,D.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g()},children:[(0,D.jsxs)(ny,{children:[(0,D.jsxs)(iy,{children:[`New `,s?.label??e]}),(0,D.jsx)(ay,{children:`Nothing is saved until you save the entry.`})]}),(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-3`,children:[o===void 0?null:(0,D.jsx)(sy,{label:s?.fields[o]?.label??`Title`,htmlFor:`${r}-title`,children:(0,D.jsx)(`input`,{id:`${r}-title`,className:cy,value:c,onChange:e=>l(e.target.value),autoFocus:!0})}),(0,D.jsx)(sy,{label:`Slug`,htmlFor:`${r}-slug`,error:m,children:(0,D.jsx)(`input`,{id:`${r}-slug`,className:cy,value:f,onChange:e=>d(e.target.value),spellCheck:!1,"aria-invalid":m!==void 0||void 0,"aria-describedby":oy(`${r}-slug`,void 0,m)})})]}),(0,D.jsxs)(ry,{children:[(0,D.jsx)(Z,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,D.jsx)(Z,{type:`submit`,variant:`primary`,disabled:!h,children:`Confirm`})]})]})}function Zw({open:e,onOpenChange:t,...n}){return(0,D.jsx)(ey,{open:e,onOpenChange:t,children:(0,D.jsx)(ty,{children:e?(0,D.jsx)(Xw,{...n,onOpenChange:t}):null})})}function Qw({collection:e,schema:t}){let{navigate:n}=wb(),r=dx(e),[i,a]=(0,E.useState)(!1),o=t.schema.collections[e]?.label??e;return(0,D.jsxs)(`section`,{className:`editlet-screen`,children:[(0,D.jsx)(NS,{title:o,children:(0,D.jsx)(Z,{variant:`action`,icon:(0,D.jsx)($.Plus,{}),onClick:()=>a(!0),children:`New entry`})}),r.error?(0,D.jsx)(`p`,{className:`editlet-u-text-danger`,role:`alert`,children:r.error.message}):r.data===void 0?(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading entries…`}):r.data.length===0?(0,D.jsx)(`div`,{className:`editlet-card editlet-card--empty`,children:(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,children:`No entries yet.`})}):(0,D.jsxs)(CS,{children:[(0,D.jsx)(wS,{children:(0,D.jsxs)(DS,{children:[(0,D.jsx)(OS,{children:`Title`}),(0,D.jsx)(OS,{children:`Slug`}),(0,D.jsx)(OS,{children:`Status`})]})}),(0,D.jsx)(TS,{children:r.data.map(t=>{let r={kind:`entry`,collection:e,slug:t.slug};return(0,D.jsxs)(DS,{className:`editlet-table__row--link`,onClick:e=>{e.defaultPrevented||n(r)},children:[(0,D.jsx)(kS,{children:(0,D.jsx)(tw,{to:r,className:`editlet-link`,children:t.title})}),(0,D.jsx)(kS,{className:`editlet-u-mono editlet-u-text-muted`,children:t.slug}),(0,D.jsx)(kS,{children:(0,D.jsx)(yS,{draft:t.draft,showPublished:!0,size:`sm`})})]},t.path)})})]}),(0,D.jsx)(Zw,{collection:e,schema:t,open:i,onOpenChange:a})]})}function $w({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 eT(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 tT=[],nT=0,{link:rT,unlink:iT,propagate:aT,checkDirty:oT,shallowPropagate:sT}=$w({update(e){return e._update()},notify(e){tT[lT++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,pT(e))}}),cT=0,lT=0,uT,dT=0;function fT(e){try{++dT,e()}finally{--dT||mT()}}function pT(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=iT(n,e)}function mT(){if(!(dT>0)){for(;cT<lT;){let e=tT[cT];tT[cT++]=void 0,e.notify()}cT=0,lT=0}}function hT(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 uT!==void 0&&rT(i,uT,nT),i._snapshot},subscribe(e){let t=eT(e),n={current:!1},r=gT(()=>{i.get(),n.current?(uT=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=uT,o=t?.compare??Object.is;if(n)uT=i,++nT,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{uT=a,n&&(i.flags&=-5),pT(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&oT(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&sT(e)}}else e&32&&(i.flags=e&-33);return uT!==void 0&&rT(i,uT,nT),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(aT(e),sT(e),mT())}},i}function gT(e){let t=()=>{let t=uT;uT=n,++nT,n.depsTail=void 0,n.flags=6;try{return e()}finally{uT=t,n.flags&=-5,pT(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&&oT(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,pT(this)}};return t(),n}var _T=class{constructor(e,t){this.atom=hT(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(eT(e))}},vT=class{constructor(e){this.atom=hT(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(eT(e))}};function yT(e,t){return typeof e==`function`?new vT(e):t?new _T(e,t):new _T(e)}var bT=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function xT(e,t){return new bT(e,t).maybeExecute}var ST=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{this.#c<this.#l?(this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{})):(this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop())};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e)this.debugLog(`Event bus client is disabled, not emitting event`,e,t);else if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d)this.debugLog(`Previously failed to connect, not emitting to bus`);else if(!this.#a)this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());else return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},CT=new class extends ST{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function wT(e,t){return typeof e==`function`?e(t):e}function TT(e,t){return NT(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function ET(e,t,n){let r=NT(t);function i(e){if(!r.length)return wT(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function DT(e,t){let n=NT(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var OT=46,kT=91,AT=93,jT=48,MT=57;function NT(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===kT),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===OT||s===kT||s===AT){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==jT),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==AT&&(a!==-1||s!==AT)&&(a!==s||s!==OT&&s!==kT)&&n.push(``);r=o+1,i=!0}else(s<jT||s>MT)&&(i=!1);a=s}return n.length||n.push(``),n}function PT(e){return!(Array.isArray(e)&&e.length===0)}function FT(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function IT(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var LT=e=>!!e&&typeof e==`object`&&`fields`in e;function RT(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!RT(e[i],t[i]))return!1;return!0}var zT=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},BT=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function VT(e,t){return e==null?t:{...e,...t}}for(var HT=256,UT=[],WT;HT--;)UT[HT]=(HT+256).toString(16).substring(1);function GT(){let e=0,t,n=``;if(!WT||HT+16>256){for(WT=Array(256),e=256;e--;)WT[e]=256*Math.random()|0;e=0,HT=0}for(;e<16;e++)t=WT[HT+e],n+=e===6?UT[t&15|64]:e===8?UT[t&63|128]:UT[t],e&1&&e>1&&e<11&&(n+=`-`);return HT++,n}var KT=xT(e=>CT.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function qT(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=qT(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,qT(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(qT(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=qT(e[n]));return t}function JT(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var YT=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function XT(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var ZT=(e,t)=>{let n=XT(e,t);return{form:n,fields:n}},QT={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:ZT(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:ZT(r.issues,e)}},$T=e=>!!e&&`~standard`in e,eE={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function tE(e){function t(t){let n=e.getFieldMeta(t)??eE;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>eE;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function nE(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var rE=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{KT(this)}),t=CT.on(`request-form-state`,e=>{e.payload.id===this._formId&&CT.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=CT.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=CT.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),CT.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return CT.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!RT(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!RT(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(fT(()=>{this.baseStore.setState(()=>nE(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=tE(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}CT.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=ET(t,e.instance.name,e.instance.options.defaultValue))}),nE({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return fT(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return fT(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=FT(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||YT}),r=!1,i={};return fT(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=iE(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=aE(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??eE,r=a?.[e],{newErrorValue:s,newSource:c}=zT({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=eE)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=aE(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=aE(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=IT(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||YT});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=aE(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=iE(r);s&&(i=i?{...i,...s}:s);let c=aE(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??eE,r=i?.[e],{newErrorValue:a,newSource:o}=zT({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=eE)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),fT(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid)n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),CT.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});else if(await this.validate(`submit`),!this.state.isValid)n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),CT.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});else{fT(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),fT(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),CT.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),CT.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}}},this.getFieldValue=e=>TT(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:wT(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=eE,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;fT(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:ET(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t.startsWith(`${n}.`)||t.startsWith(`${n}[`)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=DT(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),tE(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],VT(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),tE(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),VT(r,{dontValidate:!0})),tE(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),VT(n,{dontValidate:!0})),tE(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return ET(ET(e,`${t}`,i),`${n}`,r)},VT(r,{dontValidate:!0})),tE(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},VT(r,{dontValidate:!0})),tE(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],VT(t,{dontValidate:!0})),tE(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=TT(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:eE},values:i===void 0?t.values:ET(t.values,e,i)}})},this.setErrorMap=e=>{fT(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(LT(t)){let{formError:e,fieldErrors:r}=iE(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>QT.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>QT.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??GT(),this._devtoolsSubmissionOverride=!1;let t=nE({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(n!==void 0&<(n))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=yT(t);let n;this.fieldMetaDerived=yT(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=TT(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;e&&e.options.disableErrorFlat||(u=u.flat(1))}let d=!PT(u),f=!o.isDirty,p=RT(l,this.getFieldInfo(a)?.instance?.options.defaultValue??TT(this.options.defaultValues,a));c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s?(i[a]=c,r++):i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=yT(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!JT(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&JT(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];y&&y.__srcErrorMap===g||(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=yT(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];r&&t.errorMap===r.errorMap||(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&<(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&RT(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return $T(e.validate)?QT[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function iE(e){return e?LT(e)?{formError:iE(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function aE(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var oE=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...eE,isTouched:e.fieldMetaBase[this.name]?.isTouched??eE.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??eE.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??eE.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,this.state.meta.isTouched||this.options.defaultValue===void 0||RT(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0}),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,VT(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,VT(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,VT(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,VT(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,VT(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,VT(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,VT(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,VT(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=FT(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||YT}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=FT(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||YT});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;fT(()=>{let e=(e,n)=>{let r=cE(n.cause),a=n.validate?sE(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=BT({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=cE(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=IT(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||YT}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=IT(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||YT});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));fT(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=cE(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=sE(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=BT({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),fT(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>JT(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[cE(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[cE(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)(!a.get(t)||t.options.asyncAlways)&&c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>QT.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>QT.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)JT(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=yT(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...eE,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!RT(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return $T(e.validate)?QT[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function sE(e){if(e)return e}function cE(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function lE(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function uE(e){return{...eE,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var dE=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??lE({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,this.state.meta.isTouched||this.options.defaultValue===void 0||RT(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0}),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...eE,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??lE({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;pE(t)&&(n=t.group,r=t.fields);let i=fE(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:lE({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,VT(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof oE&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&JT(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=zT({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=eE)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=FT(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||YT}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=FT(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||YT});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;fT(()=>{let t=(t,r)=>{let i=hE(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&pE(s)&&(c=s.group,l=s.fields);let u=fE(c),d=n[i],{newErrorValue:f,newSource:p}=BT({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=hE(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=IT(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||YT}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=IT(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||YT});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=hE(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&pE(o)&&(l=o.group,u=o.fields);let d=fE(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=BT({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return fT(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>JT(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[hE(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>JT(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),fT(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid())n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});else if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid)n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});else{fT(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),fT(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=yT(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??uE(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!RT(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if($T(e.validate)){let t=QT[e.type](e.value,e.validate);return e.type===`validate`?mE(t):t.then(mE)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function fE(e){if(e)return e}function pE(e){return!!e&&typeof e==`object`&&`fields`in e}function mE(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function hE(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function gE(e,t){if(!t)return;let n=Object.assign({},e,{state:qT(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return fT(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var _E=t((e=>{var t=v();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,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),vE=t(((e,t)=>{t.exports=_E()})),yE=t((e=>{var t=v(),n=vE();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),bE=t(((e,t)=>{t.exports=yE()}))();function xE(e,t){return e===t}function SE(e,t=e=>e,n){let r=n?.compare??xE,i=(0,E.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,E.useCallback)(()=>e.get(),[e]);return(0,bE.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var CE=(e,t=e=>e,n)=>SE(e,t,{compare:n}),wE=typeof window<`u`?E.useLayoutEffect:E.useEffect;function TE(e){let[t,n]=(0,E.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,E.useState)(()=>new oE({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new oE({...e}),i(a),n({form:e.form,name:e.name}));let o=SE(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=SE(a.store,e=>e.meta.isTouched),c=SE(a.store,e=>e.meta.isBlurred),l=SE(a.store,e=>e.meta.isDirty),u=SE(a.store,e=>e.meta.errorMap),d=SE(a.store,e=>e.meta.errorSourceMap),f=SE(a.store,e=>e.meta.isValidating),p=(0,E.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return wE(a.mount,[a]),wE(()=>{a.update(e)}),p}var EE=(({children:e,...t})=>{let n=TE(t),r=(0,E.useMemo)(()=>wT(e,n),[e,n]);return(0,D.jsx)(D.Fragment,{children:r})});function DE(){return(0,E.useState)(()=>GT())[0]}var OE=E,kE=`19.3.1`.split(`.`)[0]===`17`?DE:OE.useId;function AE(e){let[t,n]=(0,E.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,E.useState)(()=>new dE({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new dE({...e})),n({form:e.form,name:e.name}));let a=SE(r.store,e=>e.value),o=SE(r.store,e=>e.meta.isTouched),s=SE(r.store,e=>e.meta.isBlurred),c=SE(r.store,e=>e.meta.isDirty),l=SE(r.store,e=>e.meta.errorMap),u=SE(r.store,e=>e.meta.errorSourceMap),d=SE(r.store,e=>e.meta.isValidating),f=SE(r.store,e=>e.meta.isSubmitting),p=SE(r.store,e=>e.meta.isSubmitted),m=SE(r.store,e=>e.meta.submissionAttempts),h=SE(r.store,e=>e.meta.isSubmitSuccessful),g=SE(r.store,e=>e.meta.canSubmit),_=SE(r.store,e=>e.meta.isValid),v=SE(r.store,e=>e.meta.isFieldsValid),y=SE(r.store,e=>e.meta.isFieldsValidating),b=SE(r.store,e=>e.meta.isGroupValid),x=(0,E.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return wE(r.mount,[r]),wE(()=>{r.update(e)}),x}var jE=(({children:e,...t})=>{let n=AE(t),r=(0,E.useMemo)(()=>wT(e,n),[e,n]);return(0,D.jsx)(D.Fragment,{children:r})});function ME({form:e,selector:t=e=>e,children:n}){let r=SE(e.store,t);return(0,D.jsx)(D.Fragment,{children:wT(n,r)})}function NE(e){let t=kE(),[n,r]=(0,E.useState)(e?.formId),[i,a]=(0,E.useState)(()=>new rE({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new rE({...e,formId:n})),r(n)}let o=(0,E.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,D.jsx)(EE,{...e,form:i})},e.FormGroup=function(e){return(0,D.jsx)(jE,{...e,form:i})},e.Subscribe=function(e){return(0,D.jsx)(ME,{form:i,selector:e.selector,children:e.children})},e},[i]);wE(i.mount,[]),wE(()=>{i.update(e)});let s=(0,E.useRef)(!1);return wE(()=>{s.current&&e?.transform&&gE(i,e.transform)},[i,e?.transform]),wE(()=>{s.current=!0}),o}var PE=`/__editlet`,FE=6e4,IE=60*FE,LE=24*IE,RE=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,year:`numeric`});function zE(e,t=Date.now()){let n=Date.parse(e);if(Number.isNaN(n))return``;let r=t-n;return r<FE?`just now`:r<IE?`${Math.floor(r/FE)}m ago`:r<LE?`${Math.floor(r/IE)}h ago`:r<7*LE?`${Math.floor(r/LE)}d ago`:RE.format(n)}function BE(e,t){let n=by(),r=Py();return xt({queryKey:[`file-history`,xy(n),e,t],enabled:t!==null,retry:!1,queryFn:async()=>{if(r)return r.source.history(e);let t=await fetch(`${PE}/history?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`history: ${t.status}`);return await t.json()}})}function VE({actor:e}){let t=(e.login??e.name).slice(0,1).toUpperCase();return e.avatarUrl?(0,D.jsx)(`img`,{className:`editlet-meta__avatar`,src:e.avatarUrl,alt:``,width:20,height:20}):(0,D.jsx)(`span`,{className:`editlet-meta__avatar editlet-meta__avatar--initial`,"aria-hidden":`true`,children:t})}function HE(e){if(e.login)return e.login;let[t,...n]=e.name.trim().split(/\s+/),r=n.at(-1);return r?`${t} ${r.slice(0,1)}`:e.name}function UE({date:e}){return(0,D.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:zE(e)})}function WE({event:e}){return(0,D.jsxs)(`span`,{className:`editlet-meta__who`,children:[(0,D.jsx)(VE,{actor:e.actor}),(0,D.jsx)(`span`,{title:e.actor.name,children:HE(e.actor)}),(0,D.jsx)(UE,{date:e.date})]})}function GE({path:e,version:t}){let n=Py(),r=Fy(),{updated:i,created:a,commits:o}=BE(e,t).data??{updated:null,created:null,commits:0},s=n&&!n.onBase?r.data?.find(e=>e.name===n.active)?.pullRequest:null,c=n?`https://github.com/${n.config.owner}/${n.config.repo}/commits/${n.active}/${e}`:null;return(0,D.jsxs)(`details`,{className:`editlet-meta`,children:[(0,D.jsxs)(`summary`,{className:`editlet-meta__summary`,children:[(0,D.jsx)($.ChevronRight,{size:14,className:`editlet-meta__chevron`}),(0,D.jsx)(`span`,{className:`editlet-meta__title`,children:`Meta`}),i?(0,D.jsxs)(`span`,{className:`editlet-meta__hint`,children:[`Updated `,(0,D.jsx)(UE,{date:i.date}),` by `,HE(i.actor)]}):null]}),(0,D.jsxs)(`dl`,{className:`editlet-meta__list`,children:[(0,D.jsx)(`dt`,{children:`File`}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{className:`editlet-meta__file`,children:e})}),t===null?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Status`}),(0,D.jsx)(`dd`,{children:`Not saved yet`})]}):null,i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Updated`}),(0,D.jsxs)(`dd`,{children:[(0,D.jsx)(WE,{event:i}),s?(0,D.jsxs)(`a`,{className:`editlet-link`,href:s.url,target:`_blank`,rel:`noreferrer`,children:[`PR #`,s.number,` `,(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}):null]})]}):null,a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Created`}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(WE,{event:a})})]}):null,o>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Commits`}),(0,D.jsxs)(`dd`,{children:[o,c?(0,D.jsxs)(`a`,{className:`editlet-link`,href:c,target:`_blank`,rel:`noreferrer`,children:[`View history `,(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}):null]})]}):null]})]})}var KE=e=>{throw new bn([{path:``,message:e}])};function qE(e,t,n){let r=n.indexOf(`/`),i=n.slice(0,r),a=n.slice(r+1);return Object.hasOwn(e.collections,i)||KE(`Unknown collection "${i}"`),t.find(e=>e.collection===i&&e.slug===a)??KE(`Entry not found: ${n}`)}function JE(e,t,n,r,i){let a=qE(e,t,r),{collection:o,slug:s}=a;e.collections[o].singleton&&KE(`A singleton cannot be renamed: its slug is always "index"`),Sn(i)||KE(`Invalid slug "${i}": use lowercase letters, digits and single hyphens`),i===s&&KE(`The new slug is the same as the old one`);let c=Tn(e,o,s),l=Tn(e,o,i),u=`${e.contentDir}/${o}/${s}/`,d=`${e.contentDir}/${o}/${i}/`,f=[...n];f.some(e=>e===l||e.startsWith(d))&&KE(`${o}/${i} is taken`);let p=f.filter(e=>e.startsWith(u)).map(e=>({from:e,to:d+e.slice(u.length)})),m=new Map(p.map(e=>[e.from,e.to])),h=jn(o,i),g=[];for(let n of t){let t=n===a,i=t?l:Tn(e,n.collection,n.slug),o=e.collections[n.collection];if(!o)continue;let s=t?[`renamed`]:[],u=[],d=n.data,f=Bb(o,d,r,h);f&&(d=f,s.push(`references`),u.push({from:r,to:h}));let p=mC(e,o,t?c:i,d,n.body).flatMap(e=>{let t=e.path===null?void 0:m.get(e.path);return t===void 0?[]:[{use:e,src:An(i,t)}]}),_=n.body;if(p.length>0){({data:d,body:_}=CC(d,_,p)),s.push(`images`);for(let{use:e,src:t}of p)u.some(t=>t.from===e.src)||u.push({from:e.src,to:t})}s.length>0&&g.push({entry:n,path:i,data:d,body:_,reasons:s,replacements:u})}return g.sort((e,t)=>Number(t.entry===a)-Number(e.entry===a)),{from:r,to:h,write:g,remove:[c],move:p}}function YE(e,t,n){let r=qE(e,t,n),i=[];for(let a of t){if(a===r)continue;let t=e.collections[a.collection],o=t?Bb(t,a.data,n,null):null;if(o){let t=Tn(e,a.collection,a.slug);i.push({entry:a,path:t,data:o,body:a.body,reasons:[`references`],replacements:[{from:n,to:null}]})}}return{ref:n,write:i,remove:[Tn(e,r.collection,r.slug)]}}function XE(e,t){let{schema:n,self:r,referrers:i,files:a}=e;try{return{plan:JE(n,[r,...i.map(e=>e.entry).filter(e=>e.path!==r.path)],a,`${r.collection}/${r.slug}`,t)}}catch(e){if(e instanceof bn)return{error:e.issues[0]?.message??e.message};throw e}}function ZE(e){let{open:t,onOpenChange:n,self:r,pending:i,blocked:a,onConfirm:o,children:s}=e,c=(0,E.useId)(),[l,u]=(0,E.useState)(r.slug),d=(0,E.useMemo)(()=>l===r.slug?null:XE(e,l),[e,l,r.slug]),f=d&&`plan`in d?d.plan:null,p=d&&`error`in d?d.error:void 0,m=f?f.write.filter(e=>e.entry.path!==r.path):[];return(0,D.jsxs)(mS,{open:t,onOpenChange:e=>{e||u(r.slug),n(e)},title:`Rename ${r.collection}/${r.slug}`,description:`The slug is the file name and the page URL. Links to the old URL on the site or elsewhere stop working.`,confirmLabel:`Rename`,pending:i,confirmDisabled:a||f===null,onConfirm:()=>f&&o(f),children:[(0,D.jsx)(sy,{label:`New slug`,htmlFor:c,error:p,describedById:c,children:(0,D.jsx)(`input`,{id:c,className:cy,value:l,autoComplete:`off`,spellCheck:!1,"aria-invalid":p?!0:void 0,"aria-describedby":p?`${c}-error`:void 0,onChange:e=>u(e.target.value.trim())})}),f?(0,D.jsxs)(`ul`,{className:`editlet-rename__plan`,"aria-label":`Rename plan`,children:[(0,D.jsxs)(`li`,{children:[r.path,` → `,f.write[0].path]}),f.move.length>0?(0,D.jsxs)(`li`,{children:[`Moves `,f.move.length,` `,f.move.length===1?`file`:`files`,` to`,` `,f.move[0].to.slice(0,f.move[0].to.lastIndexOf(`/`)+1)]}):null,m.map(e=>(0,D.jsxs)(`li`,{children:[`Updates `,e.entry.collection,`/`,e.entry.slug,` (`,e.reasons.join(`, `),`)`]},e.path))]}):null,s]})}function QE(e,t){let n=e.collections[t.ref.slice(0,t.ref.indexOf(`/`))];return t.fields.map(e=>n?.fields[e]?.label??e).join(`, `)}function $E({schema:e,items:t}){return(0,D.jsx)(`ul`,{className:`editlet-used-by__list`,children:t.map(t=>(0,D.jsxs)(`li`,{className:`editlet-used-by__item`,children:[(0,D.jsx)(tw,{to:t.ref,className:`editlet-used-by__link`,children:t.title}),(0,D.jsxs)(`span`,{className:`editlet-u-text-muted editlet-u-text-xs`,children:[t.ref,` · via `,QE(e,t)]})]},t.ref))})}function eD({schema:e,items:t}){let n=(0,E.useId)();return!t||t.length===0?null:(0,D.jsxs)(`section`,{className:`editlet-used-by`,"aria-labelledby":n,children:[(0,D.jsxs)(`h2`,{id:n,className:`editlet-used-by__title`,children:[`Used by `,t.length,` `,t.length===1?`entry`:`entries`]}),(0,D.jsx)($E,{schema:e,items:t})]})}function tD(e,t){return t.write.map(t=>({path:t.path,content:tb(e.collections[t.entry.collection],t.data,t.body,t.entry.keyOrder),sha:t.path===t.entry.path?t.entry.sha:null}))}async function nD(e,t,n,r){let i=[];for(let{from:e,to:a}of t.move)i.push({path:a,content:await n(e),sha:null},{path:e,content:null,sha:r(e)});return[...tD(e,t),...t.remove.map(e=>({path:e,content:null,sha:r(e)})),...i]}function rD(e,t,n){return[...t.remove.map(e=>({path:e,content:null,sha:n(e)})),...tD(e,t)]}function iD(e,t){return t.write.flatMap(({entry:t,data:n,body:r})=>Bg(e,{collection:t.collection,slug:t.slug,data:n,body:r}).map(e=>`${t.collection}/${t.slug}: ${e.path?`${e.path} — `:``}${e.message}`))}function aD(e){return e&&e.length>0?e.join(`; `):void 0}function oD(e){return e&&e.length>0?!0:void 0}function sD(e,t,n){return{label:e.label,hint:e.hint,required:e.required,error:aD(t),describedById:n}}function cD(e,t,n){return oy(e,t.hint,aD(n))}var lD=e=>typeof e==`string`?e:e==null?``:String(e),uD=e=>Array.isArray(e)?e.map(e=>String(e)):[],dD=`Yes`,fD=`No`;function pD({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let o=t.type===`boolean`&&t.labels?t.labels:{true:dD,false:fD},s=(e,t)=>{let a=n===e;return(0,D.jsx)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>r(e),onBlur:i,className:Dv(`editlet-ff-boolean__seg`,a?`editlet-ff-boolean__seg--active`:`editlet-ff-boolean__seg--inactive`),children:t})};return(0,D.jsx)(sy,{...sD(t,a,e),children:(0,D.jsxs)(`div`,{id:e,className:`editlet-ff-boolean__track`,role:`group`,"aria-label":t.label,"aria-describedby":cD(e,t,a),children:[s(!0,o.true),s(!1,o.false)]})})}var mD=`#000000`,hD=/^#[0-9a-f]{6}$/i;function gD({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsxs)(`div`,{className:`editlet-ff-color__row`,children:[(0,D.jsx)(`input`,{type:`color`,className:`editlet-ff-color__picker`,value:hD.test(n)?n.toLowerCase():mD,onChange:e=>r(e.target.value.toLowerCase()),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-required":t.required||void 0,"aria-label":`${t.label} color picker`}),(0,D.jsx)(`div`,{className:`editlet-ff-color__input-wrap`,children:(0,D.jsx)(`input`,{id:e,type:`text`,name:e,className:Dv(cy,`editlet-ff-color__hex-input`),value:n,onChange:e=>r(e.target.value),onBlur:i,placeholder:`#aabbcc`,spellCheck:!1,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0})})]})})}var _D=/^(\d{4})-(\d{2})-(\d{2})$/,vD=/^\d{4}-\d{2}-\d{2}T/,yD=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),bD=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}),xD=e=>String(e).padStart(2,`0`);function SD(e,t){if(t){let t=_D.exec(e);if(!t)return;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return n.getMonth()===Number(t[2])-1?n:void 0}if(!vD.test(e))return;let n=new Date(e);return Number.isNaN(n.getTime())?void 0:n}function CD(e,t){let n=SD(e,t);return n?(t?yD:bD).format(n):e}function wD(e,t){let n=`${e.getFullYear()}-${xD(e.getMonth()+1)}-${xD(e.getDate())}`;return t?n:`${n}T${xD(e.getHours())}:${xD(e.getMinutes())}`}function TD(e,t){if(e===``||t)return e;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toISOString().replace(`.000Z`,`Z`)}function ED({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let o=t.type===`datetime`&&t.dateOnly===!0,s=(0,E.useRef)(null),c=SD(n,o),l=()=>{try{s.current?.showPicker()}catch{}};return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsxs)(`div`,{className:`editlet-input editlet-input--affixed editlet-ff-datetime`,onClick:l,children:[(0,D.jsx)(`input`,{id:e,className:`editlet-input__inner`,type:`text`,name:e,readOnly:!0,value:CD(n,o),placeholder:o?`Select a date`:`Select a date and time`,onKeyDown:e=>{e.key===`Enter`||e.key===` `||e.key===`ArrowDown`?(e.preventDefault(),l()):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r(``))},onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0}),(0,D.jsx)(`span`,{className:`editlet-input__affix`,"aria-hidden":`true`,children:(0,D.jsx)($.Calendar,{size:16})}),(0,D.jsx)(`input`,{ref:s,className:`editlet-ff-datetime__picker`,type:o?`date`:`datetime-local`,tabIndex:-1,"aria-hidden":`true`,value:c?wD(c,o):``,onChange:e=>r(TD(e.target.value,o))})]})})}function DD({images:e,entryFolder:t,Preview:n,onPick:r,onUpload:i,uploading:a}){let o=(0,E.useRef)(null),s=e.filter(e=>e.startsWith(`${t}/`)),[c,l]=(0,E.useState)(s.length>0?`entry`:`all`),[u,d]=(0,E.useState)(``),f=u.trim().toLowerCase(),p=(c===`entry`?s:e).filter(e=>e.toLowerCase().includes(f));return(0,D.jsxs)(`div`,{className:`editlet-media-picker`,children:[(0,D.jsxs)(`div`,{className:`editlet-media-picker__toolbar`,children:[(0,D.jsx)(`input`,{type:`search`,className:cy,placeholder:`Search images…`,"aria-label":`Search images`,value:u,onChange:e=>d(e.target.value)}),(0,D.jsxs)(xS,{"aria-label":`Which images`,children:[(0,D.jsxs)(SS,{active:c===`entry`,onClick:()=>l(`entry`),children:[`This entry (`,s.length,`)`]}),(0,D.jsxs)(SS,{active:c===`all`,onClick:()=>l(`all`),children:[`All (`,e.length,`)`]})]}),i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Upload,{size:14}),disabled:a,onClick:()=>o.current?.click(),children:`Upload`}),(0,D.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,className:`editlet-u-hidden`,"data-testid":`media-picker-file`,"aria-label":`Image file to upload`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&i(t)}})]}):null]}),p.length===0?(0,D.jsx)(`p`,{className:`editlet-ff-image__none`,children:e.length===0?`No images under the content folder yet.`:f===``?`This entry has no images of its own yet.`:`No images match the search.`}):(0,D.jsx)(`div`,{className:`editlet-media-grid editlet-media-grid--auto`,children:p.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`editlet-media-grid__card`,title:e,onClick:()=>r(e),children:[(0,D.jsx)(RC,{children:(0,D.jsx)(n,{path:e,alt:``})}),(0,D.jsxs)(`div`,{className:`editlet-media-grid__info`,children:[(0,D.jsx)(`div`,{className:`editlet-media-grid__name`,children:e.slice(e.lastIndexOf(`/`)+1)}),(0,D.jsx)(`div`,{className:`editlet-media-grid__meta`,children:e})]})]},e))})]})}var OD={src:``,alt:``},kD=e=>e.split(`/`).pop()||e,AD=e=>Array.from(e.dataTransfer?.types??[]).includes(`Files`);function jD({name:e,field:t,value:n,onChange:r,onBlur:i,error:a,ctx:o}){let s=(0,E.useRef)(null),c=(0,E.useRef)(n);c.current=n;let[l,u]=(0,E.useState)(null),[d,f]=(0,E.useState)(!1),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(!1),[_,v]=(0,E.useState)(!1),y=(0,E.useRef)(0),b=o.Preview,x=n.src===``?null:o.resolveSrc(n.src),S=`${e}-alt`,C=async e=>{u(null),f(!0);try{r({src:await o.stageUpload(e),alt:c.current.alt})}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}},w={onDragEnter(e){AD(e)&&(e.preventDefault(),y.current+=1,v(!0))},onDragOver(e){AD(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},onDragLeave(e){AD(e)&&(y.current=Math.max(0,y.current-1),y.current===0&&v(!1))},onDrop(e){if(!AD(e))return;e.preventDefault(),y.current=0,v(!1);let t=e.dataTransfer.files[0];t&&!d&&C(t)}};return(0,D.jsxs)(sy,{...sD(t,a,e),children:[(0,D.jsxs)(`div`,{className:`editlet-ff-image__body`,"data-dragging":_?`true`:void 0,...w,children:[n.src===``?(0,D.jsxs)(`div`,{className:`editlet-ff-image__empty`,children:[(0,D.jsx)($.Image,{size:28}),(0,D.jsx)(`span`,{children:`Drop an image here`})]}):(0,D.jsx)(`div`,{className:`editlet-ff-image__preview`,children:(0,D.jsx)(b,{path:x,alt:n.alt,openable:!0})}),(0,D.jsxs)(`div`,{className:`editlet-ff-image__actions`,children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Upload,{size:14}),disabled:d,onClick:()=>s.current?.click(),children:`Upload`}),(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Image,{size:14}),onClick:()=>m(!0),children:`Gallery`}),n.src!==``||n.alt!==``?(0,D.jsx)(Z,{variant:`outline`,size:`sm`,iconOnly:!0,className:`editlet-ff-image__remove`,"aria-label":`Remove image`,title:`Remove image`,onClick:()=>g(!0),children:(0,D.jsx)($.Trash,{size:16})}):null,n.src===``?null:(0,D.jsx)(`code`,{className:`editlet-ff-image__meta`,title:n.src,children:kD(n.src)})]})]}),(0,D.jsxs)(`div`,{className:`editlet-ff-image__alt`,children:[(0,D.jsx)(`label`,{htmlFor:S,className:`editlet-ff-image__alt-label`,children:`Alt text`}),(0,D.jsx)(`input`,{id:S,className:cy,type:`text`,value:n.alt,placeholder:`Describe the image for screen readers`,"aria-label":`${t.label} alt text`,onChange:e=>r({src:n.src,alt:e.target.value}),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a)})]}),l?(0,D.jsxs)(`div`,{className:`editlet-field__error`,role:`alert`,children:[(0,D.jsx)($.X,{size:11}),l]}):null,(0,D.jsx)(`input`,{ref:s,type:`file`,accept:`image/*`,className:`editlet-u-hidden`,"data-testid":`${e}-file`,"aria-label":`${t.label}: file to upload`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&C(t)}}),(0,D.jsx)(mS,{open:h,onOpenChange:g,title:`Remove image?`,description:`The image and its alt text are cleared from this entry. Image files in the repository are not deleted.`,confirmLabel:`Remove`,onConfirm:()=>r(OD)}),(0,D.jsx)(ey,{open:p,onOpenChange:m,children:(0,D.jsxs)(ty,{className:`editlet-ff-image__dialog`,children:[(0,D.jsx)(ny,{children:(0,D.jsx)(iy,{children:`Gallery`})}),(0,D.jsx)(DD,{images:o.images,entryFolder:o.entryPath.replace(/\.md$/,``),Preview:b,uploading:d,onPick:e=>{r({src:o.toSrc(e),alt:n.alt}),m(!1)},onUpload:e=>{m(!1),C(e)}})]})})]})}function MD(e){let t=e.trim();if(t===``)return`empty`;try{return JSON.parse(t),`valid`}catch{return`invalid`}}function ND({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let o=MD(n);return(0,D.jsxs)(sy,{...sD(t,a,e),htmlFor:e,children:[(0,D.jsx)(`textarea`,{id:e,className:Dv(ly,`editlet-ff-json__textarea`,oD(a)&&`editlet-textarea--error`),name:e,value:n,onChange:e=>r(e.target.value),onBlur:i,spellCheck:!1,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0}),(0,D.jsx)(`div`,{className:Dv(`editlet-ff-json__status`,`editlet-ff-json__status--${o}`),children:o===`empty`?t.required?`Enter JSON…`:`Optional — leave empty for no value`:o===`valid`?`Valid JSON`:`Invalid JSON`})]})}var PD=`modulepreload`,FD=function(e,t){return new URL(e,t).href},ID={},LD=function(e){return e.pathname.endsWith(`.css`)},RD=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},zD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=FD(t,n);let r=s(t),i=LD(r);return RD(ID,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:PD,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},BD=new Set([`paragraph`,`heading`,`code`,`listItem`,`tableCell`,`blockquote`,`thematicBreak`,`html`]);function VD(e,t,n,r){let i=[],a=t;for(let t of r){let r=e.indexOf(t,a);r!==-1&&r<n?(i.push(r),a=r+1):i.push(Math.min(a,n-1))}return i}async function HD(e){let[{fromMarkdown:t},{gfm:n},{gfmFromMarkdown:r}]=await Promise.all([zD(()=>import(`./mdast-util-from-markdown-C79q1_d8.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4]),import.meta.url),zD(()=>import(`./micromark-extension-gfm-Wz6-oszS.js`).then(e=>e.n),__vite__mapDeps([5,1,3,4]),import.meta.url),zD(()=>import(`./mdast-util-gfm-cM-_xFJE.js`).then(e=>e.t),__vite__mapDeps([6,1,4,2]),import.meta.url)]),i=t(e,{extensions:[n()],mdastExtensions:[r()]}),a=``,o=[],s=t=>{BD.has(t.type)&&a!==``&&!a.endsWith(`
|
|
253
|
+
`)&&(a+=`
|
|
254
|
+
`,o.push(t.position?.start.offset??o.at(-1)??0));let n=t.position?.start.offset,r=t.position?.end.offset;if((t.type===`text`||t.type===`inlineCode`||t.type===`code`)&&t.value!==void 0){if(n===void 0||r===void 0)return;let i=t.type===`code`&&/^\s*(`{3,}|~{3,})/.test(e.slice(n))?e.indexOf(`
|
|
255
|
+
`,n)+1:n;a+=t.value,o.push(...VD(e,i,r,t.value))}else for(let e of t.children??[])s(e)};return s(i),{text:a,at:o}}function UD(e){let t=``,n=[];return e.descendants((e,r)=>{if(e.isTextblock&&t!==``&&!t.endsWith(`
|
|
256
|
+
`)&&(t+=`
|
|
257
|
+
`,n.push(r)),e.isText&&e.text){for(let t=0;t<e.text.length;t++)n.push(r+t);t+=e.text}return!0}),{text:t,at:n}}function WD(e,t,n){e.focus({preventScroll:!0}),e.setSelectionRange(t,n),e.scrollIntoView?.({block:`center`,behavior:`smooth`})}var GD=(0,E.lazy)(()=>zD(()=>import(`./RichEditor-IZKdt6MK.js`),__vite__mapDeps([7,1,0,2,3,4,6,5,8]),import.meta.url)),KD=`editlet:markdown-mode`;function qD(){try{return globalThis.localStorage?.getItem(KD)===`source`?`source`:`rich`}catch{return`rich`}}function JD(e){try{globalThis.localStorage?.setItem(KD,e)}catch{}}function YD({name:e,field:t,value:n,onChange:r,onBlur:i,error:a,ctx:o}){let[s,c]=(0,E.useState)(qD),[l,u]=(0,E.useState)(null),d=s===`rich`&&l===null,f=(0,E.useRef)(null),p=(0,E.useRef)(null);(0,E.useEffect)(()=>(o.selectTarget?.(e,async()=>{if(d)return p.current?.()??null;let e=f.current;if(!e)return null;let{text:t,at:n}=await HD(e.value);return{text:t,select:(t,r)=>WD(e,n[t],n[r-1]+1)}}),()=>o.selectTarget?.(e,null)),[o,e,d]);let m=e=>{c(e),u(null),JD(e)},h=(0,D.jsx)(`textarea`,{ref:f,id:e,className:Dv(ly,`editlet-ff-markdown__textarea`,oD(a)&&`editlet-textarea--error`),name:e,rows:16,value:n,spellCheck:!1,onChange:e=>r(e.target.value),onBlur:i,"aria-label":t.label,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-required":t.required||void 0});return(0,D.jsxs)(sy,{...sD(t,a,e),htmlFor:d?void 0:e,className:`editlet-ff-markdown`,children:[(0,D.jsxs)(xS,{className:`editlet-ff-markdown__mode`,"aria-label":`Editor mode`,children:[(0,D.jsx)(SS,{active:d,onClick:()=>m(`rich`),children:`Rich`}),(0,D.jsx)(SS,{active:!d,onClick:()=>m(`source`),children:`Source`})]}),l?(0,D.jsx)(`p`,{className:`editlet-ff-markdown__note`,role:`status`,children:l}):null,d?(0,D.jsx)(E.Suspense,{fallback:h,children:(0,D.jsx)(GD,{value:n,onChange:r,onBlur:i,ctx:o,label:t.label,describedBy:cD(e,t,a),invalid:oD(a),onFallback:u,onSelectTarget:e=>{p.current=e}})}):h]})}function XD({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let o=t.type===`number`?t:void 0,s=o?.step??(o?.integer?1:`any`),c=n.trim()===``||Number.isFinite(Number(n));return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsx)(`input`,{id:e,className:cy,type:c?`number`:`text`,name:e,value:n,min:o?.min,max:o?.max,step:s,onChange:e=>r(e.target.value),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0})})}function ZD(e){let t={};for(let n of e??[]){let e=/^([A-Za-z0-9]+)(?:\.([^\s:]+))?: ([^]*)$/.exec(n),r=e?e[1]:``,i=e?e[2]?`${e[2]}: ${e[3]}`:e[3]:n;(t[r]??=[]).push(i)}return t}var QD=e=>({...e,selectTarget:void 0});function $D(e){let{name:t,fields:n,value:r,onChange:i,errors:a,ctx:o}=e;return(0,D.jsx)(`div`,{className:`editlet-ff-object__fields`,children:Object.entries(n).map(([e,n])=>(0,D.jsx)(DO,{name:`${t}.${e}`,field:n,value:r[e],onChange:t=>i({...r,[e]:t}),error:a[e],ctx:o},e))})}function eO(e){let{name:t,field:n,own:r,children:i,actions:a}=e,o=aD(r);return(0,D.jsxs)(`fieldset`,{className:`editlet-field editlet-ff-object`,"aria-describedby":o?`${t}-error`:void 0,children:[(0,D.jsxs)(`legend`,{className:`editlet-ff-object__legend`,children:[(0,D.jsxs)(`span`,{className:`editlet-field__label`,children:[n.label,n.required?(0,D.jsx)(`span`,{className:`editlet-field__required`,children:`*`}):null]}),n.hint?(0,D.jsx)(`span`,{className:`editlet-field__hint`,children:n.hint}):null]}),i,a,o?(0,D.jsxs)(`div`,{id:`${t}-error`,className:`editlet-field__error`,role:`alert`,children:[(0,D.jsx)($.X,{size:11}),o]}):null]})}var tO=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function nO({name:e,field:t,value:n,onChange:r,error:i,ctx:a}){if(t.type!==`object`)return null;let o=ZD(i);return(0,D.jsx)(eO,{name:e,field:t,own:o[``],children:(0,D.jsx)($D,{name:e,fields:t.fields,value:n,onChange:r,errors:o,ctx:QD(a)})})}function rO(e,t){for(let[n,r]of Object.entries(e)){let e=t[n];if((r.type===`string`||r.type===`text`)&&typeof e==`string`&&e.trim()!==``)return e.trim()}}function iO(e){let{name:t,field:n,value:r,onChange:i,error:a,ctx:o,kindOf:s,add:c}=e,l=ZD(a),u=(e,t)=>{let n=[...r],[a]=n.splice(e,1);n.splice(t,0,a),i(n)};return(0,D.jsx)(eO,{name:t,field:n,own:l[``],actions:c,children:r.length>0?(0,D.jsx)(`ol`,{className:`editlet-ff-items`,"aria-label":`${n.label} items`,children:r.map((e,n)=>{let a=tO(e),c=s(a),d=c?rO(c.fields,a):void 0,f=[c?.label??`Unknown ${String(a.block??`item`)}`,d].filter(Boolean).join(` · `),p=typeof a.__key==`string`?a[zy]:`at-${n}`,m=ZD(l[String(n)]);return(0,D.jsxs)(`li`,{className:`editlet-ff-items__item`,"aria-label":`${n+1}. ${f}`,children:[(0,D.jsxs)(`div`,{className:`editlet-ff-items__head`,children:[(0,D.jsxs)(`span`,{className:`editlet-ff-items__title`,children:[(0,D.jsx)(`span`,{className:`editlet-ff-items__index`,children:n+1}),f]}),(0,D.jsxs)(`span`,{className:`editlet-ff-items__actions`,children:[(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":`Move ${f} up`,title:`Move up`,disabled:n===0,onClick:()=>u(n,n-1),children:(0,D.jsx)($.ChevronDown,{size:14,className:`editlet-ff-items__up`})}),(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":`Move ${f} down`,title:`Move down`,disabled:n===r.length-1,onClick:()=>u(n,n+1),children:(0,D.jsx)($.ChevronDown,{size:14})}),(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":`Remove ${f}`,title:`Remove`,onClick:()=>i(r.filter((e,t)=>t!==n)),children:(0,D.jsx)($.Trash,{size:14})})]})]}),m[``]?(0,D.jsxs)(`div`,{className:`editlet-field__error`,role:`alert`,children:[(0,D.jsx)($.X,{size:11}),aD(m[``])]}):null,c?(0,D.jsx)($D,{name:`${t}.${n}`,fields:c.fields,value:a,onChange:e=>i(r.map((t,r)=>r===n?e:t)),errors:m,ctx:QD(o)}):null]},p)})}):null})}var aO=(e,t)=>(e.type===`object`||e.type===`blocks`)&&e.max!==void 0&&t>=e.max;function oO(e){let{field:t,value:n,onChange:r}=e;if(t.type!==`object`)return null;let i=(0,D.jsxs)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Plus,{size:14}),disabled:aO(t,n.length),onClick:()=>r([...n,Xy(t)]),children:[`Add `,t.label.toLowerCase(),` item`]});return(0,D.jsx)(iO,{...e,kindOf:()=>({label:`Item`,fields:t.fields}),add:i})}function sO(e){let{field:t,value:n,onChange:r}=e,i=(0,E.useId)(),[a,o]=(0,E.useState)(!1);if(t.type!==`blocks`)return null;let s=aO(t,n.length),c=(0,D.jsxs)(`div`,{className:`editlet-ff-blocks__add`,children:[(0,D.jsx)(Z,{variant:`outline`,size:`sm`,icon:(0,D.jsx)($.Plus,{size:14}),disabled:s,"aria-expanded":a&&!s,"aria-controls":i,onClick:()=>o(!a),children:`Add block`}),a&&!s?(0,D.jsx)(`div`,{id:i,className:`editlet-ff-blocks__kinds`,role:`group`,"aria-label":`${t.label}: block kinds`,children:Object.entries(t.blocks).map(([e,i])=>(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,"data-block":e,onClick:()=>{o(!1),r([...n,Xy(t,e)])},children:i.label},e))}):null]});return(0,D.jsx)(iO,{...e,kindOf:e=>{let n=e[Md];return typeof n==`string`&&Object.hasOwn(t.blocks,n)?t.blocks[n]:void 0},add:c})}function cO(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>{let t=`${e.label} ${e.hint??``}`.toLowerCase();return n.every(e=>t.includes(e))})}function lO({id:e,options:t,display:n,onSelect:r,onBlur:i,placeholder:a,disabled:o,invalid:s,describedBy:c,label:l,required:u}){let d=(0,E.useId)(),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(null),[g,_]=(0,E.useState)(0),v=(0,E.useMemo)(()=>cO(t,m??``),[t,m]),y=Math.min(g,v.length-1),b=e=>`${d}-${e}`,x=()=>{p(!1),h(null),_(0)},S=e=>{e&&(r(e.value),x())};return(0,D.jsxs)(`div`,{className:`editlet-ff-combobox`,children:[(0,D.jsx)(`input`,{id:e,type:`text`,role:`combobox`,autoComplete:`off`,className:cy,value:m??n,placeholder:a,disabled:o,"aria-expanded":f,"aria-controls":d,"aria-autocomplete":`list`,"aria-activedescendant":f&&y>=0?b(y):void 0,"aria-invalid":s,"aria-describedby":c,"aria-label":l,"aria-required":u||void 0,onFocus:e=>{e.currentTarget.select(),p(!0)},onClick:()=>p(!0),onChange:e=>{h(e.target.value),_(0),p(!0)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!f)return p(!0);let t=e.key===`ArrowDown`?1:-1;_((Math.max(y,0)+t+v.length)%Math.max(v.length,1))}else if(e.key===`Enter`){if(!f)return;e.preventDefault(),S(v[y])}else e.key===`Escape`&&f&&(e.preventDefault(),e.stopPropagation(),x())},onBlur:()=>{x(),i?.()}}),(0,D.jsxs)(`div`,{id:d,role:`listbox`,"aria-label":l,className:`editlet-ff-combobox__list`,hidden:!f,children:[v.map((e,t)=>(0,D.jsxs)(`div`,{id:b(t),role:`option`,"aria-selected":t===y,className:`editlet-ff-combobox__option${t===y?` editlet-ff-combobox__option--active`:``}`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(e),onMouseEnter:()=>_(t),children:[(0,D.jsx)(`span`,{className:`editlet-ff-combobox__label`,children:e.label}),e.hint?(0,D.jsx)(`span`,{className:`editlet-ff-combobox__hint`,children:e.hint}):null]},e.value)),v.length===0?(0,D.jsx)(`p`,{className:`editlet-ff-combobox__empty`,children:`No matching entries`}):null]})]})}var uO=e=>`Referenced entry not found: ${e}`;function dO(e){return e.field.type===`reference`?e.ctx.entries(e.field.collections):[]}var fO=e=>({value:e.ref,label:e.title,hint:e.ref});function pO(e,t){return e.ctx.entriesPending||t.length===0?e.error:[...new Set([...e.error??[],...t.map(uO)])]}function mO(e){let{name:t,field:n,value:r,onChange:i,onBlur:a}=e,o=dO(e),s=o.find(e=>e.ref===r),c=r!==``&&s===void 0,l=pO(e,c?[r]:[]),{EntryLink:u}=e.ctx,d=s?.title??(c&&!e.ctx.entriesPending?`Not found: ${r}`:r);return(0,D.jsx)(sy,{...sD(n,l,t),htmlFor:t,children:(0,D.jsxs)(`div`,{className:`editlet-ff-reference__row`,children:[(0,D.jsx)(lO,{id:t,options:o.map(fO),display:d,onSelect:i,onBlur:a,placeholder:`Search entries…`,invalid:oD(l),describedBy:cD(t,n,l),label:n.label,required:n.required}),r===``?null:(0,D.jsx)(Z,{variant:`ghost`,iconOnly:!0,className:`editlet-ff-reference__clear`,"aria-label":`Clear ${n.label}`,title:`Clear`,onClick:()=>i(``),children:(0,D.jsx)($.X,{size:14})}),s&&u?(0,D.jsxs)(u,{to:s.ref,className:Ov({variant:`outline`,className:`editlet-ff-reference__open`}),"aria-label":`Open ${s.title}`,title:`Open ${s.ref}`,children:[`Open`,(0,D.jsx)($.ChevronRight,{size:14})]}):null]})})}function hO(e){let{name:t,field:n,value:r,onChange:i,onBlur:a}=e,o=dO(e),s=new Map(o.map(e=>[e.ref,e.title])),c=o.filter(e=>!r.includes(e.ref)),l=n.type===`reference`?n.max:void 0,u=l!==void 0&&r.length>=l,d=e.ctx.entriesPending?[]:r.filter(e=>!s.has(e)),f=pO(e,d),{EntryLink:p}=e.ctx;return(0,D.jsxs)(sy,{...sD(n,f,t),htmlFor:t,children:[r.length>0?(0,D.jsx)(`ul`,{className:`editlet-ff-reference__chips`,"aria-label":`${n.label} selected`,children:r.map((e,t)=>{let n=s.get(e),a=d.includes(e);return(0,D.jsxs)(`li`,{className:`editlet-ff-reference__chip${a?` editlet-ff-reference__chip--broken`:``}`,children:[n===void 0||!p?(0,D.jsx)(`span`,{className:`editlet-ff-reference__chip-label`,title:e,children:a?`Not found: ${e}`:n??e}):(0,D.jsx)(p,{to:e,className:`editlet-ff-reference__chip-label`,title:`Open ${e}`,children:n}),(0,D.jsx)(`button`,{type:`button`,className:`editlet-ff-reference__chip-remove`,onClick:()=>i(r.filter((e,n)=>n!==t)),"aria-label":`Remove ${n??e}`,children:(0,D.jsx)($.X,{size:12})})]},t)})}):null,(0,D.jsx)(lO,{id:t,options:c.map(fO),display:``,onSelect:e=>i([...r,e]),onBlur:a,placeholder:u?`Maximum reached`:`Add… (type to search)`,disabled:u,invalid:oD(f),describedBy:cD(t,n,f),label:n.label,required:n.required})]})}function gO(e){return e.field.type===`select`?e.field.options:[]}function _O(e){let{name:t,field:n,value:r,onChange:i,onBlur:a,error:o}=e,s=gO(e),c=r!==``&&!s.some(e=>e.value===r);return(0,D.jsx)(sy,{...sD(n,o,t),htmlFor:t,children:(0,D.jsxs)(`select`,{id:t,name:t,className:cy,value:r,onChange:e=>i(e.target.value),onBlur:a,"aria-invalid":oD(o),"aria-describedby":cD(t,n,o),"aria-label":n.label,"aria-required":n.required||void 0,children:[n.required?r===``?(0,D.jsx)(`option`,{value:``,disabled:!0,children:`Choose…`}):null:(0,D.jsx)(`option`,{value:``,children:`—`}),c?(0,D.jsx)(`option`,{value:r,children:r}):null,s.map(e=>(0,D.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})}function vO(e){let{name:t,field:n,value:r,onChange:i,onBlur:a,error:o}=e,s=gO(e),c=e=>i(r.includes(e)?r.filter(t=>t!==e):[...r,e]);return(0,D.jsx)(sy,{...sD(n,o,t),children:(0,D.jsx)(`ul`,{id:t,className:`editlet-ff-select__multi`,"aria-label":n.label,children:s.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{className:`editlet-ff-select__multi-label`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:r.includes(e.value),onChange:()=>c(e.value),onBlur:a,className:`editlet-ff-select__multi-checkbox`,"aria-invalid":oD(o),"aria-describedby":cD(t,n,o)}),(0,D.jsx)(`span`,{children:e.label})]})},e.value))})})}function yO({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsx)(`input`,{id:e,className:cy,type:`text`,name:e,value:n,onChange:e=>r(e.target.value),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0})})}function bO({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let[o,s]=(0,E.useState)(``),c=()=>{let e=o.trim();e!==``&&(r([...n,e]),s(``))};return(0,D.jsxs)(sy,{...sD(t,a,e),htmlFor:e,children:[(0,D.jsx)(`input`,{id:e,className:Dv(`editlet-ff-list__add-input`,oD(a)&&`editlet-ff-list__add-input--error`),type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())},onBlur:()=>{c(),i?.()},placeholder:`Type the value and hit enter`,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0}),n.length>0?(0,D.jsx)(`ul`,{className:`editlet-ff-list__items`,children:n.map((e,t)=>(0,D.jsxs)(`li`,{className:`editlet-ff-list__item`,children:[(0,D.jsx)(`span`,{className:`editlet-ff-list__item-value`,children:e}),(0,D.jsx)(`span`,{className:`editlet-ff-list__item-sep`,"aria-hidden":!0}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>r(n.filter((e,n)=>n!==t)),className:`editlet-ff-list__item-remove`,"aria-label":`Remove ${e}`,children:(0,D.jsx)($.X,{size:14})})]},t))}):null]})}var xO=4;function SO({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){let o=t.type===`text`&&t.rows!==void 0?t.rows:xO;return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsx)(`textarea`,{id:e,className:Dv(ly,oD(a)&&`editlet-textarea--error`),name:e,rows:o,value:n,onChange:e=>r(e.target.value),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0})})}function CO({name:e,field:t,value:n,onChange:r,onBlur:i,error:a}){return(0,D.jsx)(sy,{...sD(t,a,e),htmlFor:e,children:(0,D.jsx)(`input`,{id:e,className:cy,type:`text`,inputMode:`url`,autoComplete:`url`,name:e,value:n,onChange:e=>r(e.target.value),onBlur:i,"aria-invalid":oD(a),"aria-describedby":cD(e,t,a),"aria-label":t.label,"aria-required":t.required||void 0})})}function wO(e){if(typeof e==`string`)return{src:e,alt:``};if(typeof e!=`object`||!e||Array.isArray(e))return{src:``,alt:``};let t=e;return{src:lD(t.src),alt:lD(t.alt)}}var TO=e=>Array.isArray(e)?e:[],EO=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function DO(e){let{field:t,value:n}=e,r=t=>({...e,value:t,onChange:e.onChange});switch(t.type){case`string`:return t.list?(0,D.jsx)(bO,{...r(uD(n))}):(0,D.jsx)(yO,{...r(lD(n))});case`text`:return(0,D.jsx)(SO,{...r(lD(n))});case`markdown`:return(0,D.jsx)(YD,{...r(lD(n))});case`boolean`:return(0,D.jsx)(pD,{...r(typeof n==`boolean`?n:void 0)});case`select`:return t.multiple?(0,D.jsx)(vO,{...r(uD(n))}):(0,D.jsx)(_O,{...r(lD(n))});case`number`:return(0,D.jsx)(XD,{...r(lD(n))});case`datetime`:return(0,D.jsx)(ED,{...r(lD(n))});case`json`:return(0,D.jsx)(ND,{...r(lD(n))});case`url`:return(0,D.jsx)(CO,{...r(lD(n))});case`color`:return(0,D.jsx)(gD,{...r(lD(n))});case`image`:return(0,D.jsx)(jD,{...r(wO(n))});case`reference`:return t.multiple?(0,D.jsx)(hO,{...r(uD(n))}):(0,D.jsx)(mO,{...r(lD(n))});case`object`:return t.list?(0,D.jsx)(oO,{...r(TO(n))}):(0,D.jsx)(nO,{...r(EO(n))});case`blocks`:return(0,D.jsx)(sO,{...r(TO(n))})}}function OO({notice:e,dismiss:t}){return e?e.found?(0,D.jsx)(`p`,{role:`status`,className:`editlet-sr-only`,children:e.text}):(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-entry__issues`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:e.text}),(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:t,children:`OK`})]}):null}function kO(e){return e.split(``).reverse().join(``)}function AO(e,t,n){let r=kO(t);return n.map(n=>{let i=Math.max(0,n.end-t.length-n.errors);return{start:NO(kO(e.slice(i,n.end)),r,n.errors,!0).reduce((e,t)=>n.end-t.end<e?n.end-t.end:e,n.end),end:n.end,errors:n.errors}})}function jO(e){return(e|-e)>>31&1}function MO(e,t,n,r){let i=e.P[n],a=e.M[n],o=r>>>31,s=t[n]|o,c=s|a,l=(s&i)+i^i|s,u=a|~(l|i),d=i&l,f=jO(u&e.lastRowMask[n])-jO(d&e.lastRowMask[n]);return u<<=1,d<<=1,d|=o,u|=jO(r)-o,i=d|~(c|u),a=u&c,e.P[n]=i,e.M[n]=a,f}function NO(e,t,n,r=!1){if(t.length===0)return[];n=Math.min(n,t.length);let i=[],a=Math.ceil(t.length/32)-1,o={P:new Uint32Array(a+1),M:new Uint32Array(a+1),lastRowMask:new Uint32Array(a+1)};o.lastRowMask.fill(1<<31),o.lastRowMask[a]=1<<(t.length-1)%32;let s=new Uint32Array(a+1),c=new Map,l=[];for(let e=0;e<256;e++)l.push(s);for(let e=0;e<t.length;e+=1){let n=t.charCodeAt(e);if(c.has(n))continue;let r=new Uint32Array(a+1);c.set(n,r),n<l.length&&(l[n]=r);for(let e=0;e<=a;e+=1){r[e]=0;for(let i=0;i<32;i+=1){let a=e*32+i;a>=t.length||t.charCodeAt(a)===n&&(r[e]|=1<<i)}}}let u=Math.max(0,Math.ceil(n/32)-1),d=new Uint32Array(a+1);for(let e=0;e<=u;e+=1)d[e]=(e+1)*32;d[a]=t.length;for(let e=0;e<=u;e+=1)o.P[e]=-1,o.M[e]=0;for(let f=0;f<e.length;f+=1){let p=e.charCodeAt(f),m;p<l.length?m=l[p]:(m=c.get(p),m===void 0&&(m=s));let h=+!!r;for(let e=0;e<=u;e+=1)h=MO(o,m,e,h),d[e]+=h;if(d[u]-h<=n&&u<a&&(m[u+1]&1||h<0)){u+=1,o.P[u]=-1,o.M[u]=0;let e;if(u===a){let n=t.length%32;e=n===0?32:n}else e=32;d[u]=d[u-1]+e-h+MO(o,m,u,h)}else for(;u>0&&d[u]>=n+32;)--u;u===a&&d[u]<=n&&(d[u]<n&&i.splice(0,i.length),i.push({start:-1,end:f+1,errors:d[u]}),n=d[u])}return i}function PO(e,t,n){return AO(e,t,NO(e,t,n))}var FO={"\xA0":` `,"‘":`'`,"’":`'`,"‚":`'`,"‛":`'`,"′":`'`,"“":`"`,"”":`"`,"„":`"`,"″":`"`,"«":`"`,"»":`"`,"‐":`-`,"‑":`-`,"‒":`-`,"–":`-`,"—":`-`,"−":`-`,"…":`...`},IO=/[-]/;function LO(e){let t=``,n=[],r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(IO.test(a))continue;let o=FO[a]??a;if(/\s/.test(o))r||(t+=` `,n.push(i)),r=!0;else{r=!1;for(let e of o.toLowerCase())t+=e,n.push(i)}}return{text:t,map:n}}var RO=.15;function zO(e,t){let n=0;for(;n<e.length&&n<t.length&&e[e.length-1-n]===t[t.length-1-n];)n++;return n}function BO(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function VO(e){if(e.length===0)return null;let t=e.toSorted((e,t)=>t.score-e.score);return t.length>1&&t[0].score===t[1].score?null:t[0]}function HO(e,{quote:t,prefix:n,suffix:r}){let i=LO(t).text.trim();if(i===``)return null;let a=LO(n).text,o=LO(r).text,s=(e,t,n,r)=>({key:e.key,start:t[n],end:t[r-1]+1}),c=[],l=e.map(e=>LO(e.projection.text));if(e.forEach((e,t)=>{let{text:n,map:r}=l[t];for(let t=n.indexOf(i);t!==-1;t=n.indexOf(i,t+1)){let s=zO(n.slice(0,t),a)+BO(n.slice(t+i.length),o);c.push({key:e.key,start:t,end:t+i.length,score:s,map:r})}}),c.length>0){let t=VO(c);return t?s(e.find(e=>e.key===t.key),t.map,t.start,t.end):null}let u=Math.floor(i.length*RO);if(u===0)return null;let d=[];e.forEach((e,t)=>{let{text:n,map:r}=l[t],a=-1;for(let t of PO(n,i,u).toSorted((e,t)=>e.start-t.start||e.errors-t.errors))t.start<a||(d.push({key:e.key,start:t.start,end:t.end,score:-t.errors,map:r}),a=t.end)});let f=VO(d);return!f||f.end<=f.start?null:s(e.find(e=>e.key===f.key),f.map,f.start,f.end)}var UO=(0,E.createContext)({request:null,finish:()=>{}}),WO=1e4;function GO({children:e}){let{navigate:t}=wb(),n=(0,E.useRef)(t);n.current=t;let[r,i]=(0,E.useState)(null);(0,E.useEffect)(()=>{let e=0,t=t=>{if(t.source!==window.parent||t.origin!==window.location.origin||!o(t.data))return;let{source:r,type:a,...s}=t.data,c=Mn(s.entry);c&&(e+=1,i({...s,id:e}),n.current({kind:`entry`,collection:c.collection,slug:c.slug}))};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[]),(0,E.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>i(e=>e?.id===r.id?null:e),WO);return()=>clearTimeout(e)},[r]);let a=(0,E.useCallback)(e=>i(t=>t?.id===e?null:t),[]),s=(0,E.useMemo)(()=>({request:r,finish:a}),[r,a]);return(0,D.jsx)(UO.Provider,{value:s,children:e})}var KO=()=>(0,E.useContext)(UO),qO=30,JO=100,YO=6e3;function XO(e,t){let n=[];for(let[r,i]of Object.entries(e.fields)){let e=i.type===`string`&&!i.list||i.type===`text`||i.type===`url`,a=t[r];e&&typeof a==`string`&&a!==``&&n.push({key:r,projection:{text:a,select(e,t){let n=document.getElementById(r);(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)&&WD(n,e,t)}}})}return n}var ZO=e=>new Promise(t=>setTimeout(t,e));function QO(e,t,n,r){let{request:i,finish:a}=KO(),[o,s]=(0,E.useState)(null),c=(0,E.useRef)(n);return c.current=n,(0,E.useEffect)(()=>{if(!i||i.entry!==e)return;let n={cancelled:!1};return(async()=>{let e=[];for(let i=0;i<qO&&!n.cancelled;i++){let n=await Promise.all([...r].map(async([e,t])=>({key:e,projection:await t()})));if(n.every(e=>e.projection)||i===29){e=[...XO(t,c.current()),...n.filter(e=>e.projection!==null)];break}await ZO(JO)}if(n.cancelled)return;let o=e.filter(e=>e.key===i.field),l=(o.length>0?HO(o,i):null)??HO(e,i);if(a(i.id),!l){s({found:!1,text:`Couldn't find the selected text in this entry`});return}e.find(e=>e.key===l.key).projection.select(l.start,l.end);let u=t.fields[l.key]?.label??`Body`;s({found:!0,text:`Selected in ${u}`})})(),()=>{n.cancelled=!0}},[i,e,t,r,a]),(0,E.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>s(null),YO);return()=>clearTimeout(e)},[o]),{notice:o,dismiss:()=>s(null)}}var $O=(0,E.createContext)({status:null,report:()=>void 0});function ek({children:e}){let[t,n]=(0,E.useState)(null),r=(0,E.useMemo)(()=>({status:t,report:n}),[t]);return(0,D.jsx)($O.Provider,{value:r,children:e})}function tk(){return(0,E.useContext)($O).status}function nk({draft:e,dirty:t,isNew:n,changes:r},i){let{report:a}=(0,E.useContext)($O),o=(0,E.useRef)(i);o.current=i,(0,E.useEffect)(()=>(a({draft:e,dirty:t,isNew:n,changes:r,review:()=>o.current()}),()=>a(null)),[a,e,t,n,r])}function rk({entry:e}){return!e.dirty&&!e.isNew?null:(0,D.jsx)(`button`,{type:`button`,className:`editlet-window__pending`,title:`Review and save`,onClick:e.review,children:e.isNew?`New entry`:`Unsaved changes (${e.changes})`})}function ik({entry:e}){return e.draft?(0,D.jsx)(yS,{draft:!0,size:`sm`}):null}var ak=new Set([`Changed on GitHub since it was read; reload and review`,`Branch keeps changing; try again`]),ok=`This entry changed on GitHub since you opened it. Reload to read it, then review your change again.`,sk=new Set([`File changed since it was read`,`File already exists`,`File not found`,...ak]),ck={type:`markdown`,label:`Body`},lk=e=>e instanceof F&&e.code===`branch_exists`,uk=(0,E.createContext)(new Map);function dk({path:e,bytes:t,alt:n,openable:r}){let[i,a]=(0,E.useState)(null);return(0,E.useEffect)(()=>{if(typeof URL.createObjectURL!=`function`)return;let n=URL.createObjectURL(new Blob([t],{type:vx(e)}));return a(n),()=>URL.revokeObjectURL(n)},[e,t]),i?(0,D.jsx)(gx,{url:i,alt:n,openable:r&&wx(e)}):(0,D.jsx)(`div`,{className:`editlet-ff-image__empty`,role:`img`,"aria-label":n||`No image`,children:(0,D.jsx)($.Image,{size:16})})}function fk({path:e,alt:t,openable:n}){let r=(0,E.useContext)(uk),i=e===null?void 0:r.get(e);return e!==null&&i?(0,D.jsx)(dk,{path:e,bytes:i,alt:t,openable:n}):(0,E.createElement)(Tx,{path:e,alt:t,openable:n})}function pk(e,t,n,r,i){return new Set(mC(e,t,n,r,i).flatMap(e=>e.path?[e.path]:[]))}function mk(e){return[...new Set(Lb(e).flatMap(([,e])=>e.collections))]}function hk({schema:e,collection:t,slug:n,path:r,loaded:i,initial:a,onDirtyChange:o,onCommitStart:s,onCommitEnd:c,onReload:l}){let u=e.collections[t],d=`${t}/${n}`,f=i===null,p=nx(),m=hx(),h=ne(),g=ZC(t,n,u.singleton===!0),_=Py(),v=Kb(),y=Qb(),{navigate:b}=wb(),{setGuard:x}=Tb(),S=Mb(),{setFormPreview:C}=Ab(),w=by(),[T]=(0,E.useState)(()=>Zy(u,a)),ee=NE({defaultValues:T}),te=CE(ee.store,e=>e.values),[re,ie]=(0,E.useState)(null),ae=(0,E.useMemo)(()=>re??eb(u,T),[re,u,T]),oe=(0,E.useMemo)(()=>eb(u,te),[u,te]),se=ib(oe,ae),ce=f||se,[le,ue]=(0,E.useState)(()=>new Map),de=(0,E.useRef)(le),[O,fe]=(0,E.useState)([]),[pe,me]=(0,E.useState)(!1),[he,ge]=(0,E.useState)(!1),[_e,ve]=(0,E.useState)(!1),[ye,be]=(0,E.useState)(!1),[xe,k]=(0,E.useState)(!1),[Se,A]=(0,E.useState)(!1),Ce=(0,E.useId)(),we=(0,E.useRef)(null),Te=(0,E.useRef)(se);Te.current=se;let j=(0,E.useRef)(!1);(0,E.useEffect)(()=>(x(()=>j.current||!Te.current||window.confirm(`Discard unsaved changes?`)),()=>x(null)),[x]),(0,E.useEffect)(()=>{if(!se)return;let e=e=>{Te.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[se]),(0,E.useEffect)(()=>o(se),[se,o]);let M=f&&re===null?null:ae;(0,E.useEffect)(()=>{let n=!1;return ub(e,t,r,M,oe,async e=>{let t=de.current.get(e);if(!t)try{t=await w.readFile(e)}catch{return null}return new Blob([t],{type:vx(e)})}).then(e=>{n||C(d,e)},()=>{}),()=>{n=!0}},[e,t,r,M,oe,w,d,C]),(0,E.useEffect)(()=>()=>C(d,null),[d,C]);let Ee=(0,E.useMemo)(()=>new Set((p.data??[]).map(e=>e.path)),[p.data]),De=fx((0,E.useMemo)(()=>mk(u),[u])),Oe=px(d),ke=f?[]:Oe.data??[],Ae=(0,E.useMemo)(()=>i?{collection:t,slug:n,data:i.file.data,body:i.file.body,path:r,sha:i.sha,keyOrder:i.keyOrder}:null,[i,t,n,r]),je=Ae&&ke.length>0?YE(e,[Ae,...ke.map(e=>e.entry).filter(e=>e.path!==r)],d):null,Me=je?iD(e,je):[],Ne=e=>p.data?.find(t=>t.path===e)?.sha??null,[Pe]=(0,E.useState)(()=>new Map),Fe=(0,E.useMemo)(()=>{let i=`${e.contentDir}/`,a=[...new Set([...[...Ee].filter(t=>t.startsWith(i)&&Pn(t)&&!Dn(e,t)),...le.keys()])].toSorted();return{entries:e=>De.filter(t=>e.includes(t.ref.slice(0,t.ref.indexOf(`/`)))),entriesPending:p.data===void 0,images:a,entryPath:r,async stageUpload(i){let a=AC(i);if(a)throw Error(a);let o=await MC(i),s=TC(new Set([...Ee,...de.current.keys()]),`${e.contentDir}/${t}/${n}`,i.name),c=new Map(de.current).set(s,o);return de.current=c,ue(c),EC(r,s)},resolveSrc:t=>kn(e,r,t),toSrc:e=>EC(r,e),Preview:fk,EntryLink:tw,selectTarget:(e,t)=>{t?Pe.set(e,t):Pe.delete(e)}}},[e,Ee,le,De,p.data,r,t,n,Pe]),Ie=QO(d,u,()=>ee.state.values,Pe),{fields:Le,general:Re}=wC(O),ze=[...new Set(Re.map(e=>ak.has(e)?ok:e))],Be=e=>fe(t=>{let n=t.filter(t=>t.path!==e&&!t.path.startsWith(`${e}.`));return n.length===t.length?t:n}),Ve=()=>{let r=eb(u,ee.state.values),i=new Set([d]);for(let t of Ee){let n=On(e,t);n&&i.add(`${n.collection}/${n.slug}`)}return[...r.issues,...Bg(e,{collection:t,slug:n,data:r.data,body:r.body},{entryExists:e=>i.has(e),fileExists:e=>Ee.has(e)||de.current.has(e)})]},He=()=>{ee.reset(T),ue(new Map),fe([])},Ue=()=>{me(!1);let e=Ve();fe(e),e.length===0&&ge(!0)},We=[...le.keys()].filter(t=>pk(e,u,r,oe.data,oe.body).has(t)),Ge=e=>{let t=_?J_(e,{repo:`${_.config.owner}/${_.config.repo}`}):e instanceof Error?e.message:String(e),n=e instanceof ex?e.issues:[{path:``,message:t}];fe(n),me(n.some(e=>sk.has(e.message)))},Ke=g.needed&&g.branch===void 0,qe=async()=>{if(Ke)return;let e=eb(u,ee.state.values),{data:a,body:o}=e,l=[{path:r,content:tb(u,a,o,i?.keyOrder??[]),sha:i?.sha??null},...We.map(e=>({path:e,content:le.get(e),sha:null}))];s();try{await m.mutateAsync({changes:l,message:v(of(f?`create`:`update`,t,n)),newBranch:g.branch})}catch(e){if(c(!1),lk(e))return void h.invalidateQueries({queryKey:wy});ge(!1),Ge(e);return}Te.current=!1,ie(e),C(d,null),c(!0),ge(!1),fe([]),S()},Je=async()=>{if(!i||Ke)return;s();let a=je!==null&&xe;try{await m.mutateAsync({changes:a?rD(e,je,Ne):[{path:r,content:null,sha:i.sha}],message:v(of(`delete`,t,n)),newBranch:g.branch})}catch(e){if(c(!1),lk(e))return void h.invalidateQueries({queryKey:wy});ve(!1),Ge(e);return}j.current=!0,ve(!1),b(u.singleton?{kind:`home`}:{kind:`collection`,collection:t}),S()},Ye=async r=>{if(!i||Ke)return;let a=r.to.slice(r.to.indexOf(`/`)+1);s();try{let i=await nD(e,r,e=>w.readFile(e),Ne);await m.mutateAsync({changes:i,message:v(sf(t,n,a)),newBranch:g.branch})}catch(e){if(c(!1),lk(e))return void h.invalidateQueries({queryKey:wy});be(!1),Ge(e);return}j.current=!0,be(!1),b({kind:`entry`,collection:t,slug:a}),S()},Xe=Zd(u),Ze=Object.hasOwn(T,Ly);nk({draft:te[Iy]===!0,dirty:se,isNew:f,changes:(0,E.useMemo)(()=>se?Px(u,i?ae:null,oe).length:0,[se,u,i,ae,oe])},Ue);let N=(e,t,n)=>(0,D.jsx)(ee.Field,{name:n,children:n=>(0,D.jsx)(DO,{name:e,field:t,value:n.state.value,onChange:t=>{n.handleChange(t),Be(e)},onBlur:n.handleBlur,error:Le[e],ctx:Fe})},e),Qe=(0,D.jsxs)(`div`,{className:`editlet-split`,children:[(0,D.jsx)(Z,{variant:`default`,icon:(0,D.jsx)($.Check,{size:16}),disabled:!ce||m.isPending,onClick:Ue,children:`Save`}),f?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`editlet-split__divider`,"aria-hidden":`true`}),(0,D.jsx)(Z,{variant:`default`,iconOnly:!0,popoverTarget:Ce,"aria-label":`More actions`,title:`More actions`,children:(0,D.jsx)($.ChevronDown,{size:16})})]})]}),$e=(0,D.jsx)(D.Fragment,{children:f?null:(0,D.jsxs)(`div`,{className:`editlet-menu editlet-menu--actions`,id:Ce,popover:`auto`,ref:we,children:[(0,D.jsxs)(`button`,{type:`button`,className:`editlet-menu__item`,disabled:!se,onClick:()=>{we.current?.hidePopover?.(),A(!0)},children:[(0,D.jsx)($.Undo,{size:16}),`Discard changes`]}),u.singleton?null:(0,D.jsxs)(`button`,{type:`button`,className:`editlet-menu__item`,disabled:se,title:se?`Save or discard the changes first`:void 0,onClick:()=>{we.current?.hidePopover?.(),be(!0)},children:[(0,D.jsx)($.Pencil,{size:16}),`Rename…`]}),(0,D.jsxs)(`button`,{type:`button`,className:`editlet-menu__item editlet-menu__item--destructive`,onClick:()=>{we.current?.hidePopover?.(),k(!1),ve(!0)},children:[(0,D.jsx)($.Trash,{size:16}),`Delete`]})]})});return(0,D.jsxs)(uk.Provider,{value:le,children:[(0,D.jsx)(`div`,{className:`editlet-page-row editlet-edit-post`,children:(0,D.jsxs)(`div`,{className:`editlet-page-content`,children:[(0,D.jsx)(OO,{...Ie}),ze.length>0?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-entry__issues`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`ul`,{className:`editlet-u-flex-1 editlet-u-stack editlet-u-gap-1`,children:ze.map((e,t)=>(0,D.jsx)(`li`,{children:e},t))}),pe?(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:l,children:`Reload`}):null]}):null,(0,D.jsxs)(`form`,{className:`editlet-edit-post__form-card`,"aria-label":`${d} fields`,onSubmit:e=>{e.preventDefault(),ce&&Ue()},children:[(0,D.jsx)(GE,{path:r,version:f?null:gk(i)}),Object.entries(u.fields).map(([e,t])=>t.type===`markdown`?null:N(e,t,e)),Xe===void 0?null:N(Xe,u.fields[Xe],Ly),Xe===void 0&&Ze?N(Ly,ck,Ly):null]}),(0,D.jsx)(eD,{schema:e,items:ke}),(0,D.jsxs)(`div`,{className:`editlet-edit-post__actions`,children:[Qe,$e]})]})}),(0,D.jsxs)(MS,{open:he,onOpenChange:ge,rows:he?Px(u,i?ae:null,oe):[],newFiles:We,confirmLabel:g.needed?`Save to branch`:`Save`,busy:m.isPending,confirmDisabled:Ke,onConfirm:()=>void qe(),children:[(0,D.jsx)(QC,{...g}),_?(0,D.jsx)($b,{paths:[r,...We],rules:y}):null]}),(0,D.jsx)(mS,{open:Se,onOpenChange:A,title:`Discard unsaved changes?`,description:`The form goes back to the saved file. New uploads that are not saved are dropped.`,confirmLabel:`Discard`,onConfirm:He}),(0,D.jsxs)(mS,{open:_e,onOpenChange:ve,title:`Delete ${d}?`,description:ke.length>0?`Other entries reference this one. Delete it together with those references, or remove them first.`:`The entry file is deleted. Image files are kept.`,confirmLabel:(g.needed?`Delete on branch`:`Delete`)+(ke.length>0&&xe?` and update ${ke.length}`:``),pending:m.isPending,confirmDisabled:Ke||ke.length>0&&(!xe||Me.length>0),onConfirm:()=>void Je(),children:[ke.length>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)($E,{schema:e,items:ke}),Me.length>0?(0,D.jsxs)(`div`,{className:`editlet-field__error`,role:`alert`,children:[(0,D.jsx)($.X,{size:11}),(0,D.jsxs)(`span`,{children:[`Removing the references would leave these entries invalid; fix them first: `,Me.join(`; `)]})]}):(0,D.jsxs)(`label`,{className:`editlet-u-row editlet-u-gap-2 editlet-u-text-sm`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:xe,onChange:e=>k(e.target.checked)}),`Also remove the references from `,ke.length,` `,ke.length===1?`entry`:`entries`]})]}):null,(0,D.jsx)(QC,{...g})]}),Ae&&!u.singleton?(0,D.jsx)(ZE,{open:ye,onOpenChange:be,schema:e,self:Ae,referrers:ke,files:(p.data??[]).map(e=>e.path),pending:m.isPending,blocked:Ke,onConfirm:e=>void Ye(e),children:(0,D.jsx)(QC,{...g})}):null]})}var gk=e=>e?.sha??null;function _k({collection:e,slug:t}){let n=cx(),r=n.data?.schema,[i,a]=(0,E.useState)(r),o=i?Tn(i,e,t):null,s=lx(o),c=ne(),{status:l,send:u}=Tb(),d=`${e}/${t}`,[f]=(0,E.useState)(()=>Jw.get(d));(0,E.useEffect)(()=>()=>void Jw.delete(d),[d]),(0,E.useEffect)(()=>{if(l===`connected`)return u({type:`highlight`,entry:d}),()=>u({type:`highlight`,entry:null})},[l,u,d]);let[p,m]=(0,E.useState)(void 0),[h,g]=(0,E.useState)(!1),[_,v]=(0,E.useState)(!1),y=s.data;r&&(i===void 0||r!==i&&!h)&&(a(r),p!==void 0&&m({data:p.data,generation:p.generation+1}));let b=r!==void 0&&i!==void 0&&r!==i;y!==void 0&&(p===void 0?m({data:y,generation:0}):gk(y)!==gk(p.data)&&(!h||_)&&(m({data:y,generation:p.generation+1}),g(!1),v(!1)));let x=p!==void 0&&y!==void 0&&gk(y)!==gk(p.data),S=i?.collections[e],C=(0,E.useMemo)(()=>{if(S&&p!==void 0)return p.data?p.data.file:{data:{...Gg(S),...f},body:``}},[S,p,f]),w=()=>{r&&a(r),m({data:y??p?.data??null,generation:(p?.generation??0)+1}),g(!1),mx(c)},T=i&&S&&o&&p&&C,ee;return ee=!T&&(n.error||s.error)?(0,D.jsx)(`p`,{className:`editlet-u-text-danger`,role:`alert`,children:(n.error??s.error)?.message}):T?(0,D.jsxs)(D.Fragment,{children:[s.error?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:s.error.message})]}):null,x&&!_||b?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:x&&!_?`This file changed on disk`:`The schema changed on disk`}),(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:w,children:`Reload`})]}):null,(0,D.jsx)(hk,{schema:i,collection:e,slug:t,path:o,loaded:p.data,initial:C,onDirtyChange:g,onCommitStart:()=>v(!0),onCommitEnd:e=>{e||v(!1)},onReload:w},`${o}:${gk(p.data)??`new`}:${p.generation}`)]}):(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`}),(0,D.jsx)(`section`,{className:`editlet-screen`,children:ee})}function vk({schema:e}){let t=nx(),n=Object.entries(e.schema.collections);return(0,D.jsxs)(`section`,{className:`editlet-screen`,children:[(0,D.jsx)(NS,{title:`Content`}),(0,D.jsx)(`ul`,{className:`editlet-collection-list`,children:n.map(([n,r])=>{let i=t.data?ux(e.schema,t.data,n).length:void 0;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(tw,{to:{kind:`collection`,collection:n},className:`editlet-collection-list__item`,"aria-label":!r.singleton&&i!==void 0?`${r.label} (${i})`:r.label,children:[(0,D.jsxs)(`span`,{className:`editlet-collection-list__head`,children:[(0,D.jsx)(`span`,{className:`editlet-collection-list__label`,children:r.label}),(0,D.jsx)(`span`,{className:`editlet-collection-list__icon`,children:r.singleton?(0,D.jsx)($.File,{size:16}):(0,D.jsx)($.Folder,{size:16})})]}),r.singleton?(0,D.jsx)(`span`,{className:`editlet-collection-list__kind`,children:`Single page`}):(0,D.jsx)(`span`,{className:`editlet-collection-list__count`,children:i??`–`})]})},n)})})]})}function yk(){return(0,D.jsxs)(`section`,{className:`editlet-screen`,children:[(0,D.jsx)(NS,{title:`Not found`}),(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--empty`,children:[(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,children:`This page does not exist.`}),(0,D.jsx)(tw,{to:``,className:`editlet-link`,children:`Go to home`})]})]})}var bk=S(),xk={loading:`Loading…`,saving:`Saving…`,syncing:`Syncing…`};function Sk({syncing:e}){let t=Ct()>0,n=St({predicate:e=>e.state.data===void 0})>0,r=St()>0;return Ck(t?`saving`:n?`loading`:e&&r?`syncing`:`idle`)}function Ck(e){let[t,n]=(0,E.useState)(e),r=(0,E.useRef)(Date.now());return(0,E.useEffect)(()=>{if(e===t)return;let i=()=>{r.current=Date.now(),n(e)},a=t===`idle`?0:r.current+600-Date.now();if(a<=0)return i();let o=setTimeout(i,a);return()=>clearTimeout(o)},[e,t]),t}function wk({syncing:e}){let t=Sk({syncing:e});return t===`idle`?null:(0,D.jsx)(`span`,{className:`editlet-window__activity`,"data-activity":t,children:xk[t]})}function Tk(e){window.parent.postMessage({source:d,...e},window.location.origin)}function Ek(){let[e]=(0,E.useState)(()=>{try{return window.parent.matchMedia(l)}catch{return null}}),t=(0,E.useCallback)(t=>(e?.addEventListener(`change`,t),()=>e?.removeEventListener(`change`,t)),[e]);return(0,E.useSyncExternalStore)(t,()=>e?.matches??!1)}function Dk(e,t){(0,E.useLayoutEffect)(()=>{if(!t)return;let n=getComputedStyle(e.current);return Tk({type:`collapse`,w:Math.ceil(parseFloat(n.width)),h:Math.ceil(parseFloat(n.height))}),()=>Tk({type:`expand`})},[e,t])}var Ok=20,kk=100,Ak={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};function jk(){let e=(0,E.useRef)(!1),t=t=>{e.current=t,Tk({type:`edge`,hover:t})};return(0,E.useEffect)(()=>()=>{e.current&&Tk({type:`edge`,hover:!1})},[]),{onPointerEnter:()=>t(!0),onPointerLeave:()=>t(!1)}}function Mk(e){let t=(0,E.useRef)(null);return{onPointerDown(n){n.button===0&&(n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId),t.current={x:n.screenX,y:n.screenY},Tk({type:`drag`,kind:e,phase:`start`,dx:0,dy:0}))},onPointerMove(n){t.current&&Tk({type:`drag`,kind:e,phase:`move`,dx:n.screenX-t.current.x,dy:n.screenY-t.current.y})},onPointerUp(n){t.current&&=(Tk({type:`drag`,kind:e,phase:`end`,dx:n.screenX-t.current.x,dy:n.screenY-t.current.y}),null)},onKeyDown(t){let n=Ak[t.key];if(!n)return;t.preventDefault();let r=t.shiftKey?kk:Ok,i=t.altKey?`se`:e;Tk({type:`drag`,kind:i,phase:`start`,dx:0,dy:0}),Tk({type:`drag`,kind:i,phase:`move`,dx:n[0]*r,dy:n[1]*r}),Tk({type:`drag`,kind:i,phase:`end`,dx:n[0]*r,dy:n[1]*r})}}}var Nk=3e3;function Pk(){let e=xt({queryKey:[`local-git`],refetchInterval:Nk,placeholderData:Ce,queryFn:async()=>{let e=await fetch(`${PE}/git`);if(!e.ok)throw Error(`git: ${e.status}`);return await e.json()},retry:!1});return e.data?.branch?e.data:null}function Fk(){let e=Pk(),t=tk(),n=t!==null&&(t.dirty||t.isNew),r=e?`${e.changes} uncommitted`:``,i=(e?.changes??0)>0?`changed`:`ok`;return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,className:`editlet-branch-chip`,icon:(0,D.jsx)($.GitBranch,{size:14}),disabled:!0,"data-tone":i,title:e.changes===0?`${e.branch}: all changes committed`:`${e.branch}: ${r}`,children:(0,D.jsx)(`span`,{className:`editlet-branch-chip__name`,children:e.branch})}):(0,D.jsx)(`span`,{className:`editlet-window__status-text`,children:`Local files`}),n?(0,D.jsx)(rk,{entry:t}):e&&e.changes>0?(0,D.jsx)(`span`,{className:`editlet-branch-chip__changes`,children:r}):null,t?(0,D.jsx)(ik,{entry:t}):null]})}var Ik=[{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}],Lk={sand:`light`,ocean:`dark`,grape:`dark`},Rk=`editlet:theme`;function zk(){try{let e=localStorage.getItem(Rk),t=Ik.find(t=>t.id===e);if(t)return t.id;if(e&&e in Lk)return Lk[e]}catch{}return typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function Bk(e){document.documentElement.dataset.editletTheme=e}function Vk(){Bk(zk())}function Hk(){let[e,t]=(0,E.useState)(zk);return[e,(0,E.useCallback)(e=>{t(e),Bk(e);try{localStorage.setItem(Rk,e)}catch{}},[])]}function Uk(e){let t=e.pullRequest;return t?t.isDraft?`Draft PR #${t.number}`:`PR #${t.number}`:`No pull request`}function Wk({name:e,details:t,active:n,onChoose:r,review:i}){return(0,D.jsxs)(`li`,{className:`editlet-branch-list__item`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`editlet-branch-list__choose`,"aria-current":n?`true`:void 0,onClick:r,children:[(0,D.jsx)(`span`,{className:`editlet-branch-list__icon`,children:n?(0,D.jsx)($.Check,{size:14}):(0,D.jsx)($.GitBranch,{size:14})}),(0,D.jsxs)(`span`,{className:`editlet-branch-list__text`,children:[(0,D.jsx)(`span`,{className:`editlet-branch-list__name`,children:e}),` `,(0,D.jsx)(`span`,{className:`editlet-branch-list__details`,children:t.map((e,t)=>(0,D.jsx)(`span`,{children:e},t))})]})]}),i?(0,D.jsx)(tw,{to:{kind:`branch`,name:i.name},className:`editlet-link editlet-branch-list__review`,onClick:i.onClick,children:`Review`}):null]})}function Gk({workspace:e,name:t,onCreated:n}){let{canLeave:r}=Tb(),i=(0,E.useId)(),[a,o]=(0,E.useState)(!1),[s,c]=(0,E.useState)(null),l=af(t,e.prefix),u=`${e.config.owner}/${e.config.repo}`,d=async()=>{if(l&&!a&&r()){o(!0),c(null);try{await e.createBranch(t),n()}catch(e){o(!1),c(e instanceof F&&e.code===`branch_exists`?`A branch with this name already exists`:J_(e,{repo:u}))}}};return(0,D.jsxs)(`div`,{className:`editlet-branch-dialog__create`,children:[(0,D.jsxs)(Z,{type:`submit`,variant:`primary`,icon:(0,D.jsx)($.Plus,{}),disabled:!l||a,"aria-describedby":l?void 0:i,onClick:e=>{e.preventDefault(),d()},children:[`Create `,t,` from `,e.base]}),l?null:(0,D.jsx)(`span`,{id:i,className:`editlet-branch-dialog__hint`,children:`Use letters, digits and dashes`}),s?(0,D.jsx)(`span`,{className:`editlet-branch-dialog__error`,role:`alert`,children:s}):null]})}function Kk({workspace:e,onClose:t}){let n=(0,E.useId)(),r=Fy(),{canLeave:i}=Tb(),[a,o]=(0,E.useState)(``),{prefix:s}=e,c=Wb(a,s),l=c===``?null:`${s}${c}`,u=r.data??[],d=u.filter(e=>Ub(e.name,s).includes(c)),f=l!==null&&r.data!==void 0&&!u.some(e=>e.name===l),p=n=>{if(n!==e.active){if(!i())return;e.switchTo(n)}t()};return(0,D.jsxs)(`form`,{className:`editlet-branch-dialog`,onSubmit:e=>e.preventDefault(),children:[(0,D.jsxs)(ny,{children:[(0,D.jsx)(iy,{children:`Branches`}),(0,D.jsx)(ay,{children:`Edits are saved on a branch; its pull request takes them to the live site.`})]}),(0,D.jsxs)(`div`,{className:`editlet-u-stack editlet-u-gap-2`,children:[(0,D.jsx)(`label`,{htmlFor:`${n}-find`,className:`editlet-field__label`,children:`Find or create a branch`}),(0,D.jsx)(uy,{id:`${n}-find`,prefix:s,value:a,onChange:e=>o(e.target.value),spellCheck:!1,autoComplete:`off`,autoFocus:!0}),f?(0,D.jsx)(Gk,{workspace:e,name:l,onCreated:t},l):null]}),(0,D.jsxs)(`ul`,{className:`editlet-branch-list`,"aria-label":`Branches`,children:[(0,D.jsx)(Wk,{name:e.base,details:[`Live site · edits here start a new branch`],active:e.onBase,onChoose:()=>p(e.base)}),d.map(n=>(0,D.jsx)(Wk,{name:n.name,details:[Uk(n),...n.committedAt?[zE(n.committedAt)]:[]],active:n.name===e.active,onChoose:()=>p(n.name),review:{name:Ub(n.name,s),onClick:t}},n.name))]}),r.error?(0,D.jsx)(`p`,{className:`editlet-branch-dialog__error`,role:`alert`,children:J_(r.error,{repo:`${e.config.owner}/${e.config.repo}`})}):r.isPending?(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading branches…`}):null]})}function qk({open:e,onOpenChange:t}){let n=Py();return n?(0,D.jsx)(ey,{open:e,onOpenChange:t,children:(0,D.jsx)(ty,{className:`editlet-branch-dialog__content`,children:e?(0,D.jsx)(Kk,{workspace:n,onClose:()=>t(!1)}):null})}):null}function Jk(){let e=Py(),t=Fy(),[n,r]=(0,E.useState)(!1),i=(0,E.useId)();if(!e)return null;let a=e.onBase?null:t.data?.find(t=>t.name===e.active)?.pullRequest,o=e.onBase?`${e.base} · live`:e.active;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`editlet-branch-chip`,icon:(0,D.jsx)($.GitBranch,{size:14}),"aria-label":`Branch`,"aria-describedby":i,"aria-haspopup":`dialog`,title:o,onClick:()=>r(!0),children:[(0,D.jsx)(`span`,{id:i,className:`editlet-branch-chip__name`,children:o}),a?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsxs)(`span`,{className:`editlet-branch-chip__pr`,children:[`#`,a.number]})]}):null]}),(0,D.jsx)(qk,{open:n,onOpenChange:r})]})}var Yk={admin:`You can change content, the schema and code. GitHub rules still decide what needs review.`,editor:`You can change content. GitHub rules decide who reviews and merges your pull requests.`};function Xk(){let e=_y(),{signOut:t}=Tv(),{canLeave:n}=Tb(),[r,i]=(0,E.useState)(null);return e?(0,D.jsxs)(`div`,{className:`editlet-user-menu`,title:e.login,children:[r===e.avatarUrl?(0,D.jsx)(`span`,{className:`editlet-user-menu__avatar editlet-user-menu__avatar--fallback`,"aria-hidden":!0,children:e.login.slice(0,1).toUpperCase()}):(0,D.jsx)(`img`,{className:`editlet-user-menu__avatar`,src:e.avatarUrl,alt:``,width:24,height:24,onError:()=>i(e.avatarUrl)}),(0,D.jsx)(`span`,{className:`editlet-user-menu__login`,children:e.login}),(0,D.jsx)(`span`,{className:`editlet-user-menu__role`,title:Yk[e.role],children:e.role===`admin`?`Admin`:`Editor`}),(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,icon:(0,D.jsx)($.LogOut,{}),title:`Sign out`,onClick:()=>n()&&t(),children:`Sign out`})]}):null}function Zk(e){e.target.closest(`a`)&&e.currentTarget.hidePopover?.()}function Qk(e,t){switch(e.kind){case`home`:return{icon:(0,D.jsx)($.Home,{size:16}),label:`Home`};case`collection`:case`entry`:{let n=t?.schema.collections[e.collection];return{icon:n?.singleton?(0,D.jsx)($.File,{size:16}):(0,D.jsx)($.Folder,{size:16}),label:n?.label??e.collection}}case`schema`:return{icon:(0,D.jsx)($.Eye,{size:16}),label:`Content model`};case`media`:return{icon:(0,D.jsx)($.Image,{size:16}),label:`Media`};case`branch`:return{icon:(0,D.jsx)($.Eye,{size:16}),label:`Review changes`};case`unknown`:return{icon:(0,D.jsx)($.Home,{size:16}),label:`Editlet`}}}function $k({id:e,schema:t,route:n}){let r=nx(),i=Py(),a=n.kind===`collection`||n.kind===`entry`?n.collection:null;return(0,D.jsxs)(`nav`,{className:`editlet-menu editlet-menu--nav`,id:e,popover:`auto`,"aria-label":`Editlet`,onClick:Zk,children:[(0,D.jsxs)(tw,{to:{kind:`home`},className:`editlet-menu__item`,"aria-current":n.kind===`home`?`page`:void 0,children:[(0,D.jsx)($.Home,{size:16}),`Home`]}),(0,D.jsx)(`div`,{className:`editlet-menu__separator`}),(0,D.jsx)(`div`,{className:`editlet-menu__label`,children:`Collections`}),t?Object.entries(t.schema.collections).map(([e,n])=>(0,D.jsxs)(tw,{to:{kind:`collection`,collection:e},className:`editlet-menu__item`,"aria-current":a===e?`page`:void 0,children:[n.singleton?(0,D.jsx)($.File,{size:16}):(0,D.jsx)($.Folder,{size:16}),n.label,!n.singleton&&r.data?(0,D.jsx)(`span`,{className:`editlet-menu__count`,children:ux(t.schema,r.data,e).length}):null]},e)):null,(0,D.jsx)(`div`,{className:`editlet-menu__separator`}),(0,D.jsxs)(tw,{to:{kind:`media`},className:`editlet-menu__item`,"aria-current":n.kind===`media`?`page`:void 0,children:[(0,D.jsx)($.Image,{size:16}),`Media`]}),(0,D.jsxs)(tw,{to:{kind:`schema`},className:`editlet-menu__item`,"aria-current":n.kind===`schema`?`page`:void 0,children:[(0,D.jsx)($.Eye,{size:16}),`Content model`]}),i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`editlet-menu__separator`}),(0,D.jsx)(`div`,{className:`editlet-menu__account`,children:(0,D.jsx)(Xk,{})})]}):null]})}function eA(){let[e,t]=Hk(),n=e===`dark`?`light`:`dark`,r=`Switch to ${n} theme`;return(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":r,title:r,onClick:()=>t(n),children:n===`dark`?(0,D.jsx)($.Moon,{size:20}):(0,D.jsx)($.Sun,{size:20})})}function tA(){let e=Py(),t=nx(),n=e!==null&&!e.onBase,r=xt({queryKey:[`branch-changes`,e?.active,t.dataUpdatedAt],queryFn:async()=>(await e.source.compare()).files.length,enabled:n});return n?r.data??null:null}function nA(e,t){return e.onBase?`Status: live`:t===null?`Status: draft`:`Status: draft (${t} ${t===1?`change`:`changes`})`}function rA(){let e=tk();return e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(rk,{entry:e}),(0,D.jsx)(ik,{entry:e})]}):null}function iA(){let e=Py(),t=tA();return(0,D.jsxs)(`footer`,{className:`editlet-window__status`,children:[e?(0,D.jsx)(`span`,{className:`editlet-window__status-text`,children:nA(e,t)}):(0,D.jsx)(Fk,{}),e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Jk,{}),e.onBase?null:(0,D.jsxs)(tw,{to:{kind:`branch`,name:Ub(e.active,e.prefix)},className:Ov({variant:`primary`,size:`sm`}),children:[(0,D.jsx)(`span`,{className:`editlet-button__icon`,children:(0,D.jsx)($.Eye,{})}),`Review changes`]})]}):null,e?(0,D.jsx)(rA,{}):null,(0,D.jsx)(wk,{syncing:e!==null})]})}function aA({edge:e}){let t=Mk(e),n=jk();return(0,D.jsx)(`div`,{className:`editlet-window__edge editlet-window__edge--${e}`,"aria-hidden":`true`,...t,...n})}function oA({collapsed:e,onExpand:t}){let{close:n}=Tb(),r=(0,E.useRef)(null),[i,a]=(0,E.useState)(!1);Dk(r,e),(0,E.useEffect)(()=>{e&&r.current?.querySelector(`button`)?.focus()},[e]);let o=()=>{(0,bk.flushSync)(()=>a(!0));let e=r.current?.getAnimations?.()??[];return e.length?Promise.all(e.map(e=>e.finished)).then(()=>{}):null};return(0,D.jsxs)(`div`,{className:Dv(`editlet-pill`,e&&`editlet-pill--open`,i&&`editlet-pill--closing`),ref:r,inert:!e,children:[(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,icon:(0,D.jsx)($.Pencil,{size:16}),onClick:t,children:`Editlet`}),(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":`Close Editlet`,title:`Close`,onClick:()=>n({exit:o}),children:(0,D.jsx)($.X,{size:16})})]})}function sA(){return[...document.querySelectorAll(`[popover]`)].some(e=>{try{return e.matches(`:popover-open`)}catch{return!1}})}function cA(e,t){(0,E.useEffect)(()=>{if(t)return;let n=t=>{t.key!==`Escape`||t.defaultPrevented||document.querySelector(`dialog[open]`)||sA()||e()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function lA({schema:e,route:t,children:n}){let[r,i]=(0,E.useState)(!1),o=(0,E.useCallback)(()=>i(!0),[]),{request:s}=KO();(0,E.useEffect)(()=>{s&&i(!1)},[s]),cA(o,r);let c=Mk(`move`),l=Ek(),u=(0,E.useId)(),d=Qk(t,e),f=gb(t),p=l?null:a.map(e=>(0,D.jsx)(aA,{edge:e},e));return(0,D.jsxs)(ek,{children:[(0,D.jsx)(Qv.Provider,{value:p,children:(0,D.jsxs)(`div`,{className:Dv(`editlet-window`,l&&`editlet-window--sheet`,r&&`editlet-window--collapsed`),inert:r,children:[(0,D.jsxs)(`header`,{className:`editlet-window__bar`,children:[(0,D.jsxs)(`div`,{className:`editlet-window__group`,children:[f?(0,D.jsx)(tw,{to:f,className:Ov({variant:`ghost`,size:`sm`,iconOnly:!0}),"aria-label":`Back`,title:`Back to ${Qk(f,e).label}`,children:(0,D.jsx)($.ArrowLeft,{size:20})}):null,(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,className:`editlet-window__nav`,icon:d.icon,iconRight:(0,D.jsx)($.ChevronDown,{size:16}),popoverTarget:u,"aria-label":`Navigation`,children:(0,D.jsx)(`span`,{className:`editlet-window__nav-label`,children:d.label})})]}),l?(0,D.jsx)(`div`,{className:`editlet-window__drag`}):(0,D.jsx)(`div`,{className:`editlet-window__drag editlet-window__drag--live`,...c,children:(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,className:`editlet-window__move`,"aria-label":`Move window`,title:`Drag to move; arrow keys move it, Alt+arrows resize it`,children:(0,D.jsx)($.Move,{size:20})})}),(0,D.jsxs)(`div`,{className:`editlet-window__group editlet-window__group--end`,children:[(0,D.jsx)(eA,{}),(0,D.jsx)(Z,{variant:`ghost`,size:`sm`,iconOnly:!0,"aria-label":`Minimize`,title:`Minimize`,onClick:o,children:(0,D.jsx)($.Minimize,{size:20})})]}),(0,D.jsx)($k,{id:u,schema:e,route:t})]}),(0,D.jsx)(`div`,{className:`editlet-window__body`,children:n}),(0,D.jsx)(iA,{}),p]})}),(0,D.jsx)(oA,{collapsed:r,onExpand:()=>i(!1)})]})}function uA({route:e,schema:t}){let n=Py(),r=t.schema.collections;switch(e.kind){case`home`:return(0,D.jsx)(vk,{schema:t});case`collection`:{let n=r[e.collection];return!n||!Object.hasOwn(r,e.collection)?(0,D.jsx)(yk,{}):n.singleton?(0,D.jsx)(_k,{collection:e.collection,slug:`index`},`${e.collection}/index`):(0,D.jsx)(Qw,{collection:e.collection,schema:t},e.collection)}case`entry`:{let t=Object.hasOwn(r,e.collection)?r[e.collection]:void 0;if(!(t&&(t.singleton?e.slug===`index`:Sn(e.slug))))return(0,D.jsx)(yk,{});let n=`${e.collection}/${e.slug}`;return(0,D.jsx)(_k,{collection:e.collection,slug:e.slug},n)}case`schema`:return(0,D.jsx)(qw,{schema:t});case`media`:return(0,D.jsx)(dw,{schema:t});case`branch`:return n?(0,D.jsx)(XS,{name:e.name}):(0,D.jsx)(PS,{title:`Branch preview`,text:`Branch preview is available in production mode`});case`unknown`:return(0,D.jsx)(yk,{})}}var dA=e=>e instanceof bn?e.issues:[{path:``,message:e.message}];function fA({filesError:e,schemaError:t,onRetry:n}){return!e&&!t?null:(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-shell__banner`,role:`alert`,children:[(0,D.jsx)($.Alert,{}),e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:e}),n?(0,D.jsx)(Z,{variant:`outline`,size:`sm`,onClick:n,children:`Try again`}):null]}):(0,D.jsxs)(`div`,{className:`editlet-u-flex-1 editlet-u-stack editlet-u-gap-1`,children:[(0,D.jsx)(`strong`,{children:`The schema has errors`}),(0,D.jsx)(`ul`,{className:`editlet-u-stack editlet-u-gap-1`,children:dA(t).map((e,t)=>(0,D.jsx)(`li`,{children:Vw(e)},t))})]})]})}function pA(e,t){return e?.restoring===!0&&t instanceof F&&t.code===`not_found`}function mA(e,t){return t?`Can't load from GitHub: ${J_(e,{repo:`${t.config.owner}/${t.config.repo}`})}`:`Can't reach the dev server: ${e.message}`}function hA(){let{route:e}=wb(),{status:t}=Tb(),n=Py(),r=jb(),i=ne(),a=nx(),o=cx(),s=pA(n,a.error),c=a.error&&!s?a.error:null;if(!o.data&&o.error&&!n)return(0,D.jsx)(Uw,{issues:dA(o.error)});let l=null;o.data?l=(0,D.jsx)(uA,{route:e,schema:o.data},n?.switches??0):o.error&&o.error!==a.error?l=(0,D.jsx)(`section`,{className:`editlet-screen`,children:(0,D.jsx)(Hw,{issues:dA(o.error)})}):c||(l=(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`}));let u=(0,D.jsxs)(D.Fragment,{children:[t===`disconnected`?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-shell__banner`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:`Not connected to the site`})]}):null,n?.fallbackNotice?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-shell__banner`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:n.fallbackNotice})]}):null,r?(0,D.jsxs)(`div`,{className:`editlet-card editlet-card--banner editlet-shell__banner`,role:`status`,children:[(0,D.jsx)($.Alert,{}),(0,D.jsx)(`span`,{className:`editlet-u-flex-1`,children:r})]}):null,o.data||n?(0,D.jsx)(fA,{filesError:c?mA(c,n):null,schemaError:o.refreshError,onRetry:n?()=>void mx(i):void 0}):null]});return(0,D.jsx)(GO,{children:(0,D.jsxs)(lA,{schema:o.data,route:e,children:[u,(0,D.jsx)(`main`,{className:`editlet-page-content`,children:l})]})})}var gA=[`access`],_A=[`git-style`],vA=`cms/schema.json`;async function yA(e,{owner:t,repo:n,baseBranch:r}){try{let i=await e.rest(`GET`,`/repos/${t}/${n}/contents/${vA}`,{query:{ref:r},raw:!0,accept:`application/vnd.github.raw+json`});return rf(Xd(new TextDecoder().decode(i),vA).git)}catch(e){if(e instanceof bn||e instanceof F&&e.code===`not_found`)return rf(null);throw e}}async function bA(e,{owner:t,repo:n}){let r=await e.rest(`GET`,`/user`),i={login:r.login,avatarUrl:r.avatar_url,role:`editor`};try{let{permissions:r}=await e.rest(`GET`,`/repos/${t}/${n}`);return(r?.admin===!0||r?.maintain===!0)&&(i.role=`admin`),{user:i,status:r?.push===!0?`ok`:`read_only`}}catch(e){if(e instanceof F&&e.code===`not_found`)return{user:i,status:`not_found`};throw e}}function xA(){return(0,D.jsx)(Mx,{title:`Editing is not set up`,text:(0,D.jsxs)(D.Fragment,{children:[`Editing on the live site is not set up. Set the `,(0,D.jsx)(`code`,{children:`admin`}),` option of the Editlet adapter (repo, authUrl). See `,(0,D.jsx)(`code`,{children:`docs/admin/production.md`}),`.`]})})}function SA(){return(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`})}function CA({github:e,authUrl:t,storage:n,preview:r,param:i,fetch:a,onShell:o,onReplace:s}){let c=Tv(),l=ne(),{getToken:u,fetch:d,signOut:f,session:p}=c,m=(0,E.useMemo)(()=>Yt({token:u,fetch:d}),[u,d]),h=xt({queryKey:gA,queryFn:()=>bA(m,e),staleTime:1/0,retry:(e,t)=>!(t instanceof Ot)&&e<1}),g=`${e.owner}/${e.repo}`,_=h.data?.status===`ok`,v=xt({queryKey:_A,queryFn:()=>yA(m,e),staleTime:1/0,enabled:_,retry:(e,t)=>!(t instanceof Ot)&&e<1}),y=_&&v.data!==void 0,b=h.data?.user.login;(0,E.useEffect)(()=>{if(y)return o(!0),()=>o(!1)},[y,o]);let[x,S]=(0,E.useState)(!1);(0,E.useEffect)(()=>{!p&&y&&S(!0)},[p,y]);let C=(0,E.useRef)(b);C.current=b,(0,E.useEffect)(()=>{if(!x||!p)return;let t=!1;return bA(m,e).then(e=>{t||(e.status!==`ok`||e.user.login!==C.current?(l.clear(),s()):(l.setQueryData(gA,e),S(!1),l.refetchQueries({predicate:e=>e.state.status===`error`})))},e=>{t||e instanceof Ot&&e.code===`unauthorized`||(l.clear(),s())}),()=>{t=!0}},[x,p,m,e,l,s]);let w=(0,D.jsx)(Z,{variant:`outline`,onClick:()=>f(),children:`Sign out`}),T=h.error??v.error;if(T)return(0,D.jsxs)(Mx,{title:`Can't check your access`,text:J_(T,{repo:g}),children:[(0,D.jsx)(Z,{variant:`primary`,onClick:()=>void(h.error?h.refetch():v.refetch()),children:`Try again`}),w]});if(!h.data)return(0,D.jsx)(SA,{});let{user:ee,status:te}=h.data;return te===`not_found`?(0,D.jsx)(Mx,{title:`Can't open ${g}`,text:`GitHub doesn't show ${g} to ${ee.login}. Check that the repository exists and that the GitHub App of the auth handler is installed on it.`,children:w}):te===`read_only`?(0,D.jsx)(Mx,{title:`No write access`,text:`${J_(new Ot(`forbidden`),{repo:g})} (signed in as ${ee.login}). Ask an owner of the repository for write access, or sign in with another account.`,children:w}):v.data?(0,D.jsxs)(gy.Provider,{value:ee,children:[(0,D.jsxs)(Ny,{config:e,style:v.data,param:i,client:m,storage:n,children:[(0,D.jsx)(jx,{preview:r,fetch:a}),(0,D.jsx)(hA,{})]}),p&&!x?null:(0,D.jsx)(hy,{authUrl:t,repo:g,login:ee.login,checking:p!==null})]}):(0,D.jsx)(SA,{})}function wA({config:e,storage:t,fetch:n}){let{session:r,lapsed:i}=Tv(),a=ne(),{github:o,authUrl:s}=e,[c,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(0),f=(0,E.useMemo)(()=>()=>d(e=>e+1),[]),p=!r&&!(i&&c);return(0,E.useEffect)(()=>{p&&i&&a.clear()},[p,i,a]),p?(0,D.jsx)(my,{authUrl:s,repo:`${o.owner}/${o.repo}`}):(0,D.jsx)(CA,{github:o,authUrl:s,storage:t,preview:e.preview===!0,param:e.param,fetch:n,onShell:l,onReplace:f},u)}function TA({config:e,fetch:t,storage:n}){let{github:r}=e;return r?(0,D.jsx)(wv,{authUrl:e.authUrl,fetch:t,sessionMinutes:e.sessionMinutes,children:(0,D.jsx)(wA,{config:{...e,github:r},storage:n,fetch:t})}):(0,D.jsx)(xA,{})}async function EA(e=globalThis.fetch.bind(globalThis),t=PE){try{let n=await e(`${t}/files`);if(n.status===200)return{mode:`local`};if(n.status===500){let e=await n.json();if(Array.isArray(e?.issues))return{mode:`local-broken`,issues:e.issues}}}catch{}return{mode:`github`}}var DA=32768;function OA(e){let t=``;for(let n=0;n<e.length;n+=DA)t+=String.fromCharCode(...e.subarray(n,n+DA));return btoa(t)}function kA(e){let{path:t,content:n}=e,r=n===null?{path:t,content:null}:typeof n==`string`?{path:t,content:n,encoding:`utf8`}:{path:t,content:OA(n),encoding:`base64`};return Object.hasOwn(e,`sha`)&&e.sha!==void 0&&(r.sha=e.sha),r}function AA({base:e=PE,fetch:t=globalThis.fetch.bind(globalThis)}={}){return{kind:`local`,async listFiles(){let n=await t(`${e}/files`);if(n.status!==200)throw Error(`Dev API ${n.status}`);return(await n.json()).files},async readFile(n){let r=await t(`${e}/file?path=${encodeURIComponent(n)}`);if(r.status===404)throw new bn([{file:n,path:``,message:`File not found: ${n}`}]);if(r.status!==200)throw Error(`Dev API ${r.status}`);return new Uint8Array(await r.arrayBuffer())},async commit(n,r){let i={message:r,changes:n.map(kA)},a=await t(`${e}/commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});if(a.status===204)return{issues:[]};if([400,409,422].includes(a.status)){let{issues:e}=await a.json();return{issues:e}}throw Error(`Dev API ${a.status}`)}}}function jA(){return new st({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}})}async function MA(e){try{let t=await e(new URL(iv,document.baseURI),{cache:`no-cache`});return t.ok?fv(await t.json()):null}catch{return null}}function NA(e,t){let[n,r]=(0,E.useState)({kind:`detecting`});return(0,E.useEffect)(()=>{if(e)return;let n=!1,i=t??globalThis.fetch.bind(globalThis);return(async()=>{let e=await EA(i);return e.mode===`local`?{kind:`ready`,source:AA({fetch:i})}:e.mode===`local-broken`?{kind:`broken`,issues:e.issues}:{kind:`github`,config:await MA(i)}})().then(e=>{n||r(e)}),()=>{n=!0}},[e,t]),e?{kind:`ready`,source:e}:n}function PA({source:e,win:t,fetch:n,storage:r,queryClient:i}){let[a]=(0,E.useState)(()=>i??jA()),o=NA(e,n),s;switch(o.kind){case`detecting`:s=(0,D.jsx)(`p`,{className:`editlet-u-text-muted`,role:`status`,children:`Loading…`});break;case`github`:s=o.config?.github?(0,D.jsx)(TA,{config:o.config,fetch:n,storage:r}):(0,D.jsx)(xA,{});break;case`broken`:s=(0,D.jsx)(Uw,{issues:o.issues});break;case`ready`:s=(0,D.jsx)(yy,{source:o.source,children:(0,D.jsx)(hA,{})})}let c=o.kind===`github`;return(0,D.jsx)(re,{client:a,children:(0,D.jsx)(Cb,{win:t,children:(0,D.jsx)(kb,{flag:c,sessionMinutes:c?o.config?.sessionMinutes:void 0,children:s})})})}Vk();var FA=document.getElementById(`root`);if(!FA)throw Error(`Editlet admin: #root element is missing`);(0,Dt.createRoot)(FA).render((0,D.jsx)(E.StrictMode,{children:(0,D.jsx)(PA,{})}));export{ey as a,ny as c,Z as d,ee as f,sy as i,iy as l,v as m,DD as n,ty as o,S as p,cy as r,ry as s,UD as t,$ as u};
|