@gentbajko/slopify 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-registry.js +9 -2
- package/dist/adapters/host-cli/index.js +11 -0
- package/dist/adapters/host-cli/transport.js +6 -1
- package/dist/adapters/image/codex-output.js +59 -17
- package/dist/adapters/image/codex.js +92 -16
- package/dist/adapters/image/fal.js +99 -8
- package/dist/adapters/image/google.js +13 -1
- package/dist/adapters/image/openai.js +37 -15
- package/dist/adapters/image/reference.js +7 -0
- package/dist/adapters/image/replicate.js +48 -2
- package/dist/adapters/image/video.js +28 -0
- package/dist/adapters/llm/codex-models.js +2 -1
- package/dist/adapters/llm/codex-server-models.js +2 -1
- package/dist/adapters/llm/run-cli.js +14 -2
- package/dist/assets/fonts/Barlow-Bold.ttf +0 -0
- package/dist/assets/fonts/SOURCE.txt +6 -0
- package/dist/assets/models.yaml +89 -1
- package/dist/catalog/registry.js +24 -3
- package/dist/catalog/runtime-models.js +1 -1
- package/dist/catalog/schema.js +20 -1
- package/dist/catalog/store.js +2 -2
- package/dist/catalog/validate.js +47 -4
- package/dist/edge/docker-launch.js +4 -0
- package/dist/edge/docker-projects/engine.js +57 -1
- package/dist/edge/docker-projects/install.js +10 -2
- package/dist/edge/docker-projects/prune.js +66 -0
- package/dist/edge/events/hub.js +11 -0
- package/dist/edge/http/app.js +2 -0
- package/dist/edge/http/backups.js +40 -0
- package/dist/edge/http/host-cli.js +17 -2
- package/dist/edge/http/problem.js +1 -0
- package/dist/edge/http/providers.js +8 -0
- package/dist/edge/http/schedules.js +1 -1
- package/dist/edge/http/settings.js +44 -0
- package/dist/edge/http/timeouts.js +38 -0
- package/dist/host-cli/runtime.js +3 -2
- package/dist/kernel/db/migrations/0019-shorts-prompts.sql +16 -0
- package/dist/kernel/db/migrations/0022-drop-duplicate-held-work.sql +56 -0
- package/dist/kernel/db/migrations/0024-reference-attachments.sql +18 -0
- package/dist/kernel/ports/host-cli.js +17 -2
- package/dist/kernel/ports/image.js +3 -1
- package/dist/kernel/ports/llm.js +3 -1
- package/dist/kernel/runner/attempt.js +5 -2
- package/dist/kernel/runner/providers.js +42 -2
- package/dist/main.js +55 -7
- package/dist/slices/admission/model.js +8 -0
- package/dist/slices/admission/rules.js +91 -2
- package/dist/slices/admission/schema.js +42 -1
- package/dist/slices/admission/start.js +53 -15
- package/dist/slices/backups/files.js +135 -0
- package/dist/slices/backups/folder.js +35 -0
- package/dist/slices/backups/model.js +65 -0
- package/dist/slices/backups/repo.js +28 -0
- package/dist/slices/backups/schedule.js +60 -0
- package/dist/slices/backups/service.js +311 -0
- package/dist/slices/batch/index.js +2 -0
- package/dist/slices/estimate/index.js +65 -2
- package/dist/slices/fonts/catalog.js +23 -0
- package/dist/slices/fonts/index.js +1 -1
- package/dist/slices/library/model.js +8 -1
- package/dist/slices/library/slots.js +13 -2
- package/dist/slices/library/snapshot.js +8 -2
- package/dist/slices/notifications/notifier.js +76 -0
- package/dist/slices/notifications/rules.js +81 -0
- package/dist/slices/notifications/send.js +40 -0
- package/dist/slices/notifications/settings.js +34 -0
- package/dist/slices/play-drafts/convert.js +72 -4
- package/dist/slices/play-drafts/readiness.js +7 -3
- package/dist/slices/play-drafts/repo.js +7 -1
- package/dist/slices/play-drafts/review-inputs.js +2 -0
- package/dist/slices/play-drafts/schema.js +44 -3
- package/dist/slices/play-drafts/service.js +6 -0
- package/dist/slices/play-drafts/uploads.js +2 -1
- package/dist/slices/project-templates/from-project.js +42 -0
- package/dist/slices/project-templates/setup.js +13 -0
- package/dist/slices/rebuild/preview-details.js +53 -3
- package/dist/slices/rebuild/preview-plan.js +2 -2
- package/dist/slices/rebuild/recipe-build.js +13 -3
- package/dist/slices/rebuild/recipe-edit.js +178 -0
- package/dist/slices/rebuild/recipe-exports.js +9 -4
- package/dist/slices/rebuild/recipe-input-schema.js +9 -1
- package/dist/slices/rebuild/recipe-legacy.js +12 -0
- package/dist/slices/rebuild/recipe-model.js +7 -1
- package/dist/slices/rebuild/recipe-provider-choice.js +15 -0
- package/dist/slices/rebuild/recipe-reference.js +44 -0
- package/dist/slices/rebuild/recipe-save.js +25 -1
- package/dist/slices/rebuild/recipe-shorts.js +186 -0
- package/dist/slices/rebuild/recipe-validation.js +33 -2
- package/dist/slices/rebuild/recipe-visual.js +29 -8
- package/dist/slices/rebuild/recipe-work.js +83 -1
- package/dist/slices/rebuild/runtime-actions.js +9 -2
- package/dist/slices/rebuild/runtime-animate.js +110 -0
- package/dist/slices/rebuild/runtime-export-edit.js +119 -0
- package/dist/slices/rebuild/runtime-export.js +13 -1
- package/dist/slices/rebuild/runtime-image.js +50 -0
- package/dist/slices/rebuild/runtime-local.js +6 -3
- package/dist/slices/rebuild/runtime-materialize.js +48 -0
- package/dist/slices/rebuild/runtime-piece-label.js +17 -0
- package/dist/slices/rebuild/runtime-provider.js +17 -10
- package/dist/slices/rebuild/runtime-publication.js +25 -4
- package/dist/slices/rebuild/runtime-run.js +11 -5
- package/dist/slices/rebuild/runtime-shorts.js +328 -0
- package/dist/slices/rebuild/runtime-store.js +7 -3
- package/dist/slices/rebuild/service-readiness.js +15 -1
- package/dist/slices/rebuild/transition-repo.js +40 -1
- package/dist/slices/revisions/adopt-content.js +7 -0
- package/dist/slices/revisions/adopt.js +7 -2
- package/dist/slices/revisions/mutation-assets.js +51 -9
- package/dist/slices/revisions/mutation-prepare.js +14 -14
- package/dist/slices/revisions/mutations.js +2 -1
- package/dist/slices/revisions/publish.js +20 -2
- package/dist/slices/revisions/schema.js +16 -1
- package/dist/slices/schedules/repo.js +1 -1
- package/dist/slices/schedules/service.js +6 -1
- package/dist/slices/settings/model.js +5 -0
- package/dist/slices/shorts/captions.js +272 -0
- package/dist/slices/shorts/clips.js +89 -0
- package/dist/slices/shorts/model.js +186 -0
- package/dist/slices/shorts/pick.js +232 -0
- package/dist/slices/shorts/prompts.js +68 -0
- package/dist/slices/shorts/render.js +163 -0
- package/dist/slices/storage/asset-name.js +9 -2
- package/dist/slices/storage/layout.js +18 -0
- package/dist/slices/storage/model.js +9 -0
- package/dist/slices/storage/portable.js +6 -3
- package/dist/slices/storage/reconcile.js +5 -1
- package/dist/slices/storage/schema.js +3 -0
- package/dist/slices/telemetry/model.js +3 -0
- package/dist/slices/video/cards.js +72 -0
- package/dist/slices/video/chapters.js +89 -0
- package/dist/slices/video/cuts.js +141 -0
- package/dist/slices/video/edit-list.js +36 -6
- package/dist/slices/video/edit-settings.js +191 -0
- package/dist/slices/video/ffmpeg.js +155 -29
- package/dist/slices/video/look.js +164 -0
- package/dist/slices/video/plan.js +68 -11
- package/dist/slices/video/slideshow.js +22 -6
- package/dist/slices/video/transitions.js +51 -0
- package/dist/slices/youtube/transcript.js +54 -0
- package/dist/web/assets/index-CktpxlJd.js +171 -0
- package/dist/web/assets/index-DB-vOnGU.css +1 -0
- package/dist/web/assets/{pdf-DR97Byps.js → pdf-BLF2i8c2.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DfXmBzCk.js +0 -168
- package/dist/web/assets/index-Y3RhfTEh.css +0 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(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 u=o((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.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=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 O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 M(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,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(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 N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=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)},te={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},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=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.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)T.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=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),d=o(((e,t)=>{t.exports=u()})),f=o((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})),p=o(((e,t)=>{t.exports=f()})),m=l(d(),1),h=p(),g=m.createContext(void 0),_=e=>{let t=m.useContext(g);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},v=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,h.jsx)(g.Provider,{value:e,children:t})),y={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=y;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 x(e){setTimeout(e,0)}var S=typeof window>`u`||`Deno`in globalThis;function C(){}function w(e,t){return typeof e==`function`?e(t):e}function T(e){return typeof e==`number`&&e>=0&&e!==1/0}function E(e,t){return Math.max(e+(t||0)-Date.now(),0)}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!j(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 k(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(A(t.options.mutationKey)!==A(a))return!1}else if(!j(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||A)(e)}function A(e){return JSON.stringify(e,(e,t)=>te(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function j(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)){for(let n=0;n<t.length;n++)if(!j(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!j(e[r],t[r]))return!1;return!0}return!1}var M=Object.prototype.hasOwnProperty;function N(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=F(e)&&F(t);if(!r&&!(te(e)&&te(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:M.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=N(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function F(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function te(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function re(e){return new Promise(t=>{b.setTimeout(t,e)})}function ie(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:N(e,t)}function ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function oe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var se=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===se?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var de=()=>S,fe=()=>de(),pe=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 pe{#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`}},he=x;function ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=he,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 _e=ge(),ve=new class extends pe{#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 ye(e){return Math.min(1e3*2**e,3e4)}function be(e){return(e??`online`)!==`online`||ve.isOnline()}var xe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Se(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(C);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new xe(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>me.isFocused()&&(e.networkMode===`always`||ve.isOnline())&&e.canRun(),p=()=>be(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(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??(fe()?0:3),a=e.retryDelay??ye,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),re(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ce=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fe()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}};function we(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=e=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(t.options,t.fetchOptions),d=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 l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?oe:ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ee:Te,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Te(r,s);if(c>0&&e==null)break;s=await d(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 Te(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 Ee(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var De=class extends Ce{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=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=Ae(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.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ie(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(C).catch(C):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=>D(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===se||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>D(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:!E(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.#s||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.#c({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)return this.#a.continueRetry(),this.#a.promise}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.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ce(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!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`?we(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Se({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof xe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();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 xe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({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.scheduleGc()}}#c(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,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(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),_e.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:be(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(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 je=class extends pe{#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),Ne(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pe(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 D(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&&!P(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fe(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||D(this.options.staleTime,this.#t)!==D(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(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 P(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().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(C)),t}#h(e){return!fe()&&D(this.options.enabled,this.#t)!==!1&&T(e)}#g(){this.#b();let e=D(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=E(this.#r.dataUpdatedAt,e)+1;this.#u=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=b.setInterval(()=>{(this.options.refetchIntervalInBackground||me.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(b.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(b.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&&Ne(e,t),o=i&&Fe(e,n,t,r);(a||o)&&(l={...l,...Oe(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=ie(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=ie(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=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:Ie(e,t),refetch:this.refetch,isEnabled:D(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),P(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)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();_e.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 Me(e,t){return D(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||D(t.retryOnMount,e)!==!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&Pe(e,t,t.refetchOnMount)}function Pe(e,t,n){if(D(t.enabled,e)!==!1&&D(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ie(e,t)}return!1}function Fe(e,t,n,r){return(e!==t||D(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ie(e,n)}function Ie(e,t){return D(t.enabled,e)!==!1&&e.isStaleByTime(D(t.staleTime,e))}var Le=class extends Ce{#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||Re(),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=Se({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})}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),_e.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Re(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ze=class extends pe{#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 Le({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=Be(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=Be(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=Be(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=Be(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){_e.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>k(t,e))}findAll(e={}){return this.getAll().filter(t=>k(e,t))}notify(e){_e.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return _e.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};function Be(e){return e.options.scope?.id}var Ve=class extends pe{#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),P(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&A(t.mutationKey)!==A(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??Re();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){_e.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},He=class extends pe{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new De({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){_e.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=>O(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>O(e,t)):t}notify(e){_e.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_e.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_e.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new He,this.#t=e.mutationCache||new ze,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=ve.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(D(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=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _e.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;_e.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return _e.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=_e.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return _e.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=_e.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}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(D(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(D(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}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(C).catch(C)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ve.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(A(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{j(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(A(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{j(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||=ee(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===se&&(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()}},We=m.createContext(!1),Ge=()=>m.useContext(We);We.Provider;function Ke(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qe=m.createContext(Ke()),Je=()=>m.useContext(qe),Ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Xe=e=>{m.useEffect(()=>{e.clearReset()},[e])},Ze=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||le(n,[e.error,r])),Qe=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))}},$e=(e,t)=>e?.suspense&&t.isPending,et=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tt(e,t,n){let r=Ge(),i=Je(),a=_(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Qe(o),Ye(o,i,s),Xe(i);let[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(m.useSyncExternalStore(m.useCallback(e=>{let t=d?l.subscribe(_e.batchCalls(e)):C;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),$e(o,u))throw et(o,l,i);if(Ze({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function I(e,t){return tt(e,je,t)}function nt(e){return e}function rt(e,t){let n=_(t),[r]=m.useState(()=>new Ve(n,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);let i=m.useSyncExternalStore(m.useCallback(e=>r.subscribe(_e.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=m.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(C)},[r]);if(i.error&&le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var it=m.useLayoutEffect;function at(e,t,n){m.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function ot(e){let t=m.useRef(null);return m.useImperativeHandle(e,()=>t.current,[]),t}function st(e){return e[e.length-1]}function ct(e,t){return typeof e==`function`?e(t):e}var lt=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;function dt(e){for(let t in e)if(lt.call(e,t))return!0;return!1}var ft=()=>Object.create(null),pt=(e,t)=>mt(e,t,ft);function mt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=vt(e)&&vt(i);if(!a&&!(gt(e)&>(i)))return i;let o=a?e:ht(e);if(!o)return i;let s=a?i:ht(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:lt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=mt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function ht(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!ut.call(e,r))return!1;t.push(r)}return t}function gt(e){if(!_t(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!_t(n)||!n.hasOwnProperty(`isPrototypeOf`))}function _t(e){return Object.prototype.toString.call(e)===`[object Object]`}function vt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function yt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!yt(e[r],t[r],n))return!1;return!0}if(gt(e)&>(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!yt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!yt(e[o],t[o],n)))return!1;return i===a}return!1}var bt=/[\x00-\x1f\x7f"<>`{}]/g;function xt(e){return e.replace(bt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function St(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return xt(t)}var Ct=[`http:`,`https:`,`mailto:`,`tel:`];function wt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Tt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=St(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=St(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Et(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Dt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ot(){throw Error(`Invariant failed`)}function kt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var At=4,jt=5;function Mt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Nt(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=Mt(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=Ft(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=It(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Ft(r);e.kind=jt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Ft(r);e.kind=At,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Nt(e,t,r,c,i,a,o,s)}function Pt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ft(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function It(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Lt(e,t){let n=Ft(`/`),r=new Uint16Array(6),i=[];for(let t of e)Nt(!1,r,t,1,n,0,i);for(let e of i)e.sort(Pt);t.masksTree=n,t.flatCache=kt(1e3)}function Rt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Ut(e,t.masksTree);return t.flatCache.set(e,r),r}function zt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ft(`/`),Nt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Ut(r,o,n)}function Bt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Ut(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Gt(a.route)),t.matchCache.set(r,a),a}function Vt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Ht(e,t=!1,n){let r=Ft(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Nt(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&Ot(),o[e.id]=e,c!==0&&e.path){let t=Vt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Pt);return{processedTree:{segmentTree:r,singleCache:kt(1e3),matchCache:kt(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Ut(e,t,n=!1){let r=e.split(`/`),i=qt(e,r,t,n);if(!i)return null;let[a]=Wt(e,r,i);return{route:i.node.route,rawParams:a}}function Wt(e,t,n){let r=Kt(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===At)break;if(u.kind===jt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length;if(e.charCodeAt(t)===123){let n=u.suffix.length,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length,r=u.suffix.length,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function Gt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Kt(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function qt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!st(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!Zt(l,n))continue;if(i.parse){if(!Xt(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==At&&Zt(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===At||i.kind===2)&&Zt(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Xt(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Yt(f,o))return n;Zt(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+Jt(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+Jt(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+Jt(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+Jt(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function Jt(e,t){return 2**(e-t-1)}function Yt(e,t){return e===2**(t-1)-1}function Xt(e,t,n){let r,i;try{[r,i]=Wt(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Zt(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===At)>(e.node.kind===At)||t.node.kind===At==(e.node.kind===At)&&t.node.depth>e.node.depth)))}function Qt(e){return $t(e.filter(e=>e!==void 0).join(`/`))}function $t(e){return e.replace(/\/{2,}/g,`/`)}function en(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function tn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function nn(e){return tn(en(e))}function rn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function an(e,t,n){return rn(e,n)===rn(t,n)}function on({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=$t(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=$t(e)),o=e.split(`/`);o.length>1&&st(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(st(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?$t(s):s)||`/`;return a&&r&&r.set(a,c),c}function sn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function cn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>un(e,n)).join(`/`):un(r,n):r}function ln({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Mt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=cn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=cn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=cn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function un(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function dn(e){return e?.isNotFound===!0}function fn(){try{return sessionStorage}catch{return}}var pn=`tsr-scroll-restoration-v1_3`,mn=fn();function hn(){try{return JSON.parse(mn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function gn(){try{mn?.setItem(pn,JSON.stringify(_n))}catch{}}var _n=hn(),vn=`data-scroll-restoration-id`,yn=e=>e.state.__TSR_key||e.href;function bn(e){let t=e.getAttribute(vn);if(t)return`[${vn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var xn=!1,Sn=`window`;function Cn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function wn(e){let t=new Set;for(let n of e){if(n===Sn)continue;let e=Cn(n);e&&t.add(e)}return t}function Tn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||yn,a=new Set,o=e=>{let t=_n[e]||={};for(let e of a)e===document?t[Sn]={scrollX,scrollY}:e.isConnected&&(t[bn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,xn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{xn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),gn()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=_n[d];if(e){let t=_n[u];for(let n in e){if(n===Sn){if(s)continue}else{let e=Cn(n);if(!e||s&&o&&(l??=wn(o),l.has(e)))continue}t||=_n[u]={},t[n]??=e[n]}}}xn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=wn(o));let t=e&&i&&c,s=r.restoring?_n[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Sn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Cn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{xn=!1}}))}function En(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Dn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function On(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Dn(r):Array.isArray(t)?t.push(Dn(r)):n[e]=[t,Dn(r)]}return n}var kn=/^(?:\s|["[{\d-]|fa|nu|tr)/,An=Mn(JSON.parse),jn=Nn(JSON.stringify,JSON.parse);function Mn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=On(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Nn(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!kn.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=En(e,r);return t?`?${t}`:``}}var Pn=`__root__`;function Fn(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function In(e){return e instanceof Response&&!!e.options}function Ln(e){return{input:({url:t})=>{for(let n of e)t=zn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Bn(e[n],t);return t}}}function Rn(e){let t=nn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Qt([`/`,t,e.pathname]),e)}}function zn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Bn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Vn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Dt(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Hn=`__TSR_index`,Un=`popstate`,Wn=`beforeunload`;function Gn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Yn(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Hn];i=Kn(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Hn];i=Kn(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Hn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Kn(e,t){t||={};let n=Xn();return{...t,key:n,__TSR_key:n,[Hn]:e}}function qn(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Yn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Xn();t.history.replaceState({[Hn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=Yn(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Hn]-l.state[Hn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=Gn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Wn,x,{capture:!0}),t.removeEventListener(Un,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Wn,x,{capture:!0}),t.addEventListener(Un,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Jn(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Yn(e,t){let n=Jn(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Xn();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Hn]:0,key:a,__TSR_key:a}}}function Xn(){return(Math.random()+1).toString(36).substring(7)}function Zn(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Qn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function $n({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function er(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var tr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=sn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:qn()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=kt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Vn(this.latestLocation,e),Tn(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=nn(a);t&&t!==`/`&&e.push(Rn({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ln(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Ht(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Lt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Tt(e).path,external:!1,searchStr:o,search:pt(t?.search,i),hash:Tt(r.slice(1)).path,state:mt(t?.state,a)}}let o=new URL(i,this.origin),s=zn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Tt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:pt(t?.search,c),hash:Tt(s.hash.slice(1)).path,state:mt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>on({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Bt(tn(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=Yn(t.href,{});t={...t,to:zn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=sr(t.params,o),l=this.routesByPath[tn(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&dt(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:Tt(ln({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,ir(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=ar(f,t,u,e._includeValidateSearch),f=pt(a,f);let p=this.options.stringifySearch(f),m=t.hash===!0?n.hash:t.hash?ct(t.hash,n.hash):void 0,h=m?`#${m}`:``,g=t.state===!0?n.state:t.state?ct(t.state,n.state):{};t.state&&(g=mt(n.state,g));let _=`${d}${p}${h}`,v,y,b=!1;if(this.rewrite){let e=new URL(_,this.origin),t=Bn(this.rewrite,e);v=e.href.replace(e.origin,``),t.origin===this.origin?y=t.pathname+t.search+t.hash:(y=t.href,b=!0)}else v=Et(_),y=v;return{publicHref:y,href:v,pathname:d,search:f,searchStr:p,state:g,hash:m??``,external:b,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=Rt(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=sr(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=tn(this.latestLocation.href)===tn(n.href)&&yt($n(n.state),$n(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(wt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Qr(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Qn(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Zn(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&wt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=dr,this.preloadRoute=e=>$r(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=zt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!yt(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?yt(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??jn,parseSearch:e.parseSearch??An,protocolAllowlist:e.protocolAllowlist??Ct}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Gt(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:tn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?or(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=ir(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof nr||(r=new nr(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=ln({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),v=i.id+g+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(_,d);let x;if(!b)try{cr(i,d)}catch(e){if(x=dn(e)||In(e)?e:new rr(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:pt(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Zn(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:g,updatedAt:Date.now(),search:y?pt(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?mt(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?pt(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=st(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=st(a),c={...e.search};for(let e of a)try{Object.assign(c,ir(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{cr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},nr=class extends Error{},rr=class extends Error{};function ir(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new nr(`Async validation not supported`);if(n.issues)throw new nr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function ar(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=ir(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=ct(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function or(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Pn}function sr(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,ct(e,n))}function cr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function lr(e,t){return e.options[t]?.preload?.()}function ur(e,t){let n=lr(e,`component`),r=lr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function dr(e,t,n){let r=()=>t===!1?void 0:t?lr(e,t):ur(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function fr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var pr=0,mr=1,hr=2,gr=3,_r=[4];function vr(e){return typeof e[0]==`number`}function yr(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function br(e,t){return e.routesById[t.routeId]}function xr(e,t,n){return In(e)?[gr,e]:dn(e)?(e.routeId||=n,[hr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[mr,e]):[pr,e]}function Sr(e,t){let n=xr(t,!0,e.id);if(n[0]!==mr)return n;try{e.options.onError?.(n[1])}catch(t){n=xr(t,!0,e.id)}return n}function Cr(e,t,n,r,i){return i[0].signal.aborted?_r:zr(e,t,n,Sr(n,r),i)}async function wr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=br(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Er(e,r),[i,Cr(e,t,u,a,n)]}if(c.aborted)return[i,_r];let p=r.paramsError??r.searchError;if(p!==void 0)return Er(e,r),[i,Cr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{kr(e,r,`beforeLoad`,n[0]);let a=await yr(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,_r];let o=zr(e,t,u,xr(a,!1,u.id),n);if(o[0]!==pr)return Er(e,r),[i,o];r.context={...r.context,...a}}catch(a){return Er(e,r),[i,Cr(e,t,u,a,n)]}finally{r.status=h,kr(e,r,!1,n[0])}}i()}function Tr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Er(e,t){let n=t._flight;t._flight=void 0,Tr(e,t,n)?.abort()}function Dr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Tr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Or(e){for(let t of e){let e=t._flight;e&&e[2]++}}function kr(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Ar(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function jr(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return _r;if(!i)return[pr,void 0];let l=n._flight;kr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Ar(e,t,n,r,s,a,!!o[3]))).then(e=>xr(e,!1,r.id),e=>xr(e,!0,r.id)).then(t=>(t[0]!==pr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===mr&&l[2]?Sr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],zr(e,t,r,await yr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Er(e,n),_r}finally{kr(e,n,!1,s)}}function Mr(e,t,n){t[0]!==gr&&(e.status=`success`,e.error=void 0,t[0]===pr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Nr(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Er(e,r)}function Pr(e,t){return t[0]===mr||t[0]===hr?{...e,status:t[0]===mr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Fr(e,t,n,r,i,a,o){let s=t[1][n],c=br(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Ar(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=_r)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Er(e,s),p=Cr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Tr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=(p?Promise.resolve(p):x?jr(e,t,s,c,g,i,a):Promise.resolve([pr,s.loaderData])).then(t=>(x&&(Mr(s,t,l),t[0]===pr&&(m&&!a[0].signal.aborted&&Nr(e,s,u),n>=o&&(s.status=`pending`))),t)),T=yr(Promise.resolve().then(()=>dr(c,void 0,C)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,Cr(e,t,c,r,a)]).then(e=>w.then(t=>(x&&!e&&t[0]===pr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.()),e)));if(r.push([n,w,T]),!y)return w.then(e=>Pr(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=jr(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,Mr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Pr(E,e))}async function Ir(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=br(e,t[n]);try{let e=dr(i,!1);e&&await yr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Lr(e,t){t[2]&&=(Dr(e,t[2].map(e=>e[3])),void 0)}async function Rr(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=gr)throw[a,t];!i&&t[0]!==pr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===gr)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function zr(e,t,n,r,i,a){for(;r[0]===gr;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[gr,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[mr,e]:Sr(n,e),a=!0}}return r}async function Br(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===hr?Ir(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=gr)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==pr&&t[0]<gr&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=gr){let n=s[1];if(n[0]!==gr||n[1].options.reloadDocument||n[2])return Lr(e,t),n;c=!0,s=[0,[mr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===mr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=br(e,u);try{await yr(i?Promise.resolve().then(()=>dr(m,l===mr?`errorComponent`:`notFoundComponent`)):Promise.all([dr(m),dr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Lr(e,t),_r}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Lr(e,t),Dr(e,o),p()):u.status=`success`}return t}async function Vr(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=br(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await yr(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function Hr(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Ir(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||i._notFound||e.preload||a?.id!==e.id||a.status!==`success`||a._notFound)break;l++}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Fr(e,i,t,u,f,r,l)},m=await wr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===hr){let t=await Ir(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=gr&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Br(e,i,u,r[0],Rr(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Rr(i[2],void 0,void 0,h.then(e=>vr(e)?0:fr(n).length,()=>0))),o=await h}catch(t){if(Lr(e,i),t===a&&a.aborted)return _r;throw t}return vr(o)?o:Vr(e,o,a,r[6]===n.length?r[6]:0)}function Ur(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=br(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Ur(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Wr(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function Gr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!fr(t[3]).some(e=>e.id===n[1]))return;let i;try{await yr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Kr(e,t){e._committed=t,e.stores.setMatches(t)}function qr(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=fr(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t<o||e.status===`success`)))continue;let i=br(e,r);!i.options.loader||t-r.updatedAt>=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,Kr(e,n),Dr(e,[...a.values(),...i],[...n,...s.values()]),er(e,i,n,t)}async function Jr(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function Yr(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Xr(e,t,n,r,i){let a=n.map(e=>({...e}));Or(a);for(let t of r)Er(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Br(e,o,r,t[0],i)}catch(t){throw Dr(e,a),t}if(vr(s)){Dr(e,a),s[0]===gr&&e._tx===t&&e._committed===n&&await Yr(e,t,s);return}if(await Vr(e,s,t[0].signal),e._tx!==t||e._committed!==n){Dr(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Er(e,n))}Kr(e,a),Dr(e,n,a)}async function Zr(e,t,n,r,i,a){let o=await Hr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(vr(o)){let n=o[0]===gr&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Wr(e,t),Dr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Wr(e,t);return}await Yr(e,t,o);return}let s=o[1];if(e._tx===t&&await Gr(e,t),e._tx!==t){Wr(e,t),Dr(e,s),Lr(e,o);return}let c=t[2],l=Qn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Gr(e,t),e._tx!==t){Wr(e,t),Dr(e,s),Lr(e,o);return}let n=await e.startTransition(()=>{Wr(e,t),qr(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Lr(e,o);return}u?.length&&Xr(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Qr(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Qn(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Jr(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Or(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Dr(e,m),await Jr(e,n);return}e._preflight=void 0;let g,_=()=>Zr(e,y,f,()=>Ur(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&kr(e,t,!1)}n[0].abort(),Dr(e,n[3],y[3],!0)}if(e._tx!==y){Dr(e,y[3]),y[3]=[],g?.(),await Jr(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Ur(e,y),g?.(_()),await v,await Jr(e,y)}async function $r(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Or(a),o=(e._preloads??=new Map).set(i,a),s=await Hr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Dr(e,a)),i.abort()}if(!vr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){dn(e)||console.error(e);return}}}var ei=`Error preloading route! ☝️`,ti=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Pn:this.parentRoute||Ot();let r=n?Pn:t?.path;r&&r!==`/`&&(r=en(r));let i=t?.id||r,a=n?Pn:Qt([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Qt([`/`,a]));let o=a===`__root__`?`/`:Qt([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=tn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Fn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ni=class extends ti{constructor(e){super(e)}},ri=class extends m.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?m.createElement(this.props.errorComponent??ii,{error:e,reset:this.reset}):this.props.children}};function ii({error:e}){let[t,n]=m.useState(!1);return(0,h.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,h.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,h.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,h.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,h.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,h.jsx)(`div`,{children:(0,h.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,h.jsx)(`code`,{children:e.message}):null})}):null]})}function ai({children:e,fallback:t=null}){return(0,h.jsx)(m.Fragment,{children:oi()?e:t})}function oi(){return m.useSyncExternalStore(si,()=>!0,()=>!1)}function si(){return()=>{}}var ci=m.createContext(null);function li(e){return m.useContext(ci)}var ui=m.createContext(void 0),di=m.createContext(void 0),fi=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(fi||{});function pi({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;continue}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 mi(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 hi=[],gi=0,{link:_i,unlink:vi,propagate:yi,checkDirty:bi,shallowPropagate:xi}=pi({update(e){return e._update()},notify(e){hi[Ci++]=e,e.flags&=~fi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=fi.Mutable|fi.Dirty,Di(e))}}),Si=0,Ci=0,wi,Ti=0;function Ei(e){try{++Ti,e()}finally{--Ti||Oi()}}function Di(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=vi(n,e)}function Oi(){if(!(Ti>0)){for(;Si<Ci;){let e=hi[Si];hi[Si++]=void 0,e.notify()}Si=0,Ci=0}}function ki(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?fi.None:fi.Mutable,get(){return wi!==void 0&&_i(i,wi,gi),i._snapshot},subscribe(e){let t=mi(e),n={current:!1},r=Ai(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=wi,o=t?.compare??Object.is;if(n)wi=i,++gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=fi.Mutable|fi.RecursedCheck);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{wi=a,n&&(i.flags&=~fi.RecursedCheck),Di(i)}}};return n?(i.flags=fi.Mutable|fi.Dirty,i.get=function(){let e=i.flags;if(e&fi.Dirty||e&fi.Pending&&bi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&xi(e)}}else e&fi.Pending&&(i.flags=e&~fi.Pending);return wi!==void 0&&_i(i,wi,gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(yi(e),xi(e),Oi())}},i}function Ai(e){let t=()=>{let t=wi;wi=n,++gi,n.depsTail=void 0,n.flags=fi.Watching|fi.RecursedCheck;try{return e()}finally{wi=t,n.flags&=~fi.RecursedCheck,Di(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:fi.Watching|fi.RecursedCheck,notify(){let e=this.flags;e&fi.Dirty||e&fi.Pending&&bi(this.deps,this)?t():this.flags=fi.Watching},stop(){this.flags=fi.None,this.depsTail=void 0,Di(this)}};return t(),n}var ji=o((e=>{var t=d();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 f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Mi=o(((e,t)=>{t.exports=ji()})),Ni=o((e=>{var t=d(),n=Mi();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}})),Pi=o(((e,t)=>{t.exports=Ni()}))();function Fi(e,t){return e===t}function Ii(e,t,n=Fi){let r=(0,m.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,m.useCallback)(()=>e?.get(),[e]);return(0,Pi.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Li={};function Ri(e,t){let n=m.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=mt(n.current,i):i}}function zi(e){let t=li(),n=m.useContext(e.from?di:ui),r=e.from??n,i=t.stores.getMatchStore(r),a=Ri(e,t),o=Ii(i,e=>e?a(e):Li);if(o!==Li)return o;(e.shouldThrow??!0)&&Ot()}function Bi(e){return zi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Vi(e){let{select:t,...n}=e;return zi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Hi(e){return zi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ui(e){return zi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Wi(e){let t=li();return m.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Gi(e){return zi({...e,select:t=>e.select?e.select(t.context):t.context})}function Ki(e){let t=m.useRef(e);return yt(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function qi(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ji(e,t,n){if(e?.external)return wt(e.href,n)?void 0:e.href;if(!aa(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),wt(t,n)?void 0:t}catch{}}function Yi(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!an(e.pathname,t.pathname,r))return!1}else{let n=rn(e.pathname,r),i=rn(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!yt(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Xi(e,t){let n=li(),r=ot(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:h,viewTransition:g,children:_,target:v,disabled:y,style:b,className:x,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:O,params:k,search:ee,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:te,...ne}=e,re=oi(),ie=Ki(e.search),ae=Ki(e.params),oe=Ki(o),se=m.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ie,ae,e.state,e.mask,e.unsafeRelative]),ce=m.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...se}),r=ia(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,y),i=Ji(r,s,n.protocolAllowlist);return[r?.href,i,Yi(e,t,oe,n.basepath,re,i!==void 0)]},[oe,y,re,se,n,s]),[le,ue,de]=Ii(n.stores.location,ce,qi),fe=de?ct(i,{})??Qi:Zi,pe=de?Zi:ct(a,{})??Zi,me=[x,fe.className,pe.className].filter(Boolean).join(` `),he=(b||fe.style||pe.style)&&{...b,...fe.style,...pe.style},ge=m.useRef(!1),_e=e.reloadDocument||ue||y?!1:c??n.options.defaultPreload,ve=l??n.options.defaultPreloadDelay??0,ye=m.useCallback(()=>{n.preloadRoute(se).catch(e=>{console.warn(e),console.warn(ei)})},[n,se]),be=m.useCallback(e=>{if(!e){na(r);return}if(!(e.isIntersecting??_e===`intent`)){e.isIntersecting===!1&&na(r);return}if(!ve){ye();return}ta.has(r)||ta.set(r,setTimeout(()=>{ta.delete(r),ye()},ve))},[ye,r,_e,ve]);at(r,be,_e!==`viewport`),m.useEffect(()=>{ge.current||_e===`render`&&(ye(),ge.current=!0)},[ye,_e]);let xe=e=>{let t=e.currentTarget.getAttribute(`target`),r=v===void 0?t:v;!y&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...se,replace:f,resetScroll:h,hashScrollIntoView:d,startTransition:p,viewTransition:g,ignoreBlocker:O}))};if(ue)return{...ne,ref:r,href:ue,..._&&{children:_},...v&&{target:v},...y&&{disabled:y},...b&&{style:b},...x&&{className:x},...S&&{onClick:S},...C&&{onBlur:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let Se=()=>{_e===`intent`&&ye()},Ce=()=>{_e===`intent`&&na(r)};return{...ne,...fe,...pe,href:le,ref:r,onClick:ra([S,xe]),onBlur:ra([C,Ce]),onFocus:ra([w,be]),onMouseEnter:ra([T,be]),onMouseLeave:ra([E,Ce]),onTouchStart:ra([D,Se]),disabled:!!y,target:v,...he&&{style:he},...me&&{className:me},...y&&$i,...de&&ea}}var Zi={},Qi={className:`active`},$i={role:`link`,"aria-disabled":!0},ea={"data-status":`active`,"aria-current":`page`},ta=new WeakMap,na=e=>{clearTimeout(ta.get(e)),ta.delete(e)},ra=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ia(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function aa(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var oa=m.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Xi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return m.createElement(`a`,t,o)}return m.createElement(n,a,o)}),sa=class extends ti{constructor(e){super(e),this.useMatch=e=>zi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Gi({...e,from:this.id}),this.useSearch=e=>Ui({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Hi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Vi({...e,from:this.id}),this.useLoaderData=e=>Bi({...e,from:this.id}),this.useNavigate=()=>Wi({from:this.fullPath}),this.Link=m.forwardRef((e,t)=>(0,h.jsx)(oa,{ref:t,from:this.fullPath,...e}))}};function ca(e){return new sa(e)}var la=class extends ni{constructor(e){super(e),this.useMatch=e=>zi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Gi({...e,from:this.id}),this.useSearch=e=>Ui({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Hi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Vi({...e,from:this.id}),this.useLoaderData=e=>Bi({...e,from:this.id}),this.useNavigate=()=>Wi({from:this.fullPath}),this.Link=m.forwardRef((e,t)=>(0,h.jsx)(oa,{ref:t,from:this.fullPath,...e}))}};function ua(e){return new la(e)}function da(e){let t=li(),n=`not-found-${Ii(t.stores.location,e=>e.pathname)}-${Ii(t.stores.status,e=>e)}`;return(0,h.jsx)(ri,{getResetKey:()=>n,onCatch:(t,n)=>{if(dn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(dn(t))return e.fallback?.(t);throw t},children:e.children})}function fa(){return(0,h.jsx)(`p`,{children:`Not Found`})}function pa(e){return(0,h.jsx)(h.Fragment,{children:e.children})}function ma(e,t,n){return t.options.notFoundComponent?(0,h.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,h.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,h.jsx)(fa,{})}function ha(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,h.jsx)(n,{}):null}var ga=(e,t)=>e[0]===t[0]&&e[1]===t[1],_a=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,va=m.memo(function({routeId:e}){let t=li();return(0,h.jsx)(ya,{router:t,match:Ii(t.stores.getMatchStore(e),e=>e)})});function ya({router:e,match:t}){let n=e.routesById[t.routeId],r=ha(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=_a(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?m.Suspense:pa,l=i?ri:pa,u=o?da:pa;return(0,h.jsxs)(n.isRoot?n.options.shellComponent??pa:pa,{children:[(0,h.jsx)(ui.Provider,{value:t.routeId,children:(0,h.jsx)(c,{fallback:r,children:(0,h.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(dn(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,h.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return m.createElement(o,e)},children:s?(0,h.jsx)(ai,{fallback:r,children:(0,h.jsx)(ba,{match:t})}):(0,h.jsx)(ba,{match:t})})})})}),null]})}var ba=m.memo(function({match:e}){let t=li(),n=e.routeId,r=t.routesById[n],i=m.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=m.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,h.jsx)(e,{},i):(0,h.jsx)(xa,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!_a(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return ha(t,r)}if(e.status===`notFound`)return ma(t,r,e.error);if(e.status===`error`)throw e.error;return a}),xa=m.memo(function(){let e=li(),t=m.useContext(ui),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Ii(a,e=>[!!e._notFound,e.error],ga),i=Ii(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return ma(e,e.routesById[t],r);if(!i)return null;let a=(0,h.jsx)(va,{routeId:i});return t===`__root__`?(0,h.jsx)(m.Suspense,{fallback:ha(e),children:a}):a});function Sa(e,t){let n=e[1];e.length=0,n?.(t)}function Ca({t:e}){let t=li(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Sa(n,!1),n.push(i,a),e(t),m.startTransition(r)}),it(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(tn(r.publicHref)!==tn(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Qn(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function wa(){let e=li(),t=e.routesById[Pn],n=ha(e,t),r=e.ssr?pa:m.Suspense,i=(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ca,{t:m.useState()[1]}),(0,h.jsx)(r,{fallback:n,children:(0,h.jsx)(Ta,{})})]});return e.options.InnerWrap?(0,h.jsx)(e.options.InnerWrap,{children:i}):i}function Ta(){let e=li(),t=e._rendered,n=Ii(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;it(()=>{t[0]===n&&Sa(t,!0)},[t,n]);let a=i?(0,h.jsx)(va,{routeId:i}):null;return(0,h.jsx)(ui.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,h.jsx)(ri,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Ea=e=>({createMutableStore:ki,createReadonlyStore:ki,batch:Ei}),Da=e=>new Oa(e),Oa=class extends tr{constructor(e){super(e,Ea)}};function ka({router:e,children:t,...n}){dt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,h.jsx)(ci.Provider,{value:e,children:t});return e.options.Wrap?(0,h.jsx)(e.options.Wrap,{children:r}):r}function Aa({router:e,...t}){return(0,h.jsx)(ka,{router:e,...t,children:(0,h.jsx)(wa,{})})}function ja(e){let t=li();return Ii(t.stores.location,Ri(e,t))}var Ma=o((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,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){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&&E());){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&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Na=o(((e,t)=>{t.exports=Ma()})),Pa=o((e=>{var t=d();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`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(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.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 o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.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=c(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=c(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})}}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=c(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=c(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})}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 s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),Fa=o(((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=Pa()})),Ia=o((e=>{var t=Na(),n=d(),r=Fa();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){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function re(e){return{current:e}}function ie(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function ae(e,t){ne++,te[ne]=e.current,e.current=t}var oe=re(null),se=re(null),ce=re(null),le=re(null);function ue(e,t){switch(ae(ce,t),ae(se,e),ae(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ie(oe),ae(oe,e)}function de(){ie(oe),ie(se),ie(ce)}function fe(e){e.memoizedState!==null&&ae(le,e);var t=oe.current,n=tf(t,e.type);t!==n&&(ae(se,e),ae(oe,n))}function pe(e){se.current===e&&(ie(oe),ie(se)),le.current===e&&(ie(le),dp._currentValue=F)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!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}e.call(n.prototype)}}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(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);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=`
|
|
6
|
+
`+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{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(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&261888;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 Ke(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=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(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 qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(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 Ye(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Xe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ze(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qe(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-Re(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&&$e(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function $e(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Re(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function et(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Re(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function tt(e,t){var n=t&-t;return n=n&42?1:I(n),(n&(e.suspendedLanes|t))===0?n:0}function I(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 nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:Dp(e.type)):e}function it(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wf(e);e!==null;){if(n=e[ot])return n;e=wf(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=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]*$`),Tt={},Et={};function Dt(e){return xe.call(Et,e)?!0:xe.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(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 kt(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 At(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 jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(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 Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function It(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(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=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(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=``+jt(s):e.removeAttribute(`name`)}function Bt(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)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(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),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(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=``+jt(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 Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(M(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=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 qt(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||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(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]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&qt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&qt(e,o,t[o])}function Yt(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 Xt=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`],[`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`]]),Zt=/^[\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 Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(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="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));zt(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&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(Au(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||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 ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,"passive",{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.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 mn=i.slice(e,1<r?1-r:void 0)}function gn(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 _n(){return!0}function vn(){return!1}function yn(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)?_n:vn,this.isPropagationStopped=vn,this}return p(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=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=p({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=p({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,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!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(p({},Dn,{dataTransfer:0})),An=yn(p({},Sn,{relatedTarget:0})),jn=yn(p({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(p({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(p({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={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`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(p({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(p({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(p({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(p({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(p({},Dn,{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})),Wn=yn(p({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!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 Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={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 ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Rd(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){Ad(e,0)}function lr(e){if(Ft(_t(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(ln){var fr;if(ln){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,tn(e)),sn(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(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(!xe.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(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=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(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=It(e.document)}return t}function Or(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 kr=ln&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==It(r)||(r=Ar,`selectionStart`in r&&Or(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}),Mr&&Cr(Mr,r)||(Mr=r,r=Rd(jr,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};ln&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),St(t,[e])}var Xr=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)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[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&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(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-Re(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<xu)throw xu=0,Su=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(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 ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(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&65011712,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 di(e,t){e.flags&=65011714;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 fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=np(e,n,oe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=ci(31,n,t,a),e.elementType=D,e.lanes=o,e;case _:return pi(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=ci(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case C:return e=ci(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=ci(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function vi(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:be(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:be(t)}}var yi=[],bi=0,xi=null,Si=0,Ci=[],wi=0,Ti=null,Ei=1,Di=``;function Oi(e,t){yi[bi++]=Si,yi[bi++]=xi,xi=e,Si=t}function ki(e,t,n){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ti=e;var r=Ei;e=Di;var i=32-Re(r)-1;r&=~(1<<i),n+=1;var a=32-Re(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ei=1<<32-Re(t)+i|n<<i|r,Di=a+e}else Ei=1<<a|n<<i|r,Di=e}function Ai(e){e.return!==null&&(Oi(e,1),ki(e,1,0))}function ji(e){for(;e===xi;)xi=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null;for(;e===Ti;)Ti=Ci[--wi],Ci[wi]=null,Di=Ci[--wi],Ci[wi]=null,Ei=Ci[--wi],Ci[wi]=null}function Mi(e,t){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ei=t.id,Di=t.overflow,Ti=e}var Ni=null,Pi=null,Fi=!1,Ii=null,Li=!1,Ri=Error(i(519));function zi(e){throw Gi(vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ri}function Bi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:jd(`cancel`,t),jd(`close`,t);break;case`iframe`:case`object`:case`embed`:jd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Od.length;n++)jd(Od[n],t);break;case`source`:jd(`error`,t);break;case`img`:case`image`:case`link`:jd(`error`,t),jd(`load`,t);break;case`details`:jd(`toggle`,t);break;case`input`:jd(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:jd(`invalid`,t);break;case`textarea`:jd(`invalid`,t),Wt(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||Wd(t.textContent,n)?(r.popover!=null&&(jd(`beforetoggle`,t),jd(`toggle`,t)),r.onScroll!=null&&jd(`scroll`,t),r.onScrollEnd!=null&&jd(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||zi(e,!0)}function Vi(e){for(Ni=e.return;Ni;)switch(Ni.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Ni=Ni.return}}function Hi(e){if(e!==Ni)return!1;if(!Fi)return Vi(e),Fi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||nf(e.type,e.memoizedProps)),n=!n),n&&Pi&&zi(e),Vi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=Cf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=Cf(e)}else t===27?(t=Pi,df(e.type)?(e=Sf,Sf=null,Pi=e):Pi=t):Pi=Ni?xf(e.stateNode.nextSibling):null;return!0}function Ui(){Pi=Ni=null,Fi=!1}function Wi(){var e=Ii;return e!==null&&(su===null?su=e:su.push.apply(su,e),Ii=null),e}function Gi(e){Ii===null?Ii=[e]:Ii.push(e)}var Ki=re(null),qi=null,Ji=null;function Yi(e,t,n){ae(Ki,t._currentValue),t._currentValue=n}function Xi(e){e._currentValue=Ki.current,ie(Ki)}function Zi(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 Qi(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),Zi(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),Zi(s,n,e),s=null}else 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 $i(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;Sr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===le.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[dp]:e.push(dp))}a=a.return}e!==null&&Qi(t,e,n,r),t.flags|=262144}function ea(e){for(e=e.firstContext;e!==null;){if(!Sr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){qi=e,Ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function na(e){return ia(qi,e)}function ra(e,t){return qi===null&&ta(e),ia(e,t)}function ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ji===null){if(e===null)throw Error(i(308));Ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ji=Ji.next=t;return n}var aa=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()})}},oa=t.unstable_scheduleCallback,sa=t.unstable_NormalPriority,ca={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new aa,data:new Map,refCount:0}}function ua(e){e.refCount--,e.refCount===0&&oa(sa,function(){e.controller.abort()})}var da=null,fa=0,pa=0,ma=null;function ha(e,t){if(da===null){var n=da=[];fa=0,pa=Sd(),ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return fa++,t.then(ga,ga),t}function ga(){if(--fa===0&&da!==null){ma!==null&&(ma.status=`fulfilled`);var e=da;da=null,pa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _a(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 va=N.S;N.S=function(e,t){uu=Ee(),typeof t==`object`&&t&&typeof t.then==`function`&&ha(e,t),va!==null&&va(e,t)};var ya=re(null);function ba(){var e=ya.current;return e===null?Gl.pooledCache:e}function xa(e,t){t===null?ae(ya,ya.current):ae(ya,t.pool)}function Sa(){var e=ba();return e===null?null:{parent:ca._currentValue,pool:e}}var Ca=Error(i(460)),wa=Error(i(474)),Ta=Error(i(542)),Ea={then:function(){}};function Da(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Oa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=Gl,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,Ma(e),e}throw Aa=t,Ca}}function ka(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Aa=e,Ca):e}}var Aa=null;function ja(){if(Aa===null)throw Error(i(459));var e=Aa;return Aa=null,e}function Ma(e){if(e===Ca||e===Ta)throw Error(i(483))}var Pa=null,Ia=0;function La(e){var t=Ia;return Ia+=1,Pa===null&&(Pa=[]),Oa(Pa,e,t)}function Ra(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function za(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ba(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=ui(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|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=mi(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===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===E&&ka(i)===t.type)?(t=a(t,n.props),Ra(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Ra(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=gi(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=pi(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=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=fi(t.type,t.key,t.props,null,e.mode,n),Ra(n,t),n.return=e,n;case g:return t=gi(t,e.mode,n),t.return=e,t;case E:return t=ka(t),f(e,t,n)}if(M(t)||ee(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,La(t),n);if(t.$$typeof===x)return f(e,ra(e,t),n);za(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 h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=ka(n),p(e,t,n,r)}if(M(n)||ee(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,La(n),r);if(n.$$typeof===x)return p(e,t,ra(e,n),r);za(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 h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=ka(r),m(e,t,n,r,i)}if(M(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,La(r),i);if(r.$$typeof===x)return m(e,t,n,ra(t,r),i);za(t,r)}return null}function v(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),Fi&&Oi(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 Fi&&Oi(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(g.key===null?h:g.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)}),Fi&&Oi(i,h),l}function y(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),Fi&&Oi(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 Fi&&Oi(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(v.key===null?g:v.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)}),Fi&&Oi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&ka(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ra(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===_?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Ra(c,o),c.return=e,e=c)}return s(e);case g: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=gi(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=ka(o),b(e,r,o,c)}if(M(o))return v(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,La(o),c);if(o.$$typeof===x)return b(e,r,ra(e,o),c);za(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=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ia=0;var i=b(e,t,n,r);return Pa=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Va=Ba(!0),Ha=Ba(!1),Ua=!1;function Wa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ga(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 Ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ja(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,et(e,n)}}function Ya(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;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Xa=!1;function Za(){if(Xa){var e=ma;if(e!==null)throw e}}function Qa(e,t,n,r){Xa=!1;var i=e.updateQueue;Ua=!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,m=f!==s.lane;if(m?(ql&f)===f:(r&f)===f){f!==0&&f===pa&&(Xa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Ua=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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),tu|=o,e.lanes=o,e.memoizedState=d}}function $a(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)$a(n[e],t)}var to=re(null),no=re(0);function ro(e,t){e=$l,ae(no,e),ae(to,t),$l=e|t.baseLanes}function io(){ae(no,$l),ae(to,to.current)}function ao(){$l=no.current,ie(to),ie(no)}var oo=re(null),so=null;function co(e){var t=e.alternate;ae(mo,mo.current&1),ae(oo,e),so===null&&(t===null||to.current!==null||t.memoizedState!==null)&&(so=e)}function lo(e){ae(mo,mo.current),ae(oo,e),so===null&&(so=e)}function uo(e){e.tag===22?(ae(mo,mo.current),ae(oo,e),so===null&&(so=e)):fo(e)}function fo(){ae(mo,mo.current),ae(oo,oo.current)}function po(e){ie(oo),so===e&&(so=null),ie(mo)}var mo=re(0);function ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||vf(n)||yf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 go=0,_o=null,vo=null,yo=null,bo=!1,xo=!1,So=!1,Co=0,wo=0,To=null,Eo=0;function Do(){throw Error(i(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function ko(e,t,n,r,i,a){return go=a,_o=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Ks:qs,So=!1,a=n(r,i),So=!1,xo&&(a=jo(t,n,r,i)),Ao(e),a}function Ao(e){N.H=Gs;var t=vo!==null&&vo.next!==null;if(go=0,yo=vo=_o=null,bo=!1,wo=0,To=null,t)throw Error(i(300));e===null||uc||(e=e.dependencies,e!==null&&ea(e)&&(uc=!0))}function jo(e,t,n,r){_o=e;var a=0;do{if(xo&&(To=null),wo=0,xo=!1,25<=a)throw Error(i(301));if(a+=1,yo=vo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Js,o=t(n,r)}while(xo);return o}function Mo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?zo(t):t,e=e.useState()[0],(vo===null?null:vo.memoizedState)!==e&&(_o.flags|=1024),t}function No(){var e=Co!==0;return Co=0,e}function Po(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fo(e){if(bo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}bo=!1}go=0,yo=vo=_o=null,xo=!1,wo=Co=0,To=null}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yo===null?_o.memoizedState=yo=e:yo=yo.next=e,yo}function Lo(){if(vo===null){var e=_o.alternate;e=e===null?null:e.memoizedState}else e=vo.next;var t=yo===null?_o.memoizedState:yo.next;if(t!==null)yo=t,vo=e;else{if(e===null)throw _o.alternate===null?Error(i(467)):Error(i(310));vo=e,e={memoizedState:vo.memoizedState,baseState:vo.baseState,baseQueue:vo.baseQueue,queue:vo.queue,next:null},yo===null?_o.memoizedState=yo=e:yo=yo.next=e}return yo}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zo(e){var t=wo;return wo+=1,To===null&&(To=[]),e=Oa(To,e,t),t=_o,(yo===null?t.memoizedState:yo.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Ks:qs),e}function Bo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return zo(e);if(e.$$typeof===x)return na(e)}throw Error(i(438,String(e)))}function Vo(e){var t=null,n=_o.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=_o.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=Ro(),_o.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]=O;return t.index++,n}function Ho(e,t){return typeof t==`function`?t(e):t}function Uo(e){return Wo(Lo(),vo,e)}function Wo(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?(go&f)===f:(ql&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===pa&&(d=!0);else if((go&p)===p){u=u.next,p===pa&&(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,_o.lanes|=p,tu|=p;f=u.action,So&&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,_o.lanes|=f,tu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Sr(o,e.memoizedState)&&(uc=!0,d&&(n=ma,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 Go(e){var t=Lo(),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);Sr(o,t.memoizedState)||(uc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ko(e,t,n){var r=_o,a=Lo(),o=Fi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Sr((vo||a).memoizedState,n);if(s&&(a.memoizedState=n,uc=!0),a=a.queue,_s(Yo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||yo!==null&&yo.memoizedState.tag&1){if(r.flags|=2048,fs(9,{destroy:void 0},Jo.bind(null,r,a,n,t),null),Gl===null)throw Error(i(349));o||go&127||qo(r,t,n)}return n}function qo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=_o.updateQueue,t===null?(t=Ro(),_o.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Jo(e,t,n,r){t.value=n,t.getSnapshot=r,Xo(t)&&Zo(e)}function Yo(e,t,n){return n(function(){Xo(t)&&Zo(e)})}function Xo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Zo(e){var t=ri(e,2);t!==null&&Tu(t,e,2)}function Qo(e){var t=Io();if(typeof e==`function`){var n=e;if(e=n(),So){Le(!0);try{n()}finally{Le(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t}function $o(e,t,n,r){return e.baseState=n,Wo(e,vo,typeof r==`function`?r:Ho)}function es(e,t,n,r,a){if(Hs(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)}};N.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=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),ns(e,t,s)}catch(n){is(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),ns(e,t,a)}catch(n){is(e,t,n)}}function ns(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){rs(e,t,n)},function(n){return is(e,t,n)}):rs(e,t,n)}function rs(e,t,n){t.status=`fulfilled`,t.value=n,as(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 is(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,as(t),t=t.next;while(t!==r)}e.action=null}function as(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function os(e,t){return t}function ss(e,t){if(Fi){var n=Gl.formState;if(n!==null){a:{var r=_o;if(Fi){if(Pi){b:{for(var i=Pi,a=Li;i.nodeType!==8;){if(!a){i=null;break b}if(i=xf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Pi=xf(i.nextSibling),r=i.data===`F!`;break a}}zi(r)}r=!1}r&&(t=n[0])}}return n=Io(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:t},n.queue=r,n=zs.bind(null,_o,r),r.dispatch=n,r=Qo(!1),a=Vs.bind(null,_o,!1,r.queue),r=Io(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=es.bind(null,_o,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function cs(e){return ls(Lo(),vo,e)}function ls(e,t,n){if(t=Wo(e,t,os)[0],e=Uo(Ho)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=zo(t)}catch(e){throw e===Ca?Ta:e}else r=t;t=Lo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(_o.flags|=2048,fs(9,{destroy:void 0},us.bind(null,i,n),null)),[r,a,e]}function us(e,t){e.action=t}function ds(e){var t=Lo(),n=vo;if(n!==null)return ls(t,n,e);Lo(),t=t.memoizedState,n=Lo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function fs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=_o.updateQueue,t===null&&(t=Ro(),_o.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 ps(){return Lo().memoizedState}function ms(e,t,n,r){var i=Io();_o.flags|=e,i.memoizedState=fs(1|t,{destroy:void 0},n,r===void 0?null:r)}function hs(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=i.memoizedState.inst;vo!==null&&r!==null&&Oo(r,vo.memoizedState.deps)?i.memoizedState=fs(t,a,n,r):(_o.flags|=e,i.memoizedState=fs(1|t,a,n,r))}function gs(e,t){ms(8390656,8,e,t)}function _s(e,t){hs(2048,8,e,t)}function vs(e){_o.flags|=4;var t=_o.updateQueue;if(t===null)t=Ro(),_o.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ys(e){var t=Lo().memoizedState;return vs({ref:t,nextImpl:e}),function(){if(Wl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function bs(e,t){return hs(4,2,e,t)}function xs(e,t){return hs(4,4,e,t)}function Ss(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 Cs(e,t,n){n=n==null?null:n.concat([e]),hs(4,4,Ss.bind(null,t,e),n)}function ws(){}function Ts(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Es(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Oo(t,r[1]))return r[0];if(r=e(),So){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r}function Ds(e,t,n){return n===void 0||go&1073741824&&!(ql&261930)?e.memoizedState=t:(e.memoizedState=n,e=wu(),_o.lanes|=e,tu|=e,n)}function Os(e,t,n,r){return Sr(n,t)?n:to.current===null?!(go&42)||go&1073741824&&!(ql&261930)?(uc=!0,e.memoizedState=n):(e=wu(),_o.lanes|=e,tu|=e,t):(e=Ds(e,n,r),Sr(e,t)||(uc=!0),e)}function ks(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Vs(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Bs(e,t,_a(c,r),Cu(e)):Bs(e,t,r,Cu(e))}catch(n){Bs(e,t,{then:function(){},status:`rejected`,reason:n},Cu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function As(){}function js(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ms(e).queue;ks(e,a,t,F,n===null?As:function(){return Ns(e),n(r)})}function Ms(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:F},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ns(e){var t=Ms(e);t.next===null&&(t=e.alternate.memoizedState),Bs(e,t.next.queue,{},Cu())}function Ps(){return na(dp)}function Fs(){return Lo().memoizedState}function Is(){return Lo().memoizedState}function Ls(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Cu();e=Ka(n);var r=qa(t,e,n);r!==null&&(Tu(r,t,n),Ja(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Rs(e,t,n){var r=Cu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Hs(e)?Us(t,n):(n=ni(e,t,n,r),n!==null&&(Tu(n,e,r),Ws(n,t,r)))}function zs(e,t,n){Bs(e,t,n,Cu())}function Bs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Hs(e))Us(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,Sr(s,o))return ti(e,t,i,0),Gl===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return Tu(n,e,r),Ws(n,t,r),!0}return!1}function Vs(e,t,n,r){if(r={lane:2,revertLane:Sd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Hs(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&Tu(t,e,2)}function Hs(e){var t=e.alternate;return e===_o||t!==null&&t===_o}function Us(e,t){xo=bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ws(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,et(e,n)}}var Gs={readContext:na,use:Bo,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useLayoutEffect:Do,useInsertionEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useSyncExternalStore:Do,useId:Do,useHostTransitionStatus:Do,useFormState:Do,useActionState:Do,useOptimistic:Do,useMemoCache:Do,useCacheRefresh:Do};Gs.useEffectEvent=Do;var Ks={readContext:na,use:Bo,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:gs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ms(4194308,4,Ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ms(4194308,4,e,t)},useInsertionEffect:function(e,t){ms(4,2,e,t)},useMemo:function(e,t){var n=Io();t=t===void 0?null:t;var r=e();if(So){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Io();if(n!==void 0){var i=n(t);if(So){Le(!0);try{n(t)}finally{Le(!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=Rs.bind(null,_o,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:function(e){e=Qo(e);var t=e.queue,n=zs.bind(null,_o,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ws,useDeferredValue:function(e,t){return Ds(Io(),e,t)},useTransition:function(){var e=Qo(!1);return e=ks.bind(null,_o,e.queue,!0,!1),Io().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=_o,a=Io();if(Fi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Gl===null)throw Error(i(349));ql&127||qo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,gs(Yo.bind(null,r,o,e),[e]),r.flags|=2048,fs(9,{destroy:void 0},Jo.bind(null,r,o,n,t),null),n},useId:function(){var e=Io(),t=Gl.identifierPrefix;if(Fi){var n=Di,r=Ei;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Eo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ps,useFormState:ss,useActionState:ss,useOptimistic:function(e){var t=Io();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Vs.bind(null,_o,!0,n),n.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return Io().memoizedState=Ls.bind(null,_o)},useEffectEvent:function(e){var t=Io(),n={impl:e};return t.memoizedState=n,function(){if(Wl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},qs={readContext:na,use:Bo,useCallback:Ts,useContext:na,useEffect:_s,useImperativeHandle:Cs,useInsertionEffect:bs,useLayoutEffect:xs,useMemo:Es,useReducer:Uo,useRef:ps,useState:function(){return Uo(Ho)},useDebugValue:ws,useDeferredValue:function(e,t){return Os(Lo(),vo.memoizedState,e,t)},useTransition:function(){var e=Uo(Ho)[0],t=Lo().memoizedState;return[typeof e==`boolean`?e:zo(e),t]},useSyncExternalStore:Ko,useId:Fs,useHostTransitionStatus:Ps,useFormState:cs,useActionState:cs,useOptimistic:function(e,t){return $o(Lo(),vo,e,t)},useMemoCache:Vo,useCacheRefresh:Is};qs.useEffectEvent=ys;var Js={readContext:na,use:Bo,useCallback:Ts,useContext:na,useEffect:_s,useImperativeHandle:Cs,useInsertionEffect:bs,useLayoutEffect:xs,useMemo:Es,useReducer:Go,useRef:ps,useState:function(){return Go(Ho)},useDebugValue:ws,useDeferredValue:function(e,t){var n=Lo();return vo===null?Ds(n,e,t):Os(n,vo.memoizedState,e,t)},useTransition:function(){var e=Go(Ho)[0],t=Lo().memoizedState;return[typeof e==`boolean`?e:zo(e),t]},useSyncExternalStore:Ko,useId:Fs,useHostTransitionStatus:Ps,useFormState:ds,useActionState:ds,useOptimistic:function(e,t){var n=Lo();return vo===null?(n.baseState=e,[e,n.queue.dispatch]):$o(n,vo,e,t)},useMemoCache:Vo,useCacheRefresh:Is};Js.useEffectEvent=ys;function Ys(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ka(r);i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(Tu(t,e,r),Ja(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ka(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(Tu(t,e,r),Ja(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Cu(),r=Ka(n);r.tag=2,t!=null&&(r.callback=t),t=qa(e,r,n),t!==null&&(Tu(t,e,n),Ja(t,e,n))}};function Zs(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?!Cr(n,r)||!Cr(i,a):!0}function Qs(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&&Xs.enqueueReplaceState(t,t.state,null)}function $s(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=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function ec(e){Xr(e)}function tc(e){console.error(e)}function nc(e){Xr(e)}function rc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ic(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 ac(e,t,n){return n=Ka(n),n.tag=3,n.payload={element:null},n.callback=function(){rc(e,t)},n}function oc(e){return e=Ka(e),e.tag=3,e}function sc(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(){ic(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){ic(t,n,r),typeof i!=`function`&&(pu===null?pu=new Set([this]):pu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function cc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&$i(t,n,a,!0),n=oo.current,n!==null){switch(n.tag){case 31:case 13:return so===null?Lu():n.alternate===null&&eu===0&&(eu=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),nd(e,r,a)),!1;case 22:return n.flags|=65536,r===Ea?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)),nd(e,r,a)),!1}throw Error(i(435,n.tag))}return nd(e,r,a),Lu(),!1}if(Fi)return t=oo.current,t===null?(r!==Ri&&(t=Error(i(423),{cause:r}),Gi(vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=vi(r,n),a=ac(e.stateNode,r,a),Ya(e,a),eu!==4&&(eu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ri&&(e=Error(i(422),{cause:r}),Gi(vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=vi(o,n),ou===null?ou=[o]:ou.push(o),eu!==4&&(eu=2),t===null)return!0;r=vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=ac(n.stateNode,r,e),Ya(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`&&(pu===null||!pu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=oc(a),sc(a,e,n,r),Ya(n,a),!1}n=n.return}while(n!==null);return!1}var lc=Error(i(461)),uc=!1;function dc(e,t,n,r){t.child=e===null?Ha(t,null,n,r):Va(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 ta(t),r=ko(e,t,n,o,a,i),s=No(),e!==null&&!uc?(Po(e,t,i),Fc(e,t,i)):(Fi&&s&&Ai(t),t.flags|=1,dc(e,t,r,i),t.child)}function pc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,mc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ic(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return Fc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function mc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref){if(uc=!1,t.pendingProps=r=a,Ic(e,i))e.flags&131072&&(uc=!0);else return t.lanes=e.lanes,Fc(e,t,i)}}return Sc(e,t,n,r,i)}function hc(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 _c(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xa(t,a===null?null:a.cachePool),a===null?io():ro(t,a),uo(t);else return r=t.lanes=536870912,_c(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&xa(t,null),io(),fo(t)):(xa(t,a.cachePool),ro(t,a),fo(t),t.memoizedState=null);return dc(e,t,i,n),t.child}function gc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function _c(e,t,n,r,i){var a=ba();return a=a===null?null:{parent:ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&xa(t,null),io(),uo(t),e!==null&&$i(e,t,r,!0),t.childLanes=i,null}function vc(e,t){return t=L({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function yc(e,t,n){return Va(t,e.child,null,n),e=vc(t,t.pendingProps),e.flags|=2,po(t),t.memoizedState=null,e}function bc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Fi){if(r.mode===`hidden`)return e=vc(t,r),t.lanes=536870912,gc(null,e);if(lo(t),(e=Pi)?(e=_f(e,Li),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return t.lanes=536870912,null}return vc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(lo(t),a){if(t.flags&256)t.flags&=-257,t=yc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(uc||$i(e,t,n,!1),a=(n&e.childLanes)!==0,uc||a){if(r=Gl,r!==null&&(s=tt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),Tu(r,e,s),lc;Lu(),t=yc(e,t,n)}else e=o.treeContext,Pi=xf(s.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=vc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xc(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 Sc(e,t,n,r,i){return ta(t),n=ko(e,t,n,r,void 0,i),r=No(),e!==null&&!uc?(Po(e,t,i),Fc(e,t,i)):(Fi&&r&&Ai(t),t.flags|=1,dc(e,t,n,i),t.child)}function Cc(e,t,n,r,i,a){return ta(t),t.updateQueue=null,n=jo(t,r,n,i),Ao(e),r=No(),e!==null&&!uc?(Po(e,t,a),Fc(e,t,a)):(Fi&&r&&Ai(t),t.flags|=1,dc(e,t,n,a),t.child)}function wc(e,t,n,r,i){if(ta(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=na(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Xs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Wa(t),o=n.contextType,a.context=typeof o==`object`&&o?na(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ys(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&&Xs.enqueueReplaceState(a,a.state,null),Qa(t,r,a,i),Za(),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=$s(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=na(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)&&Qs(t,a,r,o),Ua=!1;var f=t.memoizedState;a.state=f,Qa(t,r,a,i),Za(),l=t.memoizedState,s||f!==l||Ua?(typeof d==`function`&&(Ys(t,n,d,r),l=t.memoizedState),(c=Ua||Zs(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,Ga(e,t),o=t.memoizedProps,u=$s(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=na(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)&&Qs(t,a,r,c),Ua=!1,f=t.memoizedState,a.state=f,Qa(t,r,a,i),Za();var p=t.memoizedState;o!==d||f!==p||Ua||e!==null&&e.dependencies!==null&&ea(e.dependencies)?(typeof s==`function`&&(Ys(t,n,s,r),p=t.memoizedState),(u=Ua||Zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ea(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,xc(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=Va(t,e.child,null,i),t.child=Va(t,null,n,i)):dc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Fc(e,t,i),e}function Tc(e,t,n,r){return Ui(),t.flags|=256,dc(e,t,n,r),t.child}var Ec={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dc(e){return{baseLanes:e,cachePool:Sa()}}function Oc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=iu),e}function kc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(mo.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Fi){if(a?co(t):fo(t),(e=Pi)?(e=_f(e,Li),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return yf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(fo(t),a=t.mode,c=L({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Dc(n),r.childLanes=Oc(e,s,n),t.memoizedState=Ec,gc(null,r)):(co(t),Ac(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(co(t),t.flags&=-257,t=jc(e,t,n)):t.memoizedState===null?(fo(t),c=r.fallback,a=t.mode,r=L({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Va(t,e.child,null,n),r=t.child,r.memoizedState=Dc(n),r.childLanes=Oc(e,s,n),t.memoizedState=Ec,t=gc(null,r)):(fo(t),t.child=e.child,t.flags|=128,t=null);else if(co(t),yf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Gi({value:r,source:null,stack:null}),t=jc(e,t,n)}else if(uc||$i(e,t,n,!1),s=(n&e.childLanes)!==0,uc||s){if(s=Gl,s!==null&&(r=tt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),Tu(s,e,r),lc;vf(c)||Lu(),t=jc(e,t,n)}else vf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pi=xf(c.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=Ac(t,r.children),t.flags|=4096);return t}return a?(fo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,gc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Dc(n):(a=c.cachePool,a===null?a=Sa():(l=ca._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Oc(e,s,n),t.memoizedState=Ec,gc(e.child,r)):(co(t),n=e.child,e=n.sibling,n=ui(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Ac(e,t){return t=L({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function L(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function jc(e,t,n){return Va(t,e.child,null,n),e=Ac(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zi(e.return,t,n)}function Nc(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 Pc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=mo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ae(mo,o),dc(e,t,r,n),r=Fi?Si:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Mc(e,n,t);else if(e.tag===19)Mc(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`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Nc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Nc(t,!0,n,null,a,r);break;case`together`:Nc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Fc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tu|=t.lanes,(n&t.childLanes)===0){if(e!==null){if($i(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=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ic(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ea(e)))}function Lc(e,t,n){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),Yi(t,ca,e.memoizedState.cache),Ui();break;case 27:case 5:fe(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:Yi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(co(t),e=Fc(e,t,n),e===null?null:e.sibling):kc(e,t,n):(co(t),t.flags|=128,null);co(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=($i(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Pc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ae(mo,mo.current),r)break;return null;case 22:return t.lanes=0,hc(e,t,n,t.pendingProps);case 24:Yi(t,ca,e.memoizedState.cache)}return Fc(e,t,n)}function R(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)uc=!0;else{if(!Ic(e,n)&&!(t.flags&128))return uc=!1,Lc(e,t,n);uc=!!(e.flags&131072)}}else uc=!1,Fi&&t.flags&1048576&&ki(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=$s(e,r),t.tag=1,t=wc(null,t,e,r,n)):(t.tag=0,t=Sc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=fc(null,t,e,r,n);break a}if(a===T){t.tag=14,t=pc(null,t,e,r,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return Sc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=$s(r,t.pendingProps),wc(e,t,r,a,n);case 3:a:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ga(e,t),Qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Yi(t,ca,r),r!==o.cache&&Qi(t,[ca],n,!0),Za(),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=Tc(e,t,r,n);break a}if(r!==a){a=vi(Error(i(424)),t),Gi(a),t=Tc(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(Pi=xf(e.firstChild),Ni=t,Fi=!0,Ii=null,Li=!0,n=Ha(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===a){t=Fc(e,t,n);break a}dc(e,t,r,n)}t=t.child}return t;case 26:return xc(e,t),e===null?(n=Hf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Fi||(n=t.type,e=t.pendingProps,r=$d(ce.current).createElement(n),r[ot]=t,r[st]=e,qd(r,n,e),yt(r),t.stateNode=r):t.memoizedState=Hf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fe(t),e===null&&Fi&&(r=t.stateNode=Tf(t.type,t.pendingProps,ce.current),Ni=t,Li=!0,a=Pi,df(t.type)?(Sf=a,Pi=xf(r.firstChild)):Pi=a),dc(e,t,t.pendingProps.children,n),xc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fi&&((a=r=Pi)&&(r=hf(r,t.type,t.pendingProps,Li),r===null?a=!1:(t.stateNode=r,Ni=t,Pi=xf(r.firstChild),Li=!1,a=!0)),a||zi(t)),fe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,nf(a,o)?r=null:s!==null&&nf(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ko(e,t,Mo,null,null,n),dp._currentValue=a),xc(e,t),dc(e,t,r,n),t.child;case 6:return e===null&&Fi&&((e=n=Pi)&&(n=gf(n,t.pendingProps,Li),n===null?e=!1:(t.stateNode=n,Ni=t,Pi=null,e=!0)),e||zi(t)),null;case 13:return kc(e,t,n);case 4:return ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Va(t,null,r,n):dc(e,t,r,n),t.child;case 11:return fc(e,t,t.type,t.pendingProps,n);case 7:return dc(e,t,t.pendingProps,n),t.child;case 8:return dc(e,t,t.pendingProps.children,n),t.child;case 12:return dc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Yi(t,t.type,r.value),dc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ta(t),a=na(a),r=r(a),t.flags|=1,dc(e,t,r,n),t.child;case 14:return pc(e,t,t.type,t.pendingProps,n);case 15:return mc(e,t,t.type,t.pendingProps,n);case 19:return Pc(e,t,n);case 31:return bc(e,t,n);case 22:return hc(e,t,n,t.pendingProps);case 24:return ta(t),r=na(ca),e===null?(a=ba(),a===null&&(a=Gl,o=la(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Wa(t),Yi(t,ca,a)):((e.lanes&n)!==0&&(Ga(e,t),Qa(t,null,null,n),Za()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Yi(t,ca,r),r!==a.cache&&Qi(t,[ca],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Yi(t,ca,r))),dc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Rc(e){e.flags|=4}function zc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Pu())e.flags|=8192;else throw Aa=Ea,wa}}else e.flags&=-16777217}function Bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!rp(t)){if(Pu())e.flags|=8192;else throw Aa=Ea,wa}}function Vc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ye(),e.lanes|=t,au|=t)}function Hc(e,t){if(!Fi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var 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}}function Uc(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&65011712,r|=i.flags&65011712,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 Wc(e,t,n){var r=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Uc(t),null;case 1:return Uc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xi(ca),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hi(t)?Rc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Uc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Rc(t),o===null?(Uc(t),zc(t,a,null,r,n)):(Uc(t),Bc(t,o))):o?o===e.memoizedState?(Uc(t),t.flags&=-16777217):(Rc(t),Uc(t),Bc(t,o)):(e=e.memoizedProps,e!==r&&Rc(t),Uc(t),zc(t,a,e,r,n)),null;case 27:if(pe(t),n=ce.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}e=oe.current,Hi(t)?Bi(t,e):(e=Tf(a,r,n),t.stateNode=e,Rc(t))}return Uc(t),null;case 5:if(pe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}if(o=oe.current,Hi(t))Bi(t,o);else{var s=$d(ce.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[ot]=t,o[st]=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(qd(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&&Rc(t)}}return Uc(t),zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ce.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ni,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Wd(e.nodeValue,n)),e||zi(t,!0)}else e=$d(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Uc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(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[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(i(558))}return Uc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Hi(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[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),a=!1}else a=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(po(t),t):(po(t),null)}return po(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),Vc(t,t.updateQueue),Uc(t),null);case 4:return de(),e===null&&Pd(t.stateNode.containerInfo),Uc(t),null;case 10:return Xi(t.type),Uc(t),null;case 19:if(ie(mo),r=t.memoizedState,r===null)return Uc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Hc(r,!1);else{if(eu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ho(e),o!==null){for(t.flags|=128,Hc(r,!1),e=o.updateQueue,t.updateQueue=e,Vc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return ae(mo,mo.current&1|2),Fi&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>du&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=ho(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vc(t,e),Hc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Fi)return Uc(t),null}else 2*Ee()-r.renderingStartTime>du&&n!==536870912&&(t.flags|=128,a=!0,Hc(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)}return r.tail===null?(Uc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=mo.current,ae(mo,a?n&1|2:n&1),Fi&&Oi(t,r.treeForkCount),e);case 22:case 23:return po(t),ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Uc(t),t.subtreeFlags&6&&(t.flags|=8192)):Uc(t),n=t.updateQueue,n!==null&&Vc(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&&ie(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),Uc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Gc(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ie(mo),null;case 4:return de(),null;case 10:return Xi(t.type),null;case 22:case 23:return po(t),ao(),e!==null&&ie(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Kc(e,t){switch(ji(t),t.tag){case 3:Xi(ca),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:ie(mo);break;case 10:Xi(t.type);break;case 22:case 23:po(t),ao(),e!==null&&ie(ya);break;case 24:Xi(ca)}}function qc(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){td(t,t.return,e)}}function Jc(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){td(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){td(t,t.return,e)}}function Yc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{eo(t,n)}catch(t){td(e,e.return,t)}}}function Xc(e,t,n){n.props=$s(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){td(e,t,n)}}function Zc(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:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){td(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){td(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){td(e,t,n)}else n.current=null}}function $c(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){td(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;Jd(r,e.type,n,t),r[st]=t}catch(t){td(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&df(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(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&&df(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 rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&df(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&df(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);qd(t,r,n),t[ot]=e,t[st]=n}catch(t){td(e,e.return,t)}}var ol=!1,sl=!1,z=!1,cl=typeof WeakSet==`function`?WeakSet:Set,ll=null;function ul(e,t){if(e=e.containerInfo,Zd=bp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Qd={focusedElem:e,selectionRange:n},bp=!1,ll=t;ll!==null;)if(t=ll,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ll=e;else for(;ll!==null;){switch(t=ll,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=$s(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){td(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)mf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:mf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ll=e;break}ll=t.return}}function dl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Tl(e,n),r&4&&qc(5,n);break;case 1:if(Tl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){td(n,n.return,e)}else{var i=$s(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){td(n,n.return,e)}}}r&64&&Yc(n),r&512&&Zc(n,n.return);break;case 3:if(Tl(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{eo(e,t)}catch(e){td(n,n.return,e)}}break;case 27:t===null&&r&4&&al(n);case 26:case 5:Tl(e,n),t===null&&r&4&&$c(n),r&512&&Zc(n,n.return);break;case 12:Tl(e,n);break;case 31:Tl(e,n),r&4&&_l(e,n);break;case 13:Tl(e,n),r&4&&B(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ad.bind(null,n),bf(e,n))));break;case 22:if(r=n.memoizedState!==null||ol,!r){t=t!==null&&t.memoizedState!==null||sl,i=ol;var a=sl;ol=r,(sl=t)&&!a?Dl(e,n,!!(n.subtreeFlags&8772)):Tl(e,n),ol=i,sl=a}break;case 30:break;default:Tl(e,n)}}function fl(e){var t=e.alternate;t!==null&&(e.alternate=null,fl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(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 pl=null,ml=!1;function hl(e,t,n){for(n=n.child;n!==null;)gl(e,t,n),n=n.sibling}function gl(e,t,n){if(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(Fe,n)}catch{}switch(n.tag){case 26:sl||Qc(n,t),hl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:sl||Qc(n,t);var r=pl,i=ml;df(n.type)&&(pl=n.stateNode,ml=!1),hl(e,t,n),Ef(n.stateNode),pl=r,ml=i;break;case 5:sl||Qc(n,t);case 6:if(r=pl,i=ml,pl=null,hl(e,t,n),pl=r,ml=i,pl!==null){if(ml)try{(pl.nodeType===9?pl.body:pl.nodeName===`HTML`?pl.ownerDocument.body:pl).removeChild(n.stateNode)}catch(e){td(n,t,e)}else try{pl.removeChild(n.stateNode)}catch(e){td(n,t,e)}}break;case 18:pl!==null&&(ml?(e=pl,ff(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Kp(e)):ff(pl,n.stateNode));break;case 4:r=pl,i=ml,pl=n.stateNode.containerInfo,ml=!0,hl(e,t,n),pl=r,ml=i;break;case 0:case 11:case 14:case 15:Jc(2,n,t),sl||Jc(4,n,t),hl(e,t,n);break;case 1:sl||(Qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xc(n,t,r)),hl(e,t,n);break;case 21:hl(e,t,n);break;case 22:sl=(r=sl)||n.memoizedState!==null,hl(e,t,n),sl=r;break;default:hl(e,t,n)}}function _l(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Kp(e)}catch(e){td(t,t.return,e)}}}function B(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Kp(e)}catch(e){td(t,t.return,e)}}function vl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cl),t;default:throw Error(i(435,e.tag))}}function yl(e,t){var n=vl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=od.bind(null,e,t);t.then(r,r)}})}function bl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(df(c.type)){pl=c.stateNode,ml=!1;break a}break;case 5:pl=c.stateNode,ml=!1;break a;case 3:case 4:pl=c.stateNode.containerInfo,ml=!0;break a}c=c.return}if(pl===null)throw Error(i(160));gl(o,s,a),pl=null,ml=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sl(t,e),t=t.sibling}var xl=null;function Sl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:bl(t,e),Cl(e),r&4&&(Jc(3,e,e.return),qc(3,e),Jc(5,e,e.return));break;case 1:bl(t,e),Cl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&64&&ol&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=xl;if(bl(t,e),Cl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[pt]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),qd(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=ep(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),qd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=ep(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),qd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ot]=e,yt(o),r=o}e.stateNode=r}else tp(a,e.type,e.stateNode)}else e.stateNode=Yf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&el(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?tp(a,e.type,e.stateNode):Yf(a,r,e.memoizedProps))}break;case 27:bl(t,e),Cl(e),r&512&&(sl||n===null||Qc(n,n.return)),n!==null&&r&4&&el(e,e.memoizedProps,n.memoizedProps);break;case 5:if(bl(t,e),Cl(e),r&512&&(sl||n===null||Qc(n,n.return)),e.flags&32){a=e.stateNode;try{Gt(a,``)}catch(t){td(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,el(e,a,n===null?a:n.memoizedProps)),r&1024&&(z=!0);break;case 6:if(bl(t,e),Cl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){td(e,e.return,t)}}break;case 3:if($f=null,a=xl,xl=kf(t.containerInfo),bl(t,e),xl=a,Cl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Kp(t.containerInfo)}catch(t){td(e,e.return,t)}z&&(z=!1,wl(e));break;case 4:r=xl,xl=kf(e.stateNode.containerInfo),bl(t,e),Cl(e),xl=r;break;case 12:bl(t,e),Cl(e);break;case 31:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 13:bl(t,e),Cl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(lu=Ee()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ol,d=sl;if(ol=u||a,sl=d||l,bl(t,e),sl=d,ol=u,Cl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||ol||sl||El(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){td(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){td(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?pf(m,!0):pf(l.stateNode,!1)}catch(e){td(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,yl(e,n))));break;case 19:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 30:break;case 21:break;default:bl(t,e),Cl(e)}}function Cl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(tl(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;il(e,nl(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Gt(o,``),n.flags&=-33),il(e,nl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;rl(e,nl(e),s);break;default:throw Error(i(161))}}catch(t){td(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)dl(e,t.alternate,t),t=t.sibling}function El(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jc(4,t,t.return),El(t);break;case 1:Qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xc(t,t.return,n),El(t);break;case 27:Ef(t.stateNode);case 26:case 5:Qc(t,t.return),El(t);break;case 22:t.memoizedState===null&&El(t);break;case 30:El(t);break;default:El(t)}e=e.sibling}}function Dl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Dl(i,a,n),qc(4,a);break;case 1:if(Dl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){td(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)$a(c[i],s)}catch(e){td(r,r.return,e)}}n&&o&64&&Yc(a),Zc(a,a.return);break;case 27:al(a);case 26:case 5:Dl(i,a,n),n&&r===null&&o&4&&$c(a),Zc(a,a.return);break;case 12:Dl(i,a,n);break;case 31:Dl(i,a,n),n&&o&4&&_l(i,a);break;case 13:Dl(i,a,n),n&&o&4&&B(i,a);break;case 22:a.memoizedState===null&&Dl(i,a,n),Zc(a,a.return);break;case 30:break;default:Dl(i,a,n)}t=t.sibling}}function Ol(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&&ua(n))}function kl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e))}function Al(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jl(e,t,n,r),t=t.sibling}function jl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Al(e,t,n,r),i&2048&&qc(9,t);break;case 1:Al(e,t,n,r);break;case 3:Al(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e)));break;case 12:if(i&2048){Al(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){td(t,t.return,e)}}else Al(e,t,n,r);break;case 31:Al(e,t,n,r);break;case 13:Al(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Al(e,t,n,r):(a._visibility|=2,Ml(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Al(e,t,n,r):Nl(e,t),i&2048&&Ol(o,t);break;case 24:Al(e,t,n,r),i&2048&&kl(t.alternate,t);break;default:Al(e,t,n,r)}}function Ml(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:Ml(a,o,s,c,i),qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ml(a,o,s,c,i)):u._visibility&2?Ml(a,o,s,c,i):Nl(a,o),i&&l&2048&&Ol(o.alternate,o);break;case 24:Ml(a,o,s,c,i),i&&l&2048&&kl(o.alternate,o);break;default:Ml(a,o,s,c,i)}t=t.sibling}}function Nl(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:Nl(n,r),i&2048&&Ol(r.alternate,r);break;case 24:Nl(n,r),i&2048&&kl(r.alternate,r);break;default:Nl(n,r)}t=t.sibling}}var Pl=8192;function Fl(e,t,n){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Il(e,t,n),e=e.sibling}function Il(e,t,n){switch(e.tag){case 26:Fl(e,t,n),e.flags&Pl&&e.memoizedState!==null&&ip(n,xl,e.memoizedState,e.memoizedProps);break;case 5:Fl(e,t,n);break;case 3:case 4:var r=xl;xl=kf(e.stateNode.containerInfo),Fl(e,t,n),xl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Pl,Pl=16777216,Fl(e,t,n),Pl=r):Fl(e,t,n));break;default:Fl(e,t,n)}}function Ll(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 Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ll=r,Vl(r,e)}Ll(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)zl(e),e=e.sibling}function zl(e){switch(e.tag){case 0:case 11:case 15:Rl(e),e.flags&2048&&Jc(9,e,e.return);break;case 3:Rl(e);break;case 12:Rl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bl(e)):Rl(e);break;default:Rl(e)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ll=r,Vl(r,e)}Ll(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jc(8,t,t.return),Bl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bl(t));break;default:Bl(t)}e=e.sibling}}function Vl(e,t){for(;ll!==null;){var n=ll;switch(n.tag){case 0:case 11:case 15:Jc(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:ua(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ll=r;else a:for(n=e;ll!==null;){r=ll;var i=r.sibling,a=r.return;if(fl(r),r===n){ll=null;break a}if(i!==null){i.return=a,ll=i;break a}ll=a}}}var Hl={getCacheForType:function(e){var t=na(ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return na(ca).controller.signal}},Ul=typeof WeakMap==`function`?WeakMap:Map,Wl=0,Gl=null,Kl=null,ql=0,Jl=0,Yl=null,Xl=!1,Zl=!1,Ql=!1,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=0,ou=null,su=null,cu=!1,lu=0,uu=0,du=1/0,fu=null,pu=null,mu=0,hu=null,gu=null,_u=0,vu=0,yu=null,bu=null,xu=0,Su=null;function Cu(){return Wl&2&&ql!==0?ql&-ql:N.T===null?rt():Sd()}function wu(){if(iu===0){if(!(ql&536870912)||Fi){var e=Ue;Ue<<=1,!(Ue&3932160)&&(Ue=262144),iu=e}else iu=536870912}return e=oo.current,e!==null&&(e.flags|=32),iu}function Tu(e,t,n){(e===Gl&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)&&(Mu(e,0),ku(e,ql,iu,!1)),Ze(e,n),(!(Wl&2)||e!==Gl)&&(e===Gl&&(!(Wl&2)&&(nu|=n),eu===4&&ku(e,ql,iu,!1)),md(e))}function Eu(e,t,n){if(Wl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||qe(e,t),a=r?Bu(e,t):Ru(e,t,!0),o=r;do{if(a===0){Zl&&!r&&ku(e,t,0,!1);break}if(n=e.current.alternate,o&&!Ou(n)){a=Ru(e,t,!1),o=!1;continue}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=ou;var l=c.current.memoizedState.isDehydrated;if(l&&(Mu(c,s).flags|=256),s=Ru(c,s,!1),s!==2){if(Ql&&!l){c.errorRecoveryDisabledLanes|=o,nu|=o,a=4;break a}o=su,su=a,o!==null&&(su===null?su=o:su.push.apply(su,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Mu(e,0),ku(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)break;case 6:ku(r,t,iu,!Xl);break a;case 2:su=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=lu+300-Ee(),10<a)){if(ku(r,t,iu,!Xl),Ke(r,0,!0)!==0)break a;_u=t,r.timeoutHandle=of(Du.bind(null,r,n,su,fu,cu,t,iu,nu,au,Xl,o,`Throttled`,-0,0),a);break a}Du(r,n,su,fu,cu,t,iu,nu,au,Xl,o,null,-0,0)}break}while(1);md(e)}function Du(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},Il(t,a,d);var m=(a&62914560)===a?lu-Ee():(a&4194048)===a?uu-Ee():0;if(m=op(d,m),m!==null){_u=a,e.cancelPendingCommit=m(qu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),ku(e,a,o,!l);return}}qu(e,t,a,n,r,i,o,s,c)}function Ou(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(!Sr(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 ku(e,t,n,r){t&=~ru,t&=~nu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Re(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&$e(e,n,t)}function Au(){return Wl&6?!0:(hd(0,!1),!1)}function ju(){if(Kl!==null){if(Jl===0)var e=Kl.return;else e=Kl,Ji=qi=null,Fo(e),Pa=null,Ia=0,e=Kl;for(;e!==null;)Kc(e.alternate,e),e=e.return;Kl=null}}function Mu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,sf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_u=0,ju(),Gl=e,Kl=n=ui(e.current,null),ql=t,Jl=0,Yl=null,Xl=!1,Zl=qe(e,t),Ql=!1,au=iu=ru=nu=tu=eu=0,su=ou=null,cu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Re(r),a=1<<i;t|=e[i],r&=~a}return $l=t,ei(),n}function Nu(e,t){_o=null,N.H=Gs,t===Ca||t===Ta?(t=ja(),Jl=3):t===wa?(t=ja(),Jl=4):Jl=t===lc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Yl=t,Kl===null&&(eu=1,rc(e,vi(t,e.current)))}function Pu(){var e=oo.current;return e===null?!0:(ql&4194048)===ql?so===null:(ql&62914560)===ql||ql&536870912?e===so:!1}function Fu(){var e=N.H;return N.H=Gs,e===null?Gs:e}function Iu(){var e=N.A;return N.A=Hl,e}function Lu(){eu=4,Xl||(ql&4194048)!==ql&&oo.current!==null||(Zl=!0),!(tu&134217727)&&!(nu&134217727)||Gl===null||ku(Gl,ql,iu,!1)}function Ru(e,t,n){var r=Wl;Wl|=2;var i=Fu(),a=Iu();(Gl!==e||ql!==t)&&(fu=null,Mu(e,t)),t=!1;var o=eu;a:do try{if(Jl!==0&&Kl!==null){var s=Kl,c=Yl;switch(Jl){case 8:ju(),o=6;break a;case 3:case 2:case 9:case 6:oo.current===null&&(t=!0);var l=Jl;if(Jl=0,Yl=null,Wu(e,s,c,l),n&&Zl){o=0;break a}break;default:l=Jl,Jl=0,Yl=null,Wu(e,s,c,l)}}zu(),o=eu;break}catch(t){Nu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ji=qi=null,Wl=r,N.H=i,N.A=a,Kl===null&&(Gl=null,ql=0,ei()),o}function zu(){for(;Kl!==null;)Hu(Kl)}function Bu(e,t){var n=Wl;Wl|=2;var r=Fu(),a=Iu();Gl!==e||ql!==t?(fu=null,du=Ee()+500,Mu(e,t)):Zl=qe(e,t);a:do try{if(Jl!==0&&Kl!==null){t=Kl;var o=Yl;b:switch(Jl){case 1:Jl=0,Yl=null,Wu(e,t,o,1);break;case 2:case 9:if(Da(o)){Jl=0,Yl=null,Uu(t);break}t=function(){Jl!==2&&Jl!==9||Gl!==e||(Jl=7),md(e)},o.then(t,t);break a;case 3:Jl=7;break a;case 4:Jl=5;break a;case 7:Da(o)?(Jl=0,Yl=null,Uu(t)):(Jl=0,Yl=null,Wu(e,t,o,7));break;case 5:var s=null;switch(Kl.tag){case 26:s=Kl.memoizedState;case 5:case 27:var c=Kl;if(s?rp(s):c.stateNode.complete){Jl=0,Yl=null;var l=c.sibling;if(l!==null)Kl=l;else{var u=c.return;u===null?Kl=null:(Kl=u,Gu(u))}break b}}Jl=0,Yl=null,Wu(e,t,o,5);break;case 6:Jl=0,Yl=null,Wu(e,t,o,6);break;case 8:ju(),eu=6;break a;default:throw Error(i(462))}}Vu();break}catch(t){Nu(e,t)}while(1);return Ji=qi=null,N.H=r,N.A=a,Wl=n,Kl===null?(Gl=null,ql=0,ei(),eu):0}function Vu(){for(;Kl!==null&&!we();)Hu(Kl)}function Hu(e){var t=R(e.alternate,e,$l);e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Uu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Cc(n,t,t.pendingProps,t.type,void 0,ql);break;case 11:t=Cc(n,t,t.pendingProps,t.type.render,t.ref,ql);break;case 5:Fo(t);default:Kc(n,t),t=Kl=di(t,$l),t=R(n,t,$l)}e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Wu(e,t,n,r){Ji=qi=null,Fo(t),Pa=null,Ia=0;var i=t.return;try{if(cc(e,i,t,n,ql)){eu=1,rc(e,vi(n,e.current)),Kl=null;return}}catch(t){if(i!==null)throw Kl=i,t;eu=1,rc(e,vi(n,e.current)),Kl=null;return}t.flags&32768?(Fi||r===1?e=!0:Zl||ql&536870912?e=!1:(Xl=e=!0,(r===2||r===9||r===3||r===6)&&(r=oo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ku(t,e)):Gu(t)}function Gu(e){var t=e;do{if(t.flags&32768){Ku(t,Xl);return}e=t.return;var n=Wc(t.alternate,t,$l);if(n!==null){Kl=n;return}if(t=t.sibling,t!==null){Kl=t;return}Kl=t=e}while(t!==null);eu===0&&(eu=5)}function Ku(e,t){do{var n=Gc(e.alternate,e);if(n!==null){n.flags&=32767,Kl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Kl=e;return}Kl=e=n}while(e!==null);eu=6,Kl=null}function qu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Qu();while(mu!==0);if(Wl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,Qe(e,n,o,s,c,l),e===Gl&&(Kl=Gl=null,ql=0),gu=t,hu=e,_u=n,vu=o,yu=a,bu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,sd(Ae,function(){return $u(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Wl,Wl|=4;try{ul(e,t,n)}finally{Wl=s,P.p=a,N.T=r}}mu=1,Ju(),Yu(),Xu()}}function Ju(){if(mu===1){mu=0;var e=hu,t=gu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{Sl(t,e);var a=Qd,o=Dr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Er(s.ownerDocument.documentElement,s)){if(c!==null&&Or(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 _=Tr(s,h),v=Tr(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}}bp=!!Zd,Qd=Zd=null}finally{Wl=i,P.p=r,N.T=n}}e.current=t,mu=2}}function Yu(){if(mu===2){mu=0;var e=hu,t=gu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{dl(e,t.alternate,t)}finally{Wl=i,P.p=r,N.T=n}}mu=3}}function Xu(){if(mu===4||mu===3){mu=0,Te();var e=hu,t=gu,n=_u,r=bu;t.subtreeFlags&10256||t.flags&10256?mu=5:(mu=0,gu=hu=null,Zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(pu=null),nt(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}_u&3&&Qu(),md(e),i=e.pendingLanes,n&261930&&i&42?e===Su?xu++:(xu=0,Su=e):xu=0,hd(0,!1)}}function Zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ua(t)))}function Qu(){return Ju(),Yu(),Xu(),$u()}function $u(){if(mu!==5)return!1;var e=hu,t=vu;vu=0;var n=nt(_u),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=yu,yu=null;var o=hu,s=_u;if(mu=0,gu=hu=null,_u=0,Wl&6)throw Error(i(331));var c=Wl;if(Wl|=4,zl(o.current),jl(o,o.current,s,n),Wl=c,hd(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{P.p=a,N.T=r,Zu(e,t)}}function ed(e,t,n){t=vi(n,t),t=ac(e.stateNode,t,2),e=qa(e,t,2),e!==null&&(Ze(e,2),md(e))}function td(e,t,n){if(e.tag===3)ed(e,e,n);else for(;t!==null;){if(t.tag===3){ed(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pu===null||!pu.has(r))){e=vi(n,e),n=oc(2),r=qa(t,n,2),r!==null&&(sc(n,r,t,e),Ze(r,2),md(r));break}}t=t.return}}function nd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ul;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)||(Ql=!0,i.add(n),e=rd.bind(null,e,t,n),t.then(e,e))}function rd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(ql&n)===n&&(eu===4||eu===3&&(ql&62914560)===ql&&300>Ee()-lu?!(Wl&2)&&Mu(e,0):ru|=n,au===ql&&(au=0)),md(e)}function id(e,t){t===0&&(t=Ye()),e=ri(e,t),e!==null&&(Ze(e,t),md(e))}function ad(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),id(e,n)}function od(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),id(e,n)}function sd(e,t){return Se(e,t)}var cd=null,ld=null,ud=!1,dd=!1,fd=!1,pd=0;function md(e){e!==ld&&e.next===null&&(ld===null?cd=ld=e:ld=ld.next=e),dd=!0,ud||(ud=!0,xd())}function hd(e,t){if(!fd&&dd){fd=!0;do for(var n=!1,r=cd;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-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,bd(r,a))}else a=ql,a=Ke(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,bd(r,a))}r=r.next}while(n);fd=!1}}function gd(){_d()}function _d(){dd=ud=!1;var e=0;pd!==0&&af()&&(e=pd);for(var t=Ee(),n=null,r=cd;r!==null;){var i=r.next,a=vd(r,t);a===0?(r.next=null,n===null?cd=i:n.next=i,i===null&&(ld=n)):(n=r,(e!==0||a&3)&&(dd=!0)),r=i}mu!==0&&mu!==5||hd(e,!1),pd!==0&&(pd=0)}function vd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Re(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Je(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Gl,n=ql,n=Ke(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ce(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ce(r),nt(n)){case 2:case 8:n=ke;break;case 32:n=Ae;break;case 268435456:n=Me;break;default:n=Ae}return r=yd.bind(null,e),n=Se(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ce(r),e.callbackPriority=2,e.callbackNode=null,2}function yd(e,t){if(mu!==0&&mu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Qu()&&e.callbackNode!==n)return null;var r=ql;return r=Ke(e,e===Gl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Eu(e,r,t),vd(e,Ee()),e.callbackNode!=null&&e.callbackNode===n?yd.bind(null,e):null)}function bd(e,t){if(Qu())return null;Eu(e,t,!0)}function xd(){lf(function(){Wl&6?Se(Oe,gd):_d()})}function Sd(){if(pd===0){var e=pa;e===0&&(e=He,He<<=1,!(He&261888)&&(He=256)),pd=e}return pd}function Cd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function wd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Td(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Cd((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?Cd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(pd!==0){var e=o?wd(i,o):new FormData(i);js(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?wd(i,o):new FormData(i),js(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ed=0;Ed<Jr.length;Ed++){var Dd=Jr[Ed];Yr(Dd.toLowerCase(),`on`+(Dd[0].toUpperCase()+Dd.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Od=`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(` `),kd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Od));function Ad(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){Xr(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){Xr(e)}i.currentTarget=null,a=c}}}}function jd(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Fd(t,e,2,!1),n.add(r))}function Md(e,t,n){var r=0;t&&(r|=4),Fd(n,e,r,t)}var Nd=`_reactListening`+Math.random().toString(36).slice(2);function Pd(e){if(!e[Nd]){e[Nd]=!0,bt.forEach(function(t){t!==`selectionchange`&&(kd.has(t)||Md(t,!1,e),Md(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Nd]||(t[Nd]=!0,Md(`selectionchange`,!1,t))}}function Fd(e,t,n,r){switch(Dp(t)){case 2:var i=xp;break;case 8:i=Sp;break;default:i=Cp}n=i.bind(null,t,n,e),i=void 0,!un||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 Id(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=ht(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}sn(function(){var r=a,i=tn(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;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=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case Br:case Vr:case Hr:l=jn;break;case Kr:l=Hn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Un;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Wn}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=cn(m,p),g!=null&&d.push(Ld(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(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ht(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:_t(l),h=u==null?c:_t(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ht(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=zd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Bd(s,c,l,d,!1),u!==null&&f!==null&&Bd(s,f,u,d,!0)}}a:{if(c=r?_t(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ur;else if(ir(c)){if(dr)v=br;else{v=vr;var y=_r}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Yt(r.elementType)&&(v=ur):v=yr;if(v&&=v(e,r)){ar(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Vt(c,`number`,c.value)}switch(y=r?_t(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(Ar=y,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(s,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(s,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,er=!0)),y=Rd(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=Rd(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Td(s,e,r,n,i)}Ad(s,t)})}function Ld(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Rd(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=cn(e,n),i!=null&&r.unshift(Ld(e,i,a)),i=cn(e,t),i!=null&&r.push(Ld(e,i,a))),e.tag===3)return r;e=e.return}return[]}function zd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Bd(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=cn(n,a),l!=null&&o.unshift(Ld(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(Ld(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Vd=/\r\n?/g,Hd=/\u0000|\uFFFD/g;function Ud(e){return(typeof e==`string`?e:``+e).replace(Vd,`
|
|
9
|
+
`).replace(Hd,``)}function Wd(e,t){return t=Ud(t),Ud(e)===t}function Gd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+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`&&Gd(e,t,`name`,a.name,a,null),Gd(e,t,`formEncType`,a.formEncType,a,null),Gd(e,t,`formMethod`,a.formMethod,a,null),Gd(e,t,`formTarget`,a.formTarget,a,null)):(Gd(e,t,`encType`,a.encType,a,null),Gd(e,t,`method`,a.method,a,null),Gd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&jd(`scroll`,e);break;case`onScrollEnd`:r!=null&&jd(`scrollend`,e);break;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));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=Qt(``+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`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`:jd(`beforetoggle`,e),jd(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Kd(e,t,n,r,a,o){switch(n){case`style`:Jt(e,r,o);break;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));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&jd(`scroll`,e);break;case`onScrollEnd`:r!=null&&jd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function qd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:jd(`error`,e),jd(`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:Gd(e,t,o,s,n,null)}}a&&Gd(e,t,`srcSet`,n.srcSet,n,null),r&&Gd(e,t,`src`,n.src,n,null);return;case`input`:jd(`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:Gd(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in jd(`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:Gd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in jd(`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:Gd(e,t,s,c,n,null)}Wt(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:Gd(e,t,l,r,n,null)}return;case`dialog`:jd(`beforetoggle`,e),jd(`toggle`,e),jd(`cancel`,e),jd(`close`,e);break;case`iframe`:case`object`:jd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Od.length;r++)jd(Od[r],e);break;case`image`:jd(`error`,e),jd(`load`,e);break;case`details`:jd(`toggle`,e);break;case`embed`:case`source`:case`link`:jd(`error`,e),jd(`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:Gd(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Kd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Gd(e,t,c,r,n,null))}function Jd(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)||Gd(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`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Gd(e,t,p,m,r,f)}}zt(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)||Gd(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`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Gd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(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:Gd(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`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Gd(e,t,s,a,r,o)}Ut(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:Gd(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`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Gd(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)&&Gd(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:Gd(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Kd(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||Kd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Gd(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||Gd(e,t,f,p,r,m)}function Yd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Xd(){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&&Yd(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&&Yd(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 Zd=null,Qd=null;function $d(e){return e.nodeType===9?e:e.ownerDocument}function ef(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 tf(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 nf(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 rf=null;function af(){var e=window.event;return e&&e.type===`popstate`?e!==rf&&(rf=e,!0):(rf=null,!1)}var of=typeof setTimeout==`function`?setTimeout:void 0,sf=typeof clearTimeout==`function`?clearTimeout:void 0,cf=typeof Promise==`function`?Promise:void 0,lf=typeof queueMicrotask==`function`?queueMicrotask:cf===void 0?of:function(e){return cf.resolve(null).then(e).catch(uf)};function uf(e){setTimeout(function(){throw e})}function df(e){return e===`head`}function ff(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),Kp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Ef(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Ef(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Ef(e.ownerDocument.body)}n=i}while(n);Kp(t)}function pf(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 mf(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`:mf(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function hf(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[pt])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=xf(e.nextSibling),e===null)break}return null}function gf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=xf(e.nextSibling),e===null))return null;return e}function _f(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=xf(e.nextSibling),e===null))return null;return e}function vf(e){return e.data===`$?`||e.data===`$~`}function yf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function bf(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 xf(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 Sf=null;function Cf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return xf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function wf(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 Tf(e,t,n){switch(t=$d(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 Ef(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var Df=new Map,Of=new Set;function kf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Af=P.d;P.d={f:jf,r:Mf,D:Ff,C:If,L:Lf,m:Rf,X:Bf,S:zf,M:Vf};function jf(){var e=Af.f(),t=Au();return e||t}function Mf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?Ns(t):Af.r(e)}var Nf=typeof document>`u`?null:document;function Pf(e,t,n){var r=Nf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Of.has(i)||(Of.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),qd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Ff(e){Af.D(e),Pf(`dns-prefetch`,e,null)}function If(e,t){Af.C(e,t),Pf(`preconnect`,e,t)}function Lf(e,t,n){Af.L(e,t,n);var r=Nf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Uf(e);break;case`script`:a=qf(e)}Df.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Df.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Wf(a))||t===`script`&&r.querySelector(Jf(a))||(t=r.createElement(`link`),qd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Rf(e,t){Af.m(e,t);var n=Nf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=qf(e)}if(!Df.has(a)&&(e=p({rel:`modulepreload`,href:e},t),Df.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Jf(a)))return}r=n.createElement(`link`),qd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function zf(e,t,n){Af.S(e,t,n);var r=Nf;if(r&&e){var i=vt(r).hoistableStyles,a=Uf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Wf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Df.get(a))&&Zf(e,n);var c=o=r.createElement(`link`);yt(c),qd(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,Xf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Bf(e,t){Af.X(e,t);var n=Nf;if(n&&e){var r=vt(n).hoistableScripts,i=qf(e),a=r.get(i);a||(a=n.querySelector(Jf(i)),a||(e=p({src:e,async:!0},t),(t=Df.get(i))&&Qf(e,t),a=n.createElement(`script`),yt(a),qd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t){Af.M(e,t);var n=Nf;if(n&&e){var r=vt(n).hoistableScripts,i=qf(e),a=r.get(i);a||(a=n.querySelector(Jf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=Df.get(i))&&Qf(e,t),a=n.createElement(`script`),yt(a),qd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Hf(e,t,n,r){var a=(a=ce.current)?kf(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`?(t=Uf(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,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=Uf(n.href);var o=vt(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(Wf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Df.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Df.set(e,n),o||Kf(a,e,n,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`?(t=qf(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Uf(e){return`href="`+Rt(e)+`"`}function Wf(e){return`link[rel="stylesheet"][`+e+`]`}function Gf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Kf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),qd(t,`link`,n),yt(t),e.head.appendChild(t))}function qf(e){return`[src="`+Rt(e)+`"]`}function Jf(e){return`script[async]`+e}function Yf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),qd(r,`style`,a),Xf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Uf(n.href);var o=e.querySelector(Wf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Gf(n),(a=Df.get(a))&&Zf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),qd(o,`link`,r),t.state.loading|=4,Xf(o,n.precedence,e),t.instance=o;case`script`:return o=qf(n.src),(a=e.querySelector(Jf(o)))?(t.instance=a,yt(a),a):(r=n,(a=Df.get(o))&&(r=p({},n),Qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),qd(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,Xf(r,n.precedence,e));return t.instance}function Xf(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 Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var $f=null;function ep(e,t,n){if($f===null){var r=new Map,i=$f=new Map;i.set(n,r)}else i=$f,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[pt]||a[ot]||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 tp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function np(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 rp(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ip(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=Uf(r.href),a=t.querySelector(Wf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=sp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Gf(r),(i=Df.get(i))&&Zf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),qd(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=sp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ap=0;function op(e,t){return e.stylesheets&&e.count===0&&lp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&lp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ap===0&&(ap=62500*Xd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&lp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ap?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function sp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var cp=null;function lp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,cp=new Map,t.forEach(up,e),cp=null,sp.call(e))}function up(e,t){if(!(t.state.loading&4)){var n=cp.get(e);if(n)var r=n.get(null);else{n=new Map,cp.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=sp.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 dp={$$typeof:x,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function fp(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=Xe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xe(0),this.hiddenUpdates=Xe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function pp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new fp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Wa(a),e}function mp(e){return e?(e=oi,e):oi}function hp(e,t,n,r,i,a){i=mp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=qa(e,r,t),n!==null&&(Tu(n,e,t),Ja(n,e,t))}function gp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function _p(e,t){gp(e,t),(e=e.alternate)&&gp(e,t)}function vp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&Tu(t,e,67108864),_p(e,67108864)}}function yp(e){if(e.tag===13||e.tag===31){var t=Cu();t=I(t);var n=ri(e,t);n!==null&&Tu(n,e,t),_p(e,t)}}var bp=!0;function xp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,Cp(e,t,n,r)}finally{P.p=a,N.T=i}}function Sp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,Cp(e,t,n,r)}finally{P.p=a,N.T=i}}function Cp(e,t,n,r){if(bp){var i=wp(r);if(i===null)Id(e,t,r,Tp,n),Ip(e,r);else if(Rp(i,e,t,n,r))r.stopPropagation();else if(Ip(e,r),t&4&&-1<Fp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ge(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Re(o);s.entanglements[1]|=c,o&=~c}md(a),!(Wl&6)&&(du=Ee()+500,hd(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&Tu(s,a,2),Au(),_p(a,2)}if(a=wp(r),a===null&&Id(e,t,r,Tp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Id(e,t,r,null,n)}}function wp(e){return e=tn(e),Ep(e)}var Tp=null;function Ep(e){if(Tp=null,e=ht(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 Tp=e,null}function Dp(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`resize`: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`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`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(De()){case Oe:return 2;case ke:return 8;case Ae:case je:return 32;case Me:return 268435456;default:return 32}default:return 32}}var Op=!1,kp=null,Ap=null,jp=null,Mp=new Map,Np=new Map,Pp=[],Fp=`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 Ip(e,t){switch(e){case`focusin`:case`focusout`:kp=null;break;case`dragenter`:case`dragleave`:Ap=null;break;case`mouseover`:case`mouseout`:jp=null;break;case`pointerover`:case`pointerout`:Mp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Np.delete(t.pointerId)}}function Lp(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=gt(t),t!==null&&vp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Rp(e,t,n,r,i){switch(t){case`focusin`:return kp=Lp(kp,e,t,n,r,i),!0;case`dragenter`:return Ap=Lp(Ap,e,t,n,r,i),!0;case`mouseover`:return jp=Lp(jp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Mp.set(a,Lp(Mp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Np.set(a,Lp(Np.get(a)||null,e,t,n,r,i)),!0}return!1}function zp(e){var t=ht(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,it(e.priority,function(){yp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(e.priority,function(){yp(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 Bp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=wp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&vp(t),e.blockedOn=n,!1;t.shift()}return!0}function Vp(e,t,n){Bp(e)&&n.delete(t)}function Hp(){Op=!1,kp!==null&&Bp(kp)&&(kp=null),Ap!==null&&Bp(Ap)&&(Ap=null),jp!==null&&Bp(jp)&&(jp=null),Mp.forEach(Vp),Np.forEach(Vp)}function Up(e,n){e.blockedOn===n&&(e.blockedOn=null,Op||(Op=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Hp)))}var Wp=null;function Gp(e){Wp!==e&&(Wp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wp===e&&(Wp=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(Ep(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,js(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Kp(e){function t(t){return Up(t,e)}kp!==null&&Up(kp,e),Ap!==null&&Up(Ap,e),jp!==null&&Up(jp,e),Mp.forEach(t),Np.forEach(t);for(var n=0;n<Pp.length;n++){var r=Pp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Pp.length&&(n=Pp[0],n.blockedOn===null);)zp(n),n.blockedOn===null&&Pp.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[st]||null;if(typeof a==`function`)o||Gp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(Ep(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Gp(n)}}}function qp(){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 Jp(e){this._internalRoot=e}Yp.prototype.render=Jp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;hp(n,Cu(),e,t,null,null)},Yp.prototype.unmount=Jp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hp(e.current,2,null,e,null,null),Au(),t[ct]=null}};function Yp(e){this._internalRoot=e}Yp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Pp.length&&t!==0&&t<Pp[n].priority;n++);Pp.splice(n,0,e),n===0&&zp(e)}};var Xp=n.version;if(Xp!==`19.2.8`)throw Error(i(527,Xp,`19.2.8`));P.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:f(e),e=e===null?null:e.stateNode,e};var Zp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qp.isDisabled&&Qp.supportsFiber)try{Fe=Qp.inject(Zp),Ie=Qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=ec,s=tc,c=nc;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=pp(e,1,!1,null,null,n,r,null,o,s,c,qp),e[ct]=t.current,Pd(e),new Jp(t)}})),La=o(((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=Ia()})),Ra=/^[\w!#$%&'*.^`|~+-]+$/,za=(e,t,n={})=>{if(!Ra.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},Ba=(e,t,n)=>(t=encodeURIComponent(t),za(e,t,n)),Va=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),Ha=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},Ua=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},Wa=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},Ga=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function Ka(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qa(e,t){if(!Ka(e)&&!Ka(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=Ka(n[e])&&Ka(r)?qa(n[e],r):r}return n}var Ja=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return Ja(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),Ya=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},Xa=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(Ba(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=Ga(a),a=Ha(a,this.pathParams),this.queryParams&&(a=Ya(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},Za=(e,t)=>Ja(function n(r){let i=t?.buildSearchParams??Ua,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=Va(e,a.join(`/`));if(s===`url`||s===`path`){let t=Ga(c);return r.args[0]&&(r.args[0].param&&(t=Ha(t,r.args[0].param)),r.args[0].query&&(t=Ya(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=Ga(c),n=Wa(r.args[0]?.param?Ha(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new Xa(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=qa(t,e);return l.fetch(r.args[0],a)}return l},[]),Qa=La();async function $a(e){if(!e.ok)throw await no(e);return await e.json()}async function eo(e){if(!e.ok)throw await no(e);return await e.text()}async function to(e){if(e.ok)return{ok:!0,value:await e.json()};let t=await io(e),n=t?.fields??[];if((e.status===400||e.status===409)&&n.length>0)return{ok:!1,fields:n};throw ro(e,t)}async function no(e){return ro(e,await io(e))}function ro(e,t){if(t===void 0)return Error(oo(e.status));let n=(t.fields??[]).map(e=>`${e.field}: ${e.message}`).join(`; `),r=t.detail??t.title;return Error(n===``?r:`${r} ${n}`)}async function io(e){if((e.headers.get(`content-type`)??``).includes(`problem+json`))return await e.json()}var ao=`Slopify isn't responding. If you're running it in Docker, check the container is running, then reload this page.`;function oo(e){return e===502||e===503||e===504?ao:`Slopify hit an unexpected error (${String(e)}). Reload the page and try again. If it keeps happening, open Settings and use Download diagnostics.`}function so(e){return async(t,n)=>{try{return await e(t,n)}catch(e){throw e instanceof TypeError?TypeError(ao,{cause:e}):e}}}function co(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}var lo=`Slopify answered in a way this page doesn't understand, usually because Slopify was updated while the page was open. Reload the page and try again.`;function uo(e,t){try{return e.parse(t)}catch(e){throw Error(lo,{cause:e})}}function fo(e,t,n){let r=so(t);return{client:Za(`${e}/api`,{fetch:r}),fetch:r,origin:e,upload:n??po(r)}}function po(e){return async(t,n,r,i)=>{let a=await e(t,{method:`PUT`,headers:{"content-type":r},body:n});return i(n.size,n.size),a}}function mo(e=()=>{}){return(t,n,r,i)=>new Promise((a,o)=>{let s=new XMLHttpRequest;s.open(`PUT`,t),s.setRequestHeader(`content-type`,r),s.upload.onprogress=e=>{i(e.loaded,e.lengthComputable?e.total:n.size)},s.onload=()=>{let t=new Headers;for(let e of s.getAllResponseHeaders().trim().split(/[\r\n]+/)){let n=e.indexOf(`:`);n>0&&t.append(e.slice(0,n).trim(),e.slice(n+1).trim())}let n=new Response(s.responseText,{status:s.status,headers:t});e(n),a(n)},s.onerror=()=>{o(TypeError(ao))},s.send(n)})}async function ho(e){return $a(await e.fetch(`${e.origin}/api/storage/export/summary`))}async function go(e){return $a(await e.client.backups.$get())}async function _o(e,t){return $a(await e.client.backups.$put({json:{...t}}))}async function vo(e){return $a(await e.client.backups.run.$post())}async function yo(e){return $a(await e.client.projects.$get())}async function bo(e,t){return $a(await e.client.projects[`:id`].$get({param:{id:t}}))}async function xo(e,t){let n=await e.client.projects[`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}async function So(e){return $a(await e.client.staging.$get())}async function Co(e){return $a(await e.fetch(`${e.origin}/api/storage`))}async function wo(e,t,n){let r=new FormData;r.set(`file`,n);let i=e.client.staging[`:kind`].$url({param:{kind:t}});return $a(await e.fetch(i,{method:`POST`,body:r}))}async function To(e,t){let n=await e.client.staging[`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}async function Eo(e){return $a(await e.client.usage.$get())}async function Do(e){return $a(await e.client.telemetry.notice.$get())}async function Oo(e){return $a(await e.client.telemetry.notice.$post())}function ko(e,t,n){return`${e.origin}/files/${t}/${n}`}async function Ao(e){return $a(await e.client.providers.$get())}async function jo(e,t,n){return $a(await e.client.providers[`:id`].key.$put({param:{id:t},json:{key:n}}))}async function Mo(e,t,n){return $a(await e.client.providers[`:id`].path.$put({param:{id:t},json:{path:n}}))}async function No(e,t){let n=await e.client.providers[`:id`].key.$delete({param:{id:t}});if(!n.ok)throw await no(n)}async function Po(e){return $a(await e.client.settings.$get())}async function Fo(e,t){return $a(await e.client.settings.$put({json:{...t}}))}async function Io(e){return $a(await e.client.settings.notifications.$get())}async function Lo(e){if(e.ok)return await e.json();let t=await io(e);throw t?.detail===void 0?ro(e,t):Error(t.detail)}async function Ro(e,t){return Lo(await e.client.settings.notifications.$put({json:{url:t}}))}async function zo(e,t){await Lo(await e.client.settings.notifications.test.$post({json:{url:t}}))}async function Bo(e){return $a(await e.client.settings.voices.$get())}async function Vo(e,t){let n=await e.client.settings.voices.$post({json:{provider:t.provider,name:t.name,voiceId:t.voiceId}});if(n.ok)return{ok:!0,voice:await n.json()};let r=await io(n),i=Uo(n.status,r);if(i!==void 0)return{ok:!1,refusal:i};throw ro(n,r)}async function Ho(e,t){let n=await e.client.settings.voices[`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}function Uo(e,t){if(t===void 0)return;if(e===409)return{field:`voiceId`,message:t.detail??t.title};let n=t.fields?.[0];if(e===400&&n!==void 0&&Wo(n.field))return{field:n.field,message:n.message}}function Wo(e){return e===`name`||e===`provider`||e===`voiceId`}async function Go(e){return $a(await e.client.prompts.$get())}async function Ko(e,t,n){let r={kind:t.kind,name:t.name,body:t.body};return to(n===void 0?await e.client.prompts.$post({json:r}):await e.client.prompts[`:id`].$put({param:{id:n},json:r}))}async function qo(e,t){let n=await e.client.prompts[`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}async function Jo(e){return $a(await e.client.entries.$get())}async function Yo(e,t,n){let r={category:t.category,mode:t.mode,name:t.name,body:t.body};return to(n===void 0?await e.client.entries.$post({json:r}):await e.client.entries[`:id`].$put({param:{id:n},json:r}))}async function Xo(e){return $a(await e.client[`document-themes`].$get())}async function Zo(e,t,n){let r={name:t.name,values:t.values};return to(n===void 0?await e.client[`document-themes`].$post({json:r}):await e.client[`document-themes`][`:id`].$put({param:{id:n},json:r}))}async function Qo(e,t){let n=await e.client[`document-themes`][`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}async function $o(e,t,n){let r=await e.client[`document-themes`].preview.$post({json:{values:t}},{init:{signal:n}});if(!r.ok)throw await no(r);return await r.blob()}async function es(e,t){return $a(await e.client.pronunciations.shared.$get({query:{except:t}}))}async function ts(e,t){let n=await e.client.entries[`:id`].$delete({param:{id:t}});if(!n.ok)throw await no(n)}function ns(e,t){return`${e.origin}/api/events/${t}`}var rs=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),is=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),as=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),os=e=>{let t=as(e);return t.charAt(0).toUpperCase()+t.slice(1)},ss={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`},cs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ls=(0,m.createContext)({}),us=()=>(0,m.useContext)(ls),ds=(0,m.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=us()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,m.createElement)(`svg`,{ref:c,...ss,width:t??l??ss.width,height:t??l??ss.height,stroke:e??f,strokeWidth:h,className:rs(`lucide`,p,i),...!a&&!cs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,m.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),fs=(e,t)=>{let n=(0,m.forwardRef)(({className:n,...r},i)=>(0,m.createElement)(ds,{ref:i,iconNode:t,className:rs(`lucide-${is(os(e))}`,`lucide-${e}`,n),...r}));return n.displayName=os(e),n},ps=fs(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ms=fs(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),hs=fs(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),gs=fs(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),_s=fs(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),vs=fs(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ys=fs(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),bs=fs(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),xs=fs(`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`}]]),Ss=fs(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Cs=fs(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ws=fs(`list-video`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M10 12H3`,key:`1ulcyk`}],[`path`,{d:`M10 19H3`,key:`108z41`}],[`path`,{d:`M15 12.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997a1 1 0 0 1-1.517-.86z`,key:`ms4nik`}]]),Ts=fs(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Es=fs(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ds=fs(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Os(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Os(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ks(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Os(e))&&(r&&(r+=` `),r+=t);return r}var As=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},js=(e,t)=>({classGroupId:e,validator:t}),Ms=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ns=`-`,Ps=[],Fs=`arbitrary..`,Is=e=>{let t=zs(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Rs(e);let n=e.split(Ns);return Ls(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?As(i,t):t:i||Ps}return n[e]||Ps}}},Ls=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Ls(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ns):e.slice(t).join(Ns),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Rs=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Fs+r:void 0})(),zs=e=>{let{theme:t,classGroups:n}=e;return Bs(n,t)},Bs=(e,t)=>{let n=Ms();for(let r in e){let i=e[r];Vs(i,n,r,t)}return n},Vs=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Hs(i,t,n,r)}},Hs=(e,t,n,r)=>{if(typeof e==`string`){Us(e,t,n);return}if(typeof e==`function`){Ws(e,t,n,r);return}Gs(e,t,n,r)},Us=(e,t,n)=>{let r=e===``?t:Ks(t,e);r.classGroupId=n},Ws=(e,t,n,r)=>{if(qs(e)){Vs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(js(n,e))},Gs=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Vs(o,Ks(t,a),n,r)}},Ks=(e,t)=>{let n=e,r=t.split(Ns),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ms(),n.nextPart.set(t,i)),n=i}return n},qs=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Js=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ys=`!`,Xs=`:`,Zs=[],Qs=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),$s=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Xs){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ys)?(c=s.slice(0,-1),l=!0):s.startsWith(Ys)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Qs(t,l,c,u)};if(t){let e=t+Xs,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Qs(Zs,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ec=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},tc=e=>({cache:Js(e.cacheSize),parseClassName:$s(e),sortModifiers:ec(e),postfixLookupClassGroupIds:nc(e),...Is(e)}),nc=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},rc=/\s+/,ic=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(rc),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ys:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},ac=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=oc(n))&&(i&&(i+=` `),i+=r);return i},oc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=oc(e[r]))&&(n&&(n+=` `),n+=t);return n},sc=(e,...t)=>{let n,r,i,a,o=o=>(n=tc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ic(e,n);return i(e,a),a};return a=o,(...e)=>a(ac(...e))},cc=[],lc=e=>{let t=t=>t[e]||cc;return t.isThemeGetter=!0,t},uc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_c=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vc=e=>fc.test(e),yc=e=>!!e&&!Number.isNaN(Number(e)),bc=e=>!!e&&Number.isInteger(Number(e)),xc=e=>e.endsWith(`%`)&&yc(e.slice(0,-1)),Sc=e=>pc.test(e),Cc=()=>!0,wc=e=>mc.test(e)&&!hc.test(e),Tc=()=>!1,Ec=e=>gc.test(e),Dc=e=>_c.test(e),Oc=e=>!L(e)&&!R(e),kc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Ac=e=>Gc(e,Yc,Tc),L=e=>uc.test(e),jc=e=>Gc(e,Xc,wc),Mc=e=>Gc(e,Zc,yc),Nc=e=>Gc(e,$c,Cc),Pc=e=>Gc(e,Qc,Tc),Fc=e=>Gc(e,qc,Tc),Ic=e=>Gc(e,Jc,Dc),Lc=e=>Gc(e,el,Ec),R=e=>dc.test(e),Rc=e=>Kc(e,Xc),zc=e=>Kc(e,Qc),Bc=e=>Kc(e,qc),Vc=e=>Kc(e,Yc),Hc=e=>Kc(e,Jc),Uc=e=>Kc(e,el,!0),Wc=e=>Kc(e,$c,!0),Gc=(e,t,n)=>{let r=uc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kc=(e,t,n=!1)=>{let r=dc.exec(e);return r?r[1]?t(r[1]):n:!1},qc=e=>e===`position`||e===`percentage`,Jc=e=>e===`image`||e===`url`,Yc=e=>e===`length`||e===`size`||e===`bg-size`,Xc=e=>e===`length`,Zc=e=>e===`number`,Qc=e=>e===`family-name`,$c=e=>e===`number`||e===`weight`,el=e=>e===`shadow`,tl=()=>{let e=lc(`color`),t=lc(`font`),n=lc(`text`),r=lc(`font-weight`),i=lc(`tracking`),a=lc(`leading`),o=lc(`breakpoint`),s=lc(`container`),c=lc(`spacing`),l=lc(`radius`),u=lc(`shadow`),d=lc(`inset-shadow`),f=lc(`text-shadow`),p=lc(`drop-shadow`),m=lc(`blur`),h=lc(`perspective`),g=lc(`aspect`),_=lc(`ease`),v=lc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),R,L],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[R,L,c],T=()=>[vc,`full`,`auto`,...w()],E=()=>[bc,`none`,`subgrid`,R,L],D=()=>[`auto`,{span:[`full`,bc,R,L]},bc,R,L],O=()=>[bc,`auto`,R,L],k=()=>[`auto`,`min`,`max`,`fr`,R,L],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[vc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[vc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[vc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,R,L],te=()=>[...b(),Bc,Fc,{position:[R,L]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Vc,Ac,{size:[R,L]}],ie=()=>[xc,Rc,jc],ae=()=>[``,`none`,`full`,l,R,L],oe=()=>[``,yc,Rc,jc],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[yc,xc,Bc,Fc],ue=()=>[``,`none`,m,R,L],de=()=>[`none`,yc,R,L],fe=()=>[`none`,yc,R,L],pe=()=>[yc,R,L],me=()=>[vc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Sc],breakpoint:[Sc],color:[Cc],container:[Sc],"drop-shadow":[Sc],ease:[`in`,`out`,`in-out`],font:[Oc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Sc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Sc],shadow:[Sc],spacing:[`px`,yc],text:[Sc],"text-shadow":[Sc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,vc,L,R,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,R,L]}],"container-named":[kc],columns:[{columns:[yc,L,R,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[bc,`auto`,R,L]}],basis:[{basis:[vc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[yc,vc,`auto`,`initial`,`none`,L]}],grow:[{grow:[``,yc,R,L]}],shrink:[{shrink:[``,yc,R,L]}],order:[{order:[bc,`first`,`last`,`none`,R,L]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...N()]}],"min-inline-size":[{"min-inline":[`auto`,...N()]}],"max-inline-size":[{"max-inline":[`none`,...N()]}],"block-size":[{block:[`auto`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,Rc,jc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Wc,Nc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,xc,L]}],"font-family":[{font:[zc,Pc,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,R,L]}],"line-clamp":[{"line-clamp":[yc,`none`,R,Mc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,R,L]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,R,L]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[yc,`from-font`,`auto`,R,jc]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[yc,`auto`,R,L]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[bc,R,L]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,R,L]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,R,L]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},bc,R,L],radial:[``,R,L],conic:[bc,R,L]},Hc,Ic]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[yc,R,L]}],"outline-w":[{outline:[``,yc,Rc,jc]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,Uc,Lc]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Uc,Lc]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[yc,jc]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Uc,Lc]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[yc,R,L]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[yc]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[R,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[yc]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,R,L]}],filter:[{filter:[``,`none`,R,L]}],blur:[{blur:ue()}],brightness:[{brightness:[yc,R,L]}],contrast:[{contrast:[yc,R,L]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Uc,Lc]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,yc,R,L]}],"hue-rotate":[{"hue-rotate":[yc,R,L]}],invert:[{invert:[``,yc,R,L]}],saturate:[{saturate:[yc,R,L]}],sepia:[{sepia:[``,yc,R,L]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,R,L]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[yc,R,L]}],"backdrop-contrast":[{"backdrop-contrast":[yc,R,L]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,yc,R,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yc,R,L]}],"backdrop-invert":[{"backdrop-invert":[``,yc,R,L]}],"backdrop-opacity":[{"backdrop-opacity":[yc,R,L]}],"backdrop-saturate":[{"backdrop-saturate":[yc,R,L]}],"backdrop-sepia":[{"backdrop-sepia":[``,yc,R,L]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,R,L]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[yc,`initial`,R,L]}],ease:[{ease:[`linear`,`initial`,_,R,L]}],delay:[{delay:[yc,R,L]}],animate:[{animate:[`none`,v,R,L]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,R,L]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[R,L,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],zoom:[{zoom:[bc,R,L]}],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,R,L]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,R,L]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[yc,Rc,jc,Mc]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},nl=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(rl(e,`cacheSize`,t),rl(e,`prefix`,n),rl(e,`experimentalParseClassName`,r),il(e.theme,a.theme),il(e.classGroups,a.classGroups),il(e.conflictingClassGroups,a.conflictingClassGroups),il(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),rl(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),rl(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),al(e.theme,i.theme),al(e.classGroups,i.classGroups),al(e.conflictingClassGroups,i.conflictingClassGroups),al(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),ol(e,i,`postfixLookupClassGroups`),ol(e,i,`orderSensitiveModifiers`),e),rl=(e,t,n)=>{n!==void 0&&(e[t]=n)},il=(e,t)=>{if(t)for(let n in t)rl(e,n,t[n])},al=(e,t)=>{if(t)for(let n in t)ol(e,t,n)},ol=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},sl=((e,...t)=>typeof e==`function`?sc(tl,e,...t):sc(()=>nl(tl(),e),...t))({extend:{theme:{text:[`label`,`small`,`body`,`row`,`title`,`wordmark`,`counter`],radius:[`control`,`panel`],animate:[`lamp-pulse`,`dialog-in`,`tick-in`],font:[`sans`,`condensed`]}}});function z(...e){return sl(ks(e))}var cl=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}),ll=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`});function ul(e,t=new Date){let n=new Date(e);return n.toDateString()===t.toDateString()?cl.format(n):`${ll.format(n)} ${cl.format(n)}`}var dl=4e3,fl=(0,m.createContext)(void 0);function pl({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&clearTimeout(t),i.current.delete(e)},[]),o=(0,m.useCallback)((e,t=`info`)=>{r.current+=1;let o=r.current;n(n=>[...n.filter(t=>t.message!==e).slice(-2),{id:o,message:e,tone:t}]),i.current.set(o,setTimeout(()=>a(o),dl))},[a]);(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())clearTimeout(t)}},[]);let s=(0,m.useMemo)(()=>o,[o]);return(0,h.jsxs)(fl.Provider,{value:s,children:[e,(0,h.jsx)(`section`,{"aria-label":`Notifications`,className:`pointer-events-none fixed top-14 right-4 z-[60] flex w-[min(360px,calc(100vw-32px))] flex-col gap-2`,children:t.map(e=>(0,h.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:z(`pointer-events-auto flex animate-tick-in items-start gap-3 rounded-panel border bg-panel px-3 py-2 text-small shadow-[0_8px_24px_var(--color-shadow)] motion-reduce:animate-none`,e.tone===`error`?`border-red text-ink`:e.tone===`success`?`border-done text-ink`:`border-line2 text-ink`),children:[(0,h.jsx)(`p`,{className:`min-w-0 flex-1 break-words`,children:e.message}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:()=>a(e.id),className:`-mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-control text-ink3 hover:bg-panel2 hover:text-ink`,children:(0,h.jsx)(Ds,{"aria-hidden":`true`,className:`size-[14px]`})})]},e.id))})]})}function ml(){return(0,m.useContext)(fl)??hl}function hl(){}var gl=(0,m.createContext)(void 0);function _l({deps:e,children:t}){return(0,h.jsx)(gl.Provider,{value:e,children:(0,h.jsx)(pl,{children:t})})}function B(){let e=(0,m.useContext)(gl);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var vl=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Buy%20Me%20a%20Coffee'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M3.4%207.6h13.1v2.1a3.9%203.9%200%200%201%200%207.6v.2a3.6%203.6%200%200%201-3.6%203.6H7a3.6%203.6%200%200%201-3.6-3.6zm13.1%204.3v3.2a1.7%201.7%200%200%200%200-3.2zM6.2%202.1a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200zm3.6%200a.9.9%200%200%201%201.8%200v2.6a.9.9%200%200%201-1.8%200z'/%3e%3c/svg%3e`,yl=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='GitHub'%3e%3cpath%20d='M15%2022v-4a4.8%204.8%200%200%200-1-3.5c3%200%206-2%206-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35%200-3.5%200%200-1%200-3%201.5-2.64-.5-5.36-.5-8%200C6%202%205%202%205%202c-.3%201.15-.3%202.35%200%203.5A5.403%205.403%200%200%200%204%209c0%203.5%203%205.5%206%205.5-.39.49-.68%201.05-.85%201.65-.17.6-.22%201.23-.15%201.85v4'/%3e%3cpath%20d='M9%2018c-4.51%202-5-2-7-2'/%3e%3c/svg%3e`,bl=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20256%20256'%20role='img'%20aria-label='Slopify'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M%2062%2028%20C%20100%2046,%20118%2060,%20140%2066%20C%20150%2068,%20152%2080,%20164%2084%20L%20232%20120%20L%20216%20132%20C%20214.0%20134.3,%20208.3%20141.7,%20204.0%20146.0%20C%20199.7%20150.3,%20194.0%20154.7,%20190.0%20158.0%20C%20186.0%20161.3,%20182.3%20162.3,%20180.0%20166.0%20C%20177.7%20169.7,%20176.3%20175.0,%20176.0%20180.0%20C%20175.7%20185.0,%20179.0%20191.0,%20178.0%20196.0%20C%20177.0%20201.0,%20174.0%20207.3,%20170.0%20210.0%20C%20166.0%20212.7,%20158.0%20213.7,%20154.0%20212.0%20C%20150.0%20210.3,%20147.3%20204.3,%20146.0%20200.0%20C%20144.7%20195.7,%20147.0%20189.7,%20146.0%20186.0%20C%20145.0%20182.3,%20143.0%20178.7,%20140.0%20178.0%20C%20137.0%20177.3,%20131.3%20179.0,%20128.0%20182.0%20C%20124.7%20185.0,%20121.3%20190.7,%20120.0%20196.0%20C%20118.7%20201.3,%20121.3%20208.0,%20120.0%20214.0%20C%20118.7%20220.0,%20115.7%20228.3,%20112.0%20232.0%20C%20108.3%20235.7,%20102.3%20237.0,%2098.0%20236.0%20C%2093.7%20235.0,%2088.3%20230.7,%2086.0%20226.0%20C%2083.7%20221.3,%2084.0%20213.3,%2084.0%20208.0%20C%2084.0%20202.7,%2086.7%20197.3,%2086.0%20194.0%20C%2085.3%20190.7,%2082.7%20187.7,%2080.0%20188.0%20C%2077.3%20188.3,%2072.7%20193.3,%2070.0%20196.0%20C%2067.3%20198.7,%2065.3%20202.3,%2064.0%20204.0%20C%2062.7%20205.7,%2062.3%20205.7,%2062.0%20206.0%20Q%2056%20118,%2062%2028%20Z%20M%20100%2084%20L%20170%20122%20L%20100%20160%20Z%20M%2098%20200%20A%206%206%200%201%200%20110%20200%20A%206%206%200%201%200%2098%20200%20Z%20M%20152%20184%20A%204%204%200%201%200%20160%20184%20A%204%204%200%201%200%20152%20184%20Z'/%3e%3c/svg%3e`,xl=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Patreon'%3e%3cpath%20fill='currentColor'%20d='M2.5%202.2h4.3v19.6H2.5z'/%3e%3ccircle%20fill='currentColor'%20cx='15.2'%20cy='9.4'%20r='6.9'/%3e%3c/svg%3e`,Sl={research:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='research'%3e%3ccircle%20cx='10.5'%20cy='10.5'%20r='6.5'/%3e%3cpath%20d='M15.5%2015.5%2021%2021'/%3e%3c/svg%3e`,article:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='article'%3e%3cpath%20d='M6%203h8l4%204v14H6z'/%3e%3cpath%20d='M14%203v4h4'/%3e%3cpath%20d='M9%2011h6'/%3e%3cpath%20d='M9%2014h6'/%3e%3cpath%20d='M9%2017h4'/%3e%3c/svg%3e`,audio:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='audio'%3e%3cpath%20d='M4%2010v4'/%3e%3cpath%20d='M8%207v10'/%3e%3cpath%20d='M12%204v16'/%3e%3cpath%20d='M16%208v8'/%3e%3cpath%20d='M20%2011v2'/%3e%3c/svg%3e`,images:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='images'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3ccircle%20cx='8.5'%20cy='9'%20r='1.5'/%3e%3cpath%20d='M21%2016l-4.5-4.5L7%2020'/%3e%3c/svg%3e`,thumbnail:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='thumbnail'%3e%3crect%20x='3'%20y='4'%20width='18'%20height='16'%20rx='2'/%3e%3cpath%20d='M10%209v6l5-3z'/%3e%3c/svg%3e`,video:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='video'%3e%3crect%20x='3'%20y='5'%20width='18'%20height='14'%20rx='2'/%3e%3cpath%20d='M7%205v14'/%3e%3cpath%20d='M17%205v14'/%3e%3cpath%20d='M3%209.5h4M3%2014.5h4M17%209.5h4M17%2014.5h4'/%3e%3c/svg%3e`,document:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20role='img'%20aria-label='document'%3e%3cpath%20d='M8%203h7l4%204v11H8z'/%3e%3cpath%20d='M15%203v4h4'/%3e%3cpath%20d='M5%207v14h11'/%3e%3cpath%20d='M11%2012h5'/%3e%3cpath%20d='M11%2015h3'/%3e%3c/svg%3e`};function Cl(e){return{maskImage:`url("${e}")`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}function wl({kind:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[22px] shrink-0 bg-current`,t),style:Cl(Sl[e])})}function Tl({className:e}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":`mark`,className:z(`block size-[26px] shrink-0 bg-current`,e),style:Cl(bl)})}var El={github:yl,patreon:xl,coffee:vl};function Dl({name:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[14px] shrink-0 bg-current`,t),style:Cl(El[e])})}var Ol={pending:`text-ink3`,running:`text-run-text`,done:`text-done`,failed:`text-red`,canceled:`text-amber`,paused:`text-amber`,provided:`text-ink2`,skipped:`text-ink3`};function kl({state:e,announce:t,className:n}){return(0,h.jsxs)(`span`,{className:z(`inline-flex items-center`,n),children:[(0,h.jsx)(`span`,{"data-state":e,className:z(`engraved font-bold`,Ol[e]),children:e}),t===void 0?null:(0,h.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`${t}: ${e}`})]})}var Al={pending:`bg-lamp-off shadow-[inset_0_0_0_1px_var(--color-lamp-ring)]`,running:`bg-lamp-run shadow-[0_0_0_3px_var(--color-lamp-halo)] animate-lamp-pulse motion-reduce:animate-none`,done:`bg-done`,failed:`bg-red`,canceled:`bg-amber`,paused:`bg-amber`,provided:`bg-lamp-off shadow-[inset_0_0_0_1px_var(--color-lamp-ring)]`,skipped:`bg-lamp-off shadow-[inset_0_0_0_1px_var(--color-lamp-ring)]`};function jl({state:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-lamp":e,className:z(`size-[10px] shrink-0 rounded-full`,Al[e],t)})}var Ml=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Nl=ks,Pl=(e,t)=>n=>{if(t?.variants==null)return Nl(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ml(t)||Ml(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Nl(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Fl=Object.defineProperty,Il=(e,t)=>Fl(e,`name`,{value:t,configurable:!0});function Ll(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Il(Ll,`setRef`);function Rl(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ll(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ll(e[t],null)}}}}Il(Rl,`composeRefs`);function zl(...e){return m.useCallback(Rl(...e),e)}Il(zl,`useComposedRefs`);var Bl=Object.defineProperty,Vl=(e,t)=>Bl(e,`name`,{value:t,configurable:!0});function Hl(e){let t=m.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Zl(r)&&typeof tu==`function`&&(r=tu(r._payload)),m.Children.forEach(r,e=>{if(Yl(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Zl(n)&&typeof tu==`function`&&(n=tu(n._payload)),a=Kl(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=m.cloneElement(a,void 0,s):!o&&m.Children.count(r)===1&&m.isValidElement(r)&&(a=r);let c=a?Jl(a):void 0,l=zl(n,c);if(!a){if(r||r===0)throw Error(o?eu(e):$l(e));return r}let u=ql(i,a.props??{});return a.type!==m.Fragment&&(u.ref=n?l:c),m.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}Vl(Hl,`createSlot`);var Ul=Hl(`Slot`),Wl=Symbol.for(`radix.slottable`);function Gl(e){let t=Vl(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Wl,t}Vl(Gl,`createSlottable`);var Kl=Vl((e,t)=>{if(`child`in e.props){let t=e.props.child;return m.isValidElement(t)?m.cloneElement(t,void 0,e.props.children(t.props.children)):null}return m.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function ql(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}Vl(ql,`mergeProps`);function Jl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Vl(Jl,`getElementRef`);function Yl(e){return m.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Wl}Vl(Yl,`isSlottable`);var Xl=Symbol.for(`react.lazy`);function Zl(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Xl&&`_payload`in e&&Ql(e._payload)}Vl(Zl,`isLazyComponent`);function Ql(e){return typeof e==`object`&&!!e&&`then`in e}Vl(Ql,`isPromiseLike`);var $l=Vl(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),eu=Vl(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),tu=m.use,nu=l(Fa(),1),ru=Object.defineProperty,iu=(e,t)=>ru(e,`name`,{value:t,configurable:!0}),au=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Hl(`Primitive.${t}`),r=m.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,h.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ou(e,t){e&&nu.flushSync(()=>e.dispatchEvent(t))}iu(ou,`dispatchDiscreteCustomEvent`);var su=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),cu=Object.defineProperty,lu=(e,t)=>cu(e,`name`,{value:t,configurable:!0});function uu(e,t){let n=m.createContext(t);n.displayName=e+`Context`;let r=lu(e=>{let{children:t,...r}=e,i=m.useMemo(()=>r,Object.values(r));return(0,h.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=m.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return lu(i,`useContext`),[r,i]}lu(uu,`createContext`);function du(e,t=[]){let n=[];function r(t,r){let i=m.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=lu(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=m.useMemo(()=>o,Object.values(o));return(0,h.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=m.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return lu(s,`useContext`),[o,s]}lu(r,`createContext`);let i=lu(()=>{let t=n.map(e=>m.createContext(e));return lu(function(n){let r=n?.[e]||t;return m.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,fu(i,...t)]}lu(du,`createContextScope`);function fu(...e){let t=e[0];if(e.length===1)return t;let n=lu(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return lu(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}lu(fu,`composeContextScopes`);var pu=Object.defineProperty,mu=(e,t)=>pu(e,`name`,{value:t,configurable:!0});function hu(e){let t=e+`CollectionProvider`,[n,r]=du(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=mu(e=>{let{scope:t,children:n}=e,r=m.useRef(null),a=m.useRef(new Map).current;return(0,h.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Hl(s),l=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=zl(t,a(s,n).collectionRef);return(0,h.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Hl(u),p=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),s=zl(t,o),c=a(u,n);return m.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,h.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function g(t){let n=a(e+`CollectionConsumer`,t);return m.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return mu(g,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},g,r]}mu(hu,`createCollection`);var gu=new WeakMap,_u=class e extends Map{static{mu(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],gu.set(this,!0)}set(e,t){return gu.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=bu(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=vu(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=vu(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return vu(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function vu(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=yu(e,t);return n===-1?void 0:e[n]}mu(vu,`at`);function yu(e,t){let n=e.length,r=bu(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}mu(yu,`toSafeIndex`);function bu(e){return e!==e||e===0?0:Math.trunc(e)}mu(bu,`toSafeInteger`);function xu(e){let t=e+`CollectionProvider`,[n,r]=du(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _u,setItemMap:mu(()=>void 0,`setItemMap`)}),o=mu(({state:e,...t})=>e?(0,h.jsx)(c,{...t,state:e}):(0,h.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=mu(e=>{let t=_();return(0,h.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=mu(e=>{let{scope:t,children:n,state:r}=e,a=m.useRef(null),[o,s]=m.useState(null),c=zl(a,s),[l,u]=r;return m.useEffect(()=>{if(!o)return;let e=Tu(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,h.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=Hl(l),d=m.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=zl(t,a(l,n).collectionRef);return(0,h.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=Hl(f),g=m.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=m.useRef(null),[s,c]=m.useState(null),l=zl(t,o,c),{setItemMap:u}=a(f,n),d=m.useRef(i);Su(d.current,i)||(d.current=i);let g=d.current;return m.useEffect(()=>{let e=g;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(wu):(t.set(s,{...e,element:s}),t.toSorted(wu)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new _u(e)))}},[s,g,u]),(0,h.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});g.displayName=f;function _(){return m.useState(new _u)}mu(_,`useInitCollection`);function v(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return mu(v,`useCollection`),[{Provider:o,Slot:d,ItemSlot:g},{createCollectionScope:r,useCollection:v,useInitCollection:_}]}mu(xu,`createCollection`);function Su(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}mu(Su,`shallowEqual`);function Cu(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}mu(Cu,`isElementPreceding`);function wu(e,t){return!e[1].element||!t[1].element?0:Cu(e[1].element,t[1].element)?-1:1}mu(wu,`sortByDocumentPosition`);function Tu(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}mu(Tu,`getChildListObserver`);var Eu=Object.defineProperty,Du=(e,t)=>Eu(e,`name`,{value:t,configurable:!0}),Ou=!!(typeof window<`u`&&window.document&&window.document.createElement);function ku(e,t,{checkForDefaultPrevented:n=!0}={}){return Du(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Du(ku,`composeEventHandlers`);function Au(e){if(!Ou)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Du(Au,`getOwnerWindow`);function ju(e){if(!Ou)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Du(ju,`getOwnerDocument`);function Mu(e,t=!1){let{activeElement:n}=ju(e);if(!n?.nodeName)return null;if(Nu(n)&&n.contentDocument)return Mu(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ju(n).getElementById(e);if(t)return t}}return n}Du(Mu,`getActiveElement`);function Nu(e){return e.tagName===`IFRAME`}Du(Nu,`isFrame`);var Pu=globalThis?.document?m.useLayoutEffect:()=>{},Fu=Object.defineProperty,Iu=(e,t)=>Fu(e,`name`,{value:t,configurable:!0}),Lu=m.useEffectEvent,Ru=m.useInsertionEffect;function zu(e){if(typeof Lu==`function`)return Lu(e);let t=m.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Ru==`function`?Ru(()=>{t.current=e}):Pu(()=>{t.current=e}),m.useMemo(()=>((...e)=>t.current?.(...e)),[])}Iu(zu,`useEffectEvent`);var Bu=Object.defineProperty,Vu=(e,t)=>Bu(e,`name`,{value:t,configurable:!0}),Hu=m.useInsertionEffect||Pu;function Uu({prop:e,defaultProp:t,onChange:n=Vu(()=>{},`onChange`),caller:r}){let[i,a,o]=Wu({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,m.useCallback(t=>{if(s){let n=Gu(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Vu(Uu,`useControllableState`);function Wu({defaultProp:e,onChange:t}){let[n,r]=m.useState(e),i=m.useRef(n),a=m.useRef(t);return Hu(()=>{a.current=t},[t]),m.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Vu(Wu,`useUncontrolledState`);function Gu(e){return typeof e==`function`}Vu(Gu,`isFunction`);var Ku=Symbol(`RADIX:SYNC_STATE`);function qu(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=zu(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=m.useReducer((t,n)=>{if(n.type===Ku)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,h=m.useRef(p);m.useEffect(()=>{h.current!==p&&(h.current=p,c||l(p))},[p,h,c]);let g=m.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return m.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Ku,state:i})},[i,d.state,c]),[g,f]}Vu(qu,`useControllableStateReducer`);var Ju=Object.defineProperty,Yu=(e,t)=>Ju(e,`name`,{value:t,configurable:!0});function Xu(e,t){return m.useReducer((e,n)=>t[e][n]??e,e)}Yu(Xu,`useStateMachine`);var Zu=Yu(e=>{let{present:t,children:n}=e,r=Qu(t),i=typeof n==`function`?n({present:r.isPresent}):m.Children.only(n),a=ed(r.ref,nd(i));return typeof n==`function`||r.isPresent?m.cloneElement(i,{ref:a}):null},`Presence`);function Qu(e){let[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),a=m.useRef(`none`),o=m.useRef(void 0),[s,c]=Xu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return m.useEffect(()=>{s===`mounted`?(a.current=o.current??td(r.current),o.current=void 0):a.current=`none`},[s]),Pu(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=td(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Pu(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Yu(a=>{let o=td(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Yu(e=>{e.target===t&&(a.current=td(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:m.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=td(t)}else r.current=null;n(e)},[])}}Yu(Qu,`usePresence`);function $u(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Yu($u,`setRef`);function ed(...e){let t=m.useRef(e);return t.current=e,m.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=$u(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():$u(n[e],null)}}},[])}Yu(ed,`useStableComposedRefs`);function td(e){return e?.animationName||`none`}Yu(td,`getAnimationName`);function nd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Yu(nd,`getElementRef`);var rd=Object.defineProperty,id=(e,t)=>rd(e,`name`,{value:t,configurable:!0}),ad=m.useId||(()=>void 0),od=0;function sd(e){let[t,n]=m.useState(ad());return Pu(()=>{e||n(e=>e??String(od++))},[e]),e||(t?`radix-${t}`:``)}id(sd,`useId`);var cd=Object.defineProperty,ld=(e,t)=>cd(e,`name`,{value:t,configurable:!0}),ud=m.createContext(void 0);function dd(e){let t=m.useContext(ud);return e||t||`ltr`}ld(dd,`useDirection`);var fd=Object.defineProperty,pd=(e,t)=>fd(e,`name`,{value:t,configurable:!0});function md(e){let t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>((...e)=>t.current?.(...e)),[])}pd(md,`useCallbackRef`);var hd=Object.defineProperty,gd=(e,t)=>hd(e,`name`,{value:t,configurable:!0}),_d=`dismissableLayer.update`,vd=`dismissableLayer.pointerDownOutside`,yd=`dismissableLayer.focusOutside`,bd,xd=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Sd=m.forwardRef(gd(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=m.useContext(xd),[d,f]=m.useState(null),p=d?.ownerDocument??globalThis?.document,[,g]=m.useState({}),_=zl(t,f),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=y?v.indexOf(y):-1,x=d?v.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=b,w=m.useRef(!1),T=Td(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:w,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return C&&!t},[u.branches,C])}),E=Ed(e=>{if(r&&w.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),D=d?x===v.length-1:!1,O=md(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return m.useEffect(()=>{if(D)return p.addEventListener(`keydown`,O,{capture:!0}),()=>p.removeEventListener(`keydown`,O,{capture:!0})},[p,D,O]),m.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bd=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Dd(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=bd))}},[d,p,n,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Dd())},[d,u]),m.useEffect(()=>{let e=gd(()=>g({}),`handleUpdate`);return document.addEventListener(_d,e),()=>document.removeEventListener(_d,e)},[]),(0,h.jsx)(au.div,{...l,ref:_,style:{pointerEvents:S?C?`auto`:`none`:void 0,...e.style},onFocusCapture:ku(e.onFocusCapture,E.onFocusCapture),onBlurCapture:ku(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ku(e.onPointerDownCapture,T.onPointerDownCapture)})},`DismissableLayer`));function Cd(){let e=m.useContext(xd),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}gd(Cd,`useDismissableLayerSurface`);var wd=gd(()=>!0,`IS_TRUE`);function Td(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=wd}=t,s=md(e),c=m.useRef(!1),l=m.useRef(!1),u=m.useRef(new Map),d=m.useRef(()=>{});return m.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}gd(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}gd(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}gd(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}gd(p,`handleInteractionBubble`);let m=gd(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Od(vd,s,p,{discrete:!0})};if(gd(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:gd(()=>c.current=!0,`onPointerDownCapture`)}}gd(Td,`usePointerDownOutside`);function Ed(e,t=globalThis?.document){let n=md(e),r=m.useRef(!1);return m.useEffect(()=>{let e=gd(e=>{e.target&&!r.current&&Od(yd,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:gd(()=>r.current=!0,`onFocusCapture`),onBlurCapture:gd(()=>r.current=!1,`onBlurCapture`)}}gd(Ed,`useFocusOutside`);function Dd(){let e=new CustomEvent(_d);document.dispatchEvent(e)}gd(Dd,`dispatchUpdate`);function Od(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ou(i,a):i.dispatchEvent(a)}gd(Od,`handleAndDispatchCustomEvent`);var kd=Object.defineProperty,Ad=(e,t)=>kd(e,`name`,{value:t,configurable:!0}),jd=`focusScope.autoFocusOnMount`,Md=`focusScope.autoFocusOnUnmount`,Nd={bubbles:!1,cancelable:!0},Pd=m.forwardRef(Ad(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=m.useState(null),l=md(i),u=md(a),d=m.useRef(null),f=zl(t,c),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Vd(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Vd(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Vd(s)};Ad(e,`handleFocusIn`),Ad(t,`handleFocusOut`),Ad(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),m.useEffect(()=>{if(s){Hd.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(jd,Nd);s.addEventListener(jd,l),s.dispatchEvent(t),t.defaultPrevented||(Fd(Gd(Ld(s)),{select:!0}),document.activeElement===e&&Vd(s))}return()=>{s.removeEventListener(jd,l),setTimeout(()=>{let t=new CustomEvent(Md,Nd);s.addEventListener(Md,u),s.dispatchEvent(t),t.defaultPrevented||Vd(e??document.body,{select:!0}),s.removeEventListener(Md,u),Hd.remove(p)},0)}}},[s,l,u,p]);let g=m.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Id(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Vd(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Vd(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,h.jsx)(au.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})},`FocusScope`));function Fd(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Vd(r,{select:t}),document.activeElement!==n)return}Ad(Fd,`focusFirst`);function Id(e){let t=Ld(e);return[Rd(t,e),Rd(t.reverse(),e)]}Ad(Id,`getTabbableEdges`);function Ld(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ad(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Ad(Ld,`getTabbableCandidates`);function Rd(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):zd(r,{upTo:t})))return r}Ad(Rd,`findVisible`);function zd(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Ad(zd,`isHidden`);function Bd(e){return e instanceof HTMLInputElement&&`select`in e}Ad(Bd,`isSelectableInput`);function Vd(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Bd(e)&&t&&e.select()}}Ad(Vd,`focus`);var Hd=Ud();function Ud(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Wd(e,t),e.unshift(t)},remove(t){e=Wd(e,t),e[0]?.resume()}}}Ad(Ud,`createFocusScopesStack`);function Wd(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ad(Wd,`arrayRemove`);function Gd(e){return e.filter(e=>e.tagName!==`A`)}Ad(Gd,`removeLinks`);var Kd=Object.defineProperty,qd=m.forwardRef(((e,t)=>Kd(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=m.useState(!1);Pu(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?nu.createPortal((0,h.jsx)(au.div,{...r,ref:t}),o):null},`Portal`)),Jd=Object.defineProperty,Yd=(e,t)=>Jd(e,`name`,{value:t,configurable:!0}),Xd=0,Zd=null;function Qd(e){return $d(),e.children}Yd(Qd,`FocusGuards`);function $d(){m.useEffect(()=>{Zd||={start:ef(),end:ef()};let{start:e,end:t}=Zd;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Xd++,()=>{Xd===1&&(Zd?.start.remove(),Zd?.end.remove(),Zd=null),Xd=Math.max(0,Xd-1)}},[])}Yd($d,`useFocusGuards`);function ef(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Yd(ef,`createFocusGuard`);var tf=function(){return tf=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},tf.apply(this,arguments)};function nf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function rf(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 af=`right-scroll-bar-position`,of=`width-before-scroll-bar`,sf=`with-scroll-bars-hidden`,cf=`--removed-body-scroll-bar-size`;function lf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function uf(e,t){var n=(0,m.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var df=typeof window<`u`?m.useLayoutEffect:m.useEffect,ff=new WeakMap;function pf(e,t){var n=uf(t||null,function(t){return e.forEach(function(e){return lf(e,t)})});return df(function(){var t=ff.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||lf(e,null)}),i.forEach(function(e){r.has(e)||lf(e,a)})}ff.set(n,e)},[e]),n}function mf(e){return e}function hf(e,t){t===void 0&&(t=mf);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function gf(e){e===void 0&&(e={});var t=hf(null);return t.options=tf({async:!0,ssr:!1},e),t}var _f=function(e){var t=e.sideCar,n=nf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return m.createElement(r,tf({},n))};_f.isSideCarExport=!0;function vf(e,t){return e.useMedium(t),_f}var yf=gf(),bf=function(){},xf=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:bf,onWheelCapture:bf,onTouchMoveCapture:bf}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=nf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=pf([n,t]),w=tf(tf({},x),i);return m.createElement(m.Fragment,null,u&&m.createElement(S,{sideCar:yf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?m.cloneElement(m.Children.only(s),tf(tf({},w),{ref:C})):m.createElement(y,tf({},w,{className:c,ref:C}),s))});xf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},xf.classNames={fullWidth:of,zeroRight:af};var Sf=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Cf(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Sf();return t&&e.setAttribute(`nonce`,t),e}function wf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Tf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Ef=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Cf())&&(wf(t,n),Tf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Df=function(){var e=Ef();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Of=function(){var e=Df();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},kf={left:0,top:0,right:0,gap:0},Af=function(e){return parseInt(e||``,10)||0},jf=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Af(n),Af(r),Af(i)]},Mf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return kf;var t=jf(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Nf=Of(),Pf=`data-scroll-locked`,Ff=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
10
|
+
.${sf} {
|
|
11
|
+
overflow: hidden ${r};
|
|
12
|
+
padding-right: ${s}px ${r};
|
|
13
|
+
}
|
|
14
|
+
body[${Pf}] {
|
|
15
|
+
overflow: hidden ${r};
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
18
|
+
padding-left: ${i}px;
|
|
19
|
+
padding-top: ${a}px;
|
|
20
|
+
padding-right: ${o}px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: ${s}px ${r};
|
|
24
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${af} {
|
|
28
|
+
right: ${s}px ${r};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${of} {
|
|
32
|
+
margin-right: ${s}px ${r};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${af} .${af} {
|
|
36
|
+
right: 0 ${r};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${of} .${of} {
|
|
40
|
+
margin-right: 0 ${r};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[${Pf}] {
|
|
44
|
+
${cf}: ${s}px;
|
|
45
|
+
}
|
|
46
|
+
`},If=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Lf=function(){m.useEffect(function(){return document.body.setAttribute(Pf,(If()+1).toString()),function(){var e=If()-1;e<=0?document.body.removeAttribute(Pf):document.body.setAttribute(Pf,e.toString())}},[])},Rf=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Lf();var a=m.useMemo(function(){return Mf(i)},[i]);return m.createElement(Nf,{styles:Ff(a,!t,i,n?``:`!important`)})},zf=!1;if(typeof window<`u`)try{var Bf=Object.defineProperty({},"passive",{get:function(){return zf=!0,!0}});window.addEventListener(`test`,Bf,Bf),window.removeEventListener(`test`,Bf,Bf)}catch{zf=!1}var Vf=zf?{passive:!1}:!1,Hf=function(e){return e.tagName===`TEXTAREA`},Uf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Hf(e)&&n[t]===`visible`)},Wf=function(e){return Uf(e,`overflowY`)},Gf=function(e){return Uf(e,`overflowX`)},Kf=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Yf(e,r)){var i=Xf(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qf=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Jf=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Yf=function(e,t){return e===`v`?Wf(t):Gf(t)},Xf=function(e,t){return e===`v`?qf(t):Jf(t)},Zf=function(e,t){return e===`h`&&t===`rtl`?-1:1},Qf=function(e,t,n,r,i){var a=Zf(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Xf(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Yf(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},$f=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ep=function(e){return[e.deltaX,e.deltaY]},tp=function(e){return e&&`current`in e?e.current:e},np=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rp=function(e){return`
|
|
47
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
49
|
+
`},ip=0,ap=[];function op(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(ip++)[0],a=m.useState(Of)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=rf([e.lockRef.current],(e.shards||[]).map(tp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=$f(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Kf(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Kf(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Qf(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(ap.length&&ap[ap.length-1]===a){var r=`deltaY`in n?ep(n):$f(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&np(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(tp).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:sp(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=$f(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,ep(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,$f(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return ap.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Vf),document.addEventListener(`touchmove`,c,Vf),document.addEventListener(`touchstart`,u,Vf),function(){ap=ap.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Vf),document.removeEventListener(`touchmove`,c,Vf),document.removeEventListener(`touchstart`,u,Vf)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:rp(i)}):null,p?m.createElement(Rf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var cp=vf(yf,op),lp=m.forwardRef(function(e,t){return m.createElement(xf,tf({},e,{ref:t,sideCar:cp}))});lp.classNames=xf.classNames;var up=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},dp=new WeakMap,fp=new WeakMap,pp={},mp=0,hp=function(e){return e&&(e.host||hp(e.parentNode))},gp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=hp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},_p=function(e,t,n,r){var i=gp(t,Array.isArray(e)?e:[e]);pp[n]||(pp[n]=new WeakMap);var a=pp[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(dp.get(e)||0)+1,l=(a.get(e)||0)+1;dp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&fp.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),mp++,function(){o.forEach(function(e){var t=dp.get(e)-1,i=a.get(e)-1;dp.set(e,t),a.set(e,i),t||(fp.has(e)||e.removeAttribute(r),fp.delete(e)),i||e.removeAttribute(n)}),mp--,mp||(dp=new WeakMap,dp=new WeakMap,fp=new WeakMap,pp={})}},vp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||up(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),_p(r,i,n,`aria-hidden`)):function(){return null}},yp=Object.defineProperty,bp=(e,t)=>yp(e,`name`,{value:t,configurable:!0}),xp=`Dialog`,[Sp,Cp]=du(xp),[wp,Tp]=Sp(xp),Ep=bp(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=Uu({prop:r,defaultProp:i??!1,onChange:a,caller:xp}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(wp,{scope:t,triggerRef:s,contentRef:c,contentId:sd(),titleId:sd(),descriptionId:sd(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Dp=`DialogPortal`,[Op,kp]=Sp(Dp,{forceMount:void 0}),Ap=bp(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Tp(Dp,t);return(0,h.jsx)(Op,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(Zu,{present:n||a.open,children:(0,h.jsx)(qd,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),jp=`DialogOverlay`,Mp=m.forwardRef(bp(function(e,t){let n=kp(jp,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Tp(jp,e.__scopeDialog);return a.modal?(0,h.jsx)(Zu,{present:r||a.open,children:(0,h.jsx)(Pp,{...i,ref:t})}):null},`DialogOverlay`)),Np=Hl(`DialogOverlay.RemoveScroll`),Pp=m.forwardRef(bp(function(e,t){let{__scopeDialog:n,...r}=e,i=Tp(jp,n),a=zl(t,Cd());return(0,h.jsx)(lp,{as:Np,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(au.div,{"data-state":Wp(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Fp=`DialogContent`,Ip=m.forwardRef(bp(function(e,t){let n=kp(Fp,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Tp(Fp,e.__scopeDialog);return(0,h.jsx)(Zu,{present:r||a.open,children:a.modal?(0,h.jsx)(Lp,{...i,ref:t}):(0,h.jsx)(Rp,{...i,ref:t})})},`DialogContent`)),Lp=m.forwardRef(bp(function(e,t){let n=Tp(Fp,e.__scopeDialog),r=m.useRef(null),i=zl(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return vp(e)},[]),(0,h.jsx)(zp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ku(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ku(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:ku(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Rp=m.forwardRef(bp(function(e,t){let n=Tp(Fp,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(zp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),zp=m.forwardRef(bp(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Tp(Fp,n);return $d(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(Pd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(Sd,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Wp(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Bp=`DialogTitle`,Vp=m.forwardRef(bp(function(e,t){let{__scopeDialog:n,...r}=e,i=Tp(Bp,n),{setTitleCount:a}=i;return Pu(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(au.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Hp=`DialogDescription`,Up=m.forwardRef(bp(function(e,t){let{__scopeDialog:n,...r}=e,i=Tp(Hp,n),{setDescriptionCount:a}=i;return Pu(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(au.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`));function Wp(e){return e?`open`:`closed`}bp(Wp,`getState`);var Gp=Object.defineProperty,Kp=(e,t)=>Gp(e,`name`,{value:t,configurable:!0});function qp(e){let[t,n]=m.useState(void 0);return Pu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}Kp(qp,`useSize`);var Jp=[`top`,`right`,`bottom`,`left`],Yp=Math.min,Xp=Math.max,Zp=Math.round,Qp=Math.floor,$p=e=>({x:e,y:e}),em={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tm(e,t,n){return Xp(e,Yp(t,n))}function nm(e,t){return typeof e==`function`?e(t):e}function rm(e){return e.split(`-`)[0]}function im(e){return e.split(`-`)[1]}function am(e){return e===`x`?`y`:`x`}function om(e){return e===`y`?`height`:`width`}function sm(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cm(e){return am(sm(e))}function lm(e,t,n){n===void 0&&(n=!1);let r=im(e),i=cm(e),a=om(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vm(o)),[o,vm(o)]}function um(e){let t=vm(e);return[dm(e),t,dm(t)]}function dm(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fm=[`left`,`right`],pm=[`right`,`left`],mm=[`top`,`bottom`],hm=[`bottom`,`top`];function gm(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pm:fm:t?fm:pm;case`left`:case`right`:return t?mm:hm;default:return[]}}function _m(e,t,n,r){let i=im(e),a=gm(rm(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dm)))),a}function vm(e){let t=rm(e);return em[t]+e.slice(t.length)}function ym(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function bm(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ym(e)}function xm(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Sm(e,t,n){let{reference:r,floating:i}=e,a=sm(t),o=cm(t),s=om(o),c=rm(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=im(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Cm(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=nm(t,e),p=bm(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xm(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wm=50,Tm=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Cm},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Sm(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<wm&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Sm(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Em=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=nm(e,t)||{};if(l==null)return{};let d=bm(u),f={x:n,y:r},p=cm(i),m=om(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yp(d[_],T),D=Yp(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=tm(E,k,O),A=!c.arrow&&im(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,j=A?k<E?k-E:k-O:0;return{[p]:f[p]+j,data:{[p]:ee,centerOffset:k-ee-j,...A&&{alignmentOffset:j}},reset:A}}}),Dm=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=nm(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=rm(r),_=sm(o),v=rm(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[vm(o)]:um(o)),x=p!==`none`;!d&&x&&b.push(..._m(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=lm(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===sm(t)||T.every(e=>sm(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sm(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Om(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function km(e){return Jp.some(t=>e[t]>=0)}var Am=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=nm(e,t);switch(i){case`referenceHidden`:{let e=Om(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:km(e)}}}case`escaped`:{let e=Om(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:km(e)}}}default:return{}}}}},jm=new Set([`left`,`top`]);async function Mm(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rm(n),s=im(n),c=sm(n)===`y`,l=jm.has(o)?-1:1,u=a&&c?-1:1,d=nm(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Nm=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Mm(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pm=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=nm(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sm(i),p=am(f),m=u[p],h=u[f],g=(e,t)=>tm(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Fm=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=nm(e,t),u={x:n,y:r},d=sm(i),f=am(d),p=u[f],m=u[d],h=nm(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jm.has(rm(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Im=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=nm(e,t),c=await i.detectOverflow(t,s),l=rm(n),u=im(n),d=sm(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Yp(p-c[m],g),y=Yp(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Xp(c.left,c.right):S=p-2*Xp(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Lm(){return typeof window<`u`}function Rm(e){return Vm(e)?(e.nodeName||``).toLowerCase():`#document`}function zm(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bm(e){return((Vm(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Vm(e){return Lm()?e instanceof Node||e instanceof zm(e).Node:!1}function Hm(e){return Lm()?e instanceof Element||e instanceof zm(e).Element:!1}function Um(e){return Lm()?e instanceof HTMLElement||e instanceof zm(e).HTMLElement:!1}function Wm(e){return!Lm()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zm(e).ShadowRoot}function Gm(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nh(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Km(e){return/^(table|td|th)$/.test(Rm(e))}function qm(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Jm=/transform|translate|scale|rotate|perspective|filter/,Ym=/paint|layout|strict|content/,Xm=e=>!!e&&e!==`none`,Zm;function Qm(e){let t=Hm(e)?nh(e):e;return Xm(t.transform)||Xm(t.translate)||Xm(t.scale)||Xm(t.rotate)||Xm(t.perspective)||!eh()&&(Xm(t.backdropFilter)||Xm(t.filter))||Jm.test(t.willChange||``)||Ym.test(t.contain||``)}function $m(e){let t=ih(e);for(;Um(t)&&!th(t);){if(Qm(t))return t;if(qm(t))return null;t=ih(t)}return null}function eh(){return Zm??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Zm}function th(e){return/^(html|body|#document)$/.test(Rm(e))}function nh(e){return zm(e).getComputedStyle(e)}function rh(e){return Hm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ih(e){if(Rm(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Wm(e)&&e.host||Bm(e);return Wm(t)?t.host:t}function ah(e){let t=ih(e);return th(t)?(e.ownerDocument||e).body:Um(t)&&Gm(t)?t:ah(t)}function oh(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ah(e),i=r===e.ownerDocument?.body,a=zm(r);if(i){let e=sh(a);return t.concat(a,a.visualViewport||[],Gm(r)?r:[],e&&n?oh(e):[])}return t.concat(r,oh(r,[],n))}function sh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ch(e){let t=nh(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Um(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zp(n)!==a||Zp(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function lh(e){return Hm(e)?e:e.contextElement}function uh(e){let t=lh(e);if(!Um(t))return $p(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ch(t),o=(a?Zp(n.width):n.width)/r,s=(a?Zp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var dh=$p(0);function fh(e){let t=zm(e);return!eh()||!t.visualViewport?dh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ph(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===zm(e)}function mh(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=lh(e),o=$p(1);t&&(r?Hm(r)&&(o=uh(r)):o=uh(e));let s=ph(a,n,r)?fh(a):$p(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=zm(a),t=Hm(r)?zm(r):r,n=e,i=sh(n);for(;i&&t!==n;){let e=uh(i),t=i.getBoundingClientRect(),r=nh(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=zm(i),i=sh(n)}}return xm({width:u,height:d,x:c,y:l})}function hh(e,t){let n=rh(e).scrollLeft;return t?t.left+n:mh(Bm(e)).left+n}function gh(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hh(e,n),y:n.top+t.scrollTop}}function _h(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Bm(r),s=t?qm(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$p(1),u=$p(0),d=Um(r);if((d||!a)&&((Rm(r)!==`body`||Gm(o))&&(c=rh(r)),d)){let e=mh(r);l=uh(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gh(o,c):$p(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function vh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function yh(e){let t=rh(e),n=e.ownerDocument.body,r=Xp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Xp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+hh(e),o=-t.scrollTop;return nh(n).direction===`rtl`&&(a+=Xp(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var bh=25;function xh(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=zm(e),a=Bm(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!eh()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(hh(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=bh&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Sh(e,t){let n=mh(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=uh(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ch(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=xh(e,n,t);else if(t===`document`)r=yh(Bm(e));else if(Hm(t))r=Sh(t,n);else{let n=fh(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xm(r)}function wh(e,t){let n=t.get(e);if(n)return n;let r=oh(e,[],!1).filter(e=>Hm(e)&&Rm(e)!==`body`),i=null,a=nh(e).position===`fixed`,o=a?ih(e):e;for(;Hm(o)&&!th(o);){let e=nh(o),t=Qm(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ih(o)}return t.set(e,r),r}function Th(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qm(t)?[]:wh(t,this._c):[].concat(n),r],o=Ch(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ch(t,a[e],i);s=Xp(n.top,s),c=Yp(n.right,c),l=Yp(n.bottom,l),u=Xp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Eh(e){let{width:t,height:n}=ch(e);return{width:t,height:n}}function Dh(e,t,n){let r=Um(t),i=Bm(t),a=n===`fixed`,o=mh(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$p(0);if((r||!a)&&((Rm(t)!==`body`||Gm(i))&&(s=rh(t)),r)){let e=mh(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=hh(i));let l=i&&!r&&!a?gh(i,s):$p(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Oh(e){return nh(e).position===`static`}function kh(e,t){if(!Um(e)||nh(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Bm(e)===n&&(n=n.ownerDocument.body),n}function Ah(e,t){let n=zm(e);if(qm(e))return n;if(!Um(e)){let t=ih(e);for(;t&&!th(t);){if(Hm(t)&&!Oh(t))return t;t=ih(t)}return n}let r=kh(e,t);for(;r&&Km(r)&&Oh(r);)r=kh(r,t);return r&&th(r)&&Oh(r)&&!Qm(r)?n:r||$m(e)||n}var jh=async function(e){let t=this.getOffsetParent||Ah,n=this.getDimensions,r=await n(e.floating);return{reference:Dh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Mh(e){return nh(e).direction===`rtl`}var Nh={convertOffsetParentRelativeRectToViewportRelativeRect:_h,getDocumentElement:Bm,getClippingRect:Th,getOffsetParent:Ah,getElementRects:jh,getClientRects:vh,getDimensions:Eh,getScale:uh,isElement:Hm,isRTL:Mh};function Ph(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fh(e,t,n){let r=null,i,a=Bm(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Qp(d),h=Qp(a.clientWidth-(u+f)),g=Qp(a.clientHeight-(d+p)),_=Qp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xp(0,Yp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ph(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=zm(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ih(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=lh(e),u=i||a?[...l?oh(l):[],...t?oh(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Fh(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?mh(e):null;c&&g();function g(){let t=mh(e);h&&!Ph(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Lh=Nm,Rh=Pm,zh=Dm,Bh=Im,Vh=Am,Hh=Em,Uh=Fm,Wh=(e,t,n)=>{let r=new Map,i=n??{},a={...Nh,...i.platform,_c:r};return Tm(e,t,{...i,platform:a})},Gh=typeof document<`u`?m.useLayoutEffect:function(){};function Kh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Kh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Kh(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function qh(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jh(e,t){let n=qh(e);return Math.round(t*n)/n}function Yh(e){let t=m.useRef(e);return Gh(()=>{t.current=e}),t}function Xh(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);Kh(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=Yh(c),O=Yh(i),k=Yh(l),ee=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Wh(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};A.current&&!Kh(T.current,t)&&(T.current=t,nu.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Gh(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=m.useRef(!1);Gh(()=>(A.current=!0,()=>{A.current=!1}),[]),Gh(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,ee);ee()}},[x,S,ee,D,E]);let j=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),M=m.useMemo(()=>({reference:x,floating:S}),[x,S]),N=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Jh(M.floating,u.x),r=Jh(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...qh(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:ee,refs:j,elements:M,floatingStyles:N}),[u,ee,j,M,N])}var Zh=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Hh({element:r.current,padding:i}).fn(n):r?Hh({element:r,padding:i}).fn(n):{}}}},Qh=(e,t)=>{let n=Lh(e);return{name:n.name,fn:n.fn,options:[e,t]}},$h=(e,t)=>{let n=Rh(e);return{name:n.name,fn:n.fn,options:[e,t]}},eg=(e,t)=>({fn:Uh(e).fn,options:[e,t]}),tg=(e,t)=>{let n=zh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ng=(e,t)=>{let n=Bh(e);return{name:n.name,fn:n.fn,options:[e,t]}},rg=(e,t)=>{let n=Vh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ig=(e,t)=>{let n=Zh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ag=Object.defineProperty,og=(e,t)=>ag(e,`name`,{value:t,configurable:!0}),sg=`Popper`,[cg,lg]=du(sg),[ug,dg]=cg(sg),fg=og(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(ug,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),pg=`PopperAnchor`,mg=m.forwardRef(og(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=dg(pg,n),o=m.useRef(null),s=a.onAnchorChange,c=zl(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&bg(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(au.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),hg=`PopperContent`,[gg,eee]=cg(hg),_g=m.forwardRef(og(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=dg(hg,n),[y,b]=m.useState(null),x=zl(t,b),[S,C]=m.useState(null),w=qp(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],ee=k.length>0,A={padding:O,boundary:k.filter(vg),altBoundary:ee},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Xh({strategy:`fixed`,placement:D,whileElementsMounted:og((...e)=>Ih(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Qh({mainAxis:i+E,alignmentAxis:o}),c&&$h({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?eg():void 0,...A}),c&&tg({...A}),ng({...A,apply:og(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&ig({element:S,padding:s}),yg({arrowWidth:T,arrowHeight:E}),f&&rg({strategy:`referenceHidden`,...A,boundary:ee?A.boundary:void 0})]}),te=v.setPlacementState;Pu(()=>(te(N),()=>{te(void 0)}),[N,te]);let[ne,re]=bg(N),ie=md(g);Pu(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=m.useState();return Pu(()=>{y&&le(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(gg,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,h.jsx)(au.div,{"data-side":ne,"data-align":re,..._,ref:x,style:{..._.style,animation:P?_.style?.animation:`none`}})})})},`PopperContent`));function vg(e){return e!==null}og(vg,`isNotNull`);var yg=og(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bg(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function bg(e){let[t,n=`center`]=e.split(`-`);return[t,n]}og(bg,`getSideAndAlignFromPlacement`);var xg=fg,Sg=mg,Cg=_g,wg=Object.defineProperty,Tg=(e,t)=>wg(e,`name`,{value:t,configurable:!0}),Eg=!1;function Dg(){let[e,t]=m.useState(Eg);return m.useEffect(()=>{Eg||(Eg=!0,t(!0))},[]),e}Tg(Dg,`useIsHydrated`);var Og=m.useSyncExternalStore;function kg(){return()=>{}}Tg(kg,`subscribe`);function Ag(){return Og(kg,()=>!0,()=>!1)}Tg(Ag,`useIsHydratedModern`);var jg=typeof Og==`function`?Ag:Dg,Mg=Object.defineProperty,Ng=(e,t)=>Mg(e,`name`,{value:t,configurable:!0}),Pg=`rovingFocusGroup.onEntryFocus`,Fg={bubbles:!1,cancelable:!0},Ig=`RovingFocusGroup`,[Lg,Rg,zg]=hu(Ig),[Bg,Vg]=du(Ig,[zg]),[Hg,Ug]=Bg(Ig),Wg=m.forwardRef(Ng(function(e,t){return(0,h.jsx)(Lg.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Lg.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Gg,{...e,ref:t})})})},`RovingFocusGroup`)),Gg=m.forwardRef(Ng(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=zl(t,f),g=dd(a),[_,v]=Uu({prop:o,defaultProp:s??null,onChange:c,caller:Ig}),[y,b]=m.useState(!1),x=md(l),S=Rg(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Pg,x),()=>e.removeEventListener(Pg,x)},[x]),(0,h.jsx)(Hg,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(au.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:ku(e.onMouseDown,()=>{C.current=!0}),onFocus:ku(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(Pg,Fg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Zg([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:ku(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Kg=`RovingFocusGroupItem`,qg=m.forwardRef(Ng(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=sd(),l=a||c,u=Ug(Kg,n),d=u.currentTabStopId===l,f=Rg(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=jg();return Pu(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(Lg.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(au.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:ku(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:ku(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:ku(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Xg(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Qg(n,r+1):n.slice(r+1)}setTimeout(()=>Zg(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Jg={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Yg(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Ng(Yg,`getDirectionAwareKey`);function Xg(e,t,n){let r=Yg(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Jg[r]}Ng(Xg,`getFocusIntent`);function Zg(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Ng(Zg,`focusFirst`);function Qg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ng(Qg,`wrapArray`);var $g=Wg,e_=qg,t_=Object.defineProperty,n_=(e,t)=>t_(e,`name`,{value:t,configurable:!0}),r_=[`Enter`,` `],i_=[`ArrowDown`,`PageUp`,`Home`],a_=[`ArrowUp`,`PageDown`,`End`],o_=[...i_,...a_];[...r_],[...r_];var s_=`Menu`,[c_,l_,u_]=hu(s_),[d_,f_]=du(s_,[u_,lg,Vg]),p_=lg(),m_=Vg(),[tee,h_]=d_(s_),[g_,__]=d_(s_),v_=n_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=p_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=md(a),f=dd(i);return m.useEffect(()=>{let e=n_(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=n_(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=n_(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(xg,{...s,children:(0,h.jsx)(tee,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(g_,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),y_=m.forwardRef(n_(function(e,t){let{__scopeMenu:n,...r}=e,i=p_(n);return(0,h.jsx)(Sg,{...i,...r,ref:t})},`MenuAnchor`)),b_=`MenuPortal`,[x_,S_]=d_(b_,{forceMount:void 0}),C_=n_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=h_(b_,t);return(0,h.jsx)(x_,{scope:t,forceMount:n,children:(0,h.jsx)(Zu,{present:n||a.open,children:(0,h.jsx)(qd,{asChild:!0,container:i,children:r})})})},`MenuPortal`),w_=`MenuContent`,[T_,E_]=d_(w_),D_=m.forwardRef(n_(function(e,t){let n=S_(w_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=h_(w_,e.__scopeMenu),o=__(w_,e.__scopeMenu);return(0,h.jsx)(c_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(Zu,{present:r||a.open,children:(0,h.jsx)(c_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(O_,{...i,ref:t}):(0,h.jsx)(k_,{...i,ref:t})})})})},`MenuContent`)),O_=m.forwardRef(n_(function(e,t){let n=h_(w_,e.__scopeMenu),r=m.useRef(null),i=zl(t,r);return m.useEffect(()=>{let e=r.current;if(e)return vp(e)},[]),(0,h.jsx)(j_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ku(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),k_=m.forwardRef(n_(function(e,t){let n=h_(w_,e.__scopeMenu);return(0,h.jsx)(j_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),A_=Hl(`MenuContent.ScrollLock`),j_=m.forwardRef(n_(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=h_(w_,n),y=__(w_,n),b=p_(n),x=m_(n),S=l_(n),[C,w]=m.useState(null),T=m.useRef(null),E=zl(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),ee=m.useRef(null),A=m.useRef(`right`),j=m.useRef(0),M=g?lp:m.Fragment,N=g?{as:A_,allowPinchZoom:!0}:void 0,P=n_(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=V_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;n_((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),$d();let F=m.useCallback(e=>A.current===ee.current?.side&&U_(e,ee.current?.area),[]);return(0,h.jsx)(T_,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:m.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{ee.current=e},[]),children:(0,h.jsx)(M,{...N,children:(0,h.jsx)(Pd,{asChild:!0,trapped:i,onMountAutoFocus:ku(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(Sd,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)($g,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:ku(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(Cg,{role:`menu`,"aria-orientation":`vertical`,"data-state":I_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:ku(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=T.current;if(e.target!==i||!o_.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);a_.includes(e.key)&&a.reverse(),z_(a)}),onBlur:ku(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:ku(e.onPointerMove,W_(e=>{let t=e.target,n=j.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>j.current?`right`:`left`;A.current=t,j.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),M_=`MenuItem`,N_=`menu.itemSelect`,P_=m.forwardRef(n_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=__(M_,e.__scopeMenu),s=E_(M_,e.__scopeMenu),c=zl(t,a),l=m.useRef(!1),u=n_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(N_,{bubbles:!0,cancelable:!0});e.addEventListener(N_,e=>r?.(e),{once:!0}),ou(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(F_,{...i,ref:c,disabled:n,onClick:ku(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:ku(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:ku(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&r_.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),F_=m.forwardRef(n_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=E_(M_,n),s=m_(n),c=m.useRef(null),l=zl(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(c_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(e_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(au.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:ku(e.onPointerMove,W_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ku(e.onPointerLeave,W_(e=>o.onItemLeave(e))),onFocus:ku(e.onFocus,()=>d(!0)),onBlur:ku(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[nee,ree]=d_(`MenuRadioGroup`,{value:void 0,onValueChange:n_(()=>{},`onValueChange`)}),[iee,aee]=d_(`MenuItemIndicator`,{checked:!1}),[oee,see]=d_(`MenuSub`);function I_(e){return e?`open`:`closed`}n_(I_,`getOpenState`);function L_(e){return e===`indeterminate`}n_(L_,`isIndeterminate`);function R_(e){return L_(e)?`indeterminate`:e?`checked`:`unchecked`}n_(R_,`getCheckedState`);function z_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}n_(z_,`focusFirst`);function B_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}n_(B_,`wrapArray`);function V_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=B_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}n_(V_,`getNextMatch`);function H_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}n_(H_,`isPointInPolygon`);function U_(e,t){return t?H_({x:e.clientX,y:e.clientY},t):!1}n_(U_,`isPointerInGraceArea`);function W_(e){return t=>t.pointerType===`mouse`?e(t):void 0}n_(W_,`whenMouse`);var G_=v_,K_=y_,q_=C_,J_=D_,Y_=P_,X_=Object.defineProperty,Z_=(e,t)=>X_(e,`name`,{value:t,configurable:!0}),Q_=`DropdownMenu`,[$_,cee]=du(Q_,[f_]),ev=f_(),[tv,nv]=$_(Q_),rv=Z_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=ev(t),l=m.useRef(null),[u,d]=Uu({prop:i,defaultProp:a??!1,onChange:o,caller:Q_});return(0,h.jsx)(tv,{scope:t,triggerId:sd(),triggerRef:l,contentId:sd(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(G_,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),iv=`DropdownMenuTrigger`,av=m.forwardRef(Z_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=nv(iv,n),o=ev(n),s=zl(t,a.triggerRef);return(0,h.jsx)(K_,{asChild:!0,...o,children:(0,h.jsx)(au.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:ku(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:ku(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),ov=Z_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=ev(t);return(0,h.jsx)(q_,{...r,...n})},`DropdownMenuPortal`),sv=`DropdownMenuContent`,cv=m.forwardRef(Z_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=nv(sv,n),a=ev(n),o=m.useRef(!1);return(0,h.jsx)(J_,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:ku(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:ku(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),lv=m.forwardRef(Z_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ev(n);return(0,h.jsx)(Y_,{...i,...r,ref:t})},`DropdownMenuItem`)),uv=rv,dv=av,fv=ov,pv=cv,mv=lv,hv=Object.defineProperty,gv=m.forwardRef(((e,t)=>hv(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(au.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),_v=Object.defineProperty,vv=(e,t)=>_v(e,`name`,{value:t,configurable:!0});function yv(e){let t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}vv(yv,`usePrevious`);var bv=Object.defineProperty,xv=(e,t)=>bv(e,`name`,{value:t,configurable:!0});function Sv(e,[t,n]){return Math.min(n,Math.max(t,e))}xv(Sv,`clamp`);var Cv=Object.defineProperty,wv=(e,t)=>Cv(e,`name`,{value:t,configurable:!0}),Tv=`Popover`,[Ev,lee]=du(Tv,[lg]),Dv=lg(),[Ov,kv]=Ev(Tv),Av=wv(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Dv(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Uu({prop:r,defaultProp:i??!1,onChange:a,caller:Tv});return(0,h.jsx)(xg,{...s,children:(0,h.jsx)(Ov,{scope:t,contentId:sd(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),jv=`PopoverAnchor`,Mv=m.forwardRef(wv(function(e,t){let{__scopePopover:n,...r}=e,i=kv(jv,n),a=Dv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(Sg,{...a,...r,ref:t})},`PopoverAnchor`)),Nv=`PopoverTrigger`,Pv=m.forwardRef(wv(function(e,t){let{__scopePopover:n,...r}=e,i=kv(Nv,n),a=Dv(n),o=zl(t,i.triggerRef),s=(0,h.jsx)(au.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Gv(i.open),...r,ref:o,onClick:ku(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(Sg,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Fv=`PopoverPortal`,[Iv,Lv]=Ev(Fv,{forceMount:void 0}),Rv=wv(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=kv(Fv,t);return(0,h.jsx)(Iv,{scope:t,forceMount:n,children:(0,h.jsx)(Zu,{present:n||a.open,children:(0,h.jsx)(qd,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),zv=`PopoverContent`,Bv=m.forwardRef(wv(function(e,t){let n=Lv(zv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=kv(zv,e.__scopePopover);return(0,h.jsx)(Zu,{present:r||a.open,children:a.modal?(0,h.jsx)(Hv,{...i,ref:t}):(0,h.jsx)(Uv,{...i,ref:t})})},`PopoverContent`)),Vv=Hl(`PopoverContent.RemoveScroll`),Hv=m.forwardRef(wv(function(e,t){let n=kv(zv,e.__scopePopover),r=m.useRef(null),i=zl(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return vp(e)},[]),(0,h.jsx)(lp,{as:Vv,allowPinchZoom:!0,children:(0,h.jsx)(Wv,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ku(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ku(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:ku(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Uv=m.forwardRef(wv(function(e,t){let n=kv(zv,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(Wv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Wv=m.forwardRef(wv(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=kv(zv,n),p=Dv(n);return $d(),(0,h.jsx)(Pd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(Sd,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(Cg,{"data-state":Gv(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function Gv(e){return e?`open`:`closed`}wv(Gv,`getState`);var Kv=Av,qv=Mv,Jv=Pv,Yv=Rv,Xv=Bv,Zv=Object.defineProperty,Qv=(e,t)=>Zv(e,`name`,{value:t,configurable:!0}),$v=[` `,`Enter`,`ArrowUp`,`ArrowDown`],ey=[` `,`Enter`],ty=`Select`,[ny,ry,iy]=hu(ty),[ay,uee]=du(ty,[iy,lg]),oy=lg(),[sy,cy]=ay(ty),[ly,uy]=ay(ty);function dy(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:g,internal_do_not_use_render:_}=e,v=oy(t),[y,b]=m.useState(null),[x,S]=m.useState(null),[C,w]=m.useState(!1),T=dd(l),[E,D]=Uu({prop:r,defaultProp:i??!1,onChange:a,caller:ty}),[O,k]=Uu({prop:o,defaultProp:s,onChange:c,caller:ty}),ee=m.useRef(null),A=m.useRef(O);m.useEffect(()=>{let e=g?y?.ownerDocument.getElementById(g):y?.form;if(e instanceof HTMLFormElement){let t=Qv(()=>k(A.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[g,y,k]);let j=!y||!!g||!!y.closest(`form`),[M,N]=m.useState(new Set),P=sd(),F=Array.from(M).map(e=>e.props.value).join(`;`),te=m.useCallback(e=>{N(t=>new Set(t).add(e))},[]),ne=m.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:P,value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:g,nativeOptions:M,nativeSelectKey:F,isFormControl:j};return(0,h.jsx)(xg,{...v,children:(0,h.jsx)(sy,{scope:t,...re,children:(0,h.jsx)(ny.Provider,{scope:t,children:(0,h.jsx)(ly,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:ne,children:Uy(_)?_(re):n})})})})}Qv(dy,`SelectProvider`);var fy=Qv(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,h.jsx)(dy,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,h.jsxs)(h.Fragment,{children:[n,e?(0,h.jsx)(Hy,{__scopeSelect:t}):null]})})},`Select`),py=`SelectTrigger`,my=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=oy(n),o=cy(py,n),s=o.disabled||r,c=zl(t,o.onTriggerChange),l=ry(n),u=m.useRef(`touch`),[d,f,p]=Gy(e=>{let t=l().filter(e=>!e.disabled),n=Ky(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),g=Qv(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,h.jsx)(Sg,{asChild:!0,...a,children:(0,h.jsx)(au.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Wy(o.value)?``:void 0,...i,ref:c,onClick:ku(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&g(e)}),onPointerDown:ku(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:ku(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&$v.includes(e.key)&&(g(),e.preventDefault())})})})},`SelectTrigger`)),dee=`SelectValue`,fee=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=cy(dee,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=zl(t,c.onValueNodeChange);Pu(()=>{l(u)},[l,u]);let f=Wy(c.value);return(0,h.jsx)(au.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,h.jsx)(m.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),hy=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,h.jsx)(au.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[gy,_y]=ay(`SelectPortal`,{forceMount:void 0}),vy=Qv(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,h.jsx)(gy,{scope:e.__scopeSelect,forceMount:n,children:(0,h.jsx)(qd,{asChild:!0,...r})})},`SelectPortal`),yy=`SelectContent`,by=m.forwardRef(Qv(function(e,t){let n=_y(yy,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=cy(yy,e.__scopeSelect),[o,s]=m.useState();return Pu(()=>{s(new DocumentFragment)},[]),(0,h.jsx)(Zu,{present:r||a.open,children:({present:e})=>e?(0,h.jsx)(Ey,{...i,ref:t}):(0,h.jsx)(xy,{...i,fragment:o})})},`SelectContent`)),xy=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?nu.createPortal((0,h.jsx)(Cy,{scope:n,children:(0,h.jsx)(ny.Slot,{scope:n,children:(0,h.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Sy=10,[Cy,wy]=ay(yy),Ty=Hl(`SelectContent.RemoveScroll`),Ey=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=cy(yy,n),[x,S]=m.useState(null),[C,w]=m.useState(null),T=zl(t,S),[E,D]=m.useState(null),[O,k]=m.useState(null),ee=ry(n),[A,j]=m.useState(!1),M=m.useRef(!1);m.useEffect(()=>{if(x)return vp(x)},[x]),$d();let N=m.useCallback(e=>{let[t,...n]=ee().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[ee,C]),P=m.useCallback(()=>N([E,x]),[N,E,x]);m.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:te}=b;m.useEffect(()=>{if(x){let e={x:0,y:0},t=Qv(t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},`handlePointerMove`),n=Qv(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||F(!1),document.removeEventListener(`pointermove`,t),te.current=null},`handlePointerUp`);return te.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,te]),m.useEffect(()=>{let e=Qv(()=>F(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ne,re]=Gy(e=>{let t=ee().filter(e=>!e.disabled),n=Ky(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=m.useCallback((e,t,n)=>{let r=!M.current&&!n;(b.value!==void 0&&b.value===t||r)&&(D(e),r&&(M.current=!0))},[b.value]),ae=m.useCallback(()=>x?.focus(),[x]),oe=m.useCallback((e,t,n)=>{let r=!M.current&&!n;(b.value!==void 0&&b.value===t||r)&&k(e)},[b.value]),se=r===`popper`?Oy:Dy,ce=se===Oy?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,h.jsx)(Cy,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:ie,selectedItem:E,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:P,selectedItemText:O,position:r,isPositioned:A,searchRef:ne,children:(0,h.jsx)(lp,{as:Ty,allowPinchZoom:!0,children:(0,h.jsx)(Pd,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:ku(i,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,h.jsx)(Sd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,h.jsx)(se,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...ce,onPlaced:()=>j(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:ku(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=ee().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Dy=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=cy(yy,n),o=wy(yy,n),[s,c]=m.useState(null),[l,u]=m.useState(null),d=zl(t,u),f=ry(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=m.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Sy,d=Sv(a,[Sy,Math.max(Sy,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Sy,d=Sv(a,[Sy,Math.max(Sy,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Sy*2,u=_.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+h+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Sy,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,ee=m+h+k,A=x-ee;if(ee<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=ee+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+_.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,_.scrollTop=ee-E+_.offsetTop}s.style.margin=`${Sy}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);Pu(()=>x(),[x]);let[S,C]=m.useState();Pu(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let w=m.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]);return(0,h.jsx)(ky,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:(0,h.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,h.jsx)(au.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),Oy=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Sy,...a}=e,o=oy(n);return(0,h.jsx)(Cg,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ky,Ay]=ay(yy,{}),jy=`SelectViewport`,My=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=wy(jy,n),o=Ay(jy,n),s=zl(t,a.onViewportChange),c=m.useRef(0);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,h.jsx)(ny.Slot,{scope:n,children:(0,h.jsx)(au.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:ku(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Sy*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[pee,mee]=ay(`SelectGroup`),Ny=`SelectItem`,[Py,Fy]=ay(Ny),Iy=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=cy(Ny,n),c=wy(Ny,n),l=s.value===r,[u,d]=m.useState(a??``),[f,p]=m.useState(!1),g=zl(t,md(e=>c.itemRefCallback?.(e,r,i))),_=sd(),v=m.useRef(`touch`),y=Qv(()=>{i||(s.onValueChange(r),s.onOpenChange(!1))},`handleSelect`);return(0,h.jsx)(Py,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:m.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,h.jsx)(ny.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,h.jsx)(au.div,{role:`option`,"aria-labelledby":_,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:ku(o.onFocus,()=>p(!0)),onBlur:ku(o.onBlur,()=>p(!1)),onClick:ku(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:ku(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:ku(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:ku(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ku(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ku(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(ey.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Ly=`SelectItemText`,Ry=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=cy(Ly,n),s=wy(Ly,n),c=Fy(Ly,n),l=uy(Ly,n),[u,d]=m.useState(null),f=md(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=zl(t,d,c.onItemTextChange,f),g=u?.textContent,_=m.useMemo(()=>(0,h.jsx)(`option`,{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return Pu(()=>(v(_),()=>y(_)),[v,y,_]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(au.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Wy(o.value)?nu.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),zy=`SelectItemIndicator`,By=m.forwardRef(Qv(function(e,t){let{__scopeSelect:n,...r}=e;return Fy(zy,n).isSelected?(0,h.jsx)(au.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Vy=`SelectBubbleInput`,Hy=m.forwardRef(Qv(function({__scopeSelect:e,...t},n){let r=cy(Vy,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=m.useRef(null),g=zl(n,p),_=i??``,v=yv(_),y=Array.from(d).some(e=>(e.props.value??``)===``);return m.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,h.jsxs)(au.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...su,...t.style},ref:g,defaultValue:_,children:[Wy(i)&&!y?(0,h.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function Uy(e){return typeof e==`function`}Qv(Uy,`isFunction`);function Wy(e){return e===``||e===void 0}Qv(Wy,`shouldShowPlaceholder`);function Gy(e){let t=md(e),n=m.useRef(``),r=m.useRef(0),i=m.useCallback(e=>{let i=n.current+e;t(i),Qv((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=m.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Qv(Gy,`useTypeaheadSearch`);function Ky(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=qy(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Qv(Ky,`findNextItem`);function qy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Qv(qy,`wrapArray`);var Jy=Object.defineProperty,Yy=(e,t)=>Jy(e,`name`,{value:t,configurable:!0}),Xy=`Toggle`,Zy=m.forwardRef(Yy(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Uu({prop:n,onChange:i,defaultProp:r??!1,caller:Xy});return(0,h.jsx)(au.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:ku(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Qy=Object.defineProperty,$y=(e,t)=>Qy(e,`name`,{value:t,configurable:!0}),eb=`ToggleGroup`,[tb,hee]=du(eb,[Vg]),nb=Vg(),rb=m.forwardRef($y(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(ob,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(sb,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${eb}\``)},`ToggleGroup`)),[ib,ab]=tb(eb),ob=m.forwardRef($y(function(e,t){let{value:n,defaultValue:r,onValueChange:i=$y(()=>{},`onValueChange`),...a}=e,[o,s]=Uu({prop:n,defaultProp:r??``,onChange:i,caller:eb});return(0,h.jsx)(ib,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(ub,{...a,ref:t})})},`ToggleGroupImplSingle`)),sb=m.forwardRef($y(function(e,t){let{value:n,defaultValue:r,onValueChange:i=$y(()=>{},`onValueChange`),...a}=e,[o,s]=Uu({prop:n,defaultProp:r??[],onChange:i,caller:eb}),c=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(ib,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(ub,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[cb,lb]=tb(eb),ub=m.forwardRef($y(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=nb(n),u=dd(o),d={dir:u,...c};return(0,h.jsx)(cb,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)($g,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(au.div,{...d,ref:t})}):(0,h.jsx)(au.div,{...d,ref:t})})},`ToggleGroupImpl`)),db=`ToggleGroupItem`,fb=m.forwardRef($y(function(e,t){let n=ab(db,e.__scopeToggleGroup),r=lb(db,e.__scopeToggleGroup),i=nb(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(e_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(pb,{...s,ref:t})}):(0,h.jsx)(pb,{...s,ref:t})},`ToggleGroupItem`)),pb=m.forwardRef($y(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=ab(db,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(Zy,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),mb=Pl(`inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap font-sans transition-colors duration-150 ease-out motion-reduce:transition-none`,{variants:{variant:{outline:`rounded-control border border-line2 bg-panel2 text-ink hover:bg-panel2 hover:border-ink3`,accent:`rounded-control border border-accent bg-transparent text-run-text hover:bg-panel2`,primary:`rounded-control bg-accent px-[14px] font-semibold text-accent-ink hover:bg-accent-edge`,ghost:`rounded-control text-ink2 hover:bg-panel2 hover:text-ink`,danger:`rounded-control border border-red bg-transparent text-ink hover:bg-panel2`,play:`rounded-panel bg-accent text-accent-ink font-extrabold tracking-[0.02em] shadow-[0_4px_0_var(--color-accent-edge)] active:translate-y-[3px] active:shadow-[0_1px_0_var(--color-accent-edge)] motion-reduce:active:translate-y-0`},size:{default:`h-8 px-3 text-body`,play:`h-14 w-full px-4 text-row`}},defaultVariants:{variant:`outline`,size:`default`}});function V({className:e,variant:t,size:n,asChild:r=!1,...i}){let a=r?Ul:`button`;return(0,h.jsx)(a,{"data-slot":`button`,className:z(mb({variant:t,size:n}),e),...i})}var hb=Ep,gb=Ap;function _b({className:e,...t}){return(0,h.jsx)(Mp,{"data-slot":`dialog-overlay`,className:z(`fixed inset-0 z-40 bg-scrim`,e),...t})}function vb({className:e,children:t,...n}){return(0,h.jsxs)(gb,{children:[(0,h.jsx)(_b,{}),(0,h.jsx)(Ip,{"data-slot":`dialog-content`,className:z(`fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] max-w-[480px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4`,`rounded-panel border border-line bg-panel p-[18px] shadow-[0_8px_24px_var(--color-shadow)]`,`data-[state=open]:animate-dialog-in motion-reduce:animate-none`,e),...n,children:t})]})}function yb({className:e,...t}){return(0,h.jsx)(Vp,{"data-slot":`dialog-title`,className:z(`text-title font-bold tracking-[-0.01em] text-ink`,e),...t})}function bb({className:e,...t}){return(0,h.jsx)(Up,{"data-slot":`dialog-description`,className:z(`text-body text-ink2`,e),...t})}var H={projects:[`projects`],revisions:e=>[`project`,e,`revisions`],revision:(e,t)=>[`project`,e,`revision`,t],revisionFile:(e,t,n)=>[`revision-file`,e,t,n],project:e=>[`project`,e],article:(e,t=null)=>[`project`,e,`article`,t],audioPreview:(e,t)=>[`audio-preview`,e,t],file:(e,t)=>[`file`,e,t],staging:[`staging`],notice:[`notice`],usage:[`usage`],providers:[`providers`],voices:[`voices`],prompts:[`prompts`],entries:[`entries`],documentThemes:[`document-themes`],settings:[`settings`]};function xb(e){return nt({queryKey:H.projects,queryFn:()=>yo(e)})}function Sb(e,t){return nt({queryKey:H.project(t),queryFn:()=>bo(e,t)})}function Cb(e){return nt({queryKey:H.notice,queryFn:()=>Do(e)})}function wb(e){return nt({queryKey:H.usage,queryFn:()=>Eo(e)})}function Tb(e){return nt({queryKey:H.providers,queryFn:()=>Ao(e)})}function Eb(e){return nt({queryKey:H.voices,queryFn:()=>Bo(e)})}function Db(e){return nt({queryKey:H.prompts,queryFn:()=>Go(e)})}function Ob(e){return nt({queryKey:H.entries,queryFn:()=>Jo(e)})}function kb(e){return nt({queryKey:H.documentThemes,queryFn:()=>Xo(e)})}function Ab(e){return nt({queryKey:H.settings,queryFn:()=>Po(e)})}var jb=[`Tokens in and out per stage, with provider and model`,`Audio seconds per segment`,`Images made`,`Thumbnails made`,`Videos rendered`,`PDF documents made`,`YouTube descriptions written`,`Shorts made`,`Projects created`,`That this machine installed Slopify`,`The time each of those happened`],Mb=[`API keys`,`Prompt bodies`,`Keyword values`,`Titles`,`Article or research text`,`Files and filenames`,`OS, locale, hardware`];function Nb(){let{api:e}=B(),t=_(),n=I(Cb(e)),r=rt({mutationFn:()=>Oo(e),onSuccess:e=>{t.setQueryData(H.notice,e)}}),i=n.data?.seen===!1,a=n.data?.appVersion;return(0,h.jsx)(hb,{open:i,children:(0,h.jsxs)(vb,{onEscapeKeyDown:e=>{e.preventDefault()},onInteractOutside:e=>{e.preventDefault()},children:[(0,h.jsx)(yb,{children:`Anonymous usage stats`}),(0,h.jsx)(bb,{children:`These numbers power the live counters on slopify.stream.`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,h.jsx)(Pb,{heading:`Tracked`,items:jb}),(0,h.jsx)(Pb,{heading:`Never tracked`,items:Mb})]}),(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Every event carries a random ID of its own and this machine's random ID, and nothing else. Nothing you write, upload, or paste ever leaves your machine.`}),a===void 0?null:(0,h.jsx)(`p`,{className:`engraved text-ink3`,children:`Slopify ${a} · this version is included in each report`}),(0,h.jsx)(V,{autoFocus:!0,variant:`play`,size:`play`,disabled:r.isPending,onClick:()=>{r.mutate()},children:`Got it`}),r.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:r.error.message})]})})}function Pb({heading:e,items:t}){let n=`notice-${e.replace(/\s+/g,`-`).toLowerCase()}`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-[6px]`,children:[(0,h.jsx)(`p`,{id:n,className:`engraved border-b border-line pb-1 text-ink3`,children:e}),(0,h.jsx)(`ul`,{"aria-labelledby":n,className:`m-0 flex list-none flex-col gap-[6px] p-0 text-small`,children:t.map(e=>(0,h.jsx)(`li`,{children:e},e))})]})}function Fb(e,t){if(t===`system`){e.removeAttribute(`data-theme`);return}e.setAttribute(`data-theme`,t)}function Ib(){let{api:e}=B(),t=I(Ab(e)).data?.appearance??`system`;return(0,m.useEffect)(()=>{Fb(document.documentElement,t)},[t]),null}function Lb({reload:e}){let{version:t}=B(),n=(0,m.useSyncExternalStore)(t.subscribe,t.staleAt,t.staleAt);return(0,h.jsx)(hb,{open:n!==void 0,children:(0,h.jsxs)(vb,{onEscapeKeyDown:e=>{e.preventDefault()},onInteractOutside:e=>{e.preventDefault()},children:[(0,h.jsx)(yb,{children:`Slopify was updated`}),(0,h.jsx)(bb,{children:`This tab was loaded before the update. Version ${n??``} is running now; reload to catch up.`}),(0,h.jsx)(V,{autoFocus:!0,variant:`play`,size:`play`,onClick:e,children:`Reload`})]})})}var Rb=[`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`project.state`,`project.updated`],zb=[`running.count`,`staging.progress`,`staging.failed`,`project.updated`,`project.state`];function Bb(e,t,n){return Hb(e,t,Rb,n.refetch,e=>{if(n.accept?.(e)!==!1){if(e.type===`llm.preview`){n.previewWriting?.(e);return}if(e.type===`article.delta`){n.appendArticle(e.text);return}if(e.type===`image.landed`||e.type===`project.updated`){n.refetch();return}n.patch(e),e.type===`stage.state`&&n.refetch()}})}function Vb(e,t,n){return Hb(e,t,zb,n.refetch,e=>{if(e.type===`running.count`){n.tally(e.count);return}if(e.type===`project.updated`||e.type===`project.state`){e.type===`project.state`&&n.projectState?.(e),n.refetch(e.projectId);return}n.stagingChanged()})}function Hb(e,t,n,r,i){let a=e(t),o=!1;a.addEventListener(`open`,()=>{o&&r(),o=!0});for(let e of n)a.addEventListener(e,t=>{let n=Ub(t.data);n.type===e&&i(n)});return()=>{a.close()}}function Ub(e){return JSON.parse(e)}var Wb=[`16:9`,`9:16`],Gb=[`research`,`article`,`audio`,`images`,`thumbnail`,`video`,`document`],Kb=[`generate`,`provide`,`off`,`from_prompt`,`prompt_by_llm`];function qb(e,t){return e[t]??`off`}var Jb=[`zoom`,`pan`,`mixed`,`still`],Yb=[`text`,`llm`],Xb=[`prompt`,`provide`],Zb=[`plain`],Qb=`dicemaster`,$b=[...Zb,Qb],ex={plain:`Plain`,dicemaster:`DiceMaster`};function tx(e){return e?.theme??`dicemaster`}function nx(e){return e?.theme??`plain`}function rx(e){return e?.custom?.name??ex[tx(e)]}function ix(e){let t=e.trim();return t===``?[{field:`name`,message:`Give the theme a name.`}]:t.length>80?[{field:`name`,message:`Keep the name under 80 characters.`}]:[]}function ax(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 ox(e,t=`|`){return e.map(e=>Tx(e)).join(t)}function sx(e,t){return typeof t==`bigint`?t.toString():t}function cx(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function lx(e){return e==null}function ux(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function dx(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function fx(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function px(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function mx(e){return JSON.stringify(e)}function hx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var gx=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function _x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var vx=cx(()=>{if(uS.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function yx(e){if(_x(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return _x(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function bx(e){return yx(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var xx=new Set([`string`,`number`,`symbol`]);function Sx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Cx(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function wx(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 Tx(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ex(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Dx={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ox(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Cx(e,px(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&fx(e,r,n.shape[r])}return fx(this,`shape`,e),e},checks:[]}))}function kx(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Cx(e,px(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return fx(this,`shape`,r),r},checks:[]}))}function Ax(e,t){if(!yx(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e 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 Cx(e,px(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return fx(this,`shape`,n),n}}))}function jx(e,t){if(!yx(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Cx(e,px(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return fx(this,`shape`,n),n}}))}function Mx(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.`);return Cx(e,px(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return fx(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Nx(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`);return Cx(t,px(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return fx(this,`shape`,i),i},checks:[]}))}function Px(e,t,n){return Cx(t,px(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return fx(this,`shape`,i),i}}))}function Fx(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 Ix(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 Lx(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Rx(e){return typeof e==`string`?e:e?.message}function zx(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Bx(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:Rx(e.inst?._zod.def?.error?.(e))??Rx(a?.(e))??Rx(t?.error?.(e))??Rx(n.customError?.(e))??Rx(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var Vx=/[\uD800-\uDBFF]/;function Hx(e){let t=e.length;if(!Vx.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 Ux(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Wx(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 Gx(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Kx(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Yx(e,n,r.value)}}function qx(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Jx(e,t,n){return qx(e,t,n,!1)}function Yx(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qx(this,t,n.bind(this))},set(e){qx(this,t,e)}})}function Xx(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Zx,Qx=!1,$x={configurable:!0,get(){Qx=!0}};function eS(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Zx!==e._zod){Zx=void 0;return}Zx=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,$x);let e=Qx;Qx=!1;try{let r=n(this);return Qx?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Qx||=e,r}catch(n){throw delete this[t],Qx||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function tS(e,t,n,r){let i=Xx(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 nS=`~constantCatch`;function rS(e){let t=()=>e;return t[nS]=!0,t}var iS,aS={value:void 0,enumerable:!1},oS=`captureStackTrace`in Error?Error:null;function sS(e){let t=oS;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return oS=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function U(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){aS.value=new a(r);try{Object.defineProperty(n,"_zod",aS)}finally{aS.value=void 0}}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),Kx(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?sS(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 cS=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},lS=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(iS=globalThis).__zod_globalConfig??(iS.__zod_globalConfig={});var uS=globalThis.__zod_globalConfig;function dS(e){return e&&Object.assign(uS,e),uS}function fS(){let e=this._zod;return e.message??=JSON.stringify(e.def,sx,2),e.message}function pS(e){this._zod.message=e}var mS={get:fS,set:pS,enumerable:!0,configurable:!0},hS={value:void 0,enumerable:!1},gS={value:void 0,enumerable:!1},_S=new WeakSet([Object.prototype,Error.prototype]),vS=(e,t)=>{e.name=`$ZodError`,hS.value=e._zod,Object.defineProperty(e,"_zod",hS),gS.value=t,Object.defineProperty(e,"issues",gS),hS.value=void 0,gS.value=void 0,Object.defineProperty(e,"message",mS);let n=Object.getPrototypeOf(e);_S.has(n)||(_S.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})}}))},yS=U(`$ZodError`,vS),bS=U(`$ZodError`,vS,void 0,{Parent:Error});function xS(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 SS(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?xS(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function CS(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 wS(e,t){return{callee:t?.callee??e,Err:t?.Err}}var TS=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 cS;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Bx(e,o,dS())));throw gx(n,a?.callee??t),n}return s.value};return t},ES=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=>Bx(e,o,dS())));throw gx(n,a?.callee??t),n}return s.value};return t},DS=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 cS;return a.issues.length?{success:!1,error:new(e??yS)(a.issues.map(e=>Bx(e,i,dS())))}:{success:!0,data:a.value}},OS=DS(bS),kS=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?{success:!1,error:new e(a.issues.map(e=>Bx(e,i,dS())))}:{success:!0,data:a.value}},AS=kS(bS),jS=e=>{let t=TS(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,wS(n,a))};return n},MS=e=>{let t=TS(e),n=(e,r,i,a)=>t(e,r,i,wS(n,a));return n},NS=e=>{let t=ES(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,wS(n,a))};return n},PS=e=>{let t=ES(e),n=async(e,r,i,a)=>await t(e,r,i,wS(n,a));return n},FS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return DS(e)(t,n,i)},IS=e=>(t,n,r)=>DS(e)(t,n,r),LS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kS(e)(t,n,i)},RS=e=>async(t,n,r)=>kS(e)(t,n,r),zS=/^[cC][0-9a-z]{6,}$/,BS=/^[0-9a-z]+$/,VS=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,HS=/^[0-9a-vA-V]{20}$/,US=/^[A-Za-z0-9]{27}$/,WS=/^[a-zA-Z0-9_-]{21}$/;function GS(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var KS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qS=/^([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})$/,JS=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)$/,YS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,XS=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function ZS(){return new RegExp(XS,`u`)}var QS=/^(?:(?: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])$/,$S=/^(([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}|:))$/,eC=/^((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])$/,tC=/^(([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])$/,nC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rC=/^[A-Za-z0-9_-]*$/,iC=/^https?$/,aC=/^\+[1-9]\d{6,14}$/,oC=`(?:(?:\\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 sC(e){return RegExp(`^${e}$`)}var cC=sC(oC);function lC(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 uC(e){return RegExp(`^${lC(e)}$`)}function dC(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${lC({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${lC({precision:e.precision})}`:n;return RegExp(`^${oC}T(?:${r})$`)}var fC=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},pC=/^-?\d+$/,mC=/^-?\d+(?:\.\d+)?$/,hC=/^(?:true|false)$/i,gC=/^null$/i,_C=/^[^A-Z]*$/,vC=/^[^a-z]*$/,yC=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bC=e=>{let t=e.value;return!lx(t)&&t.length!==void 0},xC={number:`number`,bigint:`bigint`,object:`date`},SC=U(`$ZodCheckLessThan`,(e,t)=>{yC.init(e,t);let n=xC[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:xC[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})}}),CC=U(`$ZodCheckGreaterThan`,(e,t)=>{yC.init(e,t);let n=xC[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:xC[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})}}),wC=U(`$ZodCheckMultipleOf`,(e,t)=>{yC.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):dx(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})}}),TC=U(`$ZodCheckNumberFormat`,(e,t)=>{yC.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Dx[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=pC)}),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})}}),EC=U(`$ZodCheckMaxLength`,(e,t)=>{var n;yC.init(e,t),(n=e._zod.def).when??(n.when=bC),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Hx(r):i)<=t.maximum)return;let a=Ux(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),DC=U(`$ZodCheckMinLength`,(e,t)=>{var n;yC.init(e,t),(n=e._zod.def).when??(n.when=bC),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Hx(r):i)>=t.minimum)return;let a=Ux(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),OC=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;yC.init(e,t),(n=e._zod.def).when??(n.when=bC),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Hx(r):i;if(a===t.length)return;let o=Ux(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})}}),kC=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;yC.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),AC=U(`$ZodCheckRegex`,(e,t)=>{kC.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})}}),jC=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=_C,kC.init(e,t)}),MC=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=vC,kC.init(e,t)}),NC=U(`$ZodCheckIncludes`,(e,t)=>{yC.init(e,t);let n=Sx(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),PC=U(`$ZodCheckStartsWith`,(e,t)=>{yC.init(e,t);let n=RegExp(`^${Sx(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),FC=U(`$ZodCheckEndsWith`,(e,t)=>{yC.init(e,t);let n=RegExp(`.*${Sx(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),IC=U(`$ZodCheckOverwrite`,(e,t)=>{yC.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),LC=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
50
|
+
`).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(`
|
|
51
|
+
`)}\n};`)(...Object.values(this.closed))}},RC={major:4,minor:5,patch:4},zC=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=RC;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=Fx(t),a;for(let o of n){if(o._zod.def.when){if(Ix(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 cS;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(zx(t.issues,n,e),i||=Fx(t,n))});else{if(t.issues.length===n)continue;zx(t.issues,n,e),i||=Fx(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Fx(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new cS;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 cS;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Jx(this,`~standard`,VC(this))},set"~standard"(e){qx(this,`~standard`,e)}}),BC=e=>e.success?{value:e.data}:{issues:e.error?.issues};function VC(e){return{validate:t=>{try{return BC(OS(e,t))}catch{return AS(e,t).then(BC)}},vendor:`zod`,version:1}}var HC=U(`$ZodString`,(e,t)=>{zC.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fC(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),UC=U(`$ZodStringFormat`,(e,t)=>{kC.init(e,t),HC.init(e,t)}),WC=U(`$ZodGUID`,(e,t)=>{t.pattern??=qS,UC.init(e,t)}),GC=U(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=JS(e)}else t.pattern??=JS();UC.init(e,t)}),KC=U(`$ZodEmail`,(e,t)=>{t.pattern??=YS,UC.init(e,t)});function qC(e,t){if(!t.normalize&&t.protocol?.source===iC.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var JC=/[\t\n\r]/g;function YC(e){return e.replace(JC,``)}function XC(e,t){return t.lastIndex=0,t.test(e.hostname)}function ZC(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var QC=U(`$ZodURL`,(e,t)=>{UC.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=qC(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}t.hostname&&!XC(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&&!ZC(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:YC(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),$C=U(`$ZodEmoji`,(e,t)=>{t.pattern??=ZS(),UC.init(e,t)}),ew=U(`$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?WS:GS(t.length),UC.init(e,t)}),tw=U(`$ZodCUID`,(e,t)=>{t.pattern??=zS,UC.init(e,t)}),nw=U(`$ZodCUID2`,(e,t)=>{t.pattern??=BS,UC.init(e,t)}),rw=U(`$ZodULID`,(e,t)=>{t.pattern??=VS,UC.init(e,t)}),iw=U(`$ZodXID`,(e,t)=>{t.pattern??=HS,UC.init(e,t)}),aw=U(`$ZodKSUID`,(e,t)=>{t.pattern??=US,UC.init(e,t)}),ow=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=dC(t),UC.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),sw=U(`$ZodISODate`,(e,t)=>{t.pattern??=cC,UC.init(e,t)}),cw=U(`$ZodISOTime`,(e,t)=>{t.pattern??=uC(t),UC.init(e,t)}),lw=U(`$ZodISODuration`,(e,t)=>{t.pattern??=KS,UC.init(e,t)}),uw=U(`$ZodIPv4`,(e,t)=>{t.pattern??=QS,UC.init(e,t),e._zod.bag.format=`ipv4`}),dw=/^[0-9a-fA-F:.]+$/;function fw(e){if(!dw.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var pw=U(`$ZodIPv6`,(e,t)=>{t.pattern??=$S,UC.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{fw(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),mw=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=eC,UC.init(e,t)});function hw(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:fw(n)}var gw=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tC,UC.init(e,t),e._zod.check=n=>{hw(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function _w(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var vw=U(`$ZodBase64`,(e,t)=>{t.pattern??=nC,UC.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{_w(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function yw(e){if(!rC.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return _w(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var bw=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=rC,UC.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{yw(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),xw=U(`$ZodE164`,(e,t)=>{t.pattern??=aC,UC.init(e,t)});function Sw(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 Cw=U(`$ZodJWT`,(e,t)=>{UC.init(e,t),e._zod.check=n=>{Sw(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ww=U(`$ZodNumber`,(e,t)=>{zC.init(e,t),e._zod.pattern=e._zod.bag.pattern??mC,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}}),Tw=U(`$ZodNumberFormat`,(e,t)=>{TC.init(e,t),ww.init(e,t)}),Ew=U(`$ZodBoolean`,(e,t)=>{zC.init(e,t),e._zod.pattern=hC,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}}),Dw=U(`$ZodNull`,(e,t)=>{zC.init(e,t),e._zod.pattern=gC,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ow=U(`$ZodUnknown`,(e,t)=>{zC.init(e,t),e._zod.parse=e=>e}),kw=U(`$ZodNever`,(e,t)=>{zC.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Aw(e,t,n){e.issues.length&&t.issues.push(...Lx(n,e.issues)),t.value[n]=e.value}var jw=U(`$ZodArray`,(e,t)=>{zC.init(e,t);let n=uS.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=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>Aw(t,r,e))):Aw(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Mw(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(...Lx(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var Nw=[];function Pw(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Nw,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=Ex(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Fw(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Mw(e,n,i,t,u,d))):Mw(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Iw=new WeakMap,Lw=U(`$ZodObject`,(e,t)=>{if(zC.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Iw.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),Iw.set(t,n),n}})}let n=cx(()=>Pw(t));eS(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)||fx(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 r=_x,i=t.catchall,a,o=uS.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>Mw(n,t,e,c,r,i))):Mw(a,t,e,c,r,i)}return i?Fw(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Rw=U(`$ZodObjectJIT`,(e,t)=>{Lw.init(e,t);let n=e._zod.parse,r=cx(()=>Pw(t)),i=uS.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new LC([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
52
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
53
|
+
const iss = ${e}.issues[i];
|
|
54
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
55
|
+
payload.issues.push(iss);
|
|
56
|
+
}`;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)}]`:mx(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(`
|
|
57
|
+
const ${n}_present = ${i};
|
|
58
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
59
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (${e}) {
|
|
63
|
+
newResult[${r}] = ${n}.value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
`)}else f?o.write(`
|
|
68
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (${n}.value === undefined) {
|
|
72
|
+
if (${i}) {
|
|
73
|
+
newResult[${r}] = undefined;
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
newResult[${r}] = ${n}.value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
`):o.write(`
|
|
80
|
+
const ${n}_present = ${i};
|
|
81
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
82
|
+
}
|
|
83
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
84
|
+
payload.issues.push({
|
|
85
|
+
code: "invalid_type",
|
|
86
|
+
expected: "nonoptional",
|
|
87
|
+
input: undefined,
|
|
88
|
+
path: [${r}]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (${n}_present) {
|
|
93
|
+
newResult[${r}] = ${n}.value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=_x,c=!uS.jitless,l=c&&vx.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?Fw([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function zw(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=>!Fx(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=>Bx(e,r,dS())))}),t)}var Bw=U(`$ZodUnion`,(e,t)=>{zC.init(e,t),eS(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),eS(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),eS(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)))}),eS(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=>ux(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=>zw(t,r,e,i)):zw(o,r,e,i)}}),Vw=U(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Bw.init(e,t);let n=e._zod.parse;eS(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||fx(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=Iw.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=cx(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!_x(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._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()),input:o,path:[t.discriminator],inst:e}),i)}}),Hw=U(`$ZodIntersection`,(e,t)=>{zC.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])=>Ww(e,t,n)):Ww(e,i,a)}});function Uw(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yx(e)&&yx(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=Uw(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=Uw(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 Ww(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=Uw(t.value,n.value);if(!c.valid){if(Fx(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Gw=U(`$ZodTuple`,(e,t)=>{zC.init(e,t);let n=t.items,r=uS.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Kw(n,`optin`),l=Kw(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=n.length-1,r=o.slice(n.length);for(let n of r){e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>qw(t,i,e))):qw(r,i,e)}}return s.length?Promise.all(s).then(()=>Jw(u,i,n,o,l)):Jw(u,i,n,o,l)}});function Kw(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function qw(e,t,n){e.issues.length&&t.issues.push(...Lx(n,e.issues)),t.value[n]=e.value}function Jw(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Lx(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Yw=U(`$ZodRecord`,(e,t)=>{zC.init(e,t);let n=uS.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!yx(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=>Bx(e,i,dS())),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(...Lx(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Lx(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`&&mC.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=>Bx(e,i,dS())),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(...Lx(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Lx(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}}),Xw=U(`$ZodEnum`,(e,t)=>{zC.init(e,t);let n=ax(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>xx.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>Sx(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}}),Zw=U(`$ZodLiteral`,(e,t)=>{zC.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?Sx(e):e?Sx(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}}),Qw=U(`$ZodTransform`,(e,t)=>{zC.init(e,t),e._zod.optin=`optional`,uS.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new lS(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 cS;return n.value=i,n}});function $w(e,t){return e.value=t.issues.length?void 0:t.value,e}var eT=U(`$ZodOptional`,(e,t)=>{zC.init(e,t),eS(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,eS(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),eS(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ux(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=>$w(e,t)):$w(e,r)}return t.innerType._zod.run(e,n)}}),tT=U(`$ZodExactOptional`,(e,t)=>{eT.init(e,t),eS(e,`values`,e=>e.def.innerType._zod.values),eS(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),nT=U(`$ZodNullable`,(e,t)=>{zC.init(e,t),eS(e,`optin`,e=>e.def.innerType._zod.optin),eS(e,`optout`,e=>e.def.innerType._zod.optout),eS(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ux(t.source)}|null)$`):void 0}),eS(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)}),rT=U(`$ZodDefault`,(e,t)=>{zC.init(e,t),e._zod.optin=`defaulted`,eS(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=>iT(e,t)):iT(r,t)}});function iT(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var aT=U(`$ZodPrefault`,(e,t)=>{zC.init(e,t),e._zod.optin=`defaulted`,eS(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))}),oT=U(`$ZodNonOptional`,(e,t)=>{zC.init(e,t),eS(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=>sT(t,e)):sT(i,e)}});function sT(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 cT(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Bx(e,r,dS()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var lT=U(`$ZodCatch`,(e,t)=>{zC.init(e,t),eS(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),eS(e,`optout`,e=>e.def.innerType._zod.optout),eS(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=>cT(e,r,t,n)):cT(e,r,t,n)}}),uT=U(`$ZodPipe`,(e,t)=>{zC.init(e,t),eS(e,`values`,e=>e.def.in._zod.values),eS(e,`optin`,e=>e.def.in._zod.optin),eS(e,`optout`,e=>e.def.out._zod.optout),eS(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=>dT(e,t.in,n)):dT(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dT(e,t.out,n)):dT(r,t.out,n)}});function dT(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 fT=U(`$ZodReadonly`,(e,t)=>{zC.init(e,t),eS(e,`propValues`,e=>e.def.innerType._zod.propValues),eS(e,`values`,e=>e.def.innerType._zod.values),eS(e,`optin`,e=>e.def.innerType?._zod?.optin),eS(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(pT):pT(r)}});function pT(e){return e.memo||(e.value=Object.freeze(e.value)),e}var mT=U(`$ZodCustom`,(e,t)=>{yC.init(e,t),zC.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=>hT(t,n,r,e));hT(i,n,r,e)}});function hT(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(Gx(e))}}var gT=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},_T=`~memo`,vT=[];function yT(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var bT=new WeakMap;function xT(e,t){let n=bT.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&xT(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);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 a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),bT.set(e,r),r}function ST(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}var CT,wT=[],TT={alloc(e,t,n){let r=CT;if(!r)return n;CT=void 0;let i={value:n,issues:null};return r.set(t.value,i),wT.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`&&DT(n,e.value))throw new gT;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=xT(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[_T];l||(l={buckets:new Map,backEdges:void 0},s[_T]=l);let u;r===s?u=i:(u=ST(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...yT(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;CT=u;let f=wT.length,p=t(o,s);CT=void 0;let m=wT.length>f?wT.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?yT(e.issues):vT),e)):(m&&(m.issues=p.issues.length?yT(p.issues):vT),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function ET(){return TT}function DT(e,t){let n=e[_T]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}var OT=()=>{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`,credit_card:`credit card number`,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(Wx(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Tx(e.values[0])}`:`Invalid option: expected one of ${ox(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`:``}: ${ox(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 kT(){return{localeError:OT()}}var AT,jT=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 MT(){return new jT}(AT=globalThis).__zod_globalRegistry??(AT.__zod_globalRegistry=MT());var NT=globalThis.__zod_globalRegistry;function PT(e,t){return new e({type:`string`,...wx(t)})}function FT(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...wx(t)})}function IT(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...wx(t)})}function LT(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...wx(t)})}function RT(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...wx(t)})}function zT(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...wx(t)})}function BT(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...wx(t)})}function VT(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...wx(t)})}function HT(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...wx(t)})}function UT(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...wx(t)})}function WT(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...wx(t)})}function GT(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...wx(t)})}function KT(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...wx(t)})}function qT(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...wx(t)})}function JT(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...wx(t)})}function YT(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...wx(t)})}function XT(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...wx(t)})}function ZT(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...wx(t)})}function QT(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...wx(t)})}function $T(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...wx(t)})}function eE(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...wx(t)})}function tE(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...wx(t)})}function nE(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...wx(t)})}function rE(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...wx(t)})}function iE(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...wx(t)})}function aE(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...wx(t)})}function oE(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...wx(t)})}function sE(e,t){return new e({type:`number`,checks:[],...wx(t)})}function cE(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...wx(t)})}function lE(e,t){return new e({type:`boolean`,...wx(t)})}function uE(e,t){return new e({type:`null`,...wx(t)})}function dE(e){return new e({type:`unknown`})}function fE(e,t){return new e({type:`never`,...wx(t)})}function pE(e,t){return new SC({check:`less_than`,...wx(t),value:e,inclusive:!1})}function mE(e,t){return new SC({check:`less_than`,...wx(t),value:e,inclusive:!0})}function hE(e,t){return new CC({check:`greater_than`,...wx(t),value:e,inclusive:!1})}function gE(e,t){return new CC({check:`greater_than`,...wx(t),value:e,inclusive:!0})}function _E(e,t){return new wC({check:`multiple_of`,...wx(t),value:e})}function vE(e,t){return new EC({check:`max_length`,...wx(t),maximum:e})}function yE(e,t){return new DC({check:`min_length`,...wx(t),minimum:e})}function bE(e,t){return new OC({check:`length_equals`,...wx(t),length:e})}function xE(e,t){return new AC({check:`string_format`,format:`regex`,...wx(t),pattern:e})}function SE(e){return new jC({check:`string_format`,format:`lowercase`,...wx(e)})}function CE(e){return new MC({check:`string_format`,format:`uppercase`,...wx(e)})}function wE(e,t){return new NC({check:`string_format`,format:`includes`,...wx(t),includes:e})}function TE(e,t){return new PC({check:`string_format`,format:`starts_with`,...wx(t),prefix:e})}function EE(e,t){return new FC({check:`string_format`,format:`ends_with`,...wx(t),suffix:e})}function DE(e){return new IC({check:`overwrite`,tx:e})}function OE(e){return DE(t=>t.normalize(e))}function kE(){return DE(e=>e.trim())}function AE(){return DE(e=>e.toLowerCase())}function jE(){return DE(e=>e.toUpperCase())}function ME(){return DE(e=>hx(e))}function NE(e,t,n){return new e({type:`array`,element:t,...wx(n)})}function PE(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...wx(n)})}function FE(e,t){let n=IE(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Gx(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(Gx(r))}},e(t.value,t)),t);return n}function IE(e,t){let n=new yC({check:`custom`,...wx(t)});return n._zod.check=e,n}function LE(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&fx(e,t,n[t]);return e}function RE(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??NT,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 zE(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 BE(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,BE(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&LE(o.schema,c),t.io===`input`&&XE(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 VE(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function HE(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}/${VE(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+VE(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>
|
|
97
|
+
|
|
98
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function UE(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;UE(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 WE=new Set([`type`,`properties`,`required`,`additionalProperties`]),GE=[`oneOf`,`anyOf`];function KE(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function qE(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!WE.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]??KE(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}fx(n,r,e.length===1?e[0]:qE(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=KE(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 JE(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of WE)if(t in e)return;let n=t.filter(e=>GE.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=qE(t);else{let e=n[0],i=GE.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=>qE([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,LE(e,r))}function YE(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)):LE(i,s),LE(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())UE(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)??[])JE(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)}LE(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,fx(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:QE(t,`input`,e.processors),output:QE(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function XE(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 XE(r.element,n);if(r.type===`set`)return XE(r.valueType,n);if(r.type===`lazy`)return XE(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 XE(r.innerType,n);if(r.type===`intersection`)return XE(r.left,n)||XE(r.right,n);if(r.type===`record`||r.type===`map`)return XE(r.keyType,n)||XE(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:XE(r.in,n)||XE(r.out,n);if(r.type===`object`){for(let e in r.shape)if(XE(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(XE(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(XE(e,n))return!0;return!!(r.rest&&XE(r.rest,n))}return!1}var ZE=(e,t={})=>n=>{let r=RE({...n,processors:t});return BE(e,r),HE(r,e),YE(r,e)},QE=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=RE({...i??{},target:a,io:t,processors:n});return BE(e,o),HE(o,e),YE(o,e)},$E={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},eD=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=$E[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},tD=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):zE(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},nD=(e,t,n,r)=>{n.type=`boolean`},rD=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},iD=(e,t,n,r)=>{n.not={}},aD=(e,t,n,r)=>{let i=e._zod.def,a=ax(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},oD=(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(zE(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(zE(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}},sD=(e,t,n,r)=>{zE(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},cD=(e,t,n,r)=>{zE(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},lD=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=BE(a.element,t,{...r,path:[...r.path,`items`]})};function uD(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?uD(t.out):t.type===`catch`?uD(t.innerType):e._zod.optin}var dD=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&zE(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)fx(i.properties,e,BE(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?uD(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=BE(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},fD=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>BE(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},pD=(e,t,n,r)=>{let i=e._zod.def,a=BE(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=BE(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)},mD=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>BE(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?BE(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?uD(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function hD(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=hD(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=>hD(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`)?mC:pC).source),p):p}var gD=new WeakMap;function _D(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 gD.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=hD(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 vD=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=BE(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)fx(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=BE(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=gD.get(t);n||(n=[],gD.set(t,n),t.deferred.push(()=>_D(t))),n.push(e)}i.additionalProperties=BE(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&uD(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))}},yD=(e,t,n,r)=>{let i=e._zod.def,a=BE(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`}]},bD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xD=Symbol();function SD(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(zE(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),xD):JSON.parse(o)}var CD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=SD(i.defaultValue,e,t,n,r);o!==xD&&(n.default=o)},wD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=SD(i.defaultValue,e,t,n,r);o!==xD&&(n._prefault=o)},TD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{zE(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ED=(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;BE(o,t,r);let s=t.seen.get(e);s.ref=o},DD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},OD=(e,t,n,r)=>{let i=e._zod.def;BE(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},kD=new WeakSet([Object.prototype,Error.prototype]);function AD(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 jD=U(`ZodError`,(e,t)=>{yS.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);kD.has(n)||(kD.add(n),AD(n,`format`,e=>t=>CS(e,t)),AD(n,`flatten`,e=>t=>SS(e,t)),AD(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,sx,2)}),AD(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,sx,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),MD=TS(jD),ND=ES(jD),PD=DS(jD),FD=kS(jD),ID=jS(jD),LD=MS(jD),RD=NS(jD),zD=PS(jD),BD=FS(jD),VD=IS(jD),HD=LS(jD),UD=RS(jD);function WD(){uS.localeError||dS(kT())}function GD(){uS.memoizer||dS({memoizer:ET()})}var KD=U(`ZodType`,(e,t)=>(WD(),zC.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(px(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 Cx(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(pk(e,t))},superRefine(e,t){return this.check(mk(e,t))},overwrite(e){return this.check(DE(e))},optional(){return YO(this)},exactOptional(){return ZO(this)},nullable(){return $O(this)},nullish(){return YO($O(this))},nonoptional(e){return ak(this,e)},array(){return K(this)},or(e){return PO([this,e])},and(e){return RO(this,e)},transform(e){return lk(this,qO(e))},default(e){return tk(this,e)},prefault(e){return rk(this,e)},catch(e){return sk(this,e)},pipe(e){return lk(this,e)},readonly(){return dk(this)},describe(e){let t=this.clone();return NT.add(t,{description:e}),t},meta(...e){if(e.length===0)return NT.get(this);let t=this.clone();return NT.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 Jx(this,`~standard`,{...VC(this),jsonSchema:{input:QE(this,`input`),output:QE(this,`output`)}})},set"~standard"(e){qx(this,`~standard`,e)},parse:function e(t,n){return MD(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ND(this,t,n,{callee:e})},safeParse(e,t){return PD(this,e,t)},async safeParseAsync(e,t){return FD(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){qx(this,`spa`,e)},encode:function e(t,n){return ID(this,t,n,{callee:e})},decode:function e(t,n){return LD(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await RD(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await zD(this,t,n,{callee:e})},safeEncode(e,t){return BD(this,e,t)},safeDecode(e,t){return VD(this,e,t)},async safeEncodeAsync(e,t){return HD(this,e,t)},async safeDecodeAsync(e,t){return UD(this,e,t)},toJSONSchema(e){return ZE(this,{})(e)},get description(){return NT.get(this)?.description},get _def(){return this._zod.def}}),qD=U(`_ZodString`,(e,t)=>{HC.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eD(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(xE(...e))},includes(...e){return this.check(wE(...e))},startsWith(...e){return this.check(TE(...e))},endsWith(...e){return this.check(EE(...e))},min(...e){return this.check(yE(...e))},max(...e){return this.check(vE(...e))},length(...e){return this.check(bE(...e))},nonempty(...e){return this.check(yE(1,...e))},lowercase(e){return this.check(SE(e))},uppercase(e){return this.check(CE(e))},trim(){return this.check(kE())},normalize(...e){return this.check(OE(...e))},toLowerCase(){return this.check(AE())},toUpperCase(){return this.check(jE())},slugify(){return this.check(ME())}}),JD=U(`ZodString`,(e,t)=>{HC.init(e,t),qD.init(e,t)},{email(e){return this.check(FT(eO,e))},url(e){return this.check(VT(iO,e))},jwt(e){return this.check(nE(yO,e))},emoji(e){return this.check(HT(aO,e))},guid(e){return this.check(IT(tO,e))},uuid(e){return this.check(LT(nO,e))},uuidv4(e){return this.check(RT(nO,e))},uuidv6(e){return this.check(zT(nO,e))},uuidv7(e){return this.check(BT(nO,e))},nanoid(e){return this.check(UT(oO,e))},cuid(e){return this.check(WT(sO,e))},cuid2(e){return this.check(GT(cO,e))},ulid(e){return this.check(KT(lO,e))},base64(e){return this.check($T(gO,e))},base64url(e){return this.check(eE(_O,e))},xid(e){return this.check(qT(uO,e))},ksuid(e){return this.check(JT(dO,e))},ipv4(e){return this.check(YT(fO,e))},ipv6(e){return this.check(XT(pO,e))},cidrv4(e){return this.check(ZT(mO,e))},cidrv6(e){return this.check(QT(hO,e))},e164(e){return this.check(tE(vO,e))},datetime(e){return this.check(rE(XD,e))},date(e){return this.check(iE(ZD,e))},time(e){return this.check(aE(QD,e))},duration(e){return this.check(oE($D,e))}});function W(e){return PT(JD,e)}var YD=U(`ZodStringFormat`,(e,t)=>{UC.init(e,t),qD.init(e,t)}),XD=U(`ZodISODateTime`,(e,t)=>{ow.init(e,t),YD.init(e,t)}),ZD=U(`ZodISODate`,(e,t)=>{sw.init(e,t),YD.init(e,t)}),QD=U(`ZodISOTime`,(e,t)=>{cw.init(e,t),YD.init(e,t)}),$D=U(`ZodISODuration`,(e,t)=>{lw.init(e,t),YD.init(e,t)}),eO=U(`ZodEmail`,(e,t)=>{KC.init(e,t),YD.init(e,t)}),tO=U(`ZodGUID`,(e,t)=>{WC.init(e,t),YD.init(e,t)}),nO=U(`ZodUUID`,(e,t)=>{GC.init(e,t),YD.init(e,t)});function rO(e){return LT(nO,e)}var iO=U(`ZodURL`,(e,t)=>{QC.init(e,t),YD.init(e,t)}),aO=U(`ZodEmoji`,(e,t)=>{$C.init(e,t),YD.init(e,t)}),oO=U(`ZodNanoID`,(e,t)=>{ew.init(e,t),YD.init(e,t)}),sO=U(`ZodCUID`,(e,t)=>{tw.init(e,t),YD.init(e,t)}),cO=U(`ZodCUID2`,(e,t)=>{nw.init(e,t),YD.init(e,t)}),lO=U(`ZodULID`,(e,t)=>{rw.init(e,t),YD.init(e,t)}),uO=U(`ZodXID`,(e,t)=>{iw.init(e,t),YD.init(e,t)}),dO=U(`ZodKSUID`,(e,t)=>{aw.init(e,t),YD.init(e,t)}),fO=U(`ZodIPv4`,(e,t)=>{uw.init(e,t),YD.init(e,t)}),pO=U(`ZodIPv6`,(e,t)=>{pw.init(e,t),YD.init(e,t)}),mO=U(`ZodCIDRv4`,(e,t)=>{mw.init(e,t),YD.init(e,t)}),hO=U(`ZodCIDRv6`,(e,t)=>{gw.init(e,t),YD.init(e,t)}),gO=U(`ZodBase64`,(e,t)=>{vw.init(e,t),YD.init(e,t)}),_O=U(`ZodBase64URL`,(e,t)=>{bw.init(e,t),YD.init(e,t)}),vO=U(`ZodE164`,(e,t)=>{xw.init(e,t),YD.init(e,t)}),yO=U(`ZodJWT`,(e,t)=>{Cw.init(e,t),YD.init(e,t)}),bO=U(`ZodNumber`,(e,t)=>{ww.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tD(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(hE(e,t))},gte(e,t){return this.check(gE(e,t))},min(e,t){return this.check(gE(e,t))},lt(e,t){return this.check(pE(e,t))},lte(e,t){return this.check(mE(e,t))},max(e,t){return this.check(mE(e,t))},int(e){return this.check(SO(e))},safe(e){return this.check(SO(e))},positive(e){return this.check(hE(0,e))},nonnegative(e){return this.check(gE(0,e))},negative(e){return this.check(pE(0,e))},nonpositive(e){return this.check(mE(0,e))},multipleOf(e,t){return this.check(_E(e,t))},step(e,t){return this.check(_E(e,t))},finite(){return this}});function G(e){return sE(bO,e)}var xO=U(`ZodNumberFormat`,(e,t)=>{Tw.init(e,t),bO.init(e,t)});function SO(e){return cE(xO,e)}var CO=U(`ZodBoolean`,(e,t)=>{Ew.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nD(e,t,n,r)});function wO(e){return lE(CO,e)}var TO=U(`ZodNull`,(e,t)=>{Dw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rD(e,t,n,r)});function EO(e){return uE(TO,e)}var DO=U(`ZodUnknown`,(e,t)=>{Ow.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function OO(){return dE(DO)}var kO=U(`ZodNever`,(e,t)=>{kw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iD(e,t,n,r)});function AO(e){return fE(kO,e)}var jO=U(`ZodArray`,(e,t)=>{GD(),jw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lD(e,t,n,r),e.element=t.element},{min(e,t){return this.check(yE(e,t))},nonempty(e){return this.check(yE(1,e))},max(e,t){return this.check(vE(e,t))},length(e,t){return this.check(bE(e,t))},unwrap(){return this.element}});function K(e,t){return NE(jO,e,t)}var MO=U(`ZodObject`,(e,t)=>{GD(),Rw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dD(e,t,n,r),tS(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return J(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:OO()})},loose(){return this.clone({...this._zod.def,catchall:OO()})},strict(){return this.clone({...this._zod.def,catchall:AO()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Ax(this,e)},safeExtend(e){return jx(this,e)},merge(e){return Mx(this,e)},pick(e){return Ox(this,e)},omit(e){return kx(this,e)},partial(...e){return Nx(JO,this,e[0])},exactPartial(...e){return Nx(XO,this,e[0],`exactPartial`)},required(...e){return Px(ik,this,e[0])}});function q(e,t){return new MO({type:`object`,shape:e??{},...wx(t)})}var NO=U(`ZodUnion`,(e,t)=>{Bw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fD(e,t,n,r),e.options=t.options});function PO(e,t){return new NO({type:`union`,options:e,...wx(t)})}var FO=U(`ZodDiscriminatedUnion`,(e,t)=>{NO.init(e,t),Vw.init(e,t)});function IO(e,t,n){return new FO({type:`union`,options:t,discriminator:e,...wx(n)})}var LO=U(`ZodIntersection`,(e,t)=>{Hw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pD(e,t,n,r)});function RO(e,t){return new LO({type:`intersection`,left:e,right:t})}var zO=U(`ZodTuple`,(e,t)=>{GD(),Gw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mD(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new JO({type:`optional`,innerType:e}))})}});function BO(e,t,n){let r=t instanceof zC;return new zO({type:`tuple`,items:e,rest:r?t:null,...wx(r?n:t)})}var VO=U(`ZodRecord`,(e,t)=>{GD(),Yw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vD(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function HO(e,t,n){return!t||!t._zod?new VO({type:`record`,keyType:W(),valueType:e,...wx(t)}):new VO({type:`record`,keyType:e,valueType:t,...wx(n)})}var UO=U(`ZodEnum`,(e,t)=>{Xw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aD(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new UO({...t,checks:[],...wx(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 UO({...t,checks:[],...wx(r),entries:i})}});function J(e,t){return new UO({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...wx(t)})}var WO=U(`ZodLiteral`,(e,t)=>{Zw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oD(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 GO(e,t){return new WO({type:`literal`,values:Array.isArray(e)?e:[e],...wx(t)})}var KO=U(`ZodTransform`,(e,t)=>{GD(),Qw.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cD(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new lS(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Gx(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(Gx(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function qO(e){return new KO({type:`transform`,transform:e})}var JO=U(`ZodOptional`,(e,t)=>{eT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>OD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function YO(e){return new JO({type:`optional`,innerType:e})}var XO=U(`ZodExactOptional`,(e,t)=>{tT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>OD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ZO(e){return new XO({type:`optional`,innerType:e})}var QO=U(`ZodNullable`,(e,t)=>{nT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $O(e){return new QO({type:`nullable`,innerType:e})}var ek=U(`ZodDefault`,(e,t)=>{rT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>CD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tk(e,t){return new ek({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():bx(t)}})}var nk=U(`ZodPrefault`,(e,t)=>{aT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rk(e,t){return new nk({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():bx(t)}})}var ik=U(`ZodNonOptional`,(e,t)=>{oT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ak(e,t){return new ik({type:`nonoptional`,innerType:e,...wx(t)})}var ok=U(`ZodCatch`,(e,t)=>{lT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sk(e,t){return new ok({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:rS(t)})}var ck=U(`ZodPipe`,(e,t)=>{uT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ED(e,t,n,r),e.in=t.in,e.out=t.out});function lk(e,t){return new ck({type:`pipe`,in:e,out:t})}var uk=U(`ZodReadonly`,(e,t)=>{fT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>DD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dk(e){return new uk({type:`readonly`,innerType:e})}var fk=U(`ZodCustom`,(e,t)=>{mT.init(e,t),KD.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sD(e,t,n,r)});function pk(e,t={}){return PE(fk,e,t)}function mk(e,t){return FE(e,t)}function hk(e){return rE(XD,e)}var gk=[`off`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],_k={enabled:!1,count:3,minSeconds:60,maxSeconds:120,titleOnScreen:!0},vk=1.25,yk=.05,bk=2e3,xk=`[PASTE THE FULL VIDEO LINK HERE]`;function Sk(e){let t=e?.trim()??``;return`Watch the full video: ${t===``?xk:t}`}function Ck(e,t){return[e.title,``,`${e.description}\n${Sk(t)}`,``,e.hashtags.join(` `)].join(`
|
|
99
|
+
`)}var wk=`Built-in`,Tk=[`Pick the moments of this video that work best as vertical shorts on YouTube Shorts, TikTok and Reels.`,``,`- Each short must make sense on its own, to a viewer who has not seen the rest of the video: no references to earlier parts, no setup that pays off outside the clip.`,`- Open on a hook: the first sentence should make someone stop scrolling (a surprising fact, a question, a bold claim). Skip clips that start with filler or a transition.`,`- End on a complete thought, not mid-argument.`,`- Prefer the most surprising, useful or emotional moments over summaries, and don't pick two shorts that say the same thing.`,`- Title: at most 60 characters, plain words, no clickbait and no hashtags.`,`- Description: one line that says what the viewer learns or feels.`,`- Hashtags: 3-5, about the subject of that clip, most specific last.`].join(`
|
|
100
|
+
`);[`Vertical 9:16 images for a short video. Each image illustrates what is being said at that moment of the clip.`,`Cinematic, high-contrast and uncluttered, with the subject large and centred so it reads on a phone screen.`,`Leave the lower half calm: captions are drawn over the middle of the frame.`,`No text, letters, logos or watermarks in the image.`].join(`
|
|
101
|
+
`);function Ek(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?1:Math.max(1,Math.ceil(e/t-.001))}function Dk(e){let t=e=>e===void 0||e.trim()===``?void 0:Number(e),n=t(e.musicVolume),r=t(e.speed),i=e.fullVideoLink?.trim()??``;return{...e.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...i===``?{}:{fullVideoLink:i},...n===void 0?{}:{musicVolume:n},...r===void 0?{}:{speed:r}}}function Ok(e){return{...e?.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...e?.fullVideoLink===void 0?{}:{fullVideoLink:e.fullVideoLink},...e?.musicVolume===void 0?{}:{musicVolume:String(e.musicVolume)},...e?.speed===void 0?{}:{speed:e.speed.toFixed(2)}}}function kk(e){let t=[],n=(e,t,n)=>Number.isInteger(e)&&e>=t&&e<=n;n(e.count,1,10)||t.push({field:`count`,message:`Enter a whole number of shorts between 1 and 10.`});for(let r of[`minSeconds`,`maxSeconds`])n(e[r],15,180)||t.push({field:r,message:`Enter a whole number of seconds between 15 and 180.`});if(t.every(e=>e.field===`count`)&&e.minSeconds>e.maxSeconds)for(let e of[`minSeconds`,`maxSeconds`])t.push({field:e,message:`The longest a short may be must be at least the shortest. Raise the maximum or lower the minimum.`});let r=e.speed;r!==void 0&&(!Number.isFinite(r)||r<.999999999||r>1.250000001||Math.abs((r-1)/.05-Math.round((r-1)/.05))>1e-6)&&t.push({field:`speed`,message:`Choose a speed between 1.00× and 1.25×, in steps of 0.05.`}),e.musicVolume!==void 0&&!n(e.musicVolume,0,100)&&t.push({field:`musicVolume`,message:`Enter the music volume as a whole number of percent between 0 and 100.`});let i=e.fullVideoLink?.trim()??``;return i!==``&&!Ak(i)&&t.push({field:`fullVideoLink`,message:`The full video link must be a whole web address starting with https:// or http://, like https://youtu.be/abc123. Paste it again, or leave the box empty.`}),t}function Ak(e){if(e.length>2e3||/\s/.test(e))return!1;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.hostname!==``}catch{return!1}}var jk=[`interval`,`narration`],Mk=[`cut`,`crossfade`,`fadeblack`,`slide`,`wipe`],Nk=[`off`,`subtle`,`strong`],Pk=[`none`,`warm`,`cold`,`desaturated`,`sepia`],Fk=[`none`,`embers`,`dust`,`fog`],Ik=[`off`,`chapters`,`every`],Lk={cuts:`interval`,transition:`cut`,transitionSeconds:.6,vignette:`off`,grain:`off`,grade:`none`,atmosphere:`none`,chapterCards:!1,animate:`off`,animateEvery:3,animateModel:``},Rk={...Lk,cuts:`narration`},zk=.2,Bk=[.2,.4,.6,.8,1,1.2,1.5,2],Vk={interval:`Every N seconds`,narration:`Follow the narration`},Hk={cut:`Cut`,crossfade:`Crossfade`,fadeblack:`Fade through black`,slide:`Slide`,wipe:`Wipe`},Uk={off:`Off`,subtle:`Subtle`,strong:`Strong`},Wk={none:`None`,warm:`Warm fantasy`,cold:`Cold`,desaturated:`Desaturated`,sepia:`Sepia`},Gk={none:`None`,embers:`Embers`,dust:`Dust`,fog:`Fog`},Kk={off:`Off`,chapters:`Chapter openers`,every:`Every Nth image`};function qk(e){return e.videoEdit??Lk}function Jk(e){let t=qk(e);return t.animate!==`off`&&e.sources.video===`generate`&&(t.animate===`every`||e.sources.audio!==`off`)}function Yk(e){let t=e.videoEdit;if(t===void 0||e.sources.video!==`generate`)return[];let n=[];return t.transition!==`cut`&&!(Number.isFinite(t.transitionSeconds)&&t.transitionSeconds>=.2&&t.transitionSeconds<=2)&&n.push({field:`transitionSeconds`,message:`Choose a transition length between ${String(zk)} and 2 seconds.`}),t.chapterCards&&e.sources.audio===`off`&&n.push({field:`chapterCards`,message:`Chapter cards are placed from the narration. Turn narration on, or turn chapter cards off.`}),t.animate===`chapters`&&e.sources.audio===`off`&&n.push({field:`animate`,message:`Chapter openers are found from the narration. Turn narration on, or choose Every Nth image.`}),t.animate===`every`&&!(Number.isInteger(t.animateEvery)&&t.animateEvery>=2&&t.animateEvery<=10)&&n.push({field:`animateEvery`,message:`Choose every 2nd to every 10th image.`}),t.animate!==`off`&&t.animateModel.trim()===``&&n.push({field:`animateModel`,message:`Choose an image-to-video model to animate images with, or turn Animate images off.`}),n}function Xk(e){return[[`Cuts`,Vk[e.cuts]],[`Transition`,e.transition===`cut`?Hk.cut:`${Hk[e.transition]} · ${String(e.transitionSeconds)} s`],[`Vignette`,Uk[e.vignette]],[`Film grain`,Uk[e.grain]],[`Colour grade`,Wk[e.grade]],[`Atmosphere`,Gk[e.atmosphere]],[`Chapter cards`,e.chapterCards?`On`:`Off`],[`Animate images`,e.animate===`off`?Kk.off:`${e.animate===`every`?`Every ${(e=>e===2?`2nd`:e===3?`3rd`:`${String(e)}th`)(e.animateEvery)} image`:Kk.chapters}${e.animateModel.trim()===``?``:` · ${e.animateModel}`}`]]}var Zk=22.5,Qk=`zoom`,$k={zoom:`Zoom in and out`,pan:`Pan across`,mixed:`Mix of both`,still:`Still`};function eA(e){return Number.isInteger(e)&&e>=1&&e<=600?void 0:`Enter a whole number of seconds between 1 and 600.`}function tA(e){return Number.isInteger(e*2)&&e>=0&&e<=50?void 0:`Enter a zoom between 0 and 50 percent, in steps of 0.5.`}function nA(e){return Number.isInteger(e*2)&&e>=0&&e<=30?void 0:`Enter a number of seconds between 0 and 30, in steps of 0.5.`}var rA={research:[`off`,`generate`,`provide`],article:[`generate`,`provide`],audio:[`off`,`generate`,`provide`],images:[`off`,`generate`,`provide`],thumbnail:[`off`,`from_prompt`,`prompt_by_llm`,`provide`],video:[`off`,`generate`],document:[`off`,`generate`]};function iA(e){let t=[],n=aA(e.draft),{sources:r}=n;n.title===``?t.push({field:`title`,message:`Enter a title for this video.`}):n.title.length>200&&t.push({field:`title`,message:`Keep the title to 200 characters or fewer.`});for(let e of Gb)rA[e].includes(qb(r,e))||t.push({field:`sources.${e}`,message:`"${qb(r,e)}" is not an option for ${e}. Reload the page and choose again.`});(r.research===`generate`||r.article===`generate`||r.thumbnail===`prompt_by_llm`||n.intro?.mode===`llm`||n.outro?.mode===`llm`||fA(n)||mA(n)||vA(n))&&!xA(n.llm)&&t.push({field:`llm`,message:`Choose a text (LLM) provider and model.`}),r.article===`generate`&&dA(n.articlePrompt)&&t.push({field:`articlePrompt`,message:`Pick an article prompt.`});let i=n.audio;t.push(...pA(n)),r.audio===`generate`&&(i===void 0||!xA(i)?t.push({field:`audio`,message:`Choose a narration provider and model.`}):i.voice.trim()===``&&t.push({field:`audio.voice`,message:`Choose a voice for the narration.`})),r.images===`generate`&&oA(n,t),(r.images===`generate`||r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`||vA(n)||Jk(n))&&!xA(n.images)&&t.push({field:`images`,message:`Choose an image provider and model.`}),(r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`)&&dA(n.thumbnailPrompt)&&t.push({field:`thumbnailPrompt`,message:`Pick a thumbnail prompt.`}),r.audio===`off`&&n.subtitles!==void 0&&n.subtitles.mode!==`off`&&t.push({field:`subtitles.mode`,message:`Subtitles need narration. Turn narration on, or turn subtitles off.`}),t.push(...hA(n)),t.push(...yA(n)),t.push(...bA(n)),t.push(..._A(n)),gA(n)&&n.reference?.source===`provide`&&lA(e.staged,n.provided.reference,`images`,`provided.reference`,`Upload the establishing image, or set Establishing image to Off in the Images section.`,t),sA(n,e.staged,t),uA(n,e.requiredSlots,t),(!Number.isFinite(n.silenceGapSeconds)||n.silenceGapSeconds<0||n.silenceGapSeconds>30)&&t.push({field:`silenceGapSeconds`,message:`Enter a silence gap between 0 and 30 seconds.`});let a=r.video===`generate`?eA(n.imageSeconds):void 0;a!==void 0&&t.push({field:`imageSeconds`,message:a});let o=r.video===`generate`?tA(n.zoomPercent):void 0;o!==void 0&&t.push({field:`zoomPercent`,message:o});let s=r.audio===`off`?void 0:nA(n.edgeSilenceSeconds);return s!==void 0&&t.push({field:`edgeSilenceSeconds`,message:s}),t.length===0?{ok:!0,draft:n}:{ok:!1,fields:t}}function aA(e){let t={...e.sources};t.article===`provide`&&(t.research=`off`),t.images===`off`&&t.video===`generate`&&(t.video=`off`);let n=Object.create(null);for(let[t,r]of Object.entries(e.values))n[t]=r.trim();return{...e,title:e.title.trim(),subtitles:t.video===`off`&&e.subtitles?.mode===`burn-in`?{...e.subtitles,mode:`files`}:e.subtitles,sources:t,values:n,intro:t.audio===`generate`?e.intro:void 0,outro:t.audio===`generate`?e.outro:void 0}}function oA(e,t){if(e.imagePrompts.length===0){t.push({field:`imagePrompts`,message:`Tick at least one image prompt, or turn images off.`});return}let n=0;for(let[r,i]of e.imagePrompts.entries())n+=i.number,dA(i.name)&&t.push({field:`imagePrompts.${r}.name`,message:`Pick an image prompt.`}),(!Number.isInteger(i.number)||i.number<1||i.number>20)&&t.push({field:`imagePrompts.${r}.number`,message:`Enter a whole number between 1 and 20.`});n>60&&t.push({field:`imagePrompts`,message:`A video can have at most 60 images; these prompts ask for ${n}. Lower the numbers.`})}function sA(e,t,n){let{sources:r,provided:i}=e;if(r.research===`provide`&&dA(i.research)&&n.push({field:`provided.research`,message:`Paste the research notes.`}),r.article===`provide`&&dA(i.article)&&n.push({field:`provided.article`,message:`Paste the article.`}),r.audio===`provide`&&lA(t,i.audio,`audio`,`provided.audio`,`Pick an audio file.`,n),r.thumbnail===`provide`&&lA(t,i.thumbnail,`thumbnail`,`provided.thumbnail`,`Pick a thumbnail image.`,n),r.images===`provide`){let e=i.images??[];e.length===0?n.push({field:`provided.images`,message:`Pick at least one image.`}):e.length>60&&n.push({field:`provided.images`,message:`A video can have at most 60 images. Remove some.`}),new Set(e).size!==e.length&&n.push({field:`provided.images`,message:`The same image is picked twice. Remove the duplicate.`});for(let[r,i]of e.entries())lA(t,i,`images`,`provided.images.${r}`,`Pick an image.`,n)}cA(e,t,n)}function cA(e,t,n){let r=e.provided.shortsMusic;if(e.shorts?.enabled!==!0||r===void 0)return;let i=`under Outputs → Export → More shorts options → Background music`,a=t.find(e=>e.id===r);a===void 0||a.stageKind!==`audio`?n.push({field:`shorts.music`,message:`The shorts' background music file is no longer available, so it can't be added to the project. Choose the file again ${i}, or remove it.`}):a.state!==`staged`&&n.push({field:`shorts.music`,message:`The shorts' background music is still uploading, so the run can't start yet. Wait for it to finish, or remove it ${i}.`})}function lA(e,t,n,r,i,a){if(t===void 0||t===``){a.push({field:r,message:i});return}let o=e.find(e=>e.id===t);if(o===void 0||o.stageKind!==n){a.push({field:r,message:`That upload is no longer available. Choose the file again.`});return}o.state!==`staged`&&a.push({field:r,message:`This file is still uploading. Wait for it to finish.`})}function uA(e,t,n){for(let r of t){let t=Object.hasOwn(e.values,r)?e.values[r]:void 0;if(t===void 0||t===``){n.push({field:`values.${r}`,message:`Fill in this field.`});continue}t.length>200&&n.push({field:`values.${r}`,message:`Keep this to 200 characters or fewer.`}),/[\n\r]/.test(t)&&n.push({field:`values.${r}`,message:`Keep this to a single line, without line breaks.`})}}function dA(e){return e===void 0||e.trim()===``}function fA(e){return e.sources.audio===`generate`&&!dA(e.narrationPrompt)}function pA(e){return fA(e)&&(e.audio?.provider!==`inworld`||e.audio.model!==`inworld-tts-2`)?[{field:`narrationPrompt`,message:`Narration preparation only works with the Inworld TTS-2 model. Choose that model under Narration, or turn preparation Off.`}]:[]}function mA(e){return e.youtubeDescription===!0&&e.sources.audio!==`off`}function hA(e){return e.youtubeDescription===!0&&e.sources.audio===`off`?[{field:`youtubeDescription`,message:`The YouTube description is timed from the narration. Turn narration on, or turn the YouTube description off.`}]:[]}function gA(e){return e.reference!==void 0&&e.sources.images===`generate`}function _A(e){return gA(e)&&e.reference?.source===`prompt`&&(e.reference.prompt===void 0||e.reference.prompt.trim()===``)?[{field:`reference.prompt`,message:`Pick an image prompt for the establishing image, upload one instead, or set Establishing image to Off in the Images section.`}]:[]}function vA(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function yA(e){let t=e.shorts;if(t?.enabled!==!0)return[];if(e.sources.audio===`off`)return[{field:`shorts.enabled`,message:`Shorts are cut from the narration. Turn narration on, or turn Shorts off.`}];let n=kk(t).map(e=>({field:`shorts.${e.field}`,message:e.message})),r=e.sources.video===`generate`?void 0:eA(e.imageSeconds);return r!==void 0&&n.push({field:`imageSeconds`,message:r}),n}function bA(e){return Yk(e).map(e=>({field:`videoEdit.${e.field}`,message:e.message}))}function xA(e){return e!==void 0&&e.provider.trim()!==``&&e.model.trim()!==``}function SA(e){return e.sources.audio===`generate`&&e.audio?.usePronunciationGlossary===!0&&e.audio.provider===`inworld`&&(e.audio.model===`inworld-tts-2`||e.audio.model===`inworld-tts-2-flash`)}var CA=W().min(1),wA=W().regex(/^[a-f0-9]{64}$/),TA=J([`audio`,`images`,`video`]),EA=q({projectId:CA,revisionId:CA,checkpointId:CA,stage:TA,workId:CA,fingerprint:wA,state:J([`configured`,`pending-review`,`held`,`released`,`satisfied`,`invalidated`,`canceled`]),createdAt:hk(),approvedAt:hk().nullable()}).strict().readonly();q({projectId:CA,revisionId:CA,checkpoints:K(q({checkpointId:CA,stage:TA,workId:CA,fingerprint:wA,state:J([`configured`,`pending-review`,`held`])}).strict().readonly()).max(3).readonly(),createdAt:hk()}).strict().readonly();var DA=q({projectId:CA,revisionId:CA,checkpointId:CA,fingerprint:wA,idempotencyKey:rO(),approvedAt:hk()}).strict().readonly(),OA=[`Cinzel`,`times`,`helvetica`,`courier`],kA=[`normal`,`medium`,`bold`,`black`,`italic`,`bolditalic`],AA=(e,t)=>{let n={error:`Use a value from ${String(e)} to ${String(t)}.`};return G({error:`Enter a number.`}).finite(n).min(e,n).max(t,n)},jA=W().regex(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i,`Use a colour like #8c1e14.`),MA=W().max(300,{error:`Keep this under 300 characters.`}),NA=MA.nullable(),PA=W().max(500,{error:`Keep this under 500 characters.`}).nullable(),FA=q({family:J(OA),style:J(kA),letterSpacing:AA(-.5,2)}).strict(),IA=q({page:q({format:J([`a4`,`letter`]),margin:AA(5,60),contentTop:AA(5,80)}).strict(),background:q({image:J([`parchment`]).nullable(),color:jA}).strict(),colors:q({heading:jA,text:jA,muted:jA,faint:jA}).strict(),fonts:q({body:FA,strong:FA,emphasis:FA,heading:FA,dramatic:FA,decorative:FA,dropCap:FA,footer:FA}).strict(),sizes:q({brand:AA(6,72),title:AA(6,72),section:AA(6,72),heading:AA(6,72),subheading:AA(6,72),body:AA(6,24),footer:AA(5,24),meta:AA(5,24)}).strict(),spacing:q({bodyLine:AA(3,20),headingLine:AA(3,30),subheadingLine:AA(3,30),paragraphGap:AA(0,3),headingGap:AA(0,5),itemGap:AA(0,3),listIndent:AA(0,30),quoteIndent:AA(0,40),ruleWidth:AA(0,150)}).strict(),dropCap:q({enabled:wO(),lines:PO([GO(2),GO(3),GO(4)]),scale:AA(1,5),gap:AA(0,20),minLength:G({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(0,{error:`Use a value from 0 to 2000.`}).max(2e3,{error:`Use a value from 0 to 2000.`}),minRoom:AA(0,1)}).strict(),titlePage:q({brandY:AA(10,200),taglineOffset:AA(0,60),titleY:AA(10,250),titleLine:AA(3,40),metaOffset:AA(0,100),metaLine:AA(3,30),showDate:wO(),showWordCount:wO(),cover:q({enabled:wO(),gap:AA(0,40),maxHeight:AA(20,200)}).strict()}).strict(),contents:q({enabled:wO(),title:MA,depth:PO([GO(1),GO(2),GO(3)]),titleOffset:AA(0,100),firstEntryOffset:AA(0,150),line:AA(3,30),indent:AA(0,30)}).strict(),header:q({enabled:wO(),top:AA(3,60),maxTitleCharacters:G({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(5,{error:`Use a value from 5 to 200.`}).max(200,{error:`Use a value from 5 to 200.`})}).strict(),footer:q({enabled:wO(),bottom:AA(3,60),reserve:AA(0,60),text:MA}).strict(),brand:q({name:NA,url:PA,tagline:NA,linkLabel:NA}).strict(),metadata:q({author:MA,subject:MA,keywords:W().max(1e3),creator:MA}).strict(),sources:q({enabled:wO(),title:MA,titleOffset:AA(0,100),bodyOffset:AA(0,150),line:AA(3,30),gap:AA(0,20)}).strict(),endPage:q({enabled:wO(),title:MA,titleOffset:AA(0,100),bodyOffset:AA(0,150),lines:K(MA).max(60).readonly(),showDocumentDetails:wO(),link:q({text:MA,url:PA}).strict().nullable(),closing:NA}).strict()}).strict(),LA=q({id:W().min(1).max(64),name:W().min(1).max(80),values:IA}).strict(),RA=q({theme:J($b),custom:LA.optional()}).strict(),zA=[`whole`,`paragraph`,`words`,`characters`],BA=[`off`,`files`,`burn-in`],VA=[`top`,`upper-middle`,`center`,`lower-middle`,`bottom`],HA=q({mode:J(BA),language:GO(`en`).default(`en`),fontId:W().max(160).regex(/^[A-Za-z0-9_-]+$/).default(`default`),position:J(VA).default(`bottom`),fontSize:G().int().min(16).max(120).default(48)}),UA={mode:`off`,language:`en`,fontId:`default`,fontSize:48,position:`bottom`},WA=q({provider:W(),model:W(),thinking:J(gk).optional()}),GA=q({name:W(),mode:J(Yb)}),KA=q({cuts:J(jk),transition:J(Mk),transitionSeconds:G(),vignette:J(Nk),grain:J(Nk),grade:J(Pk),atmosphere:J(Fk),chapterCards:wO(),animate:J(Ik),animateEvery:G(),animateModel:W()}),qA=q({checkpoints:K(TA).max(3).refine(e=>new Set(e).size===e.length).readonly().optional(),title:W(),format:J(Wb),sources:q({research:J(Kb),article:J(Kb),audio:J(Kb),images:J(Kb),thumbnail:J(Kb),video:J(Kb),document:J(Kb).optional()}),llm:WA.optional(),audio:WA.extend({voice:W(),usePronunciationGlossary:wO().optional(),shareGlossary:wO().optional()}).optional(),sharedGlossary:K(q({term:W().min(1).max(200),ipa:K(W().min(1).max(200)).min(1).max(20).readonly()})).max(2e4).readonly().optional(),images:WA.optional(),reference:q({source:J(Xb),prompt:W().optional(),thumbnail:wO().optional()}).optional(),articlePrompt:W().optional(),narrationPrompt:W().optional(),imagePrompts:K(q({name:W(),number:G()})),thumbnailPrompt:W().optional(),intro:GA.optional(),outro:GA.optional(),values:HO(W(),W()),provided:q({research:W().optional(),article:W().optional(),audio:W().optional(),images:K(W()).optional(),thumbnail:W().optional(),reference:W().optional(),shortsMusic:W().optional()}),chunking:q({mode:J(zA),words:G().optional(),characters:G().int().min(1).max(1e6).optional()}).optional(),silenceGapSeconds:G(),imageSeconds:G().default(15),zoomPercent:G().default(Zk),motionStyle:J(Jb).default(Qk),edgeSilenceSeconds:G().default(2),subtitles:HA.optional(),document:RA.optional(),youtubeDescription:wO().optional(),descriptionPrompt:W().optional(),shorts:q({enabled:wO(),count:G(),minSeconds:G(),maxSeconds:G(),prompt:W().optional(),imagePrompt:W().optional(),titleOnScreen:wO().optional(),fullVideoLink:W().optional(),musicVolume:G().optional(),speed:G().optional()}).optional(),videoEdit:KA.optional()}),JA=qA.extend({rendered:HO(W(),W())}),YA=[`article`,`image`,`thumbnail`,`narration`,`description`,`shorts`],XA=[`intro`,`outro`],gee=1e5;q({id:W(),kind:J(YA),name:W(),body:W(),slots:W(),updated_at:W()}),q({id:W(),category:J(XA),mode:J(Yb),name:W(),body:W(),slots:W(),updated_at:W()});var ZA=q({id:W(),name:W(),body:W(),slots:K(W()).readonly(),updatedAt:W()}),QA=q({prompts:K(ZA.extend({kind:J(YA)}).strict().readonly()).readonly(),entries:K(ZA.extend({category:J(XA),mode:J(Yb)}).strict().readonly()).readonly()}).strict().readonly(),$A=rO(),ej=W(),tj=HO(ej,ej).readonly(),nj=q({provider:ej,model:ej,thinking:J(gk).optional()}).strict(),rj=[`audio`,`images`,`thumbnail`,`reference`],ij=q({attachmentId:$A,name:ej}).strict().readonly(),aj=q({title:ej,checkpoints:qA.shape.checkpoints,format:J(Wb),sources:q({research:J(Kb),article:J(Kb),audio:J(Kb),images:J(Kb),thumbnail:J(Kb),video:J(Kb),document:J(Kb).optional()}).strict().readonly(),document:RA.readonly().optional(),llm:nj.readonly(),audio:nj.extend({voice:ej,usePronunciationGlossary:wO().optional(),shareGlossary:wO().optional()}).readonly(),images:nj.readonly(),reference:q({source:J([`off`,...Xb]),prompt:ej,thumbnail:wO()}).strict().readonly().optional(),articlePrompt:ej,narrationPrompt:ej.optional(),youtubeDescription:wO().optional(),descriptionPrompt:ej.optional(),shorts:q({enabled:wO(),count:ej,minSeconds:ej,maxSeconds:ej,prompt:ej,imagePrompt:ej,titleOnScreen:wO().optional(),fullVideoLink:ej.optional(),musicVolume:ej.optional(),speed:ej.optional()}).strict().readonly().optional(),imagePrompts:K(q({name:ej,number:ej}).strict().readonly()).readonly(),thumbnailPrompt:ej,intro:ej,outro:ej,chunking:q({mode:J(zA),words:ej,characters:ej}).strict().readonly(),subtitles:q({mode:J(BA),language:GO(`en`),fontId:ej,fontSize:ej,position:J(VA)}).strict().readonly(),imageSeconds:ej.default(`15`),edgeSilenceSeconds:ej.default(`2`),zoomPercent:ej.default(String(Zk)),motionStyle:J(Jb).default(Qk),videoEdit:KA.strict().readonly().optional(),values:tj,provided:q({research:ej,article:ej,audio:ij.nullable(),thumbnail:ij.nullable(),images:K(ij).readonly(),reference:ij.nullable().optional(),shortsMusic:ij.nullable().optional()}).strict().readonly()}).strict().readonly(),oj=q({schemaVersion:GO(1),librarySnapshot:QA.optional(),templateSource:q({id:$A,version:G().int().positive()}).strict().readonly().optional(),form:aj,section:J([`content`,`outputs`,`style`,`review`]),variants:K(q({id:$A,title:ej,values:tj}).strict().readonly()).readonly(),expectedWords:ej,previewText:ej,fontUpload:q({operationId:$A,name:ej}).strict().readonly().nullable()}).strict().readonly(),sj=q({id:$A,document:oj}).strict().readonly(),cj=sj.unwrap().extend({baseVersion:G().int().positive(),mutationId:$A}).strict().readonly(),lj=sj.unwrap().extend({sourceId:$A}).strict().readonly(),uj=q({id:$A,baseVersion:G().int().positive()}).strict().readonly(),dj=q({id:$A,kind:J(rj),name:ej,state:J([`pending`,`copying`,`ready`,`reattach`]),stagedFileId:ej.nullable(),bytes:G().nonnegative(),error:ej.nullable()}).strict().readonly(),fj=q({id:$A,version:G().int().positive(),createdAt:ej,updatedAt:ej,document:oj}).strict().readonly(),pj=q({checkpointSet:K(EA.unwrap().extend({reviewedFingerprint:ej}).strict().readonly()).readonly().optional(),requestId:$A,projectIds:K(ej).readonly(),queue:K(q({projectId:ej,batchId:ej,position:G(),state:J([`queued`,`active`,`finished`])}).strict().readonly()).readonly(),replayed:wO()}).strict().readonly(),mj=q({currency:GO(`USD`),rows:K(q({stage:ej,low:G().nullable(),high:G().nullable(),detail:ej}).strict().readonly()).readonly(),low:G(),high:G(),unknown:G(),expectedWords:G(),catalogueDate:ej.nullable(),assumptions:K(ej).readonly()}).strict().readonly(),hj=q({checkpointSet:K(q({runIndex:G().int().nonnegative(),checkpointId:ej,stage:TA,fingerprint:ej,workKeys:K(ej).readonly(),dependents:K(J(Gb)).readonly()}).strict().readonly()).readonly().optional(),id:$A,draftId:$A,draftVersion:G().int().positive(),fingerprint:ej,runs:K(q({draft:qA,rendered:tj,templates:tj}).strict().readonly()).readonly(),estimates:K(mj).readonly()}).strict().readonly(),gj=q({draft:fj,attachments:K(dj).readonly(),review:hj.nullable(),pendingStart:q({reviewId:$A,draftVersion:G().int().positive()}).strict().readonly().nullable(),start:pj.nullable()}).strict().readonly(),_j=q({title:W(),status:G(),detail:W().optional(),reason:W().optional(),currentVersion:G().int().positive().nullable().optional(),reviewId:rO().optional(),fields:K(q({field:W(),message:W()})).optional(),errors:K(q({path:W(),message:W()})).optional()}),vj=q({drafts:K(q({id:rO(),title:W(),version:G().int().positive(),updatedAt:W(),readable:wO()}).strict()).readonly()}).strict(),yj=uj.unwrap().omit({id:!0}).extend({draftId:rO(),reviewId:rO()}).strict();async function bj(e,t){let n;try{n=await e.json()}catch{throw ro(e,void 0)}if(e.ok)return{ok:!0,value:uo(t,n)};let r=_j.safeParse(n);if(!r.success)throw ro(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw ro(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentVersion:i.currentVersion??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[],...i.reviewId===void 0?{}:{reviewId:i.reviewId}}}async function xj(e,t,n,r,i){return bj(await e.fetch(`${e.origin}/api/drafts${t}`,{method:n,...i===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(i)}}),r)}function Sj(e){return`/${encodeURIComponent(rO().parse(e))}`}async function Cj(e){return xj(e,``,`GET`,vj)}async function wj(e,t){return xj(e,``,`POST`,gj,sj.parse(t))}async function Tj(e,t){return xj(e,Sj(t),`GET`,gj)}async function Ej(e,t){let{id:n,...r}=cj.parse(t);return xj(e,Sj(n),`PUT`,gj,r)}async function Dj(e,t){let{sourceId:n,...r}=lj.parse(t);return xj(e,`${Sj(n)}/fork`,`POST`,gj,r)}async function Oj(e,t){let{id:n,...r}=uj.parse(t);return xj(e,Sj(n),`DELETE`,q({discarded:GO(!0)}).strict(),r)}async function kj(e,t){let{id:n,...r}=uj.parse(t);return xj(e,`${Sj(n)}/review`,`POST`,hj,r)}async function Aj(e,t){let{draftId:n,...r}=yj.parse(t);return xj(e,`${Sj(n)}/start`,`POST`,pj,r)}function jj(e,t,n){return`${e.origin}/api/drafts${Sj(t)}/attachments/${encodeURIComponent(rO().parse(n))}/file`}async function Mj(e,t,n,r,i){let a=new FormData;return a.set(`file`,r),bj(await e.fetch(jj(e,t,n),{method:`PUT`,body:a,...i?{signal:i}:{}}),dj)}var Nj=[`fonts`];async function Pj(e){return $a(await e.fetch(`${e.origin}/api/fonts`))}async function Fj(e,t){let n=new FormData;return n.set(`file`,t),$a(await e.fetch(`${e.origin}/api/fonts`,{method:`POST`,body:n}))}function Ij(e,t){return`${e.origin}/api/fonts/${encodeURIComponent(t)}/file`}var Lj=`slopify.play-draft`;function Rj(e){try{e?window.localStorage?.setItem(Lj,e):window.localStorage?.removeItem(Lj)}catch(e){console.warn(`Active draft browser storage is unavailable`,e)}}function zj(){try{return window.localStorage?.getItem(Lj)??null}catch(e){return console.warn(`Active draft browser storage is unavailable`,e),null}}async function Bj(e,t){let n=await Promise.allSettled([t.fetchQuery({...Tb(e),staleTime:0}),t.fetchQuery({...Db(e),staleTime:0}),t.fetchQuery({...Ob(e),staleTime:0}),t.fetchQuery({...Ab(e),staleTime:0}),t.fetchQuery({...Eb(e),staleTime:0}),t.fetchQuery({queryKey:Nj,queryFn:()=>Pj(e),staleTime:0})]);for(let e of n)e.status===`rejected`&&console.warn(`Draft choices could not refresh`,e.reason)}var Vj=oj.parse({schemaVersion:1,form:{title:``,format:`16:9`,sources:{research:`off`,article:`generate`,audio:`generate`,images:`generate`,thumbnail:`off`,video:`generate`},llm:{provider:``,model:``},audio:{provider:``,model:``,voice:``,usePronunciationGlossary:!0,shareGlossary:!0},images:{provider:``,model:``},articlePrompt:``,narrationPrompt:``,imagePrompts:[],thumbnailPrompt:``,intro:``,outro:``,chunking:{mode:`whole`,words:`500`,characters:`3000`},subtitles:{...UA,fontSize:`48`},imageSeconds:`15`,edgeSilenceSeconds:`2`,zoomPercent:String(Zk),motionStyle:Qk,videoEdit:Rk,values:{},provided:{research:``,article:``,audio:null,images:[],thumbnail:null}},section:`content`,variants:[],expectedWords:`1500`,previewText:`Every story begins with a word.`,fontUpload:null});function Hj(e){let t={...e.sources,...e.sources.article===`provide`?{research:`off`}:{},...e.sources.images===`off`?{video:`off`}:{}},n=t.audio===`off`?`off`:t.video===`off`&&e.subtitles.mode===`burn-in`?`files`:e.subtitles.mode;return{...e,sources:t,subtitles:{...e.subtitles,mode:n}}}function Uj(e){let t=oj.parse(e);return JSON.stringify({...t,form:Hj(t.form)})}function Wj(e,t,n){return{...e,acknowledged:Math.max(e.acknowledged,t),version:n}}function Gj(e,t){return t.type===`edit`?{...e,edited:e.edited+1}:Wj(e,t.generation,t.version)}function Kj(e,t,n){return{mutationId:n,document:oj.parse(JSON.parse(Uj(e))),generation:t.edited,baseVersion:t.version}}function qj(){return{document:Vj,view:null,clock:{edited:0,acknowledged:0,version:0},id:null,recoveryId:null,pending:null,status:`unsaved`,error:null,reveal:null}}function Jj(e,t,n){let r=e.form.provided,i=t.form.provided,a=new Map;for(let[e,t]of[[r.audio,i.audio],[r.thumbnail,i.thumbnail],[r.shortsMusic,i.shortsMusic],...r.images.map((e,t)=>[e,i.images[t]])])e&&t&&a.set(e.attachmentId,t.attachmentId);let o=e=>e?{...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}:null;return{...n,form:{...n.form,provided:{...n.form.provided,audio:o(n.form.provided.audio),thumbnail:o(n.form.provided.thumbnail),...n.form.provided.shortsMusic===void 0?{}:{shortsMusic:o(n.form.provided.shortsMusic)},images:n.form.provided.images.map(e=>({...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}))}}}}function Yj(e,t){if(e.draft.id!==t.id)return e;let n=t.document.form.provided,r=new Set([n.audio,n.thumbnail,n.shortsMusic,...n.images].flatMap(e=>e?[e.attachmentId]:[]));return{...e,attachments:e.attachments.filter(e=>r.has(e.id)).map(e=>{let n=t.view?.attachments.find(t=>t.id===e.id);return(e.state===`pending`||e.state===`copying`)&&(n?.state===`ready`||n?.state===`reattach`)?n:e})}}function Xj(e,t){let n={...UA,...e},r=t.audio===`off`?`off`:(t.video===`off`||t.images===`off`)&&n.mode===`burn-in`?`files`:n.mode;if(r!==`off`)return{...n,mode:r};let i=HA.shape.fontId.safeParse(n.fontId),a=HA.shape.fontSize.safeParse(n.fontSize);return{...n,mode:r,fontId:i.success?i.data:UA.fontId,fontSize:a.success?a.data:UA.fontSize}}function Zj(e){return e.mode===`off`||e.fontId!==``&&Number.isInteger(e.fontSize)&&e.fontSize>=16&&e.fontSize<=120}function Qj(e){return e===`shortsMusic`?`audio`:e}function $j(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function eM(e){let t=e=>e.trim()===``?NaN:Number(e);return{enabled:e.enabled,count:t(e.count),minSeconds:t(e.minSeconds),maxSeconds:t(e.maxSeconds),...e.prompt.trim()?{prompt:e.prompt}:{},...e.imagePrompt.trim()?{imagePrompt:e.imagePrompt}:{},...Dk(e)}}({...Vj.form}),{...Vj.form.sources};var tM={off:`Off`,generate:`Generate`,provide:`Provide`,from_prompt:`From prompt`,prompt_by_llm:`Prompt by LLM`};function nM(e){return rA[e].map(e=>({value:e,label:tM[e]}))}function rM(e,t){return fA(e)||mA(e)||$j(e)||e.sources.article===`generate`||e.sources.thumbnail===`prompt_by_llm`||e.sources.audio===`generate`&&(iM(t,`intro`,e.intro)===`llm`||iM(t,`outro`,e.outro)===`llm`)}function iM(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.mode}function aM(e){return[e.audio,e.thumbnail,e.shortsMusic,e.reference,...e.images].flatMap(e=>e?.file===void 0?[]:[e.file])}function oM(e){let{form:t}=e;return{...t.checkpoints===void 0?{}:{checkpoints:t.checkpoints},title:t.title,format:t.format,sources:{...t.sources,...t.sources.article===`provide`?{research:`off`}:{},...t.sources.images===`off`?{video:`off`}:{}},llm:t.llm,audio:t.audio,images:t.images,...t.sources.images===`generate`&&t.reference!==void 0&&t.reference.source!==`off`?{reference:{source:t.reference.source,...t.reference.source===`prompt`?{prompt:t.reference.prompt}:{},thumbnail:t.reference.thumbnail}}:{},articlePrompt:t.articlePrompt,...t.narrationPrompt===void 0?{}:{narrationPrompt:t.narrationPrompt},...t.sources.audio!==`off`&&t.youtubeDescription===!0?{youtubeDescription:!0,...t.descriptionPrompt?.trim()?{descriptionPrompt:t.descriptionPrompt}:{}}:{},...$j(t)&&t.shorts!==void 0?{shorts:eM(t.shorts)}:{},imagePrompts:t.imagePrompts,thumbnailPrompt:t.thumbnailPrompt,...sM(cM(e,`intro`),e=>({intro:e})),...sM(cM(e,`outro`),e=>({outro:e})),values:lM(t.values,e.slots),provided:{research:t.provided.research,article:t.provided.article,...sM(t.provided.audio?.file,e=>({audio:e.id})),...sM(t.provided.thumbnail?.file,e=>({thumbnail:e.id})),...sM(t.sources.images===`generate`&&t.reference?.source===`provide`?t.provided.reference?.file:void 0,e=>({reference:e.id})),images:t.provided.images.flatMap(e=>e.file===void 0?[]:[e.file.id]),...$j(t)?sM(t.provided.shortsMusic?.file,e=>({shortsMusic:e.id})):{}},chunking:t.chunking,subtitles:Xj(t.subtitles,t.sources),silenceGapSeconds:e.silenceGapSeconds,imageSeconds:t.imageSeconds,edgeSilenceSeconds:t.edgeSilenceSeconds,zoomPercent:t.zoomPercent,motionStyle:t.motionStyle,...t.videoEdit===void 0?{}:{videoEdit:t.videoEdit},...t.sources.document===`generate`?{document:t.document}:{}}}function sM(e,t){return e===void 0?{}:t(e)}function cM(e,t){if(e.form.sources.audio!==`generate`)return;let n=t===`intro`?e.form.intro:e.form.outro,r=iM(e.entries,t,n);return n===``||r===void 0?void 0:{name:n,mode:r}}function lM(e,t){let n=Object.create(null);for(let r of t)n[r]=Object.hasOwn(e,r)?e[r]??``:``;return n}function uM(e,t){return e?.draftId===t.draftId&&e.version===t.version&&e.editGeneration===t.editGeneration}function dM({api:e,queryClient:t,current:n,flush:r,render:i}){let a={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},o,s=0,c=0,l=null,u=e=>{a={...a,...e},i()},d=()=>({draftId:n().id??``,version:n().clock.version,editGeneration:n().clock.edited}),f=()=>uM(o,d())&&n().clock.edited===n().clock.acknowledged,p=(e=!1)=>{s++,o=void 0,u({valid:!1,...e?{fields:[],error:null}:{}})},m=e=>u({error:e.message,fields:e.fields,valid:!1}),h=e=>{l=null,u({created:e,uncertain:!1,starting:!1,valid:!1})},g=async()=>{let t=l?.draftId;if(!t)return;let n=await Tj(e,t);if(!n.ok){m(n);return}n.value.start&&h(n.value.start)};return{reset:()=>{s++,c++,o=void 0,l=null,a={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},i()},state:()=>({...a,valid:a.valid&&f()}),invalidate:p,restore:e=>{s++,c++,o=void 0,l=e.pendingStart?{draftId:e.draft.id,baseVersion:e.pendingStart.draftVersion,reviewId:e.pendingStart.reviewId}:null,a={receipt:null,pending:!1,starting:!1,uncertain:l!==null,valid:!1,error:null,fields:[],created:e.start},i()},review:async()=>{if(a.pending||a.starting||a.uncertain||a.created)return;let i=++c;u({pending:!0,valid:!1,error:null,fields:[]});try{if(await Promise.all([Bj(e,t),t.refetchQueries({queryKey:[`provider-models`]})]),i!==c||!await r()||!n().id)return;let a=d(),l=s,f=await kj(e,{id:a.draftId,baseVersion:a.version});if(i!==c||l!==s||!uM(a,d()))return;if(!f.ok){m(f);return}if(f.value.draftId!==a.draftId||f.value.draftVersion!==a.version)return;o=a,u({receipt:f.value,valid:!0})}catch(e){i===c&&u({error:e instanceof Error?e.message:`This setup couldn't be checked. Press Refresh review to try again.`})}finally{i===c&&u({pending:!1})}},start:async()=>{if(a.starting||a.created||n().document.section!==`review`||!l&&(!a.valid||!f()||a.pending||!a.receipt||fM(n().document,n().view)!==void 0)||(!l&&a.receipt&&(l={draftId:a.receipt.draftId,baseVersion:a.receipt.draftVersion,reviewId:a.receipt.id}),!l))return;let t=l;Rj(t.draftId),u({starting:!0,error:null});try{if(a.uncertain&&(await g(),a.created))return;let n=await Aj(e,t);if(n.ok){h(n.value);return}n.reason===`pending-start`||n.reason===`already-started`?(u({uncertain:!0}),await g()):(l=null,u({uncertain:!1}),m(n))}catch(e){u({uncertain:!0,valid:!1,error:`${co(e instanceof Error?e.message:`Slopify didn't confirm the start`)} The run may already have started. Press Check Start result to find out before trying again.`})}finally{u({starting:!1})}}}}function fM(e,t){if(e.fontUpload!==null)return`subtitles.fontUpload`;let{sources:n,provided:r}=e.form;return[...n.audio===`provide`&&r.audio?[{ref:r.audio,field:`provided.audio`}]:[],...n.thumbnail===`provide`&&r.thumbnail?[{ref:r.thumbnail,field:`provided.thumbnail`}]:[],...n.images===`provide`?r.images.map((e,t)=>({ref:e,field:`provided.images.${t}`})):[],...$j(e.form)&&r.shortsMusic?[{ref:r.shortsMusic,field:`shorts.music`}]:[]].find(({ref:e})=>t?.attachments.find(t=>t.id===e.attachmentId)?.state!==`ready`)?.field}function pM(e,t){return e?.draftId===t.draftId&&e.attachmentId===t.attachmentId}function mM({api:e,queryClient:t,state:n,edit:r,flush:i,generation:a,publish:o,render:s}){let c=(0,m.useRef)(0),l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)(new Map),f=(0,m.useRef)(new Map),p=e=>{let t=n.current.document.form.provided,r=[t.audio,t.thumbnail,t.shortsMusic,t.reference,...t.images].find(t=>t?.attachmentId===e.attachmentId);return pM(r&&n.current.id?{draftId:n.current.id,attachmentId:r.attachmentId}:void 0,e)};(0,m.useEffect)(()=>{for(let[e,t]of d.current)t!==a()&&d.current.delete(e);for(let[e,t]of f.current)(!p(t.owner)||t.generation!==a())&&(t.controller.abort(),f.current.delete(e))}),(0,m.useEffect)(()=>{let e=f.current,t=d.current;return()=>{c.current++,t.clear();for(let t of e.values())t.controller.abort();e.clear()}},[]);let h=async(t,l,u)=>{if(l.length===0)return;let m=Qj(t),h=m===`images`&&!u?l:l.slice(-1),g=h.map(e=>({attachmentId:crypto.randomUUID(),name:e.name})),_=c.current,v=a();for(let e of g)d.current.set(e.attachmentId,v);let y=n.current.document,b=y.form.provided;r({...y,form:{...y.form,provided:m===`images`?{...b,images:u?b.images.flatMap(e=>e.attachmentId===u?g:[e]):[...b.images,...g]}:{...b,[t]:g.at(-1)??null}}});let x=await i();for(let e of g)d.current.delete(e.attachmentId);if(!x||v!==a()||_!==c.current){s();return}let S=n.current.id;S&&await Promise.all(g.map(async(t,r)=>{let i=h[r],s={draftId:S,attachmentId:t.attachmentId};if(!i||!p(s))return;let l=new AbortController;f.current.set(t.attachmentId,{owner:s,controller:l,generation:v});let u=e=>{let r=n.current.view;v===a()&&_===c.current&&r?.draft.id===S&&p(s)&&!l.signal.aborted&&o({view:{...r,review:null,attachments:[...r.attachments.filter(e=>e.id!==t.attachmentId),e]}})};try{let n=await Mj(e,S,t.attachmentId,i,l.signal);n.ok?u(n.value):u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:n.message})}catch(e){u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:e instanceof Error?e.message:`Reattach this file`})}finally{f.current.delete(t.attachmentId)}}))},g=e=>{l.current=null;let t=n.current.document;r({...t,fontUpload:null,form:{...t.form,subtitles:{...t.form.subtitles,fontId:e}}})},_=async o=>{let d=crypto.randomUUID();l.current=d,r({...n.current.document,fontUpload:{operationId:d,name:o.name}});let f=c.current,p=a();if(!await i()||p!==a()||f!==c.current){l.current===d&&(l.current=null),s();return}if(n.current.document.fontUpload?.operationId===d)try{let{font:r}=await Fj(e,o);if(p!==a()||f!==c.current||n.current.document.fontUpload?.operationId!==d)return;t.setQueryData(Nj,e=>({fonts:[...(e?.fonts??[]).filter(e=>e.id!==r.id),r]})),g(r.id),await i()}catch(e){p===a()&&f===c.current&&n.current.document.fontUpload?.operationId===d&&(u.current={operationId:d,message:e instanceof Error?e.message:`Reattach this font`},s())}finally{l.current===d&&(l.current=null,s())}},v=l.current!==null&&l.current===n.current.document.fontUpload?.operationId;return{attachmentUploading:e=>{let t=f.current.get(e);return d.current.get(e)===a()||t!==void 0&&t.generation===a()&&p(t.owner)&&!t.controller.signal.aborted},fontUpload:{pending:v,error:u.current?.operationId===n.current.document.fontUpload?.operationId?u.current?.message:void 0,pick:e=>{_(e)}},attach:h,selectFont:g,uploadSubtitleFont:_,fontUploading:v}}function hM(e,t,n){(0,m.useEffect)(()=>{let r=e=>[`prompts`,`entries`,`providers`,`provider-models`,`fonts`,`settings`].includes(String(e[0])),i=t.getQueryCache().subscribe(e=>{e.type===`updated`&&r(e.query.queryKey)&&(e.action.type===`success`||e.action.type===`invalidate`)&&n.invalidate()}),a=()=>{n.invalidate(),Bj(e,t),t.refetchQueries({queryKey:[`provider-models`]})};return window.addEventListener(`focus`,a),()=>{i(),window.removeEventListener(`focus`,a)}},[e,t,n])}function gM(){let{api:e}=B(),t=_(),[,n]=(0,m.useReducer)(e=>e+1,0),r=(0,m.useRef)(qj()),i=(0,m.useMemo)(()=>{let i,a=null,o=!1,s=0,c=!1,l=null,u=!0,d=e=>{r.current={...r.current,...e},u&&n()},f=()=>{clearTimeout(i),i=void 0},p=()=>{t.invalidateQueries({queryKey:[`play-drafts`]})},m=e=>{d({status:`error`,error:e instanceof Error?e.message:`Your latest changes weren't saved. Keep this page open and try again.`})},h=e=>e.ok?!0:(d({status:e.reason===`conflict`?`conflict`:`error`,error:e.message}),!1),g=e=>{b.restore(e),d({...qj(),document:e.draft.document,view:e,id:e.draft.id,clock:{edited:0,acknowledged:0,version:e.draft.version},status:`saved`}),Rj(e.draft.id),p()},_=async()=>{let t=s;for(;r.current.clock.edited>r.current.clock.acknowledged;){if(r.current.status===`conflict`||t!==s||l!==null&&l===r.current.id)return!1;let n=r.current,i=n.id??crypto.randomUUID(),a=n.pending??Kj(n.document,n.clock,crypto.randomUUID());d({id:i,pending:a,status:`saving`,error:null});try{let n=a.baseVersion===0?await wj(e,{id:i,document:a.document}):await Ej(e,{id:i,baseVersion:a.baseVersion,mutationId:a.mutationId,document:a.document});if(t!==s)return!1;if(!h(n))return n.reason!==`conflict`&&d({pending:null}),!1;let c=Gj(r.current.clock,{type:`acknowledge`,generation:a.generation,version:n.value.draft.version});if(d({clock:c,view:{...Yj(n.value,r.current),review:c.edited>c.acknowledged?null:n.value.review},pending:null,status:c.edited>c.acknowledged?`unsaved`:`saved`,error:null}),Rj(i),p(),!o)return!0}catch(e){return t===s&&m(e),!1}}return r.current.status!==`conflict`&&r.current.status!==`error`},v=()=>c?Promise.resolve(!1):a||(r.current.clock.edited===r.current.clock.acknowledged?Promise.resolve(!0):l!==null&&l===r.current.id?Promise.resolve(!1):(a=_().finally(()=>{a=null}),a)),y=()=>(f(),o=!0,v()),b=dM({api:e,queryClient:t,current:()=>r.current,flush:y,render:()=>{u&&n()}}),x=e=>{if(b.state().starting||b.state().uncertain||b.state().created)return;b.invalidate(JSON.stringify({...e,section:r.current.document.section})!==JSON.stringify(r.current.document));let t=r.current;d({document:e,clock:Gj(t.clock,{type:`edit`}),view:t.view?{...t.view,review:null}:null,status:t.status===`conflict`||t.status===`error`?t.status:`unsaved`}),f(),!(c||l!==null&&l===t.id||t.status===`conflict`||t.status===`error`)&&(t.id?i=setTimeout(()=>{y()},500):(o=!1,v()))},S=async(n,i=()=>!0)=>{if(b.state().starting||b.state().uncertain||b.state().created||(r.current.id!==n||r.current.status!==`conflict`)&&!await y()||!i())return!1;let a=++s,o=r.current.clock.edited;f();try{let c=await Tj(e,n);return a!==s||o!==r.current.clock.edited||!i()?!1:h(c)?(T=null,g(c.value),await Bj(e,t),i()):(r.current.id||d({recoveryId:n}),!1)}catch(e){return a===s&&o===r.current.clock.edited&&(m(e),r.current.id||d({recoveryId:n})),!1}},C=async()=>{if(b.state().starting||b.state().uncertain||b.state().created)return;let e=s;await y()&&e===s&&(s++,T=null,d(qj()),b.reset(),Rj(null))},w=async({id:t,version:n})=>{if(b.state().starting||b.state().uncertain||b.state().created)throw Error(`Resolve the pending Start before discarding a draft`);if(c||l!==null)throw Error(`Wait for the current draft operation before discarding`);let i=s;l=t,(r.current.id??r.current.recoveryId)===t&&f();try{a&&await a;let o=await Oj(e,{id:t,baseVersion:n});if(!o.ok&&o.reason!==`not-found`)throw Error(o.message);if(p(),i!==s||(r.current.id??r.current.recoveryId)!==t)return;f(),s++,T=null,d(qj()),b.reset(),Rj(null)}finally{l=null}},T=null;return{review:b,takeCreated:()=>{let e=b.state().created;if(!e)return null;s++,d(qj()),b.reset(),Rj(null);for(let e of[[`projects`],[`staging`],[`play-drafts`]])t.invalidateQueries({queryKey:e});return e},edit:x,flush:y,open:S,newDraft:C,discard:w,saveAsNew:async()=>{if(b.state().starting||b.state().uncertain||b.state().created||(f(),c||l!==null))return;a&&await a;let t=r.current;if(!t.id||!t.view&&t.status!==`conflict`){await y();return}let n=s;T?.sourceId!==t.id&&(T=null),T??={sourceId:t.id,id:crypto.randomUUID(),document:Kj(t.document,t.clock,crypto.randomUUID()).document,generation:t.clock.edited};let i=T;c=!0;try{let t=await Dj(e,{sourceId:i.sourceId,id:i.id,document:i.document});if(n!==s)return;if(!h(t)){t.reason===`conflict`&&(T=null);return}let a=r.current.clock.edited>i.generation?r.current.document:null;s++,g(t.value),T=null,c=!1,a&&x(Jj(i.document,t.value.draft.document,a))}catch(e){n===s&&m(e)}finally{c=!1}},navigate:async(e,t)=>{let n=s,i={...r.current.document,section:e};r.current.id||r.current.clock.edited>0?x(i):d({document:i}),await y()&&n===s&&d({reveal:{section:e,...t===void 0?{}:{field:t},sequence:(r.current.reveal?.sequence??0)+1}})},generation:()=>s,publish:d,start:()=>{u=!0;let e=zj();e&&S(e)},stop:()=>{u=!1,f()}}},[e,t]);(0,m.useEffect)(()=>(i.start(),i.stop),[i]),hM(e,t,i.review);let a=mM({api:e,queryClient:t,state:r,edit:i.edit,flush:i.flush,generation:i.generation,publish:i.publish,render:n}),o=r.current;return{...a,review:i.review.state(),reviewDraft:i.review.review,startRun:i.review.start,invalidateReview:i.review.invalidate,takeCreated:i.takeCreated,document:o.document,section:o.document.section,view:o.view,status:o.status,error:o.error,edited:o.clock.edited,acknowledged:o.clock.acknowledged,reveal:o.reveal,edit:i.edit,flush:i.flush,open:i.open,generation:i.generation,newDraft:i.newDraft,discard:i.discard,saveAsNew:i.saveAsNew,navigate:i.navigate,activeId:o.id??o.recoveryId}}var _M=(0,m.createContext)(null);function vM({children:e}){let t=gM();return(0,h.jsx)(_M.Provider,{value:t,children:e})}function yM(){let e=(0,m.useContext)(_M);if(!e)throw Error(`PlayDraftProvider is required`);return e}var bM=(0,m.createContext)(void 0);function xM({children:e}){let[t,n]=(0,m.useState)(()=>new Map),r=(0,m.useCallback)((e,t)=>{n(n=>{let r=n.get(e),i=typeof t==`function`?t(r):t;if(r===i)return n;let a=new Map(n);return i===void 0?a.delete(e):a.set(e,i),a})},[]),i=(0,m.useMemo)(()=>({prompts:t,updatePrompt:r}),[t,r]);return(0,h.jsx)(bM.Provider,{value:i,children:e})}function SM(e){let t=(0,m.useContext)(bM),[n,r]=(0,m.useState)(void 0),i=t?.updatePrompt,a=(0,m.useCallback)(t=>{i?i(e,t):r(t)},[e,i]);return[t?t.prompts.get(e):n,a]}function CM(e){return e.trim()===``?NaN:Number(e)}function wM(){let e=yM(),t=(0,m.useRef)(e);t.current=e;let n=e.document.form,r=t=>{if(!t)return;let n=e.view?.attachments.find(e=>e.id===t.attachmentId),r=n?.state===`ready`&&n.stagedFileId?{id:n.stagedFileId,stageKind:n.kind===`reference`?`images`:n.kind,path:n.stagedFileId,originalFilename:n.name,bytes:n.bytes,state:`staged`,createdAt:e.view?.draft.createdAt??``}:void 0;return{key:t.attachmentId,name:t.name,file:r,error:n?.error??(n?.state===`reattach`||!r&&!e.attachmentUploading(t.attachmentId)?`Reattach this file`:void 0)}},i={...n,sources:{...n.sources,document:qb(n.sources,`document`)},document:{theme:nx(n.document),...n.document?.custom===void 0?{}:{custom:n.document.custom}},imagePrompts:n.imagePrompts.map(e=>({...e,number:Number(e.number)})),chunking:n.chunking.mode===`words`?{mode:`words`,...n.chunking.words===``?{}:{words:Number(n.chunking.words)}}:n.chunking.mode===`characters`?{mode:`characters`,...n.chunking.characters===``?{}:{characters:Number(n.chunking.characters)}}:{mode:n.chunking.mode},subtitles:{...n.subtitles,fontSize:Number(n.subtitles.fontSize)},imageSeconds:CM(n.imageSeconds),edgeSilenceSeconds:CM(n.edgeSilenceSeconds),zoomPercent:CM(n.zoomPercent),provided:{research:n.provided.research,article:n.provided.article,audio:r(n.provided.audio),thumbnail:r(n.provided.thumbnail),...n.provided.reference===void 0?{}:{reference:r(n.provided.reference)},shortsMusic:r(n.provided.shortsMusic),images:n.provided.images.flatMap(e=>{let t=r(e);return t?[t]:[]})}},a=(0,m.useRef)(i);return a.current=i,[i,(0,m.useCallback)(e=>{let n=t.current.document,r=typeof e==`function`?e(a.current):e;a.current=r;let i=(e,t)=>e===void 0?``:Object.is(e,Number(t))?t:String(e),o=e=>e?{attachmentId:e.key,name:e.name}:null,{document:s,...c}=r.sources,{document:l,...u}=r,{shortsMusic:d}=r.provided,f=n.form.sources.document!==void 0||s!==`off`,p=n.form.document!==void 0||l.theme!==nx(n.form.document)||l.custom!==void 0;t.current.edit({...n,form:{...u,sources:f?r.sources:c,...p?{document:l}:{},imagePrompts:r.imagePrompts.map(e=>({...e,number:i(e.number,n.form.imagePrompts.find(t=>t.name===e.name)?.number??String(e.number))})),chunking:{...n.form.chunking,mode:r.chunking.mode,...r.chunking.mode===`words`?{words:i(r.chunking.words,n.form.chunking.words)}:{},...r.chunking.mode===`characters`?{characters:i(r.chunking.characters,n.form.chunking.characters)}:{}},subtitles:{...n.form.subtitles,...r.subtitles,fontSize:i(r.subtitles.fontSize,n.form.subtitles.fontSize)},imageSeconds:Object.is(r.imageSeconds,CM(n.form.imageSeconds))?n.form.imageSeconds:String(r.imageSeconds),edgeSilenceSeconds:Object.is(r.edgeSilenceSeconds,CM(n.form.edgeSilenceSeconds))?n.form.edgeSilenceSeconds:String(r.edgeSilenceSeconds),zoomPercent:Object.is(r.zoomPercent,CM(n.form.zoomPercent))?n.form.zoomPercent:String(r.zoomPercent),provided:{research:r.provided.research,article:r.provided.article,audio:o(r.provided.audio),thumbnail:o(r.provided.thumbnail),...r.provided.reference===void 0&&n.form.provided.reference===void 0?{}:{reference:o(r.provided.reference)},images:r.provided.images.map(e=>({attachmentId:e.key,name:e.name})),...d!==void 0||n.form.provided.shortsMusic!==void 0?{shortsMusic:o(d)}:{}}}})},[])]}var TM=`slopify.notifications.browser`,EM=`slopify.notifications.sent`,DM=6e4,OM=new Set;function kM(){return typeof window<`u`&&`Notification`in window}function AM(){return kM()?Notification.permission:`unsupported`}function jM(){try{return window.localStorage.getItem(TM)===`on`}catch{return!1}}function MM(e){try{e?window.localStorage.setItem(TM,`on`):window.localStorage.removeItem(TM)}catch{}for(let e of OM)e()}function NM(e){OM.add(e);let t=t=>{t.key===TM&&e()};return window.addEventListener(`storage`,t),()=>{OM.delete(e),window.removeEventListener(`storage`,t)}}function PM(){return jM()&&AM()===`granted`}function FM(e){if(e===`unsupported`)return`This browser can't show notifications. Use a current Chrome, Edge, Firefox or Safari, or set a Notification URL below instead.`;if(e===`denied`)return`Notifications are blocked for this site. Allow them in your browser's site settings (the icon left of the address bar), reload, then turn Browser notifications on again.`}async function IM(){return kM()?Notification.permission==="default"?await Notification.requestPermission():Notification.permission:`unsupported`}async function LM(e,t=Date.now){let n=()=>{let n={};try{let e=JSON.parse(window.localStorage.getItem(EM)??`{}`);typeof e==`object`&&e&&(n=Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&t()-e[1]<DM)))}catch{}if(n[e]!==void 0)return!1;try{window.localStorage.setItem(EM,JSON.stringify({...n,[e]:t()}))}catch{}return!0};try{if(typeof navigator<`u`&&navigator.locks!==void 0)return await navigator.locks.request(`slopify-run-notification`,n)}catch{}return n()}function RM(e,t){let n=new Notification(e.text.headline,{body:e.text.detail,tag:`slopify-run-${e.projectId}`});n.onclick=()=>{window.focus(),t(e.projectId),n.close()}}function zM(e,t){if(e===`running`)switch(t){case`done`:return`ready`;case`failed`:return`failed`;case`pending`:return`waiting`;default:return}}var BM=140;function VM(e){let t=e?.split(/\r?\n/).map(e=>e.trim()).find(e=>e!==``);if(t!==void 0)return t.length<=BM?t:`${t.slice(0,139).trimEnd()}…`}function HM(e,t){let n=t.title.trim()===``?`Untitled project`:t.title.trim();switch(e){case`ready`:return t.makesVideo?{headline:`Video ready: ${n}`,detail:`Open the project to watch it.`}:{headline:`Run finished: ${n}`,detail:`Open the project to see its files.`};case`failed`:{let e=VM(t.reason);return{headline:e===void 0?`Run failed: ${n}`:`Run failed: ${n} — ${e}`,detail:`Open the project to see what stopped it and press Retry.`}}case`waiting`:return{headline:`Waiting for you: ${n}`,detail:`Open the project to review the held step or press Resume.`}}}var UM={headline:`Slopify test notification`,detail:`Notifications work. You'll get one when a run finishes, fails or waits for you.`},WM=2048;function GM(e){let t=e.trim();if(t===``)return;if(t.length>2048)return`Keep the Notification URL to ${String(WM)} characters or fewer.`;let n;try{n=new URL(t)}catch{return`Enter a full address starting with https:// or http://, for example https://ntfy.sh/your-topic.`}if(n.protocol!==`https:`&&n.protocol!==`http:`)return`The Notification URL must start with https:// or http://.`;if(n.username!==``||n.password!==``)return`Remove the user name and password from the Notification URL; Slopify can't send them.`}function KM(e){let t=new Map,n=new Set,r=t=>{let r=t.catch(t=>{e.report(t)}).finally(()=>{n.delete(r)});n.add(r)},i=async(t,n,r)=>{let i=await e.subject(t);i!==void 0&&await e.claim(`${t}:${n}`)&&e.show({projectId:t,kind:r,text:HM(r,i)})};return{observe:n=>{let a=t.get(n.projectId);if(t.set(n.projectId,n.state),a===n.state)return;let o=zM(a,n.state);o!==void 0&&e.enabled()&&r(i(n.projectId,n.state,o))},seed:async()=>{try{for(let n of await e.seed())t.has(n.id)||t.set(n.id,n.status)}catch(t){e.report(t)}},settled:async()=>{for(;n.size>0;)await Promise.all([...n])}}}function qM(){let{api:e}=B(),t=_(),n=Wi(),r=(0,m.useRef)(n);r.current=n;let i=(0,m.useMemo)(()=>KM({enabled:PM,seed:async()=>(await t.fetchQuery({...xb(e),staleTime:5e3})).projects,subject:async t=>{let n=await bo(e,t);return{title:n.project.title,makesVideo:n.project.config.sources.video!==`off`,reason:n.stages.find(e=>e.state===`failed`)?.failureReason??void 0}},claim:e=>LM(e),show:e=>{RM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},report:e=>{console.warn(`Slopify couldn't show a run notification.`,e)}}),[e,t]);return(0,m.useEffect)(()=>(PM()&&i.seed(),NM(()=>{PM()&&i.seed()})),[i]),i}function JM(e,t){if(e===void 0)return;if(t.type===`project.state`)return{...e,project:{...e.project,status:t.state}};let n=e.stages.findIndex(e=>e.kind===t.stage),r=e.stages[n];return r===void 0?e:{...e,stages:e.stages.with(n,YM(r,t))}}function YM(e,t){return t.type===`stage.progress`?{...e,progressCurrent:t.current,progressTotal:t.total}:{...e,state:t.state,failureReason:t.failureReason??e.failureReason}}function XM(e,t){let n,r=!1,i=()=>{n=void 0,r&&(r=!1,e(),a())},a=()=>{n=setTimeout(i,t)};return{ask:()=>{if(n!==void 0){r=!0;return}e(),a()},stop:()=>{n!==void 0&&clearTimeout(n),n=void 0,r=!1}}}var ZM=[{id:`text-key`,title:`1. Connect a text provider`,target:`keys-llm`,page:`settings`},{id:`audio-key`,title:`2. Connect a voice provider`,target:`keys-tts`,page:`settings`},{id:`image-key`,title:`3. Connect an image provider`,target:`keys-image`,page:`settings`},{id:`voice`,title:`4. Add a narration voice`,target:`voices`,page:`settings`},{id:`article-name`,title:`5. Name your article prompt`,target:`prompt-name`,page:`article`},{id:`article-body`,title:`6. Write instructions with keywords`,target:`prompt-body`,page:`article`},{id:`article-keywords`,title:`7. Check the detected keywords`,target:`prompt-slots`,page:`article`},{id:`article-save`,title:`8. Save your article prompt`,target:`prompt-save`,page:`article`},{id:`image-prompt`,title:`9. Create an image prompt`,target:`prompt-editor`,page:`image`},{id:`image-save`,title:`10. Save your image prompt`,target:`prompt-save`,page:`image`},{id:`play-options`,title:`11. Name the project and choose text generation`,target:`play-options`,page:`play`},{id:`play-article`,title:`12. Choose your article`,target:`play-article`,page:`play`},{id:`play-keywords`,title:`13. Fill in your keywords`,target:`play-keywords`,page:`play`},{id:`play-audio`,title:`14. Choose narration`,target:`play-audio`,page:`play`},{id:`play-images`,title:`15. Choose images`,target:`play-images`,page:`play`},{id:`play-video`,title:`16. Choose video output`,target:`play-video`,page:`play`},{id:`play-subtitles`,title:`17. Style optional subtitles`,target:`play-subtitles`,page:`play`},{id:`play-start`,title:`18. Review and start your run`,target:`play-start`,page:`play`},{id:`project`,title:`19. Follow and control the run`,target:`project-controls`,page:`project`},{id:`download`,title:`20. Download your results`,target:`project-video`,page:`project`}];function QM(e,t){return e.active?t.type===`project-created`?{...e,projectId:t.id,step:ZM.findIndex(e=>e.id===`project`)}:t.kind===`article`?{...e,articleId:t.id}:t.kind===`image`?{...e,imageId:t.id}:e:e}function $M(e){let t=ZM.findIndex(t=>t.id===e);return t<0?void 0:t}var eN={"play-options":`content`,"play-article":`content`,"play-keywords":`content`,"play-audio":`outputs`,"play-images":`outputs`,"play-video":`outputs`,"play-subtitles":`style`,"play-start":`review`};function tN(e){return e.kind===`keyed`?e.hasKey:e.installed&&e.issue===void 0}var nN={research:`Research`,article:`Article`,audio:`Audio`,images:`Images`,thumbnail:`Thumbnail`,video:`Video`,document:`Document`};function rN(e){return e.sources.video===`off`?e.sources.audio===`off`?`article`:`audio`:`video`}function iN(e,t){return e===`video`&&rN(t)===`audio`?`Audio export`:nN[e]}function aN(e,t){return e.kind===`video`&&e.state===`running`&&t.subtitles!==void 0&&t.subtitles.mode!==`off`&&e.progressTotal===100&&(e.progressCurrent??0)<=35}var oN={research:(e,t)=>`chapter ${String(e)} of ${String(t)}`,article:(e,t)=>`${String(e)} of ${String(t)}`,audio:(e,t)=>`chunk ${String(e)} of ${String(t)}`,images:(e,t)=>`image ${String(e)} of ${String(t)}`,thumbnail:(e,t)=>`${String(e)} of ${String(t)}`,video:(e,t)=>`${String(mN(e,t))}% rendered`,document:(e,t)=>`${String(e)} of ${String(t)}`},sN={audio_intro:`intro`,audio_body:`body`,audio_outro:`outro`};function cN(e,t,n,r=!1){let i=t.filter(t=>t.stageKind===e.kind);switch(e.state){case`skipped`:return`Not part of this run`;case`pending`:return n.status===`paused`||r?`Waiting for Resume`:e.kind===`images`||e.kind===`thumbnail`&&e.source===`from_prompt`?`Ready to run`:`Waits for the stages above`;case`provided`:return dN(i)??`Provided`;case`failed`:return`Stopped after ${lN(e)}`;case`canceled`:return`Canceled by user`;case`running`:return aN(e,n.config)?`Preparing subtitles · ${String(mN(e.progressCurrent??0,35))}%`:e.kind===`video`&&rN(n.config)===`audio`?`Exporting combined audio`:e.progressTotal===null||e.progressTotal<=0?`Running`:oN[e.kind](e.progressCurrent??0,e.progressTotal);case`done`:return uN(e.kind,i,n)}}function lN(e){return e.attemptCount===1?`1 attempt`:`${String(e.attemptCount)} attempts`}function uN(e,t,n){switch(e){case`research`:return`Notes ready`;case`article`:{let e=t.filter(e=>e.role===`sources`||e.role===`glossary`);return e.length===0?`Article ready`:`Article and ${String(e.length)} end-matter files`}case`audio`:return vN([gN(t.flatMap(e=>{let t=sN[e.role];return t===void 0?[]:[t]})),pN(fN(t))]);case`images`:return hN(t.filter(e=>e.role===`image`).length,`image`);case`thumbnail`:return t.length===0?`Thumbnail ready`:`1 image`;case`video`:return vN([pN(fN(t)),rN(n.config)===`audio`?`WAV · stereo · 48 kHz`:n.format]);case`document`:return`PDF · ${rx(n.config.document)} theme`}}function dN(e){let t=e.flatMap(e=>e.originalFilename===null?[]:[e.originalFilename]);return t.length===0?void 0:t.join(`, `)}function fN(e){let t=Math.max(0,...e.map(e=>e.durationMs??0));return t===0?void 0:t}function pN(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=Math.round(e/1e3),n=[Math.floor(t/60)%60,t%60].map(e=>String(e).padStart(2,`0`)),r=Math.floor(t/3600);return r===0?n.join(`:`):[String(r),...n].join(`:`)}function mN(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function hN(e,t){return e===1?`1 ${t}`:`${String(e)} ${t}s`}function gN(e){if(e.length!==0)return e.length===1?_N(e[0]??``):_N(`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]??``}`)}function _N(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vN(e){return e.filter(e=>e!==void 0&&e!==``).join(` · `)}var yN=12,bN=16;function xN(e,t,n){return Math.max(t,Math.min(e,Math.max(t,n)))}function SN(e,t,n){let r=Math.min(n.width,t.width-24),i=xN(e?.left??(t.width-r)/2,yN,t.width-r-yN),a=xN((e?.top??0)+((e?.height??t.height)-n.height)/2,yN,t.height-n.height-yN),o=t.height-n.height-yN;if(!e)return{left:i,top:a,width:r,docked:!1};let s=e.left+e.width,c=e.top+e.height;return s+bN+r<=t.width-yN?{left:s+bN,top:a,width:r,docked:!1}:e.left-bN-r>=yN?{left:e.left-bN-r,top:a,width:r,docked:!1}:c>=yN&&c+bN+n.height<=t.height-yN?{left:i,top:c+bN,width:r,docked:!1}:e.top-bN-n.height>=yN&&e.top<=t.height-yN?{left:i,top:e.top-bN-n.height,width:r,docked:!1}:{left:t.width-r-yN,top:Math.max(yN,o),width:r,docked:!0}}function CN(e,t,n=t.height){let r=xN(e.left-6,0,t.width),i=xN(e.top-6,0,Math.min(n,t.height)),a=xN(e.left+e.width+6,0,t.width),o=xN(e.top+e.height+6,0,Math.min(n,t.height));return a>r&&o>i?{left:r,top:i,width:a-r,height:o-i}:null}var wN=`[data-slot="select-content"], [data-slot="dropdown-menu-content"]`;function TN(e){try{return document.querySelector(e)}catch{return null}}function EN(){return[...document.querySelectorAll(`[data-slot="dialog-content"][data-state="open"]`)].at(-1)??null}function DN(e){if(!e)return[];let t=[e,...e.querySelectorAll(`[aria-controls]`)],n=new Set(t.flatMap(e=>(e.getAttribute(`aria-controls`)??``).split(` `)));return[...document.querySelectorAll(wN)].filter(e=>n.has(e.id))}function ON(e){let t=e.getBoundingClientRect();return t.width>0&&t.height>0?{left:t.left,top:t.top,width:t.width,height:t.height}:null}var kN=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable="true"]`;function AN(e,t,n,r){let i=(0,m.useRef)(document.activeElement),a=(0,m.useRef)(t);a.current=t,(0,m.useEffect)(()=>{let e=i.current;return()=>{queueMicrotask(()=>{e instanceof HTMLElement&&e.isConnected&&!n.current&&e.focus({preventScroll:!0})})}},[n]),(0,m.useEffect)(()=>{let t=()=>{let t=TN(e);return[t,n.current,...DN(t)].filter(e=>e!==null)},i=e=>e instanceof Node&&t().some(t=>t.contains(e)),o=e=>{EN()||i(e.target)||(e.preventDefault(),e.stopImmediatePropagation())},s=e=>{EN()||i(e.target)||e.target instanceof HTMLElement&&e.target.hasAttribute(`data-radix-focus-guard`)||r.current?.focus({preventScroll:!0})},c=n=>{if(EN())return;let r=DN(TN(e));if(n.key===`Escape`){if(r.length>0)return;n.preventDefault(),n.stopImmediatePropagation(),a.current();return}if(n.key!==`Tab`){i(n.target)||o(n);return}if(r.length>0)return;let s=t().flatMap(e=>[e,...e.querySelectorAll(kN)]).filter((e,t,n)=>n.indexOf(e)===t&&e.tabIndex>=0&&!e.matches(`:disabled, [hidden], [aria-hidden='true']`)&&!e.closest(`[hidden], [inert]`)&&(!e.closest(`details:not([open])`)||e.closest(`summary`)!==null));if(s.length===0)return;let c=s.indexOf(document.activeElement),l=c===-1?n.shiftKey?s.length-1:0:(c+(n.shiftKey?-1:1)+s.length)%s.length;n.preventDefault(),s[l]?.focus()},l=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`click`,`dblclick`,`contextmenu`];for(let e of l)window.addEventListener(e,o,!0);return window.addEventListener(`keydown`,c,!0),window.addEventListener(`focusin`,s,!0),()=>{for(let e of l)window.removeEventListener(e,o,!0);window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`focusin`,s,!0)}},[e,n,r])}function jN(e,t,n,r,i,a){let[o,s]=(0,m.useState)(()=>({key:e,target:null,portals:[],width:window.innerWidth,height:window.innerHeight,cardHeight:260,modalOpen:EN()!==null}));return(0,m.useLayoutEffect)(()=>{let o=0,c=0,l=null,u=null,d=new Map,f=new ResizeObserver(()=>h()),p=e=>{for(let[t,n]of d)e.has(t)||(t.style.zIndex=n,d.delete(t))},m=()=>{o=0;let r=TN(t);r!==u&&(u&&f.unobserve(u),r&&f.observe(r),u=r);let i=r?ON(r):null;r&&i&&l!==r&&(l=r,cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=0,r.isConnected&&(r.scrollIntoView({block:`start`,inline:`nearest`,behavior:`instant`}),m())}));let a=DN(r),h=new Set;for(let e of a){let t=e.closest(`[data-radix-popper-content-wrapper]`)??e;h.add(t),d.has(t)||(d.set(t,t.style.zIndex),t.style.zIndex=`102`)}p(h);let g={key:e,target:i,portals:a.map(ON).filter(e=>e!==null),width:window.innerWidth,height:window.innerHeight,cardHeight:n.current?.getBoundingClientRect().height||260,modalOpen:EN()!==null};s(e=>JSON.stringify(e)===JSON.stringify(g)?e:g)};function h(){o||=requestAnimationFrame(m)}let g=new MutationObserver(e=>{e.some(e=>!i.current?.contains(e.target)&&e.target!==a.current)&&h()});return g.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`id`,`class`,`style`,`hidden`,`aria-controls`,`data-state`,`data-tour`]}),n.current&&f.observe(n.current),f.observe(document.documentElement),window.addEventListener(`resize`,h),window.addEventListener(`scroll`,h,!0),window.visualViewport?.addEventListener(`resize`,h),window.visualViewport?.addEventListener(`scroll`,h),m(),EN()||r.current?.focus({preventScroll:!0}),()=>{cancelAnimationFrame(o),cancelAnimationFrame(c),f.disconnect(),g.disconnect(),window.removeEventListener(`resize`,h),window.removeEventListener(`scroll`,h,!0),window.visualViewport?.removeEventListener(`resize`,h),window.visualViewport?.removeEventListener(`scroll`,h),p(new Set)}},[e,t,n,r,i,a]),o}function MN({stepId:e,target:t,title:n,children:r,progress:i,onNext:a,onBack:o,onClose:s,nextLabel:c=`Next`,nextDisabled:l=!1,onSkip:u,skipLabel:d=`Skip this step`}){let f=(0,m.useId)(),p=`${e}:${t}`,g=(0,m.useRef)(null),_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=(0,m.useRef)(null),b=jN(p,t,g,_,v,y);AN(t,s,g,_);let[x,S]=(0,m.useState)({key:p,height:0}),C=b.key===p?b.target:null,w={width:b.width,height:b.height},T={width:Math.min(360,w.width-24),height:b.cardHeight},E=SN(C,w,T),D=C?CN(C,w,E.docked?E.top-12:w.height):null,O=b.key===p?b.portals.map(e=>CN(e,w)).filter(e=>e!==null):[],k=[...D?[D]:[],...O],ee=`M0 0H${w.width}V${w.height}H0Z`+(D?`M${D.left} ${D.top}H${D.left+D.width}V${D.top+D.height}H${D.left}Z`:``);(0,m.useLayoutEffect)(()=>{S(e=>{let t=Math.max(e.key===p?e.height:0,E.docked?T.height+24:0);return e.key===p&&e.height===t?e:{key:p,height:t}})},[p,E.docked,T.height]);let A=x.key===p?x.height:0;return(0,m.useEffect)(()=>{let e=document.documentElement,t=e.style.scrollPaddingBottom;return e.style.scrollPaddingBottom=`${A}px`,()=>{e.style.scrollPaddingBottom=t}},[A]),(0,nu.createPortal)((0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{ref:y,"aria-hidden":`true`,style:{height:A}}),(0,h.jsxs)(`div`,{ref:v,hidden:b.modalOpen,"data-tutorial":`spotlight`,className:`pointer-events-none fixed inset-0 z-[100] font-sans`,children:[(0,h.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 h-full w-full`,width:w.width,height:w.height,children:[(0,h.jsx)(`defs`,{children:(0,h.jsxs)(`mask`,{id:`${f}-mask`,children:[(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`}),k.map(e=>(0,h.jsx)(`rect`,{x:e.left,y:e.top,width:e.width,height:e.height,rx:`6`,fill:`black`},`${e.left}:${e.top}:${e.width}:${e.height}`))]})}),(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`rgb(0 0 0 / 0.72)`,mask:`url(#${f}-mask)`}),(0,h.jsx)(`path`,{d:ee,fill:`transparent`,fillRule:`evenodd`,pointerEvents:`fill`}),D&&(0,h.jsx)(`rect`,{"data-tutorial":`hole`,x:D.left,y:D.top,width:D.width,height:D.height,rx:`6`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`2`})]}),(0,h.jsxs)(`section`,{ref:g,"aria-label":`Interactive getting started guide`,"aria-describedby":`${f}-instructions`,"data-tutorial":`card`,className:`pointer-events-auto fixed z-[101] flex flex-col gap-3 rounded-panel border border-line2 bg-panel p-4 text-body text-ink shadow-[0_8px_24px_var(--color-shadow)]`,style:{left:E.left,top:E.top,width:E.width,maxHeight:Math.min(w.height-24,Math.max(160,Math.min(420,w.height*.48)))},children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,h.jsxs)(`span`,{className:`engraved text-run-text`,children:[`Getting started · `,i]}),(0,h.jsx)(V,{variant:`ghost`,onClick:s,"aria-label":`Exit guide`,className:`h-7 px-2`,children:`Exit`})]}),(0,h.jsx)(`h2`,{ref:_,id:`${f}-title`,tabIndex:-1,className:`shrink-0 text-title font-bold outline-none`,children:n}),(0,h.jsxs)(`div`,{id:`${f}-instructions`,className:`min-h-0 overflow-y-auto text-ink2 [&_p+p]:mt-2 [&_code]:text-ink`,children:[r,!C&&(0,h.jsx)(`p`,{role:`status`,className:`mt-3 text-amber`,children:`This section is not available yet. Wait for the page to load, go back, or exit the guide.`}),E.docked&&C&&(0,h.jsx)(`p`,{className:`mt-3 text-small`,children:`Scroll the page to work through the highlighted section.`})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-line pt-3`,children:[o&&(0,h.jsx)(V,{onClick:o,children:`Back`}),u&&(0,h.jsx)(V,{variant:`ghost`,onClick:u,className:`px-2`,children:d}),(0,h.jsx)(V,{variant:`primary`,onClick:a,disabled:l||!C,className:`ml-auto`,children:c})]})]})]})]}),document.body)}function NN({href:e,children:t}){return(0,h.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-ink underline underline-offset-2`,children:t})}function PN({text:e}){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(`p`,{className:`select-text rounded-control border border-line2 bg-panel2 p-3 text-small leading-relaxed`,children:e}),(0,h.jsx)(V,{onClick:()=>{if(i(!1),!navigator.clipboard){i(!0);return}navigator.clipboard.writeText(e).then(()=>n(!0),()=>i(!0))},children:t?`Copied`:`Copy example`}),r?(0,h.jsx)(`p`,{role:`status`,children:`Select the example above and copy it manually.`}):null]})}function FN({step:e}){switch(e){case`text-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`First, choose what will write your scripts. You only need one text provider.`}),(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Sign in to `,(0,h.jsx)(NN,{href:`https://openrouter.ai/settings/keys`,children:`OpenRouter`}),`, create an API key, and make sure the account can use your chosen model.`]}),(0,h.jsxs)(`li`,{children:[`Paste it into OpenRouter’s `,(0,h.jsx)(`strong`,{children:`API key`}),` field here and press`,` `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]})]}),(0,h.jsx)(`p`,{children:`Already using Claude Code, Codex or Gemini CLI? You can use its existing CLI login instead. “Installed” means Slopify found the CLI; sign in through that CLI before generating. If it is missing, enter its executable path and save to check again.`}),(0,h.jsx)(`p`,{className:`text-ink3`,children:`These are the real Settings controls. The tutorial never reads your key. Skip any step you have already handled.`})]});case`audio-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The voice provider turns the finished article into audio. Choose`,` `,(0,h.jsx)(`strong`,{children:`ElevenLabs`}),`, `,(0,h.jsx)(`strong`,{children:`OpenAI`}),`, or `,(0,h.jsx)(`strong`,{children:`Cartesia`}),`; you do not need all three.`]}),(0,h.jsxs)(`p`,{children:[`Create a key in your provider’s account, enable the API access or credits it requires, then paste the key into its row and press `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(NN,{href:`https://elevenlabs.io/app/developers/api-keys`,children:`ElevenLabs keys`}),` `,`· `,(0,h.jsx)(NN,{href:`https://platform.openai.com/api-keys`,children:`OpenAI keys`}),` ·`,` `,(0,h.jsx)(NN,{href:`https://play.cartesia.ai/keys`,children:`Cartesia keys`})]}),(0,h.jsx)(`p`,{children:`Next, you’ll add the exact voice that this provider should use. Skip voice setup if you plan to provide your own narration or turn Audio Off.`})]});case`image-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Choose one image provider, create a key in its dashboard, paste it into the matching row, and press `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(NN,{href:`https://fal.ai/dashboard/keys`,children:`fal.ai`}),` ·`,` `,(0,h.jsx)(NN,{href:`https://replicate.com/account/api-tokens`,children:`Replicate`}),` ·`,` `,(0,h.jsx)(NN,{href:`https://aistudio.google.com/apikey`,children:`Google AI Studio`}),` ·`,` `,(0,h.jsx)(NN,{href:`https://platform.openai.com/api-keys`,children:`OpenAI`})]}),(0,h.jsxs)(`p`,{children:[`A saved key is not a billing check. The selected image model needs available quota. If Google reports `,(0,h.jsx)(`strong`,{children:`limit: 0`}),`, check the key’s project, billing and image-model quota before retrying.`]}),(0,h.jsx)(`p`,{children:`OpenAI’s voice and image rows are saved separately, even when you use the same API key. Skip this step if you plan to provide your own images or turn Images and Thumbnail Off.`})]});case`voice`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Voice name`}),` you will recognize, such as “Travel narrator.”`]}),(0,h.jsxs)(`li`,{children:[`Select the `,(0,h.jsx)(`strong`,{children:`Provider`}),` whose voice key you saved.`]}),(0,h.jsxs)(`li`,{children:[`Copy the exact `,(0,h.jsx)(`strong`,{children:`Voice ID`}),` from that provider’s voice library or documentation.`]}),(0,h.jsxs)(`li`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Add voice`}),`.`]})]}),(0,h.jsx)(`p`,{children:`The name is your label; the ID tells the provider which voice to use. Slopify checks the ID with the provider when narration runs. A voice is only required when Audio is set to Generate.`})]})}}var IN=`Write a 150-word narration about {{topic}} for {{audience}}. Open with an interesting fact, explain three highlights, and end with one memorable takeaway. Use natural spoken English. Return only the narration, without headings or stage directions.`,LN=`A cinematic editorial photograph of {{topic}}, with natural light, a clear focal point, rich detail, and no text or logos. Compose it for a travel video.`;function RN({step:e,output:t=`video`}){switch(e){case`text-key`:case`audio-key`:case`image-key`:case`voice`:return(0,h.jsx)(FN,{step:e});case`article-name`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`A prompt is a reusable set of instructions. This one will write the narration for each video.`}),(0,h.jsxs)(`p`,{children:[`Give it a recognizable name, such as `,(0,h.jsx)(`strong`,{children:`Short travel narration`}),`. This is the prompt’s library name, not your video’s title.`]}),(0,h.jsx)(`p`,{children:`The next steps will add its instructions and reusable keywords.`})]});case`article-body`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Tell the model what to write, who it is for, the length, and the style. Put anything you want to change between runs inside double braces.`}),(0,h.jsx)(PN,{text:IN}),(0,h.jsxs)(`p`,{children:[`Paste or write the instructions in `,(0,h.jsx)(`strong`,{children:`Body`}),`. `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` `,`and `,(0,h.jsx)(`strong`,{children:`{{audience}}`}),` will become fields on Play.`]})]});case`article-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`This panel detects your keywords as you type. With the example, it should list`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`{{topic}}`}),` is a field name, not the value. You will enter “Albania” on Play later. Repeated names use the same value; names are case-sensitive, so`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`Topic`}),` are different.`]}),(0,h.jsxs)(`p`,{children:[`There are no automatic keywords: `,(0,h.jsx)(`strong`,{children:`{{title}}`}),` would also ask you for a value. Fix any keyword warnings in Body before saving.`]})]});case`article-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press the highlighted `,(0,h.jsx)(`strong`,{children:`Save`}),` button in the editor. The prompt will appear in your Article library.`]}),(0,h.jsx)(`p`,{children:`The tour continues when the save succeeds and the editor returns to the prompt list. If a name is already taken, go Back and choose another.`})]});case`image-prompt`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Keep `,(0,h.jsx)(`strong`,{children:`Kind`}),` on `,(0,h.jsx)(`strong`,{children:`Image`}),`. Name this prompt`,` `,(0,h.jsx)(`strong`,{children:`Travel imagery`}),`, then enter this example or your own visual instructions.`]}),(0,h.jsx)(PN,{text:LN}),(0,h.jsxs)(`p`,{children:[`Using `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` in both prompts creates one shared field on Play. Image prompts describe the picture directly; they do not automatically receive your article.`]})]});case`image-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Save`}),` to add this to your Image library. Next you will combine both prompts on Play.`]}),(0,h.jsx)(`p`,{children:`You can create more prompts later for different subjects, styles, lengths, or languages.`})]});case`play-article`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Play is where you configure one project. Leave `,(0,h.jsx)(`strong`,{children:`Article`}),` on`,` `,(0,h.jsx)(`strong`,{children:`Generate`}),`, then select the article prompt you saved.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Provide`}),` is for an article you already have. For this first run, use Generate and keep the script short. Article is required; every other stage can be Off.`]}),(0,h.jsx)(`p`,{children:`Research starts Off. You can turn it on in a later run for web-grounded notes that are automatically passed to the article writer.`})]});case`play-audio`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Audio`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Pick your voice`,` `,(0,h.jsx)(`strong`,{children:`TTS`}),` provider, a `,(0,h.jsx)(`strong`,{children:`TTS model`}),`, then the saved`,` `,(0,h.jsx)(`strong`,{children:`Voice`}),`.`]}),(0,h.jsxs)(`p`,{children:[`Keep chunking on `,(0,h.jsx)(`strong`,{children:`Whole`}),` for the short example: the narration is sent as one request. Other chunking modes split longer text into pieces.`]}),(0,h.jsx)(`p`,{children:`Use Provide to upload existing narration, including any intro and outro in that file, or Off to skip narration. Video can still run silently, with each image shown for 5 seconds.`})]});case`play-images`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Images`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Choose the image`,` `,(0,h.jsx)(`strong`,{children:`Provider`}),` and `,(0,h.jsx)(`strong`,{children:`Model`}),`, select your image prompt, and set`,` `,(0,h.jsx)(`strong`,{children:`Number`}),` to 2 for a small first run.`]}),(0,h.jsx)(`p`,{children:`Number means separate images made from that same prompt. It does not make one scene per article paragraph. Add more image prompts when you want different scenes.`}),(0,h.jsx)(`p`,{children:`Use Provide for your own images or Off to skip them. Turning Images Off also turns Video Off. Thumbnail remains independent; keep it Off for this first run.`})]});case`play-video`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Choose `,(0,h.jsx)(`strong`,{children:`Generate`}),` for an MP4 slideshow. It needs generated or provided images. With Audio Off, the video is silent and each image lasts 5 seconds.`]}),(0,h.jsxs)(`p`,{children:[`Choose `,(0,h.jsx)(`strong`,{children:`Off`}),` to skip video. If Audio is active, Slopify exports one combined `,(0,h.jsx)(`strong`,{children:`WAV`}),` with the intro, body, outro and configured gaps.`]}),(0,h.jsx)(`p`,{children:`If both Audio and Video are Off, download the article and any other enabled outputs individually.`})]});case`play-subtitles`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Subtitles are optional and start `,(0,h.jsx)(`strong`,{children:`Off`}),`. Choose`,` `,(0,h.jsx)(`strong`,{children:`Subtitle files`}),` for SRT and VTT downloads, or`,` `,(0,h.jsx)(`strong`,{children:`Burn into video + files`}),` to keep captions visible in an MP4.`]}),(0,h.jsxs)(`p`,{children:[`English captions are timed locally from your narration with no paid API. First use downloads an approximately `,(0,h.jsx)(`strong`,{children:`95 MB`}),` speech model. Audio must be active; WAV exports support separate subtitle files.`]}),(0,h.jsx)(`p`,{children:`Pick a font or upload a TTF/OTF file, then adjust its size in the preview. Styling applies to burned captions. You can also add or change subtitles on a completed project later without regenerating its narration.`})]});case`play-options`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Project title`}),`, such as “A quick trip to Albania.” Set the title in Content.`]}),(0,h.jsxs)(`p`,{children:[`Select the text `,(0,h.jsx)(`strong`,{children:`LLM`}),` and `,(0,h.jsx)(`strong`,{children:`Text model`}),`. The model list loads for your provider. Use `,(0,h.jsx)(`strong`,{children:`Refresh`}),` for updated choices or`,` `,(0,h.jsx)(`strong`,{children:`Custom ID`}),`to enter an exact model ID when supported.`]}),(0,h.jsx)(`p`,{children:`Intro and Outro are available in Outputs when Audio is Generate. The LLM controls appear only when an enabled stage needs text generation.`})]});case`play-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The prompts you picked created these fields. For the examples, enter`,` `,(0,h.jsx)(`strong`,{children:`Albania`}),` for `,(0,h.jsx)(`strong`,{children:`topic`}),` and`,` `,(0,h.jsx)(`strong`,{children:`first-time travelers`}),` for `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsxs)(`p`,{children:[`A field under `,(0,h.jsx)(`strong`,{children:`Common`}),` feeds both the article and images. Changing it changes both prompts for this run.`]}),(0,h.jsx)(`p`,{children:`Fill every visible field. Each value must fit on one line and be no more than 200 characters. Your saved prompt keeps its braces so you can reuse it next time.`})]});case`play-start`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Review the enabled outputs, costs and readiness in Review. If anything is missing, use Back to fix the highlighted section.`}),(0,h.jsxs)(`p`,{children:[`When ready, press the real `,(0,h.jsx)(`strong`,{children:`Start run`}),` or `,(0,h.jsx)(`strong`,{children:`Queue N`}),` `,`button. This creates a project and sends generation requests to your chosen providers, which may charge your account.`]}),(0,h.jsx)(`p`,{children:`The tour will follow you to the project. You can also finish the tutorial without generating anything.`})]});case`project`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The rundown under the title shows overall progress and every stage. Select a stage to see its results or live writing. Press `,(0,h.jsx)(`strong`,{children:`Pause`}),` to stop active requests safely and keep finished work.`]}),(0,h.jsxs)(`p`,{children:[`Open the `,(0,h.jsx)(`strong`,{children:`Edit`}),` tab and press `,(0,h.jsx)(`strong`,{children:`Edit project`}),` to change providers, models, voice, prompts or optional steps.`,(0,h.jsx)(`strong`,{children:` Save changes`}),` keeps a new revision without starting generation.`,(0,h.jsx)(`strong`,{children:` Rebuild affected outputs`}),`, beside it, reviews the required work and cost before starting. Finished outputs remain available in the `,(0,h.jsx)(`strong`,{children:`History`}),` `,`tab.`]}),(0,h.jsxs)(`p`,{children:[`Select a failed stage and open `,(0,h.jsx)(`strong`,{children:`Error details`}),` to read the provider’s message. `,(0,h.jsx)(`strong`,{children:`Retry stage`}),` keeps completed outputs; its menu offers a full re-run of that section.`]})]});case`download`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[t===`audio`?(0,h.jsxs)(h.Fragment,{children:[`When Audio export finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Audio (.wav)`}),` for the combined narration.`]}):t===`article`?(0,h.jsxs)(h.Fragment,{children:[`Use `,(0,h.jsx)(`strong`,{children:`Download`}),` here to save the article. Audio and Video are Off for this project.`]}):(0,h.jsxs)(h.Fragment,{children:[`When Video finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Video (.mp4)`}),`.`]}),` `,`The completed project stays in `,(0,h.jsx)(`strong`,{children:`Projects`}),` so you can return to it.`]}),(0,h.jsxs)(`p`,{children:[`Select Article, Audio or Images in `,(0,h.jsx)(`strong`,{children:`Stages`}),` to download their outputs.`,` `,(0,h.jsx)(`strong`,{children:`Download all`}),` under Images gives an image ZIP, not the video.`]}),(0,h.jsxs)(`p`,{children:[`If subtitles are enabled, download the `,(0,h.jsx)(`strong`,{children:`.srt`}),` or `,(0,h.jsx)(`strong`,{children:`.vtt`}),` `,`files beside the final export. File-mode captions are also available in the video player.`]}),(0,h.jsxs)(`p`,{children:[`You have reached the end. Open `,(0,h.jsx)(`strong`,{children:`Tutorial`}),` in the navigation anytime to walk through these steps again.`]})]})}}function zN(e){return tN(e.readiness)}function BN({session:e,progress:t,update:n}){let{api:r}=B(),i=yM(),a=Wi(),o=ja(),s=I(Cb(r)),c=I(Tb(r)),l=I(Eb(r)),u=I({...Sb(r,e.projectId??``),enabled:e.projectId!==void 0}),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(null),g=ZM[e.step],_=s.data?.seen===!0;if((0,m.useEffect)(()=>{if(_&&g&&p.current!==e.step){if(p.current=e.step,g.page===`settings`){let e=g.id===`voice`?`voices`:`providers`;(o.pathname!==`/settings`||!o.searchStr.includes(`section=${e}`))&&a({to:`/settings`,search:{section:e}})}if(g.page===`article`||g.page===`image`){let t=g.page===`article`?e.articleId:e.imageId,n=o.pathname===`/prompts/new`&&o.searchStr.includes(`kind=${g.page}`);t&&o.pathname!==`/prompts/${t}`?a({to:`/prompts/$promptId`,params:{promptId:t}}):!t&&!n&&a({to:`/prompts/new`,search:{kind:g.page}})}g.page===`play`&&o.pathname!==`/play`&&a({to:`/play`}),g.page===`project`&&e.projectId&&o.pathname!==`/projects/${e.projectId}`&&a({to:`/projects/$projectId`,params:{projectId:e.projectId}})}},[_,g,e.step,e.articleId,e.imageId,e.projectId,o.pathname,o.searchStr,a]),(0,m.useEffect)(()=>{if(!_||g?.page!==`play`||o.pathname!==`/play`)return;let e=!0;return f(null),i.navigate(eN[g.id]).then(()=>{e&&f(g.id)}),()=>{e=!1}},[_,g,o.pathname,i.navigate]),(0,m.useEffect)(()=>{o.pathname===`/prompts`&&(g?.id===`image-prompt`&&e.imageId?n(e=>({...e,step:ZM.findIndex(e=>e.id===`play-options`)})):(g?.id===`article-save`&&e.articleId||g?.id===`image-save`&&e.imageId)&&n(e=>({...e,step:e.step+1})))},[o.pathname,g?.id,e.articleId,e.imageId,n]),!_||!g||g.page===`play`&&(d!==g.id||i.section!==eN[g.id]))return null;let v=c.data?.providers??[],y=e=>v.some(t=>t.family===e&&zN(t)),b=(l.data?.voices??[]).some(e=>v.some(t=>t.id===e.provider&&zN(t))),x={"text-key":y(`llm`),"audio-key":y(`tts`),"image-key":y(`image`),voice:b,"article-name":t.promptIsArticle===!0&&t.promptNamed===!0,"article-body":t.promptIsArticle===!0&&t.promptBodyReady===!0&&t.promptHasKeywords===!0,"article-keywords":t.promptHasKeywords===!0,"article-save":!1,"image-prompt":t.promptIsImage===!0&&t.promptSaveReady===!0&&t.promptHasKeywords===!0,"image-save":!1,"play-article":t.playArticleReady===!0,"play-audio":t.playAudioReady===!0,"play-images":t.playImagesReady===!0,"play-video":t.playVideoReady===!0,"play-subtitles":t.playSubtitlesReady===!0,"play-options":t.playOptionsReady===!0,"play-keywords":t.playKeywordsReady===!0,"play-start":!1},S=()=>n(e=>({...e,active:!1})),C=()=>{e.step===ZM.length-1||g.id===`play-start`?S():n(e=>({...e,step:e.step+1}))},w=u.data?rN(u.data.project.config):`video`,T=g.id===`download`&&w===`article`?`project-article`:g.id===`play-keywords`&&t.playHasKeywords===!1?`play-options`:g.target,E=g.id===`article-save`||g.id===`image-save`,D=(g.page===`article`||g.page===`image`)&&t.promptSaving===!0;return(0,h.jsxs)(MN,{stepId:g.id,target:`[data-tour="${T}"]`,title:g.title,progress:`${e.step+1} of ${ZM.length} · First project`,onClose:S,...e.step===0||g.id===`project`||D?{}:{onBack:()=>n(e=>({...e,step:e.step-1}))},onNext:C,nextDisabled:D||x[g.id]===!1,nextLabel:E?`Use Save in the editor`:g.id===`play-start`?`Use Start run / Queue N on the page`:g.id===`download`?`Finish tutorial`:`Next`,...D?{}:{onSkip:C},skipLabel:g.id===`play-start`?`Finish without generating`:E?`Skip without saving`:`Skip this step`,children:[(0,h.jsx)(RN,{step:g.id,output:w}),c.error||l.error?(0,h.jsx)(`p`,{className:`text-red`,children:c.error?.message??l.error?.message}):null]})}var VN=q({schemaVersion:GO(1),active:wO(),stepId:J([`text-key`,`audio-key`,`image-key`,`voice`,`article-name`,`article-body`,`article-keywords`,`article-save`,`image-prompt`,`image-save`,`play-options`,`play-article`,`play-keywords`,`play-audio`,`play-images`,`play-video`,`play-subtitles`,`play-start`,`project`,`download`]),articleId:W().optional(),imageId:W().optional(),projectId:W().optional()}).strict();q({baseVersion:G().int().nonnegative(),mutationId:rO(),session:VN}).strict();var HN=q({version:G().int().nonnegative(),session:VN,readable:wO()}).strict();async function UN(e){let t=await $a(await e.client.tutorial.$get()),n=HN.safeParse(t);return n.success?n.data:{version:0,readable:!1,session:{schemaVersion:1,active:!1,stepId:`text-key`}}}async function WN(e,t){return HN.parse(await $a(await e.client.tutorial.$put({json:t})))}async function GN(e){let t=await e.client.tutorial.$delete();if(!t.ok)throw await no(t)}function KN(){let{api:e}=B(),[t,n]=(0,m.useState)({active:!1,step:0}),[r,i]=(0,m.useState)(null),a=(0,m.useMemo)(()=>{let t={active:!1,step:0},r=0,a=!1,o=!1,s=0,c=!0,l=!1,u=!1,d=null,f=[],p=[],m=e=>i(e instanceof Error?e.message:`Your tutorial progress wasn't saved. You can keep going; it will try again on the next step.`),h=async()=>{if(!u&&a&&c){u=!0;try{for(;d||p.length>0;){if(!d){let e=p.shift();if(!e)break;let t=ZM[e.step];if(!t)throw Error(`This tutorial step isn't recognised. Choose Restart tutorial to start over.`);let{step:n,...i}=e;d={baseVersion:r,mutationId:crypto.randomUUID(),session:{...i,schemaVersion:1,stepId:t.id}}}r=(await WN(e,d)).version,d=null}i(null)}catch(e){m(e)}finally{u=!1}}},g=e=>{if(!a){f.push(e);return}let r=typeof e==`function`?e(t):e;r!==t&&(t=r,n(t),p.push(t),h())},_=()=>{if(!a){l=!0;return}if(!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}g({active:!0,step:0})},v=async()=>{if(o||a)return;o=!0;let u=s;try{let o=await UN(e);if(u!==s)return;if(r=o.version,c=o.readable,c||(a=!0),!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}let{schemaVersion:d,stepId:p,...m}=o.session;if(t={active:m.active,step:$M(p)??0,...m.articleId===void 0?{}:{articleId:m.articleId},...m.imageId===void 0?{}:{imageId:m.imageId},...m.projectId===void 0?{}:{projectId:m.projectId}},t.articleId||t.imageId){let{prompts:n}=await Go(e),{articleId:r,imageId:i,...a}=t;t={...a,...r!==void 0&&n.some(e=>e.id===r&&e.kind===`article`)?{articleId:r}:{},...i!==void 0&&n.some(e=>e.id===i&&e.kind===`image`)?{imageId:i}:{}}}if(t.projectId&&await bo(e,t.projectId),u!==s)return;a=!0,n(t);for(let e of f.splice(0))g(e);l&&_(),i(null)}catch(e){u===s&&m(e)}finally{o=!1}},y=async()=>{if(!u){u=!0,s++,f.length=0,l=!1;try{await GN(e),r=0,c=!0,a=!0,d=null,p.length=0,t={active:!0,step:0},n(t),p.push(t),i(null)}catch(e){m(e)}finally{u=!1}await h()}};return{update:g,start:_,restore:v,retry:()=>{a?h():v()},restart:()=>{y()}}},[e]);return(0,m.useEffect)(()=>{a.restore()},[a]),{session:t,update:a.update,start:a.start,retry:a.retry,restart:a.restart,error:r}}var qN=(0,m.createContext)(void 0);function JN({children:e}){let{session:t,update:n,start:r,retry:i,restart:a,error:o}=KN(),[s,c]=(0,m.useState)({}),l=(0,m.useCallback)(e=>{c(t=>Object.entries(e).every(([e,n])=>t[e]===n)?t:{...t,...e})},[]),u=(0,m.useCallback)(e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t))))},[]),d=(0,m.useCallback)(e=>{n(t=>QM(t,e))},[n]),f=ZM[t.step]?.id,p=t.active&&(f===`project`||f===`download`)?f:void 0,g=(0,m.useMemo)(()=>({active:t.active,projectId:t.projectId,projectStep:p,start:r,report:l,clear:u,event:d}),[t.active,t.projectId,p,r,l,u,d]);return(0,h.jsxs)(qN.Provider,{value:g,children:[e,o?(0,h.jsxs)(`div`,{role:`alert`,className:`fixed bottom-4 left-4 z-[100] rounded-panel border border-line bg-panel p-4 text-ink`,children:[(0,h.jsx)(`p`,{children:o}),(0,h.jsx)(V,{type:`button`,onClick:i,children:`Retry tutorial save`}),(0,h.jsx)(V,{type:`button`,onClick:a,children:`Restart tutorial`})]}):null,t.active?(0,h.jsx)(BN,{session:t,progress:s,update:n}):null]})}function YN(){return(0,m.useContext)(qN)}function XN(e){let t=(0,m.useContext)(qN),n=t?.report,r=t?.clear,i=(0,m.useRef)(e);i.current=e,(0,m.useEffect)(()=>{n?.(e)},[n,e]),(0,m.useEffect)(()=>()=>{r?.(Object.keys(i.current))},[r])}function ZN(){let e=(0,m.useContext)(qN);return(0,m.useCallback)(t=>{e?.event(t)},[e?.event])}function QN(e){let t=(0,m.useContext)(qN);return t?.projectId===e?t.projectStep:void 0}function $N(){let e=YN();return e?(0,h.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center gap-[6px] whitespace-nowrap text-ink2 hover:text-ink`,onClick:e.start,disabled:e.active,"aria-label":`Start interactive tutorial`,title:`Start interactive tutorial`,children:[(0,h.jsx)(_s,{className:`size-4`,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Tutorial`})]}):null}function eP(){let e=YN();return!e||e.active?null:(0,h.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-4 rounded-panel border border-line bg-panel px-4 py-[14px]`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`h2`,{className:`font-semibold`,children:`Make your first video`}),(0,h.jsx)(`p`,{className:`mt-1 text-small text-ink2`,children:`An interactive walkthrough of API keys, reusable prompts, keywords, and Play. Each step highlights the real controls you will use.`})]}),(0,h.jsx)(V,{variant:`accent`,onClick:e.start,children:`Start tutorial`})]})}var tP=[`app-update`],nP=9e5,rP=2e3,iP=12e4;async function aP(e,t=!1,n){let r=AbortSignal.timeout(2e4);return $a(await e.fetch(`${e.origin}/api/update${t?`?refresh=1`:``}`,{signal:n===void 0?r:AbortSignal.any([n,r]),cache:`no-store`}))}async function oP(e){return $a(await e.fetch(`${e.origin}/api/update`,{method:`POST`,signal:AbortSignal.timeout(2e4)}))}function sP(e){let{api:t}=B(),n=_(),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(!1),[s,c]=(0,m.useState)(),l=(0,m.useRef)(!1),u=I({queryKey:tP,queryFn:({signal:e})=>aP(t,!1,e),staleTime:nP,refetchOnWindowFocus:`always`,refetchInterval:e=>!a&&(r!==null||e.state.data?.status===`checking`||e.state.data?.status===`installing`||e.state.data?.status===`restarting`)?rP:nP,retry:!1}),d=rt({mutationFn:()=>aP(t,!0),onMutate:()=>(o(!1),c(void 0),n.cancelQueries({queryKey:tP})),onSuccess:e=>n.setQueryData(tP,e),retry:!1}),f=rt({mutationFn:()=>oP(t),onMutate:()=>(o(!1),c(void 0),n.cancelQueries({queryKey:tP})),onSuccess:e=>{i(e.currentVersion),o(!1),c(void 0),n.setQueryData(tP,e)},onError:()=>{n.invalidateQueries({queryKey:tP})},retry:!1}),p=r!==null||u.data?.status===`installing`||u.data?.status===`restarting`;(0,m.useEffect)(()=>{if(!p||a)return;let e=window.setTimeout(()=>{i(null),o(!0),c(`The update did not finish. Restart Slopify (in Docker, restart the container), reload this page, and try again.`)},iP);return()=>window.clearTimeout(e)},[p,a]),(0,m.useEffect)(()=>{if(r===null||u.data===void 0)return;let t=u.data.status===`idle`||u.data.status===`error`;u.data.currentVersion!==r&&t&&!l.current?(l.current=!0,i(null),o(!1),c(void 0),e()):t&&(i(null),o(!1),c(void 0))},[r,e,u.data]);let h=!a&&(r!==null||u.data?.status===`installing`||u.data?.status===`restarting`),g=s??f.error?.message??d.error?.message??(h?void 0:u.error?.message??u.data?.error);return{info:u.data,updating:h,checking:u.isFetching||d.isPending||u.data?.status===`checking`,installing:f.isPending,reconnecting:h&&u.isError,error:g,refresh:()=>{f.reset(),o(!1),c(void 0),d.mutate()},install:()=>{d.reset(),o(!1),c(void 0),f.mutate()}}}function cP({reload:e}){let t=sP(e),{info:n,updating:r,installing:i,reconnecting:a,checking:o,error:s}=t,c=r||i,l=n?.blockedReason??(n?.busy?`Pause running projects before updating.`:void 0),u=`Slopify updates: ${n?n.available?`Your version: ${n.currentVersion} · Newest: ${n.latestVersion}`:`Slopify ${n.currentVersion}`:`Slopify`}. ${a?`Reconnecting after update…`:c?`Updating…`:o?`Checking for updates…`:s??l??(n?.available?`Click to download and install the update.`:`Click to check for updates.`)}`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":u,title:u,disabled:c||o,onClick:()=>{n?.available&&n.canUpdate&&!l?t.install():t.refresh()},className:z(`relative flex size-8 shrink-0 items-center justify-center rounded-control bg-transparent text-ink2 hover:bg-panel2 hover:text-ink`,s&&`text-amber`),children:[(0,h.jsx)(Es,{"aria-hidden":`true`,size:16,className:z((c||o)&&`animate-spin motion-reduce:animate-none`)}),n?.available&&!c?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-1 right-1 size-2 rounded-full bg-lamp-run`}):null]}),(0,h.jsx)(`span`,{className:`sr-only`,role:s?`alert`:`status`,children:u})]})}var lP=[{to:`/`,label:`Projects`,match:[`/`,`/projects`]},{to:`/play`,label:`Play`,match:[`/play`]},{to:`/prompts`,label:`Library`,match:[`/library`,`/prompts`,`/entries`,`/templates`,`/schedules`]},{to:`/settings`,label:`Settings`,match:[`/settings`,`/usage`]}];function uP(e,t){return t.some(t=>t===`/`?e===`/`:e===t||e.startsWith(`${t}/`))}var dP=[{href:`https://github.com/GentBajko/slopify`,label:`GitHub`,glyph:`github`,tone:``},{href:`https://www.patreon.com/cw/GentBajko`,label:`Patreon`,glyph:`patreon`,tone:`text-lamp-run`},{href:`https://buymeacoffee.com/gentbajko`,label:`Buy Me a Coffee`,glyph:`coffee`,tone:`text-lamp-run`}];function fP(){return(0,h.jsx)(xM,{children:(0,h.jsx)(vM,{children:(0,h.jsx)(JN,{children:(0,h.jsx)(pP,{})})})})}function pP(){let{api:e,openEvents:t}=B(),n=_(),[r,i]=(0,m.useState)(0),a=ja({select:e=>e.pathname}),o=qM();return(0,m.useEffect)(()=>{let r=XM(()=>{n.invalidateQueries({queryKey:H.projects})},200),a=Vb(t,ns(e,`global`),{tally:i,projectState:o.observe,stagingChanged:()=>{n.invalidateQueries({queryKey:H.staging})},refetch:e=>{e===void 0?n.invalidateQueries():r.ask()}});return()=>{a(),r.stop()}},[e,t,n,o]),(0,h.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,h.jsxs)(`header`,{className:`sticky top-0 z-40 flex h-12 min-w-0 items-center gap-4 border-b border-line bg-panel px-4 sm:gap-6 sm:px-6`,children:[(0,h.jsxs)(oa,{to:`/`,className:`flex shrink-0 items-center gap-[10px] text-wordmark font-extrabold tracking-[-0.02em] text-ink`,children:[(0,h.jsx)(Tl,{className:`relative top-[3px] text-lamp-run`}),(0,h.jsx)(`span`,{className:`max-[480px]:sr-only`,children:`Slopify`})]}),(0,h.jsx)(`nav`,{"aria-label":`Main navigation`,className:`flex min-w-0 flex-1 items-stretch gap-5 self-stretch overflow-x-auto [scrollbar-width:none] sm:gap-6`,children:lP.map(e=>{let t=uP(a,e.match);return(0,h.jsx)(oa,{to:e.to,"aria-current":t?`page`:void 0,className:z(`flex shrink-0 items-center border-b-2 whitespace-nowrap focus-visible:outline-offset-[-3px]`,t?`border-lamp-run text-ink`:`border-transparent text-ink2 hover:text-ink`),children:e.label},e.to)})}),(0,h.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 sm:gap-3 [&_button]:min-h-8 [&_button]:min-w-8`,children:[r===0?null:(0,h.jsxs)(oa,{to:`/`,"aria-label":`${String(r)} running`,title:`${String(r)} running`,className:`engraved flex min-h-8 items-center gap-2 whitespace-nowrap text-run-text hover:text-ink`,children:[(0,h.jsx)(jl,{state:`running`}),String(r),(0,h.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:`running`})]}),dP.map(e=>(0,h.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,title:e.label,className:`hidden min-h-8 min-w-8 shrink-0 items-center justify-center gap-[6px] whitespace-nowrap text-ink2 hover:text-ink sm:flex`,children:[(0,h.jsx)(Dl,{name:e.glyph,className:e.tone}),(0,h.jsx)(`span`,{className:`sr-only min-[1100px]:not-sr-only`,children:e.label})]},e.href)),(0,h.jsx)(cP,{reload:()=>window.location.reload()}),(0,h.jsx)($N,{})]})]}),(0,h.jsx)(`main`,{className:`mx-auto w-full max-w-[1200px] min-w-0 flex-1 px-4 pt-5 pb-10 sm:px-6`,children:(0,h.jsx)(xa,{})}),(0,h.jsx)(`footer`,{id:`app-footer`,className:`flex items-center gap-[18px] border-t border-line px-4 py-[14px] text-label text-ink3 sm:px-6`,children:(0,h.jsx)(`span`,{children:`Free. Your keys, your machine.`})}),(0,h.jsx)(Ib,{}),(0,h.jsx)(Nb,{}),(0,h.jsx)(Lb,{reload:()=>{window.location.reload()}})]})}var mP=XA.map(e=>({value:e,label:gP(e)})),hP=Yb.map(e=>({value:e,label:_P(e)}));function gP(e){switch(e){case`intro`:return`Intro`;case`outro`:return`Outro`}}function _P(e){switch(e){case`text`:return`Text`;case`llm`:return`LLM`}}function vP(e){switch(e){case`text`:return`Text is narrated as written.`;case`llm`:return`LLM is an instruction whose answer is narrated.`}}function yP(e){switch(e){case`text`:return`No slots. This text is narrated as written.`;case`llm`:return`No slots. This instruction runs as written.`}}function bP(e){return XA.find(t=>t===e)??`intro`}var xP=YA.map(e=>({value:e,label:SP(e)}));function SP(e){switch(e){case`article`:return`Article`;case`image`:return`Image`;case`thumbnail`:return`Thumbnail`;case`narration`:return`Narration Preparation`;case`description`:return`YouTube Description`;case`shorts`:return`Shorts`}}function CP(e){return YA.find(t=>t===e)??`article`}function wP({open:e,title:t,consequence:n,verb:r,dismiss:i=`Cancel`,pending:a=!1,onConfirm:o,onCancel:s}){return(0,h.jsx)(hb,{open:e,onOpenChange:e=>{e||s()},children:(0,h.jsxs)(vb,{children:[(0,h.jsx)(yb,{children:t}),(0,h.jsx)(bb,{children:n}),(0,h.jsxs)(`div`,{className:`flex justify-end gap-[10px]`,children:[(0,h.jsx)(V,{type:`button`,autoFocus:!0,onClick:s,children:i}),(0,h.jsx)(V,{type:`button`,variant:`danger`,disabled:a,onClick:o,children:r})]})]})})}var TP={info:`text-ink2`,error:`text-red`,warning:`text-amber`,success:`text-done`};function EP({children:e,tone:t=`info`,className:n,id:r}){let i=typeof e==`string`?e:void 0;return(0,h.jsx)(`div`,{id:r,"data-slot":`status-slot`,role:t===`error`?`alert`:`status`,title:i,className:z(`flex min-h-8 min-w-0 flex-1 items-center gap-2 overflow-hidden text-small`,TP[t],n),children:e==null||e===!1?null:i===void 0?e:(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:i})})}function DP({status:e,children:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`action-bar`,className:z(`sticky bottom-0 z-20 -mx-4 mt-6 flex min-h-14 flex-wrap items-center gap-x-3 gap-y-2 border-t border-line bg-panel px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))] shadow-[0_-6px_14px_-10px_var(--color-shadow)] sm:-mx-6 sm:px-6`,n),children:[(0,h.jsx)(`div`,{className:`flex w-full min-w-0 sm:w-auto sm:flex-1`,children:e??(0,h.jsx)(EP,{})}),(0,h.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]})}var OP=2e3;function kP(e,t){let n=(0,m.useRef)(t);(0,m.useEffect)(()=>{n.current=t}),(0,m.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{n.current()},OP);return()=>{clearTimeout(t)}},[e])}function AP(){return(0,h.jsxs)(`span`,{className:`inline-flex animate-tick-in items-center gap-1 text-label text-done motion-reduce:animate-none`,children:[(0,h.jsx)(ps,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function jP({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=o.join(` `);return(0,h.jsxs)(`div`,{"data-slot":`editor-actions`,className:`sticky bottom-0 z-10 -mx-[18px] -mb-[18px] flex flex-wrap items-center gap-[10px] rounded-b-panel border-t border-line bg-panel px-[18px] py-3 shadow-[0_-6px_14px_-10px_var(--color-shadow)]`,children:[(0,h.jsx)(V,{className:`bg-transparent`,onClick:e,disabled:e===void 0,"aria-hidden":e===void 0||void 0,tabIndex:e===void 0?-1:void 0,style:e===void 0?{visibility:`hidden`}:void 0,children:`Delete`}),(0,h.jsx)(EP,{tone:l?`error`:`info`,id:l?void 0:n,children:l||(i?(0,h.jsx)(AP,{}):t)}),a,(0,h.jsx)(V,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,onClick:()=>{c||s()},children:`Save`})]})}function MP({children:e,className:t,"data-tour":n}){return(0,h.jsx)(`div`,{"data-tour":n,className:z(`overflow-hidden rounded-panel border border-line bg-panel`,t),children:e})}function NP({children:e,className:t,"data-tour":n}){return(0,h.jsx)(`div`,{"data-tour":n,className:z(`relative flex items-center gap-[14px] border-b border-line px-4 py-[14px] last:border-b-0`,t),children:e})}function PP({current:e,total:t}){let n=t<=0?0:Math.min(1,Math.max(0,e/t));return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-meter`,className:`absolute inset-x-0 bottom-0 h-[2px] bg-lamp-run transition-[width] duration-[250ms] ease-out motion-reduce:transition-none`,style:{width:`${String(Math.round(n*100))}%`}})}var FP=`rounded-panel border border-line bg-panel p-[18px]`;function IP(){return(0,h.jsxs)(`div`,{className:`mx-auto grid max-w-[1440px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${FP} flex flex-col gap-[14px]`,children:[(0,h.jsx)(`span`,{className:`h-8 w-64 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-[520px] rounded-control bg-panel2`})]}),(0,h.jsx)(`div`,{className:`${FP} flex flex-col gap-3`,children:(0,h.jsx)(`span`,{className:`h-3 w-28 rounded-control bg-panel2`})})]})}function LP({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto max-w-[1440px]`,children:[(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:e})}),t]})}var RP=`mt-[10px] inline-block text-small text-run-text underline`;function zP({title:e,back:t,lead:n,meta:r,status:i,actions:a,className:o}){return(0,h.jsxs)(`div`,{"data-slot":`page-bar`,className:z(`flex min-h-12 flex-wrap items-center justify-between gap-x-5 gap-y-2 pb-3`,o),children:[(0,h.jsxs)(`div`,{className:`flex min-w-[min(100%,260px)] flex-1 flex-wrap items-center gap-x-3 gap-y-1`,children:[t?(0,h.jsxs)(oa,{to:t.to,...t.search?{search:t.search}:{},className:`shrink-0 text-small text-ink2 hover:text-ink`,children:[`< `,t.label]}):null,n,(0,h.jsx)(`h1`,{className:`min-w-0 break-words text-title font-bold tracking-[-0.01em]`,children:e}),i===void 0?null:(0,h.jsx)(`span`,{className:`inline-flex min-w-[88px] items-center`,children:i}),r?(0,h.jsx)(`span`,{className:`min-w-0 text-small text-ink2`,children:r}):null]}),a?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}):null]})}var BP=`modulepreload`,VP=function(e){return`/`+e},HP={},UP=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),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?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=VP(t,n),t=s(t),t in HP)return;HP[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:BP,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}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)})};function WP({data:e,label:t,onDrawn:n}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let e=r.current;if(e===null)return;let t=new ResizeObserver(([e])=>{a(Math.floor(e?.contentRect.width??0))});return t.observe(e),()=>{t.disconnect()}},[]),(0,m.useEffect)(()=>{let t=r.current;if(t===null||e===void 0||i===0)return;let a=!1;return GP(e,i).then(e=>{a||(t.replaceChildren(...e),n?.(void 0))},e=>{a||n?.(e instanceof Error?e:Error(String(e)))}),()=>{a=!0}},[e,i,n]),(0,h.jsx)(`div`,{ref:r,role:`img`,"aria-label":t,className:`flex flex-col gap-3 [&>canvas]:w-full [&>canvas]:shadow-[0_1px_4px_var(--color-shadow)]`})}async function GP(e,t){let n=await UP(()=>import(`./pdf-BLF2i8c2.js`),[]),r=await UP(()=>import(`./pdf.worker.min-zC6nfbxG.js`),[]);n.GlobalWorkerOptions.workerSrc=r.default;let i=n.getDocument({data:e.slice()}),a=await i.promise;try{let e=window.devicePixelRatio||1,n=[];for(let r=1;r<=a.numPages;r+=1){let i=await a.getPage(r),o=i.getViewport({scale:t*e/i.getViewport({scale:1}).width}),s=window.document.createElement(`canvas`);s.width=Math.floor(o.width),s.height=Math.floor(o.height),await i.render({canvas:s,viewport:o}).promise,n.push(s)}return n}finally{await i.destroy()}}function KP({className:e,...t}){return(0,h.jsx)(`input`,{"data-slot":`input`,className:z(`h-8 w-full min-w-0 rounded-control border border-line2 bg-panel2 px-[10px] text-small text-ink`,`placeholder:text-ink3 aria-invalid:border-red`,e),...t})}function qP({className:e,...t}){return(0,h.jsx)(`textarea`,{"data-slot":`textarea`,className:z(`w-full min-w-0 rounded-control border border-line2 bg-panel2 px-[10px] py-2 text-small text-ink`,`placeholder:text-ink3 aria-invalid:border-red`,e),...t})}function JP({className:e,...t}){return(0,h.jsx)(gv,{"data-slot":`label`,className:z(`engraved block select-none text-ink3`,e),...t})}function YP({className:e,children:t,...n}){return(0,h.jsxs)(`span`,{className:`relative inline-flex min-w-0 items-center`,children:[(0,h.jsx)(`select`,{"data-slot":`picker`,className:z(`h-8 w-full min-w-0 appearance-none rounded-control border border-line2 bg-panel2`,`py-[5px] pr-[26px] pl-[10px] text-small text-ink aria-invalid:border-red`,e),...n,children:t}),(0,h.jsx)(ms,{"aria-hidden":`true`,className:`pointer-events-none absolute right-[8px] size-[14px] text-ink2`})]})}var XP=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),ZP=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),QP=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),$P=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),eF=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),tF=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),nF=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),rF=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},XP([`page`,`margin`],`Margins`),XP([`page`,`contentTop`],`Text starts at`,`From the top, on pages with the header.`),{kind:`choice`,path:[`background`,`image`],label:`Background`,options:[{value:`parchment`,label:`Parchment texture`},{value:null,label:`Flat colour`}]},{kind:`color`,path:[`background`,`color`],label:`Page colour`,help:`Used when the background is a flat colour.`}]},{title:`Colours`,fields:[{kind:`color`,path:[`colors`,`heading`],label:`Headings`,help:`Also drop caps, the brand name and links.`},{kind:`color`,path:[`colors`,`text`],label:`Body text`},{kind:`color`,path:[`colors`,`muted`],label:`Muted`,help:`Dates, bullets, quotes and the dots in the contents.`},{kind:`color`,path:[`colors`,`faint`],label:`Faint`,help:`Running header and page numbers.`}]},{title:`Fonts`,fields:[nF(`body`,`Body`),nF(`strong`,`Bold text`),nF(`emphasis`,`Italic text`),nF(`heading`,`Headings`),nF(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),nF(`decorative`,`Tagline and title-page link`),nF(`dropCap`,`Drop caps`),nF(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[ZP([`sizes`,`title`],`Title`),ZP([`sizes`,`brand`],`Brand`),ZP([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),ZP([`sizes`,`heading`],`Second-level headings`),ZP([`sizes`,`subheading`],`Third-level headings`),ZP([`sizes`,`body`],`Body`),ZP([`sizes`,`meta`],`Date and word count`),ZP([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[XP([`spacing`,`bodyLine`],`Body line height`),XP([`spacing`,`headingLine`],`Heading line height`),XP([`spacing`,`subheadingLine`],`Subheading line height`),QP([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),QP([`spacing`,`headingGap`],`Before a heading`,`× line`),QP([`spacing`,`itemGap`],`After a list item`,`× line`),XP([`spacing`,`listIndent`],`List indent`),XP([`spacing`,`quoteIndent`],`Quote indent`),XP([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[$P([`dropCap`,`enabled`],`Drop caps`,`A large first letter after each heading.`),{kind:`choice`,path:[`dropCap`,`lines`],label:`Lines tall`,options:[{value:2,label:`2 lines`},{value:3,label:`3 lines`},{value:4,label:`4 lines`}]},QP([`dropCap`,`scale`],`Letter size`,`× lines`),XP([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},QP([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[XP([`titlePage`,`brandY`],`Brand from top`),XP([`titlePage`,`taglineOffset`],`Tagline below brand`),XP([`titlePage`,`titleY`],`Title from top`),XP([`titlePage`,`titleLine`],`Title line height`),XP([`titlePage`,`metaOffset`],`Details below title`),XP([`titlePage`,`metaLine`],`Details line height`),$P([`titlePage`,`showDate`],`Show the date`),$P([`titlePage`,`showWordCount`],`Show the word count`),$P([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),XP([`titlePage`,`cover`,`gap`],`Space around cover`),XP([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[tF([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),tF([`brand`,`tagline`],`Tagline`),tF([`brand`,`url`],`Website`,`Where the brand and its link go.`),tF([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[$P([`contents`,`enabled`],`Contents page`),eF([`contents`,`title`],`Title`),{kind:`choice`,path:[`contents`,`depth`],label:`Lists headings down to`,options:[{value:1,label:`Top level`},{value:2,label:`Second level`},{value:3,label:`Third level`}]},XP([`contents`,`titleOffset`],`Title from top margin`),XP([`contents`,`firstEntryOffset`],`First entry from top margin`),XP([`contents`,`line`],`Line height`),XP([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[$P([`header`,`enabled`],`Running header`,`The title at the top of each page.`),XP([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},$P([`footer`,`enabled`],`Page numbers`),eF([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),XP([`footer`,`bottom`],`From the bottom`),XP([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[$P([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),eF([`sources`,`title`],`Title`),XP([`sources`,`titleOffset`],`Title from top margin`),XP([`sources`,`bodyOffset`],`List from top margin`),XP([`sources`,`line`],`Line height`),XP([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[$P([`endPage`,`enabled`],`Closing page`),eF([`endPage`,`title`],`Title`),{kind:`lines`,path:[`endPage`,`lines`],label:`Text`,help:`One line each. Start with "•" for a bullet, end with ":" for a bold label, leave a line empty for a gap.`},$P([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},tF([`endPage`,`closing`],`Closing line`),XP([`endPage`,`titleOffset`],`Title from top margin`),XP([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[eF([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),eF([`metadata`,`subject`],`Subject`),eF([`metadata`,`keywords`],`Keywords`),eF([`metadata`,`creator`],`Creator`)]}],iF=OA.map(e=>({value:e,label:{Cinzel:`Cinzel`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function aF(e){let t={normal:`Regular`,medium:`Medium`,bold:`Bold`,black:`Black`,italic:`Italic`,bolditalic:`Bold italic`};return(e===`Cinzel`?[`normal`,`medium`,`bold`,`black`]:[`normal`,`bold`,`italic`,`bolditalic`]).map(e=>({value:e,label:t[e]}))}function oF(e,t){let n=e;for(let e of t)n=n?.[e];return n}function sF(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:sF(a,i,n)}}function cF(e){let t=IA;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function lF(e){return`values.${e.join(`.`)}`}function uF({themeId:e,from:t,onLeave:n}){let{api:r}=B(),i=_(),a=I(kb(r)),o=(0,m.useId)(),s=(0,m.useId)(),c=(0,m.useId)(),[l,u]=(0,m.useState)(void 0),[d,f]=(0,m.useState)([]),[p,g]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),b=a.data,x=e===void 0?void 0:b?.themes.find(t=>t.id===e),S=e===void 0?b?.themes.find(e=>e.id===t)??b?.builtIns.find(e=>e.name===(t??`plain`))??b?.builtIns[0]:x,C=S===void 0?void 0:{name:e===void 0?`${`label`in S?S.label:S.name} copy`:S.name,values:S.values},w=l??C,T=rt({mutationFn:t=>Zo(r,t,e),onSuccess:async e=>{if(!e.ok){f(e.fields);return}g(!0),await i.invalidateQueries({queryKey:kb(r).queryKey})}}),E=rt({mutationFn:e=>Qo(r,e),onSuccess:async()=>{y(!1),await i.invalidateQueries({queryKey:kb(r).queryKey}),n()}});kP(p,n);let D=(0,m.useMemo)(()=>w===void 0?void 0:IA.safeParse(w.values),[w]),O=[...w===void 0||w.name.trim()===``?[]:ix(w.name),...D===void 0||D.success?[]:D.error.issues.map(e=>({field:`values.${e.path.join(`.`)}`,message:e.message})),...d];if(a.error!==null)return(0,h.jsx)(hF,{children:a.error.message});if(b===void 0)return(0,h.jsx)(IP,{});if(w===void 0)return(0,h.jsx)(hF,{children:`That theme is gone. It may have been deleted in another tab.`});let k=(e,t)=>{u(e),f(e=>e.filter(e=>e.field!==t))},ee=w.name.trim()===``?`Give the theme a name.`:O.length>0?`Fix the highlighted settings first.`:void 0,A=O.filter(e=>e.field===`name`);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{back:{to:`/document-themes`,label:`Documents`},title:e===void 0?`New document theme`:`Edit document theme`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(320px,440px)]`,children:[(0,h.jsxs)(`div`,{className:`${FP} flex min-w-0 flex-col gap-[14px]`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{htmlFor:o,className:`mb-[5px]`,children:`Name`}),(0,h.jsx)(KP,{id:o,value:w.name,"aria-invalid":A.length>0,"aria-describedby":A.length===0?void 0:s,onChange:e=>{k({...w,name:e.target.value},`name`)}}),A.length===0?null:(0,h.jsx)(`p`,{id:s,className:`mt-1 text-label text-red`,children:A.map(e=>e.message).join(` `)})]}),rF.map((e,t)=>(0,h.jsxs)(`details`,{open:t<2||e.fields.some(e=>dF(O,e.path)),className:`group rounded-control border border-line`,children:[(0,h.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-[10px] font-semibold`,children:[(0,h.jsx)(hs,{"aria-hidden":`true`,className:`size-[14px] text-ink2 transition-transform group-open:rotate-90 motion-reduce:transition-none`}),e.title]}),(0,h.jsx)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-x-5 gap-y-3 border-t border-line px-3 py-3 sm:grid-cols-2`,children:e.fields.map(e=>(0,h.jsx)(pF,{field:e,theme:w.values,problem:dF(O,e.path),onChange:t=>{k({...w,values:t},lF(e.path))}},e.path.join(`.`)))})]},e.title)),(0,h.jsx)(jP,{onDelete:e===void 0?void 0:()=>{y(!0)},blocked:ee,blockedId:c,pending:T.isPending,saved:p,cancel:(0,h.jsx)(V,{asChild:!0,children:(0,h.jsx)(oa,{to:`/document-themes`,children:`Cancel`})}),errors:[T.error,E.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{T.mutate(w)}})]}),(0,h.jsx)(fF,{values:D?.success===!0?w.values:void 0})]}),(0,h.jsx)(wP,{open:v,title:`Delete "${w.name}"?`,consequence:`Projects that used it keep their own copy of its settings.`,verb:`Delete`,pending:E.isPending,onConfirm:()=>{e!==void 0&&E.mutate(e)},onCancel:()=>{y(!1)}})]})}function dF(e,t){let n=lF(t),r=e.filter(e=>e.field===n||e.field.startsWith(`${n}.`));return r.length===0?void 0:r.map(e=>e.message).join(` `)}function fF({values:e}){let{api:t}=B(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(`busy`),[o,s]=(0,m.useState)(void 0),c=e===void 0?void 0:JSON.stringify(e);(0,m.useEffect)(()=>{if(c===void 0)return;let e=new AbortController,n=window.setTimeout(()=>{a(`busy`),$o(t,JSON.parse(c),e.signal).then(async e=>({bytes:new Uint8Array(await e.arrayBuffer()),blob:e})).then(({bytes:t,blob:n})=>{e.signal.aborted||r({bytes:t,url:URL.createObjectURL(n)})},t=>{e.signal.aborted||(s(t instanceof Error?t.message:String(t)),a(`failed`))})},450);return()=>{window.clearTimeout(n),e.abort()}},[t,c]),(0,m.useEffect)(()=>()=>{n!==void 0&&URL.revokeObjectURL(n.url)},[n]);let l=(0,m.useCallback)(e=>{if(e===void 0){a(`idle`);return}s(e.message),a(`failed`)},[]),u=e===void 0?`Paused until the highlighted settings are fixed.`:i===`busy`?`Updating…`:i===`failed`?`The preview couldn't be made: ${o??`unknown error`}`:`A sample article with this theme. Your projects use their own text and thumbnail.`;return(0,h.jsxs)(`div`,{className:`${FP} flex flex-col gap-3 lg:sticky lg:top-16`,children:[(0,h.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,h.jsx)(`h2`,{className:`font-semibold`,children:`Preview`}),n===void 0?null:(0,h.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`text-small text-run-text underline`,children:`Open full size`})]}),(0,h.jsx)(`div`,{className:`max-h-[calc(100vh-220px)] min-h-[320px] overflow-y-auto rounded-control border border-line bg-panel2 p-3`,children:(0,h.jsx)(WP,{data:n?.bytes,label:`The sample article laid out with this theme`,onDrawn:l})}),(0,h.jsx)(`p`,{role:`status`,className:i===`failed`?`text-small text-red`:`text-small text-ink2`,children:u})]})}function pF({field:e,theme:t,problem:n,onChange:r}){let i=(0,m.useId)(),a=oF(t,e.path),o=n=>{r(sF(t,e.path,n))},s=[e.help===void 0?``:`${i}-help`,n===void 0?``:`${i}-error`].filter(e=>e!==``).join(` `),c=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${i}-help`,className:`text-label text-ink2`,children:e.help}),n===void 0?null:(0,h.jsx)(`p`,{id:`${i}-error`,className:`text-label text-red`,children:n})]}),l={id:i,"aria-invalid":n!==void 0,"aria-describedby":s===``?void 0:s};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{...l,type:`checkbox`,checked:a===!0,className:`size-4 accent-accent`,onChange:e=>{o(e.currentTarget.checked)}}),e.label]}),c]});case`number`:{let{min:t,max:n}=cF(e.path);return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(KP,{...l,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof a==`number`&&Number.isFinite(a)?a:``,onChange:e=>{o(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:e.unit})]})})}case`color`:{let t=typeof a==`string`?a:``,n=/^#?[0-9a-f]{6}$/i.test(t)?`#${t.replace(`#`,``)}`:/^#?[0-9a-f]{3}$/i.test(t)?`#${[...t.replace(`#`,``)].map(e=>e+e).join(``)}`:`#000000`;return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`color`,"aria-label":`${e.label} colour`,value:n,className:`h-8 w-10 cursor-pointer rounded-control border border-line2 bg-panel2 p-[2px]`,onChange:e=>{o(e.target.value)}}),(0,h.jsx)(KP,{...l,className:`w-28 font-mono`,value:t,onChange:e=>{o(e.target.value)}})]})})}case`text`:return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsx)(KP,{...l,value:typeof a==`string`?a:``,onChange:e=>{o(e.target.value)}})});case`optional-text`:return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsx)(KP,{...l,value:typeof a==`string`?a:``,onChange:e=>{o(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===a);return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsx)(YP,{...l,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&o(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=a,n=aF(t.family);return(0,h.jsx)(mF,{id:i,label:e.label,notes:c,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(YP,{...l,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=iF.find(t=>t.value===e.target.value);if(n===void 0)return;let r=aF(n.value).some(e=>e.value===t.style);o({...t,family:n.value,style:r?t.style:`normal`})},children:iF.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(YP,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{o({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(KP,{type:`number`,"aria-label":`${e.label} letter spacing in millimetres`,title:`Letter spacing (mm)`,step:.01,className:`w-20`,value:Number.isFinite(t.letterSpacing)?t.letterSpacing:``,onChange:e=>{o({...t,letterSpacing:e.target.value===``?NaN:Number(e.target.value)})}})]})})}case`lines`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,children:[(0,h.jsx)(JP,{htmlFor:i,children:e.label}),(0,h.jsx)(qP,{...l,rows:8,value:Array.isArray(a)?a.join(`
|
|
102
|
+
`):``,onChange:e=>{o(e.target.value.split(`
|
|
103
|
+
`))}}),c]});case`link`:{let t=a;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{id:i,type:`checkbox`,checked:t!==null,className:`size-4 accent-accent`,onChange:e=>{o(e.currentTarget.checked?{text:`Visit the website`,url:null}:null)}}),e.label]}),t===null?null:(0,h.jsxs)(`span`,{className:`grid grid-cols-[minmax(0,1fr)] gap-2 sm:grid-cols-2`,children:[(0,h.jsx)(KP,{"aria-label":`Link text`,placeholder:`Link text`,value:t.text,onChange:e=>{o({...t,text:e.target.value})}}),(0,h.jsx)(KP,{"aria-label":`Link address`,placeholder:`https://`,value:t.url??``,onChange:e=>{o({...t,url:e.target.value===``?null:e.target.value})}})]}),c]})}}}function mF({id:e,label:t,notes:n,children:r}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsx)(JP,{htmlFor:e,children:t}),r,n]})}function hF({children:e}){return(0,h.jsx)(LP,{back:(0,h.jsx)(oa,{to:`/document-themes`,className:RP,children:`Back to Documents`}),children:e})}var gF=uv,_F=dv;function vF({className:e,sideOffset:t=4,align:n=`end`,...r}){return(0,h.jsx)(fv,{children:(0,h.jsx)(pv,{"data-slot":`dropdown-menu-content`,sideOffset:t,align:n,className:z(`z-50 min-w-[160px] overflow-hidden rounded-panel border border-line bg-panel p-1`,`shadow-[0_8px_24px_var(--color-shadow)]`,e),...r})})}function yF({className:e,...t}){return(0,h.jsx)(mv,{"data-slot":`dropdown-menu-item`,className:z(`flex cursor-default items-center rounded-control px-[10px] py-[5px] text-small text-ink`,`outline-hidden select-none focus:bg-panel2 data-highlighted:bg-panel2`,e),...t})}var bF=e=>z(`relative -mb-px inline-flex min-h-10 shrink-0 items-center gap-2 border-b-2 px-3 text-body font-semibold whitespace-nowrap`,`transition-colors duration-150 ease-out motion-reduce:transition-none focus-visible:outline-offset-[-3px]`,e?`border-lamp-run text-ink`:`border-transparent text-ink2 hover:text-ink`);function xF({items:e,value:t,onChange:n,label:r,idPrefix:i,trailing:a,className:o}){let s=(0,m.useRef)(null);return(0,h.jsxs)(`div`,{className:z(`flex min-w-0 items-end gap-3 border-b border-line`,o),"data-slot":`tabs`,children:[(0,h.jsx)(`div`,{ref:s,role:`tablist`,"aria-label":r,onKeyDown:r=>{if(r.key!==`ArrowRight`&&r.key!==`ArrowLeft`)return;let a=e.filter(e=>!e.disabled),o=a[(a.findIndex(e=>e.id===t)+(r.key===`ArrowRight`?1:-1)+a.length)%a.length];o&&(r.preventDefault(),n(o.id),s.current?.querySelector(`#${i}-tab-${o.id}`)?.focus())},className:`flex min-w-0 flex-1 items-end overflow-x-auto [scrollbar-width:none]`,children:e.map(e=>(0,h.jsxs)(`button`,{id:`${i}-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":e.id===t,"aria-controls":`${i}-panel-${e.id}`,tabIndex:e.id===t?0:-1,disabled:e.disabled,onClick:()=>n(e.id),className:bF(e.id===t),children:[e.label,e.badge===void 0?null:(0,h.jsx)(`span`,{className:`text-small font-normal text-ink3`,children:e.badge})]},e.id))}),a?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 pb-1`,children:a}):null]})}function SF({items:e,label:t,className:n}){return(0,h.jsx)(`nav`,{"aria-label":t,className:z(`flex min-w-0 items-end overflow-x-auto border-b border-line [scrollbar-width:none]`,n),children:e.map(e=>(0,h.jsx)(oa,{to:e.to,...e.search?{search:e.search}:{},activeOptions:{exact:!1,includeSearch:!1},className:bF(!1),activeProps:{className:`!border-lamp-run !text-ink`,"aria-current":`page`},children:e.label},e.to))})}function CF({idPrefix:e,id:t,active:n,children:r,className:i}){return(0,h.jsx)(`div`,{id:`${e}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${e}-tab-${t}`,hidden:!n,className:i,children:r})}var wF=[{to:`/prompts`,label:`Prompts`},{to:`/entries`,label:`Intros & Outros`},{to:`/templates`,label:`Templates`},{to:`/document-themes`,label:`Documents`},{to:`/schedules`,label:`Schedules`}];function TF(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{title:`Library`}),(0,h.jsx)(SF,{items:wF,label:`Library sections`,className:`mb-5`}),(0,h.jsx)(xa,{})]})}function EF({children:e,action:t}){return(0,h.jsxs)(`div`,{className:`mb-4 flex min-h-8 flex-wrap items-center gap-x-4 gap-y-2`,children:[e,(0,h.jsx)(`span`,{className:`flex-1`}),t]})}var DF=`grid grid-cols-[minmax(0,1fr)_auto_32px] items-center gap-x-[14px] border-b border-line px-4 py-[10px] last:border-b-0`,OF=`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-[14px] border-b border-line px-4 py-[10px] last:border-b-0`;function kF(){let{api:e}=B(),t=_(),n=I(kb(e)),[r,i]=(0,m.useState)(void 0),a=rt({mutationFn:t=>Qo(e,t),onSettled:async()=>{i(void 0),await t.invalidateQueries({queryKey:H.documentThemes})}});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EF,{action:(0,h.jsx)(V,{asChild:!0,children:(0,h.jsxs)(oa,{to:`/document-themes/new`,search:{from:`plain`},children:[(0,h.jsx)(Ts,{"aria-hidden":`true`,className:`size-[14px]`}),`New theme`]})}),children:(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`How a project's PDF looks. Pick one on the Document row in Play or in Edit project.`})}),n.error===null?null:(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:n.error.message})}),n.data===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,h.jsxs)(`section`,{"aria-labelledby":`document-themes-yours`,children:[(0,h.jsx)(`h2`,{id:`document-themes-yours`,className:`mb-2 text-small font-semibold text-ink2`,children:`Your themes`}),n.data.themes.length===0?(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-ink2`,children:`No themes of your own yet. Copy a built-in below to start one.`})}):(0,h.jsx)(MP,{children:n.data.themes.map(e=>(0,h.jsxs)(`div`,{className:DF,children:[(0,h.jsx)(oa,{to:`/document-themes/$themeId`,params:{themeId:e.id},className:`min-w-0 truncate font-semibold hover:underline`,children:e.name}),(0,h.jsx)(AF,{colors:e.values.colors}),(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`More for ${e.name}`,className:`size-8 p-0`,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsxs)(vF,{align:`end`,children:[(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/document-themes/$themeId`,params:{themeId:e.id},children:`Edit`})}),(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/document-themes/new`,search:{from:e.id},children:`Duplicate`})}),(0,h.jsx)(yF,{onSelect:()=>{i(e)},children:`Delete`})]})]})]},e.id))})]}),(0,h.jsxs)(`section`,{"aria-labelledby":`document-themes-built-in`,children:[(0,h.jsx)(`h2`,{id:`document-themes-built-in`,className:`mb-2 text-small font-semibold text-ink2`,children:`Built in`}),(0,h.jsx)(MP,{children:n.data.builtIns.map(e=>(0,h.jsxs)(`div`,{className:OF,children:[(0,h.jsx)(`span`,{className:`min-w-0 truncate font-semibold`,children:e.label}),(0,h.jsx)(AF,{colors:e.values.colors}),(0,h.jsx)(V,{asChild:!0,children:(0,h.jsx)(oa,{to:`/document-themes/new`,search:{from:e.name},children:`Copy`})})]},e.name))})]})]}),(0,h.jsx)(wP,{open:r!==void 0,title:`Delete "${r?.name??``}"?`,consequence:`Projects that used it keep their own copy of its settings.`,verb:`Delete`,pending:a.isPending,onConfirm:()=>{r!==void 0&&a.mutate(r.id)},onCancel:()=>{i(void 0)}})]})}function AF({colors:e}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1`,children:[e.heading,e.text,e.muted].map((e,t)=>(0,h.jsx)(`span`,{className:`size-3 rounded-full border border-line`,style:{backgroundColor:e.startsWith(`#`)?e:`#${e}`}},t))})}function jF({name:e,className:t}){return(0,h.jsx)(`span`,{"data-slot-chip":e,className:z(`engraved animate-tick-in rounded-control border border-line2 bg-panel2 px-[7px] py-[2px] text-ink2 motion-reduce:animate-none`,t),children:e})}function MF({className:e,...t}){return(0,h.jsx)(rb,{"data-slot":`toggle-group`,className:z(`inline-flex w-fit items-stretch overflow-hidden rounded-control border border-line2`,e),...t})}function NF({className:e,...t}){return(0,h.jsx)(fb,{"data-slot":`toggle-group-item`,className:z(`min-h-8 shrink-0 border-r border-line2 px-[10px] py-[5px] text-label text-ink2 last:border-r-0`,`transition-colors duration-150 ease-out motion-reduce:transition-none hover:bg-panel2 hover:text-ink`,`data-[state=on]:bg-panel2 data-[state=on]:text-ink data-[state=on]:shadow-[inset_0_-2px_0_var(--color-lamp-run)]`,`disabled:cursor-not-allowed disabled:opacity-40`,e),...t})}var PF=`grid grid-cols-[minmax(0,1fr)_auto_32px] items-center gap-x-[14px] gap-y-[6px] border-b border-line px-4 py-[10px] last:border-b-0 md:grid-cols-[260px_70px_minmax(0,1fr)_32px]`,FF=`col-span-3 col-start-1 row-start-2 flex flex-wrap gap-[6px] md:col-span-1 md:col-start-3 md:row-start-1`;function IF({category:e,onCategory:t}){let{api:n}=B(),r=_(),i=I(Ob(n)),[a,o]=(0,m.useState)(void 0),s=rt({mutationFn:e=>ts(n,e),onSettled:async()=>{o(void 0),await r.invalidateQueries({queryKey:H.entries})}}),c=i.data?.entries.filter(t=>t.category===e);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EF,{action:(0,h.jsx)(V,{asChild:!0,children:(0,h.jsxs)(oa,{to:`/entries/new`,search:{category:e},children:[(0,h.jsx)(Ts,{"aria-hidden":`true`,className:`size-[14px]`}),`New entry`]})}),children:(0,h.jsx)(MF,{type:`single`,value:e,"aria-label":`Entry category`,onValueChange:e=>{let n=mP.find(t=>t.value===e);n!==void 0&&t(n.value)},children:mP.map(e=>(0,h.jsx)(NF,{value:e.value,children:e.label},e.value))})}),i.error===null?null:(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:i.error.message})}),c===void 0?i.error===null?(0,h.jsx)(BF,{}):null:c.length===0?(0,h.jsx)(RF,{category:e}):(0,h.jsx)(MP,{children:c.map(e=>(0,h.jsxs)(`div`,{className:PF,children:[(0,h.jsx)(oa,{to:`/entries/$entryId`,params:{entryId:e.id},className:`col-start-1 row-start-1 min-w-0 truncate font-semibold hover:underline`,children:e.name}),(0,h.jsx)(LF,{mode:e.mode}),(0,h.jsx)(`span`,{className:FF,children:e.slots.map(e=>(0,h.jsx)(jF,{name:e},e))}),(0,h.jsx)(zF,{entry:e,onDelete:()=>{o(e)}})]},e.id))}),s.error===null?null:(0,h.jsx)(`p`,{className:`mt-[10px] text-label text-red`,children:s.error.message}),(0,h.jsx)(wP,{open:a!==void 0,title:a===void 0?``:`Delete "${a.name}"?`,consequence:`Projects that used it keep their text.`,verb:`Delete`,pending:s.isPending,onConfirm:()=>{a!==void 0&&s.mutate(a.id)},onCancel:()=>{o(void 0)}})]})}function LF({mode:e}){return(0,h.jsx)(`span`,{"data-entry-mode":e,className:`engraved col-start-2 row-start-1 justify-self-start rounded-control border border-line2 bg-panel2 px-[7px] py-[2px] font-bold text-ink`,children:_P(e)})}function RF({category:e}){return(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`max-w-[75ch] px-4 py-6 text-ink2`,children:`No ${e}s yet. An ${e} is narrated ${e===`intro`?`before`:`after`} the body in the run's voice.`})})}function zF({entry:e,onDelete:t}){return(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`More for ${e.name}`,className:`col-start-3 row-start-1 size-8 p-0 md:col-start-4`,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsxs)(vF,{children:[(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/entries/$entryId`,params:{entryId:e.id},children:`Edit`})}),(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/entries/new`,search:{category:e.category,from:e.id},children:`Duplicate`})}),(0,h.jsx)(yF,{onSelect:t,children:`Delete`})]})]})}function BF(){return(0,h.jsx)(MP,{children:[0,1,2].map(e=>(0,h.jsxs)(`div`,{className:PF,children:[(0,h.jsx)(`span`,{className:`col-start-1 row-start-1 h-3 w-40 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`col-start-2 row-start-1 h-[18px] w-10 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:FF,children:(0,h.jsx)(`span`,{className:`h-[18px] w-14 rounded-control bg-panel2`})}),(0,h.jsx)(`span`,{className:`col-start-3 row-start-1 h-7 w-12 rounded-control bg-panel2 md:col-start-4`})]},e))})}function VF({slots:e,body:t,lint:n,lintId:r,noSlots:i=`No slots. This prompt runs as written.`}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h2`,{className:`engraved text-ink3`,children:`Detected slots`}),e.length>0?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-[6px]`,children:e.map(e=>(0,h.jsx)(jF,{name:e,className:`px-2 py-[3px]`},e))}):t.trim()===``?(0,h.jsx)(`p`,{className:`text-small text-ink3`,children:`Slots appear here as you type {{name}}.`}):(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:i}),n.length===0?null:(0,h.jsxs)(`div`,{id:r,className:`flex flex-col gap-[6px] border-t border-line pt-3`,children:[(0,h.jsx)(`span`,{className:`engraved text-red`,children:n.length===1?`1 slot error`:`${String(n.length)} slot errors`}),n.map(e=>(0,h.jsx)(`span`,{className:`text-small text-red`,children:e.message},e.message))]})]})}function HF({label:e,value:t,options:n,describedBy:r,onPick:i}){let a=(0,m.useId)();return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{id:a,className:`mb-[5px]`,children:e}),(0,h.jsx)(MF,{type:`single`,value:t,"aria-labelledby":a,"aria-describedby":r,onValueChange:e=>{let t=n.find(t=>t.value===e);t!==void 0&&i(t.value)},children:n.map(e=>(0,h.jsx)(NF,{value:e.value,children:e.label},e.value))})]})}var UF=/\{\{([^{}\n]*)\}\}/g,WF=`{{`,GF=`}}`;function KF(e){let t=[],n=[],r=e.indexOf(WF);for(;r!==-1;){let i=e.indexOf(`
|
|
104
|
+
`,r+2),a=i===-1?e.length:i,o=e.indexOf(GF,r+2);if(o===-1||o>a){n.push({kind:`unclosed`,at:r}),r=e.indexOf(WF,r+2);continue}let s=e.slice(r+2,o),c=s.trim();s.includes(`{`)||s.includes(`}`)?n.push({kind:`nested`,at:r}):c===``?n.push({kind:`empty`,at:r}):t.includes(c)||t.push(c),r=e.indexOf(WF,o+2)}return{names:t,errors:n}}function qF(e,t){let n=YF(e),r=YF(t),i=[];for(let e of[...n,...r]){if(i.some(t=>t.name===e))continue;let t=n.includes(e),a=r.includes(e);i.push({name:e,group:t&&a?`common`:t?`text`:`image`})}return i}function JF(e,t){return e.replace(UF,(e,n)=>{let r=n.trim(),i=Object.hasOwn(t,r)?t[r]:void 0;return i===void 0?e:i})}function YF(e){let t=[];for(let n of e)for(let e of KF(n).names)t.includes(e)||t.push(e);return t}function XF(e){return QF(e.name,e.body)}function ZF(e){return QF(e.name,e.body)}function QF(e,t){let n=[],r=e.trim();if(r===``?n.push({field:`name`,message:`Enter a name.`}):r.length>200&&n.push({field:`name`,message:`Keep the name to 200 characters or fewer.`}),t.trim()===``)return n.push({field:`body`,message:`Enter the text.`}),n;if(t.length>1e5)return n.push({field:`body`,message:`The text is too long. Keep it to ${String(gee)} characters or fewer.`}),n;for(let e of KF(t).errors)n.push({field:`body`,message:$F(e,t)});return n}function $F(e,t){let n=eI(t,e.at);switch(e.kind){case`unclosed`:return`The \`{{\` at ${n} is never closed. Add \`}}\` after the keyword name.`;case`empty`:return`The keyword at ${n} has no name. Write a name between \`{{\` and \`}}\`.`;case`nested`:return`The keyword at ${n} contains a brace. Keywords cannot be placed inside other keywords.`}}function eI(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`
|
|
105
|
+
`),i=n.split(`
|
|
106
|
+
`).length,a=t-r;return`line ${String(i)}, column ${String(a)}`}function tI(e,t){return[...`kind`in e?XF(e):ZF(e),...t]}function nI(e){return e[0]?.message}function rI(e){return e.filter(e=>e.field===`body`)}function iI(e){return e.filter(e=>e.field===`name`)}function aI(e){return KF(e).names}function oI(e){let t=[],n=0;for(let r of KF(e).errors){if(r.at<n)continue;r.at>n&&t.push({start:n,text:e.slice(n,r.at),marked:!1});let i=Math.min(r.at+2,e.length);t.push({start:r.at,text:e.slice(r.at,i),marked:!0}),n=i}return n<e.length&&t.push({start:n,text:e.slice(n),marked:!1}),t}var sI=`px-3 py-[10px] font-sans text-body leading-[1.5] break-words [scrollbar-gutter:stable]`;function cI({id:e,value:t,invalid:n,describedBy:r,onChange:i}){let a=(0,m.useRef)(null);return(0,h.jsxs)(`div`,{className:`relative max-w-[75ch]`,children:[(0,h.jsxs)(`div`,{ref:a,"aria-hidden":`true`,"data-slot":`lint-overlay`,className:z(sI,`pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap`,`rounded-control border border-transparent bg-panel2 text-ink`),children:[oI(t).map(e=>(0,h.jsx)(`span`,{"data-lint-mark":e.marked?e.start:void 0,className:e.marked?`text-red underline decoration-red decoration-2 underline-offset-[3px]`:void 0,children:e.text},e.start)),`
|
|
107
|
+
`]}),(0,h.jsx)(qP,{id:e,rows:24,value:t,spellCheck:!1,"aria-invalid":n,"aria-describedby":r,className:z(sI,`relative block min-h-[520px] resize-y overflow-auto bg-transparent text-transparent caret-ink`),onChange:e=>{i(e.target.value)},onScroll:e=>{let t=a.current;t!==null&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function lI({entryId:e,category:t,from:n,onLeave:r}){let{api:i}=B(),a=_(),o=I(Ob(i)),s=(0,m.useId)(),c=(0,m.useId)(),l=(0,m.useId)(),u=(0,m.useId)(),d=(0,m.useId)(),f=(0,m.useId)(),[p,g]=(0,m.useState)(void 0),[v,y]=(0,m.useState)([]),[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=o.data?.entries,T=e??n,E=T===void 0?void 0:w?.find(e=>e.id===T),D=E===void 0?{category:t,mode:`text`,name:``,body:``}:{category:E.category,mode:E.mode,name:e===void 0?`${E.name} copy`:E.name,body:E.body},O=p??D,k=rt({mutationFn:t=>Yo(i,t,e),onSuccess:async e=>{if(!e.ok){y(e.fields);return}x(!0),await a.invalidateQueries({queryKey:Ob(i).queryKey})}}),ee=rt({mutationFn:e=>ts(i,e),onSuccess:async()=>{C(!1),await a.invalidateQueries({queryKey:Ob(i).queryKey}),r(O.category)}});kP(b,()=>{r(O.category)});let A=(e,t)=>{g(e),y(e=>e.filter(e=>e.field!==t))},j=tI(O,v),M=nI(j),N=aI(O.body),P=O.body.trim()===``?[]:rI(j),F=O.name.trim()===``?[]:iI(j);return o.error===null?T!==void 0&&w===void 0?(0,h.jsx)(IP,{}):T!==void 0&&E===void 0?(0,h.jsx)(uI,{category:t,children:`That entry is gone. It may have been deleted in another tab.`}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{back:{to:`/entries`,label:`Intros & Outros`,search:{category:O.category}},title:e===void 0?`New entry`:`Edit entry`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${FP} flex min-w-0 flex-col gap-[14px]`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-[14px]`,children:[(0,h.jsxs)(`div`,{className:`min-w-[200px] flex-1`,children:[(0,h.jsx)(JP,{htmlFor:s,className:`mb-[5px]`,children:`Name`}),(0,h.jsx)(KP,{id:s,value:O.name,"aria-invalid":F.length>0,"aria-describedby":F.length===0?void 0:c,onChange:e=>{A({...O,name:e.target.value},`name`)}}),F.length===0?null:(0,h.jsx)(`p`,{id:c,className:`mt-1 text-label text-red`,children:F.map(e=>e.message).join(` `)})]}),(0,h.jsx)(HF,{label:`Category`,value:O.category,options:mP,onPick:e=>{A({...O,category:e},`name`)}}),(0,h.jsx)(HF,{label:`Mode`,value:O.mode,options:hP,describedBy:l,onPick:e=>{A({...O,mode:e},`mode`)}})]}),(0,h.jsx)(`p`,{id:l,className:`-mt-[6px] text-right text-small text-ink2`,children:vP(O.mode)}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{htmlFor:u,className:`mb-[5px]`,children:`Body`}),(0,h.jsx)(cI,{id:u,value:O.body,invalid:P.length>0,describedBy:P.length===0?void 0:d,onChange:e=>{A({...O,body:e},`body`)}})]}),(0,h.jsx)(jP,{onDelete:e===void 0?void 0:()=>{C(!0)},blocked:M,blockedId:f,pending:k.isPending,saved:b,cancel:(0,h.jsx)(V,{asChild:!0,children:(0,h.jsx)(oa,{to:`/entries`,search:{category:O.category},children:`Cancel`})}),errors:[k.error,ee.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{k.mutate(O)}})]}),(0,h.jsx)(`div`,{className:`${FP} flex flex-col gap-3 lg:sticky lg:top-16`,children:(0,h.jsx)(VF,{slots:N,body:O.body,lint:P,lintId:d,noSlots:yP(O.mode)})})]}),(0,h.jsx)(wP,{open:S,title:`Delete "${O.name}"?`,consequence:`Projects that used it keep their text.`,verb:`Delete`,pending:ee.isPending,onConfirm:()=>{e!==void 0&&ee.mutate(e)},onCancel:()=>{C(!1)}})]}):(0,h.jsx)(uI,{category:O.category,children:o.error.message})}function uI({category:e,children:t}){return(0,h.jsx)(LP,{back:(0,h.jsx)(oa,{to:`/entries`,search:{category:e},className:RP,children:`Back to Intros & Outros`}),children:t})}function dI({open:e,title:t,onClose:n,children:r,footer:i,width:a=`wide`,headingRef:o,className:s}){let c=(0,m.useId)(),l=(0,m.useRef)(null),u=o??l,d=(0,m.useRef)(null),f=(0,m.useRef)(null),p=(0,m.useRef)(n);return(0,m.useEffect)(()=>{p.current=n}),(0,m.useEffect)(()=>{if(!e)return;d.current=document.activeElement,f.current?.contains(document.activeElement)||u.current?.focus({preventScroll:!0});let t=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-slot="dialog-content"][data-state="open"]`)||p.current()};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t);let e=d.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[e,u]),e?(0,h.jsxs)(`aside`,{ref:f,role:`dialog`,"aria-modal":`false`,"aria-labelledby":c,"data-slot":`drawer`,className:z(`fixed top-12 right-0 bottom-0 z-30 flex w-full flex-col border-l border-line2 bg-panel shadow-[-12px_0_28px_-12px_var(--color-shadow)]`,a===`wide`?`sm:w-[min(560px,100vw)]`:`sm:w-[min(440px,100vw)]`,`data-[state=open]:animate-tick-in motion-reduce:animate-none`,s),"data-state":`open`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-3 border-b border-line px-4`,children:[(0,h.jsx)(`h2`,{ref:u,id:c,tabIndex:-1,className:`min-w-0 flex-1 truncate text-row font-semibold focus-visible:outline-offset-[-2px]`,children:t}),(0,h.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`inline-flex size-8 items-center justify-center rounded-control text-ink2 hover:bg-panel2 hover:text-ink`,children:(0,h.jsx)(Ds,{"aria-hidden":`true`,className:`size-4`})})]}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:r}),i?(0,h.jsx)(`div`,{className:`flex min-h-14 shrink-0 flex-wrap items-center gap-2 border-t border-line px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))]`,children:i}):null]}):null}function fI(e){let{form:t}=e,n=[],r=[];if(xI(n,t.title),fA(t)&&xI(n,yI(e.prompts,`narration`,t.narrationPrompt??``)),t.sources.article===`generate`&&xI(n,yI(e.prompts,`article`,t.articlePrompt)),t.sources.audio===`generate`&&(xI(n,bI(e.entries,`intro`,t.intro)),xI(n,bI(e.entries,`outro`,t.outro))),mA(t)&&xI(n,yI(e.prompts,`description`,t.descriptionPrompt??``)),$j(t)&&(xI(n,yI(e.prompts,`shorts`,t.shorts?.prompt??``)),xI(r,yI(e.prompts,`image`,t.shorts?.imagePrompt??``))),t.sources.images===`generate`){for(let n of t.imagePrompts)xI(r,yI(e.prompts,`image`,n.name));t.reference?.source===`prompt`&&xI(r,yI(e.prompts,`image`,t.reference.prompt))}return(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)&&xI(r,yI(e.prompts,`thumbnail`,t.thumbnailPrompt)),qF(n,r)}function pI(e){let t=fI(e),n={form:e.form,entries:e.entries,slots:t.map(e=>e.name),silenceGapSeconds:e.silenceGapSeconds},r=oM(n),i=iA({draft:r,staged:aM(e.form.provided),requiredSlots:n.slots}),a=Zj(r.subtitles??e.form.subtitles)?i:{ok:!1,fields:[...i.ok?[]:i.fields,{field:`subtitles.fontSize`,message:`Choose a whole subtitle font size from 16 to 120.`}]};return{fields:t,draft:r,result:a,blocker:hI(e.form,a)}}var mI=`sources,provided.research,articlePrompt,provided.article,audio,provided.audio,narrationPrompt,imagePrompts,images,provided.images,reference,provided.reference,thumbnailPrompt,provided.thumbnail,subtitles,title,intro,outro,llm,values,silenceGapSeconds,edgeSilenceSeconds,imageSeconds,zoomPercent,motionStyle,youtubeDescription,descriptionPrompt,shorts.enabled,shorts.count,shorts.minSeconds,shorts.maxSeconds,shorts.prompt,shorts.imagePrompt,shorts.speed,shorts.musicVolume,shorts.music,shorts.fullVideoLink,videoEdit.transitionSeconds,videoEdit.chapterCards,videoEdit.animate,videoEdit.animateEvery,videoEdit.animateModel`.split(`,`);function hI(e,t){let n=gI(e);if(n!==void 0)return n;if(t.ok)return;let r=[...t.fields].sort((e,t)=>_I(e.field)-_I(t.field))[0];return r===void 0?void 0:{field:r.field,hint:vI(e,r)}}function gI(e){let{sources:t,provided:n}=e,r=[];if(t.audio===`provide`&&n.audio!==void 0&&r.push(n.audio),t.images===`provide`&&r.push(...n.images),t.thumbnail===`provide`&&n.thumbnail!==void 0&&r.push(n.thumbnail),t.images===`generate`&&e.reference?.source===`provide`&&n.reference!==void 0&&r.push(n.reference),$j(e)&&n.shortsMusic!==void 0&&r.push(n.shortsMusic),r.some(e=>e.error!==void 0))return{field:`provided`,hint:`Remove the upload that failed to play`};if(r.some(e=>e.file===void 0))return{field:`provided`,hint:`Wait for the uploads to finish to play`}}function _I(e){let t=mI.length;for(let[n,r]of mI.entries())(e===r||e.startsWith(`${r}.`))&&n<t&&(t=n);return t}function vI(e,t){if(t.field.startsWith(`values.`))return`Fill ${t.field.slice(7)} to play`;if(t.field.startsWith(`imagePrompts.`))return t.field.endsWith(`.number`)?`Set a Number between 1 and 20 to play`:`Pick an image prompt to play`;switch(t.field){case`title`:return e.title.trim()===``?`Name the video to play`:`Shorten the title to 200 characters to play`;case`imagePrompts`:return e.imagePrompts.length===0?`Tick an image prompt to play`:`Lower the Numbers to play: a run makes at most 60 images`;case`llm`:return`Pick an LLM provider and model to play`;case`articlePrompt`:return`Pick an article prompt to play`;case`audio`:return`Pick a narration provider to play`;case`audio.voice`:return`Pick a voice to play`;case`images`:return`Pick an image provider and model to play`;case`thumbnailPrompt`:return`Pick a thumbnail prompt to play`;case`youtubeDescription`:return`Turn narration on, or the YouTube description off, to play`;case`shorts.enabled`:return`Turn narration on, or Shorts off, to play`;case`shorts.count`:return`Set how many shorts to make to play`;case`shorts.minSeconds`:case`shorts.maxSeconds`:return`Set the shorts' length to play`;case`shorts.speed`:return`Choose the shorts' speed to play`;case`shorts.musicVolume`:return`Set the shorts' music volume to play`;case`shorts.music`:return`Attach the shorts' background music again, or remove it, to play`;case`shorts.fullVideoLink`:return`Fix the full video link to play`;case`provided.research`:return`Paste the research notes to play`;case`provided.article`:return`Paste the article to play`;case`provided.audio`:return`Attach the narration audio to play`;case`provided.images`:return e.provided.images.length>60?`Remove images to play: a run holds at most 60`:`Attach at least one image to play`;case`provided.thumbnail`:return`Attach the thumbnail image to play`;case`reference.prompt`:return`Pick the establishing image's prompt to play`;case`provided.reference`:return`Attach the establishing image to play`;default:return t.message}}function yI(e,t,n){if(n!==``)return e.find(e=>e.kind===t&&e.name===n)?.body}function bI(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.body}function xI(e,t){t!==void 0&&e.push(t)}function SI(e){let t=new Map,n=(e,n)=>{if(e)for(let r of KF(e).names){let e=t.get(r)??[];e.includes(n)||e.push(n),t.set(r,e)}},{form:r,prompts:i,entries:a}=e;if(n(r.title,`Project title`),fA(r)&&n(yI(i,`narration`,r.narrationPrompt??``),`Narration Preparation`),r.sources.article===`generate`&&n(yI(i,`article`,r.articlePrompt),`Article`),r.sources.images===`generate`)for(let e of r.imagePrompts)n(yI(i,`image`,e.name),`Image: ${e.name}`);if((r.sources.thumbnail===`from_prompt`||r.sources.thumbnail===`prompt_by_llm`)&&n(yI(i,`thumbnail`,r.thumbnailPrompt),`Thumbnail`),r.sources.audio===`generate`)for(let e of[`intro`,`outro`])n(bI(a,e,r[e]),e===`intro`?`Intro`:`Outro`);return mA(r)&&n(yI(i,`description`,r.descriptionPrompt??``),`YouTube description`),$j(r)&&(n(yI(i,`shorts`,r.shorts?.prompt??``),`Shorts`),n(yI(i,`image`,r.shorts?.imagePrompt??``),`Shorts images`)),t}var CI=Kv,wI=Jv,TI=qv;function EI({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Yv,{children:(0,h.jsx)(Xv,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:z(`z-50 w-[min(340px,calc(100vw-24px))] rounded-panel border border-line bg-panel p-3 text-small text-ink2`,`shadow-[0_8px_24px_var(--color-shadow)] outline-hidden`,e),...r})})}function DI({label:e,children:t,className:n}){return(0,h.jsxs)(CI,{children:[(0,h.jsx)(wI,{type:`button`,"aria-label":`About ${e}`,className:z(`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-ink3 hover:bg-panel2 hover:text-ink`,n),children:(0,h.jsx)(Cs,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsx)(EI,{className:`space-y-2 leading-[1.45]`,children:t})]})}var OI=[{stage:`audio`,label:`Audio`},{stage:`images`,label:`Images`},{stage:`video`,label:`Video / export`}];function kI(e,t){if(e!==`checkpoints`&&!e.startsWith(`checkpoints.`))return;let n=e.slice(12),r=/^\d+$/.test(n)?t.checkpoints?.[Number(n)]:n;return{section:`review`,field:OI.some(e=>e.stage===r)?`checkpoints.${r}`:`checkpoints`}}function AI({problem:e}){let t=yM(),{document:n,review:r}=t,{form:i}=n,a=(0,m.useId)(),o=i.checkpoints??[];return(0,h.jsxs)(`fieldset`,{"data-play-field":`checkpoints`,tabIndex:-1,"aria-invalid":e(`checkpoints`)!==void 0,disabled:r.starting||r.uncertain,className:`min-w-0 rounded-panel border border-line px-3 pt-1 pb-2`,children:[(0,h.jsxs)(`legend`,{className:`flex items-center gap-1 px-1 font-semibold`,children:[`Review checkpoints`,(0,h.jsx)(DI,{label:`review checkpoints`,children:(0,h.jsx)(`p`,{children:`Hold a step so you can review and edit before it runs. Independent steps continue. Approve each checkpoint on the project page when you are ready.`})})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-x-6`,children:OI.map(({stage:r,label:s})=>{let c=o.includes(r),l=r===`video`?i.sources.video!==`off`&&i.sources.images!==`off`||i.sources.audio!==`off`:i.sources[r]===`generate`,u=e(`checkpoints.${r}`),d=`${a}-${r}`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`label`,{htmlFor:d,className:`flex min-h-10 items-center gap-3 max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:d,type:`checkbox`,"data-play-field":`checkpoints.${r}`,"aria-invalid":u!==void 0,"aria-describedby":`${d}-detail`,checked:c,disabled:!l&&!c,className:`size-4 accent-accent`,onChange:e=>{let a=e.target.checked?[...o,r]:o.filter(e=>e!==r);t.edit({...n,form:{...i,checkpoints:a}}),t.invalidateReview(!0)}}),`Before `,s]}),(0,h.jsx)(`p`,{id:`${d}-detail`,className:u||c&&!l?`pl-7 text-small text-red`:`sr-only`,children:u??(l?`Approval required before this step and its dependents run.`:c?`This step is unavailable. Remove its checkpoint or enable the step.`:r===`video`?`Enable Video or Audio to review before export.`:`Choose Generate for ${s} to add this checkpoint.`)})]},r)})}),e(`checkpoints`)?(0,h.jsx)(`p`,{className:`text-small text-red`,children:e(`checkpoints`)}):null]})}function jI({fields:e,values:t,origins:n,problem:r,onChange:i}){return e.length?(0,h.jsxs)(`section`,{"data-tour":`play-keywords`,className:`min-w-0 py-6`,children:[(0,h.jsx)(`h3`,{className:`mb-2 text-lg font-semibold`,children:`Keywords`}),(0,h.jsxs)(`p`,{className:`mb-5 text-small text-ink3`,children:[`Each keyword is entered once. For example, `,`{{topic}}`,` becomes the topic you enter below.`]}),(0,h.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.map(e=>(0,h.jsx)(MI,{name:e.name,value:Object.hasOwn(t,e.name)?t[e.name]??``:``,origins:n?.get(e.name),problem:r(`values.${e.name}`),onChange:i},e.name))})]}):null}function MI({name:e,origins:t,value:n,problem:r,onChange:i}){let a=(0,m.useId)(),o=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(JP,{htmlFor:a,className:`mb-[5px]`,children:e}),(0,h.jsx)(KP,{id:a,"data-play-field":`values.${e}`,value:n,maxLength:200,spellCheck:!1,"aria-invalid":r!==void 0,"aria-describedby":r===void 0?void 0:o,onChange:t=>{i(e,t.target.value)}}),t?.length?(0,h.jsx)(`p`,{className:`mt-1 text-small text-ink3`,children:t.join(` · `)}):null,r===void 0?null:(0,h.jsx)(`p`,{id:o,className:`mt-1 text-label text-red`,children:r})]})}var NI=e=>[`provider-models`,e];async function PI(e,t,n=!1,r){let i=`${e.origin}/api/providers/${encodeURIComponent(t)}/models${n?`?refresh=1`:``}`;return $a(await e.fetch(i,r?{signal:r}:void 0))}function FI(e,t){return nt({queryKey:NI(t),queryFn:({signal:n})=>PI(e,t,!1,n),enabled:t!==``,staleTime:3e4,refetchInterval:3e4,retry:!1})}function II(e,t,n){return nt({queryKey:[`provider-video-models`,t],queryFn:async({signal:n})=>$a(await e.fetch(`${e.origin}/api/providers/${encodeURIComponent(t)}/models?video=1`,{signal:n})),enabled:n&&t!==``,staleTime:6e4,retry:!1})}function LI(e){return e!==``&&e!==`fal`&&e!==`replicate`}function RI(e){if(!tN(e))return e.kind===`keyed`?`Key Missing`:e.issueKind===`login`?`Sign In Required`:e.issueKind===`bridge`?`Host Helper Unavailable`:e.issueKind===`version`?`CLI Update Required`:e.issue===void 0||e.issueKind===`missing`?`CLI Missing`:`CLI Unavailable`}function zI({label:e,field:t,problem:n,inline:r=!1,children:i}){let a=(0,m.useId)(),o=(0,m.useId)();return(0,h.jsxs)(`div`,{className:z(r?`flex min-w-0 max-w-full items-center gap-[10px]`:`min-w-0 [&>span]:w-full`),children:[(0,h.jsx)(JP,{htmlFor:a,className:r?`shrink-0`:`mb-[5px]`,children:e}),i({field:t,id:a,describedBy:n===void 0?void 0:o}),n===void 0?null:(0,h.jsx)(`p`,{id:o,className:z(`text-label text-red`,r?``:`mt-1`),children:n})]})}function BI({label:e,field:t,value:n,problem:r,inline:i,placeholder:a,options:o,disabled:s=!1,onPick:c}){return(0,h.jsx)(zI,{field:t,label:e,problem:r,inline:i,children:({id:e,describedBy:l})=>(0,h.jsxs)(YP,{id:e,"data-play-field":t,value:n,disabled:s,"aria-invalid":r!==void 0,"aria-describedby":l,className:i===!0?`w-auto min-w-[120px]`:void 0,onChange:e=>{c(e.target.value)},children:[(0,h.jsx)(`option`,{value:``,children:a}),n!==``&&!o.some(e=>e.value===n)?(0,h.jsxs)(`option`,{value:n,children:[n,` (saved choice)`]}):null,o.map(e=>(0,h.jsx)(`option`,{value:e.value,disabled:e.disabled===!0,children:e.label},e.value))]})})}function VI(e,t){return e.filter(e=>e.family===t).map(e=>{let t=HI(e);return{value:e.id,label:t===void 0?e.displayName:`${e.displayName} · ${t}`,disabled:t!==void 0}})}function HI(e){return RI(e.readiness)}function UI({label:e,field:t,family:n,providers:r,value:i,problem:a,inline:o,onPick:s}){return(0,h.jsx)(BI,{field:t,label:e,value:i,problem:a,inline:o,placeholder:`Pick a provider`,options:[...i!==``&&!r.some(e=>e.id===i&&e.family===n)?[{value:i,label:`${i} (saved provider)`,disabled:!0}]:[],...VI(r,n)],onPick:s})}function WI(e){return(0,h.jsx)(GI,{...e},e.provider)}function GI({label:e,field:t,provider:n,value:r,problem:i,inline:a,onPick:o}){let{api:s}=B(),c=_(),l=I(FI(s,n)),[u,d]=(0,m.useState)(!1),f=(0,m.useId)(),p=(0,m.useId)(),g=rt({mutationFn:()=>PI(s,n,!0),onSuccess:e=>c.setQueryData(NI(n),e)}),v=l.data?.models??[],y=[...new Set(v.flatMap(e=>e.group?[e.group]:[]))],b=l.data?.allowsCustom??LI(n),x=u&&b,S=l.isFetching||g.isPending,C=g.error?.message??l.error?.message??l.data?.warning,w=r!==``&&!v.some(e=>e.id===r);return(0,h.jsxs)(`div`,{className:`min-w-0 max-w-full`,children:[(0,h.jsx)(zI,{field:t,label:e,problem:i,inline:a,children:({id:e,describedBy:s})=>{let c=[s,C?f:void 0,l.data?.notice?p:void 0].filter(Boolean).join(` `)||void 0;return(0,h.jsx)(`div`,{className:z(`min-w-0 [&>span]:w-full`,a?`max-w-[260px]`:`w-full`),children:x?(0,h.jsx)(KP,{id:e,"data-play-field":t,value:r,spellCheck:!1,placeholder:`Type the model id`,"aria-invalid":i!==void 0,"aria-describedby":c,className:a?`w-[180px] max-w-full`:void 0,onChange:e=>o(e.target.value)}):(0,h.jsxs)(YP,{id:e,"data-play-field":t,value:r,disabled:n===``,"aria-invalid":i!==void 0,"aria-describedby":c,className:a?`w-full min-w-[120px] max-w-[260px]`:void 0,onChange:e=>o(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:n===``?`Pick a provider first`:l.isPending?`Loading models…`:`Pick a model`}),w?(0,h.jsxs)(`option`,{value:r,children:[r,` (saved model)`]}):null,v.filter(e=>!e.group).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id)),y.map(e=>(0,h.jsx)(`optgroup`,{label:e,children:v.filter(t=>t.group===e).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))},e))]})})}}),n===``?null:(0,h.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(0,h.jsxs)(V,{type:`button`,variant:`ghost`,className:`px-2 text-label`,"aria-label":`Refresh ${e} list`,title:`Refresh models`,disabled:S,onClick:()=>g.mutate(),children:[(0,h.jsx)(Es,{"aria-hidden":`true`,className:z(`size-3`,S&&`animate-spin motion-reduce:animate-none`)}),`Refresh`]}),b?(0,h.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 text-label`,"aria-label":x?`Choose ${e} from list`:`Enter ${e} ID`,onClick:()=>d(!x),children:x?`Use list`:`Custom ID`}):null]}),l.data?.notice?(0,h.jsx)(`p`,{id:p,className:`mt-1 max-w-[360px] text-label text-ink3`,children:l.data.notice}):null,C?(0,h.jsx)(`p`,{id:f,className:`mt-1 max-w-[360px] text-label text-ink3`,role:`status`,children:C}):null]})}function KI({id:e,value:t,disabled:n,className:r,field:i,onChange:a}){let{api:o}=B(),s=I(kb(o)).data?.themes??[],c=t?.custom,l=c===void 0?void 0:s.find(e=>e.id===c.id),u=c!==void 0&&(l===void 0||l.name!==c.name||JSON.stringify(l.values)!==JSON.stringify(c.values)),d=c===void 0&&tx(t)===`dicemaster`,f=c===void 0?`builtin:${tx(t)}`:u?`kept`:`custom:${c.id}`;return(0,h.jsxs)(YP,{id:e,"data-play-field":i,className:r,disabled:n,value:f,onChange:e=>{let n=e.target.value;if(n===`kept`)return;if(n.startsWith(`builtin:`)){let e=Zb.find(e=>`builtin:${e}`===n);e!==void 0&&a({theme:e});return}let r=s.find(e=>`custom:${e.id}`===n);r!==void 0&&a({theme:tx(t),custom:{id:r.id,name:r.name,values:r.values}})},children:[(0,h.jsxs)(`optgroup`,{label:`Built in`,children:[Zb.map(e=>(0,h.jsx)(`option`,{value:`builtin:${e}`,children:ex[e]},e)),d?(0,h.jsx)(`option`,{value:`builtin:${Qb}`,children:`${ex[Qb]} (retired, this project's look)`}):null]}),s.length===0&&!u?null:(0,h.jsxs)(`optgroup`,{label:`Your themes`,children:[u?(0,h.jsx)(`option`,{value:`kept`,children:`${c.name} (this project's copy)`}):null,s.map(e=>(0,h.jsx)(`option`,{value:`custom:${e.id}`,children:u&&l?.id===e.id?`${e.name} (current version)`:e.name},e.id))]})]})}function qI({label:e,field:t,hideLabel:n=!1,value:r,options:i,className:a,onPick:o}){let s=(0,m.useId)();return(0,h.jsxs)(`span`,{className:z(`inline-flex items-center gap-[10px]`,a),children:[(0,h.jsx)(JP,{id:s,className:n?`sr-only`:`shrink-0`,children:e}),(0,h.jsx)(MF,{type:`single`,value:r,"aria-labelledby":s,onValueChange:e=>{let t=i.find(t=>t.value===e);t!==void 0&&t.disabled!==!0&&o(t.value)},children:i.map(e=>(0,h.jsx)(NF,{value:e.value,"data-play-field":e.value===r?t:void 0,disabled:e.disabled===!0,children:e.label},e.value))})]})}function JI({value:e,onPick:t,rawCounts:n}){let r=e.words??500,i=e.characters??3e3,a=e.mode===`words`||e.mode===`characters`,o=e.mode===`characters`,s=o?e.characters:e.words;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(qI,{field:`chunking.mode`,label:`Chunking`,className:`min-w-0 max-w-full flex-wrap [&_[data-slot=toggle-group]]:max-w-full [&_[data-slot=toggle-group]]:flex-wrap`,value:e.mode,options:[{value:`whole`,label:`Whole`},{value:`paragraph`,label:`Paragraph`},{value:`words`,label:`Every ${String(n?.words??r)} words`},{value:`characters`,label:`Every ${String(n?.characters??i)} characters`}],onPick:e=>{if(n){n.onChange(e,e===`characters`?n.characters:n.words);return}t(e===`words`?{mode:e,words:r}:e===`characters`?{mode:e,characters:i}:{mode:e})}}),a?(0,h.jsx)(zI,{label:o?`Characters`:`Words`,problem:void 0,inline:!0,children:({id:r})=>(0,h.jsx)(KP,{id:r,"data-play-field":o?`chunking.characters`:`chunking.words`,type:n?`text`:`number`,min:1,max:o?1e6:1e4,inputMode:`numeric`,className:`w-[100px] tabular-nums`,value:n?o?n.characters:n.words:s===void 0?``:String(s),onChange:r=>{if(n){n.onChange(e.mode,r.target.value);return}let i=Number.parseInt(r.target.value,10),a=Number.isFinite(i)&&i>0;t(o?a?{mode:`characters`,characters:Math.min(i,1e6)}:{mode:`characters`}:a?{mode:`words`,words:Math.min(i,1e4)}:{mode:`words`})}})}):null,o?(0,h.jsx)(`p`,{className:`basis-full text-small text-ink3`,children:`Ends at the last complete sentence within the character count, including spaces. A longer sentence stays whole; provider request limits still apply.`}):null]})}var YI=1;function XI({prompts:e,picked:t,problem:n,onPick:r,rawNumbers:i}){let a=(0,m.useId)(),o=t.reduce((e,t)=>e+t.number,0),s=t.filter(t=>!e.some(e=>e.name===t.name)),c=[...e.map(e=>({name:e.name,missing:!1})),...s.map(e=>({name:e.name,missing:!0}))];return c.length===0?(0,h.jsx)(`p`,{className:`basis-full text-right text-small text-ink3`,children:`No image prompts saved. Write one on Prompts.`}):(0,h.jsxs)(`div`,{className:`flex basis-full flex-col items-start gap-[6px]`,children:[(0,h.jsx)(`span`,{id:a,className:`engraved text-ink3`,children:`Image prompts`}),(0,h.jsx)(`ul`,{"aria-labelledby":a,className:`flex flex-wrap justify-start gap-x-4 gap-y-2`,children:c.map(e=>{let a=t.findIndex(t=>t.name===e.name),o=a===-1?void 0:t[a];return(0,h.jsxs)(`li`,{children:[e.missing?(0,h.jsx)(`span`,{className:`block text-label text-red`,children:`Missing template · untick to remove`}):null,(0,h.jsx)(ZI,{name:e.name,number:o?.number,rawNumber:i?{value:i.values.find(t=>t.name===e.name)?.number??``,onChange:t=>i.onChange(e.name,t)}:void 0,problem:a===-1?void 0:n(`imagePrompts.${String(a)}.number`),onTick:n=>{r(n?[...t,{name:e.name,number:YI}]:t.filter(t=>t.name!==e.name))},onNumber:n=>{r(t.map(t=>t.name===e.name?{name:t.name,number:n}:t))}})]},e.name)})}),t.length===0?null:(0,h.jsx)(`span`,{className:`text-label text-ink3 tabular-nums`,children:Number.isFinite(o)?`${String(o)} of 60 images`:`Complete image counts to see the total`})]})}function ZI({name:e,number:t,problem:n,onTick:r,onNumber:i,rawNumber:a}){let o=(0,m.useId)(),s=(0,m.useId)(),c=(0,m.useId)();return(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{id:o,"data-play-field":`imagePrompts`,type:`checkbox`,checked:t!==void 0,className:`size-[14px] shrink-0 accent-accent`,onChange:e=>{r(e.target.checked)}}),(0,h.jsx)(`label`,{htmlFor:o,className:t===void 0?`text-ink3`:`text-ink`,children:e}),(0,h.jsx)(JP,{htmlFor:s,className:`sr-only`,children:`Number for ${e}`}),(0,h.jsx)(KP,{id:s,"data-play-field":`imagePrompts.${e}.number`,type:a?`text`:`number`,min:YI,max:20,inputMode:`numeric`,disabled:t===void 0,"aria-invalid":n!==void 0,"aria-describedby":n===void 0?void 0:c,className:`w-[64px] tabular-nums`,value:a?.value??(t===void 0||t===0?``:String(t)),onChange:e=>{if(a){a.onChange(e.target.value);return}let t=Number.parseInt(e.target.value,10);i(Number.isFinite(t)?t:0)}}),n===void 0?null:(0,h.jsx)(`span`,{id:c,className:`text-label text-red`,children:n})]})}var QI=`text-small text-ink2 file:mr-3 file:h-8 file:rounded-control file:border file:border-line2 file:bg-panel2 file:px-3 file:text-ink`;function $I({label:e,field:t,value:n,placeholder:r,problem:i,onChange:a}){let o=(0,m.useId)(),s=(0,m.useId)();return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{htmlFor:o,className:`mb-[5px]`,children:e}),(0,h.jsx)(qP,{id:o,"data-play-field":t,rows:6,value:n,placeholder:r,"aria-invalid":i!==void 0,"aria-describedby":i===void 0?void 0:s,onChange:e=>{a(e.target.value)}}),i===void 0?null:(0,h.jsx)(`p`,{id:s,className:`mt-1 text-label text-red`,children:i})]})}function eL({label:e,field:t,accept:n,multiple:r=!1,disabled:i=!1,uploads:a,problem:o,numbered:s=!1,onPick:c,onRemove:l,onReattach:u}){let d=(0,m.useId)(),f=(0,m.useId)();return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{htmlFor:d,className:`mb-[5px]`,children:e}),(0,h.jsx)(`input`,{id:d,"data-play-field":t,type:`file`,accept:n,multiple:r,disabled:i,"aria-invalid":o!==void 0,"aria-describedby":o===void 0?void 0:f,className:QI,onChange:e=>{c([...e.target.files??[]]),e.target.value=``}}),o===void 0?null:(0,h.jsx)(`p`,{id:f,className:`mt-1 text-label text-red`,children:o}),a.length===0?null:(0,h.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:a.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3`,children:[s?(0,h.jsx)(`span`,{className:`engraved w-6 text-ink3`,children:String(t+1)}):null,(0,h.jsx)(tL,{upload:e}),e.error!==void 0&&u?(0,h.jsxs)(`label`,{className:`text-small text-ink2`,children:[`Reattach`,(0,h.jsx)(`input`,{"aria-label":`Reattach ${e.name}`,className:`max-w-full`,type:`file`,accept:n,onChange:t=>{let n=t.target.files?.[0];t.target.value=``,n&&u(e.key,n)}})]}):null,l===void 0?null:(0,h.jsx)(V,{variant:`ghost`,className:`ml-auto`,"aria-label":`Remove ${e.name}`,onClick:()=>{l(e.key)},children:`Remove`})]},e.key))})]})}function tL({upload:e}){return(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3 text-small [overflow-wrap:anywhere]`,children:[(0,h.jsx)(`span`,{className:e.error===void 0?`text-ink`:`text-red`,children:e.name}),e.error===void 0?(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:e.file===void 0?`Copying`:`Staged`}):(0,h.jsx)(`span`,{className:`text-small text-red`,children:e.error})]})}var nL=`col-span-3 grid min-w-0 grid-cols-1 gap-4 min-[700px]:grid-cols-2`,rL=`col-span-3 min-w-0`;function iL({kind:e,name:t,dim:n,children:r}){return(0,h.jsxs)(`section`,{"data-tour":`play-${e}`,className:`grid grid-cols-[24px_1fr_auto] items-center gap-x-2 gap-y-4 border-b border-line py-4 [&>div:empty]:hidden`,children:[(0,h.jsx)(wl,{kind:e,className:n?`text-ink3`:`text-ink2`}),(0,h.jsx)(`h3`,{className:z(`text-row font-semibold`,n?`text-ink3`:void 0),children:t}),r]})}function aL({kind:e,form:t,update:n}){return(0,h.jsx)(qI,{field:`sources.${e}`,label:`${e} source`,hideLabel:!0,className:`max-[700px]:col-span-3 max-[700px]:justify-self-start [&_[data-slot=toggle-group]]:flex-wrap`,value:t.sources[e],options:nM(e).map(n=>({...n,disabled:e===`video`&&n.value===`generate`&&t.sources.images===`off`})),onPick:r=>{n({sources:{...t.sources,[e]:r,...e===`images`&&r===`off`?{video:`off`}:{}}})}})}function oL(e,t){return e.filter(e=>e.kind===t).map(e=>({value:e.name,label:e.name}))}function sL({value:e,prompts:t,supported:n,error:r,libraryLinks:i=!0,onChange:a}){let o=(0,m.useId)(),s=t.filter(e=>e.kind===`narration`),c=s.find(t=>t.name===e),l=r??(e!==``&&!n?`Choose Inworld TTS-2 or turn preparation Off.`:void 0);return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-2`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:o,className:`text-small font-semibold`,children:`Narration Preparation`}),(0,h.jsx)(DI,{label:`Narration Preparation`,children:(0,h.jsx)(`p`,{children:`Optional. Uses the selected LLM once per narration chunk and entry. Supports Inworld TTS-2; the article and clean narration stay unchanged.`})})]}),(0,h.jsxs)(YP,{id:o,"data-play-field":`narrationPrompt`,value:e,"aria-describedby":`${o}-help${l?` ${o}-error`:``}`,"aria-invalid":l!==void 0||void 0,onChange:e=>a(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Off`}),e!==``&&c===void 0?(0,h.jsxs)(`option`,{value:e,children:[e,` (saved selection)`]}):null,s.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),(0,h.jsx)(`p`,{id:`${o}-help`,className:`sr-only`,children:`Optional. Uses the selected LLM once per narration chunk and entry. Supports Inworld TTS-2; the article and clean narration stay unchanged.`}),l?(0,h.jsx)(`p`,{id:`${o}-error`,className:`text-small text-red`,children:l}):null,i?(0,h.jsxs)(`div`,{className:`flex gap-4 text-small`,children:[(0,h.jsx)(oa,{to:`/prompts/new`,search:{kind:`narration`},children:`Create prompt`}),c?(0,h.jsx)(oa,{to:`/prompts/$promptId`,params:{promptId:c.id},children:`View prompt`}):null]}):null]})}function cL({value:e,supported:t,onChange:n,shared:r}){let i=(0,m.useId)(),a=t&&e===!0;return(0,h.jsxs)(`div`,{className:`col-span-full min-w-0 space-y-2`,children:[(0,h.jsxs)(`label`,{htmlFor:i,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:i,type:`checkbox`,"data-play-field":`audio.usePronunciationGlossary`,checked:e===!0,disabled:!t,"aria-describedby":`${i}-help${t?``:` ${i}-support`}`,className:`size-4 accent-accent`,onChange:e=>n(e.currentTarget.checked)}),`Use Pronunciation Glossary`,(0,h.jsx)(DI,{label:`the Pronunciation Glossary`,children:(0,h.jsxs)(`p`,{children:[`Uses IPA supplied in the article’s Pronunciation Glossary, for example`,` `,(0,h.jsx)(`code`,{children:`Arda: /ˈɑɹdə/`}),`. Works independently of Narration Preparation with no extra LLM call. Supports generated Inworld TTS-2 and TTS-2 Flash audio. Readable text stays unchanged; no glossary means ordinary narration.`]})})]}),(0,h.jsxs)(`p`,{id:`${i}-help`,className:`sr-only`,children:[`Uses IPA supplied in the article’s Pronunciation Glossary, for example`,` `,(0,h.jsx)(`code`,{children:`Arda: /ˈɑɹdə/`}),`. Works independently of Narration Preparation with no extra LLM call. Supports generated Inworld TTS-2 and TTS-2 Flash audio. Readable text stays unchanged; no glossary means ordinary narration.`]}),r===void 0?null:(0,h.jsxs)(`div`,{className:`space-y-1 pl-7`,children:[(0,h.jsxs)(`label`,{htmlFor:`${i}-shared`,className:`flex min-h-8 items-center gap-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${i}-shared`,type:`checkbox`,"data-play-field":`audio.shareGlossary`,checked:r.value===!0,disabled:!a,"aria-describedby":`${i}-shared-help`,className:`size-4 accent-accent`,onChange:e=>r.onChange(e.currentTarget.checked)}),`Also use pronunciations from my other projects`]}),(0,h.jsx)(`p`,{id:`${i}-shared-help`,className:`text-label text-ink3`,children:`Adds every term from your other projects’ glossaries, copied when this project starts. This project’s own glossary wins where they differ. Turn it off to use this article’s glossary only.`}),r.note===void 0?null:r.note]}),t?null:(0,h.jsx)(`p`,{id:`${i}-support`,className:`text-label text-ink3`,children:`Unavailable for this provider or model. Your saved preference is retained.`})]})}var lL=`The establishing image is made first and is never shown in the video. Every other image - the video's, the shorts' and, if ticked, the thumbnail - is drawn with it as a reference, so the characters, style and palette stay the same. Changing it or making it again marks those images outdated.`,uL={source:`off`,prompt:``,thumbnail:!0},dL=[{value:`prompt`,label:`From a prompt`},{value:`provide`,label:`Upload`}];function fL({value:e,prompts:t,problem:n,upload:r,prompt:i,onChange:a}){let o=(0,m.useId)(),s=e.source===`off`,c=t.filter(e=>e.kind===`image`).map(e=>({value:e.name,label:e.name}));return(0,h.jsxs)(`div`,{className:`col-span-full grid min-w-0 grid-cols-1 gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2`,children:[(0,h.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,h.jsx)(BI,{field:`reference.source`,label:`Establishing image`,value:s?``:e.source,placeholder:`Off`,options:dL,problem:n?.(`reference.source`),onPick:t=>a({...e,source:t===`prompt`||t===`provide`?t:`off`})})}),(0,h.jsx)(DI,{label:`the establishing image`,children:lL})]}),e.source===`provide`?(0,h.jsx)(`div`,{className:`min-w-0`,children:r}):i??(0,h.jsx)(BI,{field:`reference.prompt`,label:`Establishing prompt`,value:e.prompt,placeholder:s?`Off`:`Pick an image prompt`,options:c,disabled:s,problem:n?.(`reference.prompt`),onPick:t=>a({...e,prompt:t})}),(0,h.jsxs)(`label`,{htmlFor:o,className:`col-span-full flex min-h-9 cursor-pointer items-center gap-2 text-small text-ink2`,children:[(0,h.jsx)(`input`,{id:o,type:`checkbox`,"data-play-field":`reference.thumbnail`,checked:e.thumbnail,disabled:s,onChange:t=>a({...e,thumbnail:t.target.checked})}),`Draw the thumbnail from it too`]})]})}function pL({choice:e,onChange:t,field:n=`llm.thinking`,label:r=`Thinking`,problem:i}){let{api:a}=B(),o=I(FI(a,e.provider)).data?.models.find(t=>t.id===e.model)?.thinkingModes??[];if(!o.length&&!e.thinking)return null;let s=r===`Thinking`?`thinking level`:r.toLowerCase();return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(BI,{field:n,label:r,value:e.thinking??`default`,placeholder:`Model default`,problem:e.thinking&&!o.includes(e.thinking)?`Choose a supported ${s}.`:i,options:[{value:`default`,label:`Model default`},...e.thinking&&!o.includes(e.thinking)?[{value:e.thinking,label:`${e.thinking} (saved level)`}]:[],...o.map(e=>({value:e,label:e===`off`?`Off`:e.charAt(0).toUpperCase()+e.slice(1)}))],onPick:n=>{let r=o.find(e=>e===n),{thinking:i,...a}=e;t(r===void 0?a:{...a,thinking:r})}}),r===`Thinking`&&o.length&&!o.includes(`off`)?(0,h.jsx)(`p`,{className:`mt-1 text-small text-ink3`,children:`This model does not support turning thinking off.`}):null]})}function mL({form:e,prompts:t,providers:n,voices:r,problem:i,update:a,onPickFiles:o,onRemoveFile:s,onReattachFile:c,rawCounts:l,advanced:u}){let d=r.filter(t=>t.provider===e.audio.provider),f=[e.chunking.mode,e.intro?`intro ${e.intro}`:void 0,e.outro?`outro ${e.outro}`:void 0,e.narrationPrompt?`preparation on`:void 0,e.audio.usePronunciationGlossary?`glossary on`:void 0].filter(e=>e!==void 0).join(` · `);return(0,h.jsxs)(iL,{kind:`audio`,name:`Audio`,dim:e.sources.audio===`off`,children:[(0,h.jsx)(aL,{kind:`audio`,form:e,update:a}),(0,h.jsx)(`div`,{className:nL,children:e.sources.audio===`generate`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UI,{field:`audio.provider`,label:`TTS`,family:`tts`,providers:n,value:e.audio.provider,problem:i(`audio`),onPick:t=>{a({audio:{...e.audio,provider:t,model:``,voice:``}})}}),(0,h.jsx)(WI,{field:`audio.model`,label:`TTS model`,provider:e.audio.provider,value:e.audio.model,problem:i(`audio.model`),onPick:t=>a({audio:{...e.audio,model:t}})}),(0,h.jsx)(BI,{field:`audio.voice`,label:`Voice`,value:e.audio.voice,placeholder:d.length===0?`No voices. Add one in Settings.`:`Pick a voice`,options:d.map(e=>({value:e.voiceId,label:e.name})),problem:i(`audio.voice`),onPick:t=>{a({audio:{...e.audio,voice:t}})}}),(0,h.jsxs)(`details`,{className:`col-span-full rounded-control border border-line px-3`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink2`,children:[`Audio Advanced · `,f]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 pt-2 pb-3 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(`div`,{className:`col-span-full`,children:(0,h.jsx)(JI,{...l?{rawCounts:l}:{},value:e.chunking,onPick:e=>{a({chunking:e})}})}),u,(0,h.jsx)(sL,{value:e.narrationPrompt??``,prompts:t,supported:e.audio.provider===`inworld`&&e.audio.model===`inworld-tts-2`,error:i(`narrationPrompt`),onChange:e=>a({narrationPrompt:e})}),(0,h.jsx)(cL,{value:e.audio.usePronunciationGlossary,supported:SA({sources:e.sources,audio:{...e.audio,usePronunciationGlossary:!0}}),onChange:t=>a({audio:{...e.audio,usePronunciationGlossary:t}}),shared:{value:e.audio.shareGlossary??!0,onChange:t=>a({audio:{...e.audio,shareGlossary:t}})}})]})]})]}):null}),e.sources.audio===`provide`?(0,h.jsxs)(`div`,{className:rL,children:[(0,h.jsx)(eL,{field:`provided.audio`,label:`Narration file`,accept:`audio/*`,uploads:e.provided.audio===void 0?[]:[e.provided.audio],problem:i(`provided.audio`),onPick:e=>{o(`audio`,e)},onReattach:c?(e,t)=>c(`audio`,e,t):void 0,onRemove:e=>{s(`audio`,e)}}),(0,h.jsx)(`p`,{className:`mt-2 text-small text-ink2`,children:`Uploaded narration is used as-is; include any intro and outro in that file.`})]}):null]})}function hL({form:e,providers:t,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s,rawNumbers:c}){return(0,h.jsxs)(iL,{kind:`images`,name:`Images`,dim:e.sources.images===`off`,children:[(0,h.jsx)(aL,{kind:`images`,form:e,update:i}),(0,h.jsx)(`div`,{className:nL,children:e.sources.images===`generate`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(gL,{form:e,providers:t,problem:r,update:i}),(0,h.jsx)(XI,{prompts:n.filter(e=>e.kind===`image`),...c?{rawNumbers:c}:{},picked:e.imagePrompts,problem:r,onPick:e=>{i({imagePrompts:e})}}),(0,h.jsx)(_L,{form:e,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,...s?{onReattachFile:s}:{}})]}):null}),e.sources.images===`provide`?(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)(eL,{field:`provided.images`,label:`Slideshow images`,accept:`image/png,image/jpeg,image/webp`,multiple:!0,numbered:!0,uploads:e.provided.images,problem:r(`provided.images`),onPick:e=>{a(`images`,e)},onReattach:s?(e,t)=>s(`images`,e,t):void 0,onRemove:e=>{o(`images`,e)}})}):null]})}function gL({form:e,providers:t,problem:n,update:r}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UI,{field:`images.provider`,label:`Provider`,family:`image`,providers:t,value:e.images.provider,problem:n(`images`),onPick:e=>r({images:{provider:e,model:``}})}),(0,h.jsx)(WI,{field:`images.model`,label:`Model`,provider:e.images.provider,value:e.images.model,problem:n(`images.model`),onPick:t=>r({images:{...e.images,model:t}})}),(0,h.jsx)(pL,{field:`images.thinking`,label:`Effort`,choice:e.images,problem:n(`images.thinking`),onChange:e=>r({images:e})})]})}function _L({form:e,prompts:t,problem:n,update:r,onPickFiles:i,onRemoveFile:a,onReattachFile:o}){return(0,h.jsx)(fL,{value:e.reference??uL,prompts:t,problem:n,onChange:e=>r({reference:e}),upload:(0,h.jsx)(eL,{field:`provided.reference`,label:`Establishing image file`,accept:`image/png,image/jpeg`,uploads:e.provided.reference===void 0?[]:[e.provided.reference],problem:n(`provided.reference`),onPick:e=>{i(`reference`,e)},onReattach:o?(e,t)=>o(`reference`,e,t):void 0,onRemove:e=>{a(`reference`,e)}})})}var vL=`After subtitle timing, the text model picks the best self-contained moments of the narration. Each becomes a vertical 1080×1920 clip with new images, big word-by-word captions, and its own title, description and hashtags. It runs beside the render; the images are charged like any other.`,yL={enabled:!1,count:String(_k.count),minSeconds:String(_k.minSeconds),maxSeconds:String(_k.maxSeconds),prompt:``,imagePrompt:``,titleOnScreen:!0},bL=Array.from({length:Math.round((vk-1)/yk)+1},(e,t)=>(1+t*yk).toFixed(2)),xL=[`titleOnScreen`,`speed`,`musicVolume`,`fullVideoLink`];function SL({value:e,prompts:t,narrated:n,problem:r,music:i,musicName:a,onChange:o}){let s=(0,m.useId)(),c=e.enabled,l=[`enabled`,`count`,`minSeconds`,`maxSeconds`,`prompt`,`imagePrompt`].map(e=>r?.(`shorts.${e}`)).find(e=>e!==void 0),u=xL.map(e=>r?.(`shorts.${e}`)).find(e=>e!==void 0),d=r?.(`shorts.music`),[f,p]=(0,m.useState)(!1),g=(t,n,i,a)=>(0,h.jsx)(KP,{id:`${s}-${t}`,"data-play-field":`shorts.${t}`,type:`text`,inputMode:`numeric`,"aria-label":n,"aria-invalid":r?.(`shorts.${t}`)!==void 0,"aria-describedby":l?`${s}-error`:void 0,title:`${String(i)}-${String(a)}`,className:`w-[64px] tabular-nums`,disabled:!c,value:e[t],onChange:n=>o({...e,[t]:n.target.value})}),_=e.speed?.trim()?e.speed:bL[0],v=e.musicVolume??``,y=[e.titleOnScreen===!0?`Title on screen`:`No title on screen`,_===bL[0]?void 0:`${_??``}×`,a===void 0?void 0:`Music: ${a}`,v.trim()===``||v===`15`?void 0:`Music at ${v}%`,e.fullVideoLink?.trim()?`Full video linked`:void 0].filter(e=>e!==void 0).join(` · `);return(0,h.jsxs)(`div`,{className:`col-span-full flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,h.jsxs)(`label`,{htmlFor:`${s}-switch`,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${s}-switch`,type:`checkbox`,"data-play-field":`shorts.enabled`,checked:c,disabled:!n&&!c,"aria-describedby":`${s}-help${l?` ${s}-error`:``}`,className:`size-4 accent-accent`,onChange:t=>o({...e,enabled:t.currentTarget.checked})}),`Shorts`,(0,h.jsx)(DI,{label:`Shorts`,children:(0,h.jsx)(`p`,{children:vL})})]}),(0,h.jsxs)(`label`,{htmlFor:`${s}-count`,className:`flex items-center gap-2 text-small`,children:[`How many`,g(`count`,`How many shorts`,1,10)]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-small`,children:[(0,h.jsx)(`label`,{htmlFor:`${s}-minSeconds`,children:`Length`}),g(`minSeconds`,`Shortest short, in seconds`,15,180),(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`to`}),g(`maxSeconds`,`Longest short, in seconds`,15,180),(0,h.jsx)(`span`,{className:`text-ink3`,children:`seconds`})]}),(0,h.jsx)(CL,{id:`${s}-prompt`,field:`shorts.prompt`,label:`Shorts prompt`,kind:`shorts`,value:e.prompt,prompts:t,disabled:!c,onChange:t=>o({...e,prompt:t})}),(0,h.jsx)(CL,{id:`${s}-image`,field:`shorts.imagePrompt`,label:`Image style`,kind:`image`,value:e.imagePrompt,prompts:t,disabled:!c,onChange:t=>o({...e,imagePrompt:t})}),(0,h.jsx)(`p`,{id:`${s}-help`,className:`sr-only`,children:vL}),l?(0,h.jsx)(`p`,{id:`${s}-error`,className:`basis-full text-small text-red`,children:l}):n?null:(0,h.jsx)(`p`,{className:`basis-full text-label text-ink3`,children:`Needs narration.`}),(0,h.jsxs)(`details`,{className:`basis-full rounded-control border border-line px-3`,open:f||u!==void 0||d!==void 0,onToggle:e=>p(e.currentTarget.open),children:[(0,h.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer items-center text-small text-ink2`,children:[`More shorts options · `,y]}),(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-4 gap-y-3 pt-2 pb-3`,children:[(0,h.jsxs)(`label`,{htmlFor:`${s}-title`,className:`flex min-h-9 items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{id:`${s}-title`,type:`checkbox`,"data-play-field":`shorts.titleOnScreen`,checked:e.titleOnScreen===!0,disabled:!c,className:`size-4 accent-accent`,onChange:t=>o({...e,titleOnScreen:t.currentTarget.checked})}),`Title on screen`,(0,h.jsx)(DI,{label:`Title on screen`,children:(0,h.jsx)(`p`,{children:`The short's title stays at the top for the whole clip, large and bold in the caption font, below where the apps draw their own buttons.`})})]}),(0,h.jsxs)(`label`,{htmlFor:`${s}-speed`,className:`flex items-center gap-2 text-small`,children:[`Speed`,(0,h.jsxs)(YP,{id:`${s}-speed`,"data-play-field":`shorts.speed`,className:`w-auto min-w-[88px]`,value:bL.includes(_??``)?_:``,"aria-invalid":r?.(`shorts.speed`)!==void 0,disabled:!c,onChange:t=>o({...e,speed:t.target.value}),children:[bL.includes(_??``)?null:(0,h.jsx)(`option`,{value:``,children:`Choose a speed`}),bL.map(e=>(0,h.jsx)(`option`,{value:e,children:e===bL[0]?`1.00× (normal)`:`${e}×`},e))]})]}),(0,h.jsxs)(`label`,{htmlFor:`${s}-volume`,className:`flex items-center gap-2 text-small`,children:[`Music volume`,(0,h.jsx)(KP,{id:`${s}-volume`,"data-play-field":`shorts.musicVolume`,type:`text`,inputMode:`numeric`,title:`0-100`,placeholder:`15`,"aria-invalid":r?.(`shorts.musicVolume`)!==void 0,className:`w-[64px] tabular-nums`,disabled:!c,value:v,onChange:t=>o({...e,musicVolume:t.target.value})}),(0,h.jsx)(`span`,{className:`text-ink3`,children:`%`})]}),(0,h.jsxs)(`label`,{htmlFor:`${s}-link`,className:`flex min-w-0 grow items-center gap-2 text-small`,children:[`Full video link`,(0,h.jsx)(KP,{id:`${s}-link`,"data-play-field":`shorts.fullVideoLink`,type:`url`,inputMode:`url`,maxLength:bk,placeholder:`https://youtu.be/…`,"aria-invalid":r?.(`shorts.fullVideoLink`)!==void 0,className:`min-w-[200px] flex-1`,disabled:!c,value:e.fullVideoLink??``,onChange:t=>o({...e,fullVideoLink:t.target.value})})]}),(0,h.jsxs)(`p`,{className:`basis-full text-label text-ink3`,children:[`Each short's description ends with a line to the full video; without a link it says`,` `,xk,` for you to fill in.`]}),i,u?(0,h.jsx)(`p`,{role:`alert`,className:`basis-full text-small text-red`,children:u}):null]})]})]})}function CL({id:e,field:t,label:n,kind:r,value:i,prompts:a,disabled:o,onChange:s}){let c=a.filter(e=>e.kind===r),l=i!==``&&!c.some(e=>e.name===i);return(0,h.jsxs)(`label`,{htmlFor:e,className:`flex items-center gap-2 text-small`,children:[n,(0,h.jsxs)(YP,{id:e,"data-play-field":t,className:`w-auto min-w-[120px]`,value:i,disabled:o,onChange:e=>s(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:wk}),l?(0,h.jsxs)(`option`,{value:i,children:[i,` (saved choice)`]}):null,c.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]})}var wL=[`Write a YouTube description for this video.`,``,`- Summary: a 2-3 sentence hook that says what the viewer gets from watching, in plain words, without clickbait.`,`- Chapters: split the video where the topic changes, 5-12 chapters for a long video and fewer for a short one. Chapter titles are 2-6 words, in title case, and name what that part covers.`,`- Hashtags: 3-5 hashtags about the subject, most specific last.`,`- Tags: 15-25 search terms a viewer might type to find this video, from broad to specific.`].join(`
|
|
108
|
+
`),TL=`Built-in`,EL=`After subtitle timing, the text model writes a YouTube description with chapters at the narration's real times, hashtags at the end, and a separate list of tags. It runs beside the render.`;function DL({enabled:e,prompt:t,prompts:n,narrated:r,problem:i,onChange:a}){let o=(0,m.useId)(),s=n.filter(e=>e.kind===`description`),c=t!==``&&!s.some(e=>e.name===t),l=i?.(`youtubeDescription`)??i?.(`descriptionPrompt`);return(0,h.jsxs)(`div`,{className:`col-span-full flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-switch`,className:`flex min-h-10 items-center gap-3 text-small font-semibold max-[1099px]:min-h-11`,children:[(0,h.jsx)(`input`,{id:`${o}-switch`,type:`checkbox`,"data-play-field":`youtubeDescription`,checked:e,disabled:!r&&!e,"aria-describedby":`${o}-help${l?` ${o}-error`:``}`,className:`size-4 accent-accent`,onChange:e=>a({youtubeDescription:e.currentTarget.checked,descriptionPrompt:t})}),`YouTube description`,(0,h.jsx)(DI,{label:`the YouTube description`,children:(0,h.jsx)(`p`,{children:EL})})]}),(0,h.jsxs)(`label`,{htmlFor:`${o}-prompt`,className:`flex items-center gap-2 text-small`,children:[`Description prompt`,(0,h.jsxs)(YP,{id:`${o}-prompt`,"data-play-field":`descriptionPrompt`,className:`w-auto min-w-[120px]`,value:t,disabled:!e,onChange:t=>a({youtubeDescription:e,descriptionPrompt:t.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:TL}),c?(0,h.jsxs)(`option`,{value:t,children:[t,` (saved choice)`]}):null,s.map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]}),(0,h.jsx)(`p`,{id:`${o}-help`,className:`sr-only`,children:EL}),l?(0,h.jsx)(`p`,{id:`${o}-error`,className:`basis-full text-small text-red`,children:l}):r?null:(0,h.jsx)(`p`,{className:`basis-full text-label text-ink3`,children:`Needs narration.`})]})}var OL={cuts:`Every N seconds holds each image for Seconds per image. Follow the narration cuts in the pause after a sentence, as near to that length as the sentences allow (never under 40% of it), and starts a new image at every chapter. Following the narration times the words first, as captions do; it works for English narration.`,transition:`How one image hands over to the next. The change is centred on the cut and takes the time chosen, so the video stays exactly as long as its narration.`,vignette:`Darkens the corners to draw the eye to the middle.`,grain:`Adds moving film grain over the whole picture.`,grade:`A colour treatment for the whole video.`,atmosphere:`An overlay drawn by Slopify itself: rising embers, drifting dust, or low fog along the bottom of the frame.`,cards:`Shows each chapter's title in the middle of the picture for 2.5 seconds as it starts, in the caption font. The chapters are the YouTube description's when that step runs, otherwise the article's headings.`,animate:`Turns some images into short moving clips with an image-to-video model on your image provider (fal.ai or Replicate). Each clip is paid, and the estimate shows the cost. An image that can't be animated is shown still, and the project page says which.`};function kL({value:e,narrated:t,imageProvider:n,problem:r,onChange:i,fieldPrefix:a=`videoEdit`}){let o=(0,m.useId)(),s=e??Lk,c=e=>i({...s,...e}),{api:l}=B(),u=I(II(l,n,s.animate!==`off`)),d=e=>r?.(`${a}.${e}`),f=[s.transition===`cut`?void 0:`${Hk[s.transition]} ${String(s.transitionSeconds)} s`,s.grade===`none`?void 0:Wk[s.grade],s.atmosphere===`none`?void 0:Gk[s.atmosphere],s.vignette===`off`?void 0:`Vignette`,s.grain===`off`?void 0:`Grain`,s.chapterCards?`Chapter cards`:void 0,s.animate===`off`?void 0:`Animated images`].filter(e=>e!==void 0),p=[`transition`,`transitionSeconds`,`chapterCards`,`animate`,`animateEvery`,`animateModel`].map(d).filter(e=>e!==void 0),g=u.data?.models??[],_=s.animateModel!==``&&!g.some(e=>e.id===s.animateModel);return{cuts:(0,h.jsx)(AL,{id:`${o}-cuts`,label:`Cuts`,help:OL.cuts,children:(0,h.jsx)(YP,{id:`${o}-cuts`,"data-play-field":`${a}.cuts`,className:`w-auto min-w-[160px]`,value:s.cuts,onChange:e=>c({cuts:e.target.value}),children:jk.map(e=>(0,h.jsx)(`option`,{value:e,children:Vk[e]},e))})}),look:(0,h.jsxs)(`details`,{className:`group min-w-0 rounded-control border border-line2`,children:[(0,h.jsxs)(`summary`,{className:`flex min-h-10 cursor-pointer items-center gap-3 px-3 text-small max-[1099px]:min-h-11`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:`Look`}),(0,h.jsx)(`span`,{className:`min-w-0 truncate text-ink3`,children:f.length===0?`Plain cuts, no effects`:f.join(` · `)})]}),(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-x-6 gap-y-3 border-line2 border-t p-3 min-[700px]:grid-cols-2`,children:[(0,h.jsxs)(AL,{id:`${o}-transition`,label:`Transition`,help:OL.transition,children:[(0,h.jsx)(YP,{id:`${o}-transition`,"data-play-field":`${a}.transition`,className:`w-auto min-w-[150px]`,value:s.transition,onChange:e=>c({transition:e.target.value}),children:Mk.map(e=>(0,h.jsx)(`option`,{value:e,children:Hk[e]},e))}),(0,h.jsx)(YP,{"aria-label":`Transition length`,"data-play-field":`${a}.transitionSeconds`,"aria-invalid":d(`transitionSeconds`)!==void 0,className:`w-auto min-w-[80px]`,disabled:s.transition===`cut`,value:String(s.transitionSeconds),onChange:e=>c({transitionSeconds:Number(e.target.value)}),children:Bk.map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[e,` s`]},e))})]}),(0,h.jsx)(AL,{id:`${o}-grade`,label:`Colour grade`,help:OL.grade,children:(0,h.jsx)(jL,{id:`${o}-grade`,field:`${a}.grade`,value:s.grade,options:Pk,labels:Wk,onChange:e=>c({grade:e})})}),(0,h.jsx)(AL,{id:`${o}-vignette`,label:`Vignette`,help:OL.vignette,children:(0,h.jsx)(jL,{id:`${o}-vignette`,field:`${a}.vignette`,value:s.vignette,options:Nk,labels:Uk,onChange:e=>c({vignette:e})})}),(0,h.jsx)(AL,{id:`${o}-grain`,label:`Film grain`,help:OL.grain,children:(0,h.jsx)(jL,{id:`${o}-grain`,field:`${a}.grain`,value:s.grain,options:Nk,labels:Uk,onChange:e=>c({grain:e})})}),(0,h.jsx)(AL,{id:`${o}-atmosphere`,label:`Atmosphere`,help:OL.atmosphere,children:(0,h.jsx)(jL,{id:`${o}-atmosphere`,field:`${a}.atmosphere`,value:s.atmosphere,options:Fk,labels:Gk,onChange:e=>c({atmosphere:e})})}),(0,h.jsx)(AL,{id:`${o}-cards`,label:`Chapter cards`,help:OL.cards,children:(0,h.jsx)(`input`,{id:`${o}-cards`,type:`checkbox`,"data-play-field":`${a}.chapterCards`,className:`size-4 accent-accent`,checked:s.chapterCards,disabled:!t&&!s.chapterCards,onChange:e=>c({chapterCards:e.currentTarget.checked})})}),(0,h.jsxs)(AL,{id:`${o}-animate`,label:`Animate images`,help:OL.animate,wide:!0,children:[(0,h.jsx)(YP,{id:`${o}-animate`,"data-play-field":`${a}.animate`,"aria-invalid":d(`animate`)!==void 0,className:`w-auto min-w-[150px]`,value:s.animate,onChange:e=>c({animate:e.target.value}),children:Ik.map(e=>(0,h.jsx)(`option`,{value:e,disabled:e===`chapters`&&!t,children:Kk[e]},e))}),(0,h.jsx)(YP,{"aria-label":`Animate every how many images`,"data-play-field":`${a}.animateEvery`,"aria-invalid":d(`animateEvery`)!==void 0,className:`w-auto min-w-[80px]`,disabled:s.animate!==`every`,value:String(s.animateEvery),onChange:e=>c({animateEvery:Number(e.target.value)}),children:Array.from({length:9},(e,t)=>t+2).map(e=>(0,h.jsxs)(`option`,{value:String(e),children:[`every `,e]},e))}),(0,h.jsxs)(YP,{"aria-label":`Image-to-video model`,"data-play-field":`${a}.animateModel`,"aria-invalid":d(`animateModel`)!==void 0,className:`w-auto min-w-[180px]`,disabled:s.animate===`off`,value:s.animateModel,onChange:e=>c({animateModel:e.target.value}),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a model`}),_?(0,h.jsxs)(`option`,{value:s.animateModel,children:[s.animateModel,` (saved choice)`]}):null,g.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),p.length>0?(0,h.jsx)(`p`,{className:`col-span-full text-small text-red`,children:p[0]}):s.animate!==`off`&&u.isSuccess&&g.length===0?(0,h.jsx)(`p`,{className:`col-span-full text-label text-ink3`,children:`This image provider has no image-to-video models. Choose fal.ai or Replicate for images to animate them.`}):null]})]})}}function AL({id:e,label:t,help:n,wide:r=!1,children:i}){return(0,h.jsxs)(`div`,{className:z(`flex min-w-0 flex-wrap items-center gap-2 text-small`,r&&`min-[700px]:col-span-2`),children:[(0,h.jsx)(`label`,{htmlFor:e,className:`min-w-[96px]`,children:t}),i,(0,h.jsx)(DI,{label:t.toLowerCase(),children:(0,h.jsx)(`p`,{children:n})})]})}function jL({id:e,field:t,value:n,options:r,labels:i,onChange:a}){return(0,h.jsx)(YP,{id:e,"data-play-field":t,className:`w-auto min-w-[130px]`,value:n,onChange:e=>a(e.target.value),children:r.map(e=>(0,h.jsx)(`option`,{value:e,children:i[e]},e))})}function ML({form:e,problem:t,update:n}){return(0,h.jsxs)(iL,{kind:`research`,name:`Research`,dim:e.sources.research===`off`,children:[(0,h.jsx)(aL,{kind:`research`,form:e,update:n}),(0,h.jsx)(`div`,{className:nL,children:e.sources.research===`generate`?(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:`Runs through the LLM, one agent per chapter`}):null}),e.sources.research===`provide`?(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)($I,{field:`provided.research`,label:`Research notes`,value:e.provided.research,placeholder:`Paste the notes the article will be written from.`,problem:t(`provided.research`),onChange:t=>{n({provided:{...e.provided,research:t}})}})}):null]})}function NL({form:e,prompts:t,problem:n,update:r}){return(0,h.jsxs)(iL,{kind:`article`,name:`Article`,dim:!1,children:[(0,h.jsx)(aL,{kind:`article`,form:e,update:r}),(0,h.jsx)(`div`,{className:`${rL} grid gap-4`,children:e.sources.article===`generate`?(0,h.jsx)(BI,{field:`articlePrompt`,label:`Article prompt`,value:e.articlePrompt,placeholder:`Pick a prompt`,options:oL(t,`article`),problem:n(`articlePrompt`),onPick:e=>{r({articlePrompt:e})}}):null}),e.sources.article===`provide`?(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)($I,{field:`provided.article`,label:`Article text`,value:e.provided.article,placeholder:`Paste the article that will be narrated.`,problem:n(`provided.article`),onChange:t=>{r({provided:{...e.provided,article:t}})}})}):null]})}function PL({form:e,providers:t,prompts:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s}){let c=e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`;return(0,h.jsxs)(iL,{kind:`thumbnail`,name:`Thumbnail`,dim:e.sources.thumbnail===`off`,children:[(0,h.jsx)(aL,{kind:`thumbnail`,form:e,update:i}),(0,h.jsxs)(`div`,{className:nL,children:[c&&e.sources.images!==`generate`?(0,h.jsx)(gL,{form:e,providers:t,problem:r,update:i}):null,c?(0,h.jsx)(BI,{field:`thumbnailPrompt`,label:`Thumbnail prompt`,value:e.thumbnailPrompt,placeholder:`Pick a prompt`,options:oL(n,`thumbnail`),problem:r(`thumbnailPrompt`),onPick:e=>{i({thumbnailPrompt:e})}}):null]}),e.sources.thumbnail===`provide`?(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)(eL,{field:`provided.thumbnail`,label:`Thumbnail image`,accept:`image/png,image/jpeg,image/webp`,uploads:e.provided.thumbnail===void 0?[]:[e.provided.thumbnail],problem:r(`provided.thumbnail`),onPick:e=>{a(`thumbnail`,e)},onReattach:s?(e,t)=>s(`thumbnail`,e,t):void 0,onRemove:e=>{o(`thumbnail`,e)}})}):null]})}var FL=`How each image moves while it's on screen.`;function IL({form:e,prompts:t,silenceGapSeconds:n,problem:r,update:i,onPickFiles:a,onRemoveFile:o,onReattachFile:s,rawTiming:c}){let l=e.sources.video===`generate`?e.sources.audio===`off`?`Silent video · each image shown once`:`Images and narration · ${String(n)} s segment gaps`:e.sources.audio===`off`?`Download each enabled stage separately`:`Combined WAV export with narration and segment gaps`,u=t=>({value:c?c[t]:Number.isFinite(e[t])?String(e[t]):``,onChange:e=>{c?c.onChange(t,e):i({[t]:e.trim()===``?NaN:Number(e)})}}),d=kL({value:e.videoEdit,narrated:e.sources.audio!==`off`,imageProvider:e.images.provider,problem:r,onChange:e=>i({videoEdit:e})});return(0,h.jsxs)(iL,{kind:`video`,name:`Export`,dim:e.sources.video===`off`,children:[(0,h.jsx)(aL,{kind:`video`,form:e,update:i}),(0,h.jsx)(`span`,{className:nL,children:(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:l})}),e.sources.video===`generate`||e.sources.audio!==`off`?(0,h.jsxs)(`div`,{className:nL,children:[e.sources.video===`generate`?(0,h.jsx)(LL,{field:`imageSeconds`,label:`Seconds per image`,help:`Each image stays on screen this long, then the next one; after the last image they start again.`,step:1,problem:r(`imageSeconds`),...u(`imageSeconds`)}):null,e.sources.video===`generate`?(0,h.jsx)(LL,{field:`zoomPercent`,label:`Zoom (%)`,help:`How far each image zooms in or out over its time on screen. 0 keeps images still.`,step:.5,problem:r(`zoomPercent`),...u(`zoomPercent`)}):null,e.sources.video===`generate`?(0,h.jsx)(zI,{label:`Motion`,problem:void 0,inline:!0,children:({id:t})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(YP,{id:t,"data-play-field":`motionStyle`,className:`w-auto min-w-[120px]`,value:e.motionStyle,onChange:e=>i({motionStyle:e.target.value}),children:Jb.map(e=>(0,h.jsx)(`option`,{value:e,children:$k[e]},e))}),(0,h.jsx)(DI,{label:`motion`,children:(0,h.jsx)(`p`,{children:FL})})]})}):null,e.sources.video===`generate`?d.cuts:null,e.sources.audio===`off`?null:(0,h.jsx)(LL,{field:`edgeSilenceSeconds`,label:`Silence at start and end (seconds)`,help:`Quiet time before the narration starts and after it ends.`,step:.5,problem:r(`edgeSilenceSeconds`),...u(`edgeSilenceSeconds`)})]}):null,e.sources.video===`generate`?(0,h.jsx)(`div`,{className:rL,children:d.look}):null,(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)(DL,{enabled:e.youtubeDescription===!0,prompt:e.descriptionPrompt??``,prompts:t,narrated:e.sources.audio!==`off`,problem:r,onChange:e=>i(e)})}),(0,h.jsx)(`div`,{className:rL,children:(0,h.jsx)(SL,{value:e.shorts??yL,prompts:t,narrated:e.sources.audio!==`off`,problem:r,musicName:e.provided.shortsMusic?.name,music:(0,h.jsxs)(`div`,{className:`basis-full`,children:[(0,h.jsx)(eL,{field:`shorts.music`,label:`Background music (optional): an audio file, looped if shorter than a short`,accept:`audio/*`,disabled:!$j(e),uploads:e.provided.shortsMusic===void 0?[]:[e.provided.shortsMusic],problem:r(`shorts.music`),onPick:e=>a(`shortsMusic`,e),onReattach:s?(e,t)=>s(`shortsMusic`,e,t):void 0,onRemove:e=>o(`shortsMusic`,e)}),(0,h.jsx)(`p`,{className:`mt-1 text-label text-ink3`,children:`Plays at the volume above under every short and dips while the narrator speaks.`})]}),onChange:e=>i({shorts:e})})}),e.sources.images===`off`?(0,h.jsx)(`p`,{className:`${rL} text-small text-ink2`,children:`Video is Off because Images is Off. Generate or provide images to enable video.`}):null]})}function LL({field:e,label:t,help:n,step:r,problem:i,value:a,onChange:o}){return(0,h.jsx)(zI,{label:t,problem:i,inline:!0,children:({id:s,describedBy:c})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KP,{id:s,"data-play-field":e,type:`text`,inputMode:r<1?`decimal`:`numeric`,className:`w-[80px] tabular-nums`,"aria-invalid":i!==void 0,"aria-describedby":c,value:a,onChange:e=>o(e.target.value)}),(0,h.jsx)(DI,{label:t.toLowerCase(),children:(0,h.jsx)(`p`,{children:n})})]})})}function RL({form:e,update:t}){let n=e.sources.document===`off`;return(0,h.jsxs)(iL,{kind:`document`,name:`Document`,dim:n,children:[(0,h.jsx)(aL,{kind:`document`,form:e,update:t}),(0,h.jsx)(`div`,{className:nL,children:(0,h.jsx)(zI,{label:`Theme`,problem:void 0,inline:!0,children:({id:r})=>(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(KI,{id:r,field:`document.theme`,className:`w-auto min-w-[120px]`,disabled:n,value:e.document,onChange:e=>{t({document:e})}}),(0,h.jsx)(oa,{to:`/document-themes`,className:`text-small text-run-text underline`,children:`Edit themes`})]})})})]})}function zL(e){let{form:t,problem:n,update:r,fields:i,entries:a,onLibrary:o}=e,s=(0,m.useId)(),c=e.prompts.find(e=>e.kind===`article`&&e.name===t.articlePrompt);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`mt-7`,children:[(0,h.jsx)(JP,{htmlFor:s,className:`mb-2`,children:`Project title`}),(0,h.jsx)(KP,{id:s,"data-play-field":`title`,value:t.title,maxLength:200,"aria-invalid":n(`title`)!==void 0,onChange:e=>r({title:e.target.value})}),n(`title`)?(0,h.jsx)(`p`,{className:`text-small text-red`,children:n(`title`)}):null]}),(0,h.jsx)(NL,{...e}),t.sources.article===`generate`?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 py-3`,children:[c?(0,h.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`summary`,{"data-play-field":`articlePrompt.preview`,className:`cursor-pointer py-2 text-small text-run-text`,children:`View prompt`}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words py-3 font-sans text-body text-ink2`,children:c.body})]}):(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e.prompts.some(e=>e.kind===`article`)?`Choose a saved article prompt.`:`No article prompts saved. Create a prompt to begin.`}),(0,h.jsx)(V,{variant:`ghost`,onClick:()=>o(`/prompts`),children:`Create prompt`})]}):(0,h.jsxs)(`p`,{className:`py-3 text-small text-ink3`,children:[t.provided.article.trim()?t.provided.article.trim().split(/\s+/).length:0,` `,`words · `,t.provided.article.length,` characters`]}),(0,h.jsx)(jI,{fields:i,origins:SI({form:t,prompts:e.prompts,entries:a,silenceGapSeconds:e.silenceGapSeconds}),values:t.values,problem:n,onChange:(e,n)=>r({values:{...t.values,[e]:n}})}),rM(t,a)?(0,h.jsxs)(`section`,{className:`border-y border-line py-4`,children:[(0,h.jsxs)(`div`,{className:`mb-3 flex items-center gap-1`,children:[(0,h.jsx)(`h3`,{className:`text-row font-semibold`,children:`Text generation`}),(0,h.jsx)(DI,{label:`text generation`,children:(0,h.jsx)(`p`,{children:`Shared by generated article, research, thumbnail wording, generated entries and Narration Preparation when enabled.`})}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(V,{variant:`ghost`,onClick:()=>o(`/settings`),children:`Settings`})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(UI,{field:`llm.provider`,label:`LLM`,family:`llm`,providers:e.providers,value:t.llm.provider,problem:n(`llm.provider`)??(t.llm.provider===``?n(`llm`):void 0),onPick:e=>r({llm:{provider:e,model:``}})}),(0,h.jsx)(WI,{field:`llm.model`,label:`Text model`,provider:t.llm.provider,value:t.llm.model,problem:n(`llm.model`)??(t.llm.provider!==``&&n(`llm`)?`Pick a text model.`:void 0),onPick:e=>r({llm:{...t.llm,model:e}})}),(0,h.jsx)(pL,{choice:t.llm,onChange:e=>r({llm:e})})]})]}):null,t.sources.article===`provide`?(0,h.jsx)(`p`,{className:`py-4 text-small text-ink3`,children:`Research is Off because the article is provided.`}):(0,h.jsx)(ML,{...e})]})}function BL(){let{api:e}=B(),t=yM(),n=_(),[r,i]=(0,m.useState)(null),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(!1),l=ml(),u=I({queryKey:[`play-drafts`],queryFn:async()=>{let t=await Cj(e);if(!t.ok)throw Error(t.message);return t.value.drafts}}),d=async()=>{if(!r||s)return;let e=r.id;c(!0),o(null);try{await t.discard({id:r.id,version:r.version}),i(null),await n.cancelQueries({queryKey:[`play-drafts`]}),n.setQueryData([`play-drafts`],t=>t?.filter(t=>t.id!==e))}catch(e){let t=e instanceof Error?e.message:`The draft wasn't discarded. Try again.`;o(t),l(t,`error`)}finally{c(!1)}};return(0,h.jsxs)(`section`,{"aria-label":`Drafts`,className:`flex min-w-0 flex-wrap items-center gap-2 text-small`,children:[(0,h.jsx)(`p`,{role:`status`,className:z(`engraved min-w-[112px] text-right`,t.status===`saved`?`text-done`:t.status===`error`||t.status===`conflict`?`text-red`:`text-ink3`),children:{unsaved:`Unsaved`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,conflict:`Changed elsewhere`}[t.status]}),t.status===`error`?(0,h.jsx)(V,{variant:`ghost`,onClick:()=>{!t.view&&t.activeId&&t.edited===0?t.open(t.activeId):t.flush()},children:`Retry`}):null,t.status===`conflict`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{variant:`ghost`,onClick:()=>{t.activeId&&t.open(t.activeId)},children:`Reload saved draft`}),(0,h.jsx)(V,{variant:`ghost`,onClick:()=>void t.saveAsNew(),children:`Save as a new draft`})]}):null,(0,h.jsxs)(CI,{children:[(0,h.jsx)(wI,{asChild:!0,children:(0,h.jsxs)(V,{variant:`ghost`,children:[`Drafts`,(0,h.jsx)(ms,{"aria-hidden":`true`,className:`size-4`})]})}),(0,h.jsxs)(EI,{align:`end`,className:`w-[340px] p-0`,"aria-label":`Saved drafts`,children:[u.isPending?(0,h.jsx)(`p`,{role:`status`,className:`px-3 py-2`,children:`Loading drafts…`}):null,u.error?(0,h.jsxs)(`p`,{role:`alert`,className:`px-3 py-2 text-red`,children:[u.error.message,` `,(0,h.jsx)(V,{variant:`ghost`,onClick:()=>void u.refetch(),children:`Retry`})]}):null,u.data?.length===0?(0,h.jsx)(`p`,{className:`px-3 py-2`,children:`No saved drafts`}):null,a?(0,h.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-red`,children:a}):null,(0,h.jsx)(`ul`,{className:`max-h-72 overflow-y-auto`,children:u.data?.map(e=>(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 border-t border-line px-3 py-2 first:border-t-0`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`button`,{type:`button`,className:`w-full break-words text-left text-ink hover:underline`,onClick:()=>void t.open(e.id),children:(0,h.jsx)(`span`,{className:`block`,children:e.title||`Untitled draft`})}),(0,h.jsxs)(`time`,{dateTime:e.updatedAt,className:`block text-label text-ink3`,children:[`Last edited `,ul(e.updatedAt)]})]}),e.readable?null:(0,h.jsx)(`p`,{className:`basis-full text-label text-amber`,children:`Unsupported or corrupt draft. Try opening it to recover, or discard it.`}),(0,h.jsx)(V,{variant:`ghost`,onClick:()=>{i(e),o(null)},"aria-label":`Discard ${e.title||`Untitled draft`}`,children:`Discard`})]},e.id))})]})]}),(0,h.jsx)(V,{onClick:()=>void t.newDraft(),children:`New draft`}),(0,h.jsx)(wP,{open:r!==null,title:`Discard draft`,consequence:`Discard ${r?.title||`Untitled draft`}? This cannot be undone.`,verb:`Confirm discard`,pending:s,onConfirm:()=>void d(),onCancel:()=>{s||i(null)}})]})}function VL(e,t){let n=[...e.querySelectorAll(`[data-play-field]`)].find(e=>e.dataset.playField===t);if(!n||n.hasAttribute(`disabled`))return!1;let r=n.closest(`details`);return r!==null&&!r.open&&(r.open=!0),n.focus(),n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),document.activeElement===n}function HL(e,t,n){let r=e;if(e===`fontUpload`&&(r=`subtitles.fontUpload`),/^provided\.images\.\d+$/.test(e)&&(r=`provided.images`),e===`subtitles`&&(r=`subtitles.mode`),e===`chunking`&&(r=`chunking.mode`),[`audio`,`llm`,`images`].includes(e)&&(r=`${e}.provider`),e===`provided`){let e=[`audio`,`images`,`thumbnail`].find(e=>t.sources[e]===`provide`&&(e===`images`?t.provided.images:[t.provided[e]]).some(e=>e&&(e.error!==void 0||e.file===void 0))),n=t.provided.shortsMusic;r=e===void 0&&$j(t)&&n!==void 0&&(n.error!==void 0||n.file===void 0)?`shorts.music`:t.reference?.source===`provide`&&t.provided.reference!==void 0&&(t.provided.reference.error!==void 0||t.provided.reference.file===void 0)?`provided.reference`:`provided.${e??`audio`}`}let i=/^imagePrompts\.(\d+)\.(.+)$/.exec(e);if(i){let e=t.imagePrompts[Number(i[1])];e&&(r=`imagePrompts.${e.name}.${i[2]}`)}e===`imagePrompts`&&(r=t.imagePrompts[0]?`imagePrompts.${t.imagePrompts[0].name}.number`:`imagePrompts`);let a=/^variants\.(\d+)\.(.+)$/.exec(e);a&&(r=`items.${n[Number(a[1])]?.key??a[1]}.${a[2]}`);let o=/^items\.(\d+)\.(.+)$/.exec(e);o&&(r=Number(o[1])===0?o[2]??e:`items.${n[Number(o[1])-1]?.key??o[1]}.${o[2]}`);let s=t=>t.some(t=>e===t||e.startsWith(`${t}.`));return{section:s([`title`,`articlePrompt`,`provided.article`,`provided.research`,`sources.article`,`sources.research`,`llm`,`values`])?`content`:s([`format`,`subtitles`,`fontUpload`])?`style`:s([`audio`,`narrationPrompt`,`provided.audio`,`intro`,`outro`,`chunking`,`images`,`imagePrompts`,`provided.images`,`thumbnailPrompt`,`provided.thumbnail`,`provided.reference`,`reference`,`provided`,`sources`,`imageSeconds`,`zoomPercent`,`motionStyle`,`edgeSilenceSeconds`,`document`,`youtubeDescription`,`descriptionPrompt`,`shorts`,`videoEdit`])?`outputs`:`review`,field:r}}function UL(e){return e===`9:16`?{width:1080,height:1920}:{width:1920,height:1080}}function WL(e,t){switch(e){case`top`:return{y:60,alignment:8,translateY:0};case`upper-middle`:return{y:t/4,alignment:5,translateY:-50};case`center`:return{y:t/2,alignment:5,translateY:-50};case`lower-middle`:return{y:t*3/4,alignment:5,translateY:-50};case`bottom`:return{y:t-60,alignment:2,translateY:-100}}}function GL({value:e,format:t,sample:n=`Every story begins with a word.`,backgroundUrl:r,showCaptions:i=!0,maxFrameHeight:a}){let{api:o}=B(),s=Ij(o,e.fontId),c=`subtitle-preview-${(0,m.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,[l,u]=(0,m.useState)(!1);(0,m.useEffect)(()=>{if(typeof FontFace>`u`||!document.fonts)return;let e=!0,t=new FontFace(c,`url(${JSON.stringify(s)})`);return u(!1),t.load().then(t=>{e&&document.fonts.add(t)}).catch(()=>{e&&u(!0)}),()=>{e=!1,document.fonts.delete(t)}},[c,s]);let d=UL(t),f=WL(e.position??`bottom`,d.height),p=Number.isFinite(e.fontSize)?Math.max(16,Math.min(120,e.fontSize)):48,g={position:`absolute`,left:`50%`,top:`${f.y/d.height*100}%`,width:`${(d.width-120)/d.width*100}%`,transform:`translate(-50%, ${f.translateY}%)`,fontFamily:`"${c}", sans-serif`,fontSize:`${p/d.width*100}cqw`,lineHeight:1.2,overflowWrap:`anywhere`,WebkitTextStroke:`${2.5/d.width*100}cqw #101010`,paintOrder:`stroke fill`,textShadow:`0 ${100/d.width}cqw ${100/d.width}cqw #000`};return(0,h.jsxs)(`figure`,{className:`min-w-0 self-start`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-label text-ink2`,children:[(0,h.jsx)(`span`,{children:`Style preview`}),(0,h.jsx)(`span`,{children:t})]}),(0,h.jsxs)(`div`,{role:`img`,"aria-label":`Subtitle style preview`,"data-format":t,"data-position":e.position??`bottom`,className:`relative mx-auto w-full overflow-hidden rounded-control border border-line2 bg-screen text-center text-white`,style:{aspectRatio:`${d.width} / ${d.height}`,maxWidth:t===`9:16`?a?`min(240px, calc((${a}) * 9 / 16))`:240:480,containerType:`inline-size`},children:[r?(0,h.jsx)(`img`,{src:r,alt:``,className:`absolute inset-0 h-full w-full object-cover`}):null,i?(0,h.jsx)(`span`,{role:`note`,"aria-label":`Caption sample`,style:g,children:n}):null]}),(0,h.jsxs)(`figcaption`,{className:`mt-2 text-label text-ink3`,children:[d.width,` × `,d.height,` · Preview at reduced scale.`,l?` Font preview unavailable; showing a fallback.`:``]})]})}function KL(){let[e,t]=(0,m.useState)(()=>window.matchMedia?.(`(min-width: 1100px)`).matches??!1);return(0,m.useEffect)(()=>{let e=window.matchMedia?.(`(min-width: 1100px)`);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function qL(){let{api:e}=B(),t=yM(),{form:n,previewText:r}=t.document,i=n.sources.images===`provide`?n.provided.images.map(e=>t.view?.attachments.find(t=>t.id===e.attachmentId&&t.kind===`images`&&t.state===`ready`&&t.stagedFileId)).find(Boolean):void 0,a=i&&t.activeId?jj(e,t.activeId,i.id):void 0,o=n.sources.video===`generate`&&n.sources.images!==`off`;return(0,h.jsxs)(`section`,{"aria-label":`Output preview`,className:`min-w-0`,children:[(0,h.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,h.jsx)(`h2`,{className:`text-small font-semibold`,children:`Output preview`}),(0,h.jsx)(V,{variant:`ghost`,className:`text-run-text`,onClick:()=>void t.navigate(`style`),children:`Edit style ↗`})]}),(0,h.jsx)(`div`,{className:`rounded-control border border-line bg-panel p-4`,children:(0,h.jsx)(GL,{value:{...n.subtitles,fontSize:Number(n.subtitles.fontSize)},format:n.format,sample:r,showCaptions:n.sources.audio!==`off`&&n.subtitles.mode!==`off`,maxFrameHeight:`max(160px, 100dvh - 360px)`,...a?{backgroundUrl:a}:{}})}),(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink3`,children:a?`Style preview using your supplied image.`:`Style preview only. No generated image is shown.`}),(0,h.jsx)(`p`,{className:`mt-2 text-small text-ink3`,children:o?n.subtitles.mode===`burn-in`?`Captions will be burned into the MP4.`:`Caption styling previews burn-in. SRT/VTT players choose their own styling.`:`Frame and caption styling apply when Video is enabled.`})]})}function JL(e){let t=yM(),n=t.document,{form:r,entries:i,problem:a,update:o}=e;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(mL,{...e,rawCounts:{...n.form.chunking,onChange:(e,r)=>t.edit({...n,form:{...n.form,chunking:{...n.form.chunking,mode:e,...e===`words`?{words:r}:e===`characters`?{characters:r}:{}}}})},advanced:(0,h.jsxs)(h.Fragment,{children:[[`intro`,`outro`].map(e=>(0,h.jsx)(BI,{field:e,label:e===`intro`?`Intro`:`Outro`,value:r[e],placeholder:`Off`,options:i.filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),problem:a(e),onPick:t=>o({[e]:t})},e)),(0,h.jsxs)(`div`,{className:`col-span-full flex flex-wrap gap-2`,children:[r.narrationPrompt?(0,h.jsx)(V,{variant:`ghost`,onClick:()=>e.onKeyword(`llm`),children:`Choose Text Generation in Content`}):null,(0,h.jsx)(V,{variant:`ghost`,onClick:e.onSettings,children:`Settings`})]})]})}),(0,h.jsx)(hL,{...e,rawNumbers:{values:n.form.imagePrompts,onChange:(e,r)=>t.edit({...n,form:{...n.form,imagePrompts:n.form.imagePrompts.map(t=>t.name===e?{...t,number:r}:t)}})}}),(0,h.jsx)(PL,{...e}),(0,h.jsx)(IL,{...e,rawTiming:{imageSeconds:n.form.imageSeconds,zoomPercent:n.form.zoomPercent,edgeSilenceSeconds:n.form.edgeSilenceSeconds,onChange:(e,r)=>t.edit({...n,form:{...n.form,[e]:r}})}}),(0,h.jsx)(RL,{...e}),e.missingKeyword?(0,h.jsxs)(`p`,{className:`py-4 text-small text-ink2`,children:[`A selected template needs keywords.`,` `,(0,h.jsx)(V,{variant:`ghost`,onClick:()=>e.onKeyword(e.missingKeyword??`values`),children:`Complete keywords in Content`})]}):null]})}var YL={ready:`done`,needs:`failed`,off:`skipped`,provided:`provided`},XL={ready:`Ready`,needs:`Needs setup`,off:`Off`,provided:`Provided`},ZL={ready:`text-done`,needs:`text-red`,off:`text-ink3`,provided:`text-ink2`};function QL(e,t){return e.some(e=>t===e||t.startsWith(`${e}.`))}function $L(e,t){let n=(e,n,r,i,a)=>{let o=t.find(e=>QL(r,e.field));return{label:e,readiness:o?`needs`:n===`off`?`off`:n===`provide`?`provided`:`ready`,field:o?.field??i,detail:a,...o?{problem:o.message}:{}}},r=e.imagePrompts.reduce((e,t)=>e+t.number,0);return[n(`Article`,e.sources.article,[`sources.article`,`articlePrompt`,`provided.article`,`values`,`llm`],e.sources.article===`provide`?`provided.article`:`articlePrompt`,e.sources.article===`provide`?`Supplied article`:e.articlePrompt||`No prompt`),n(`Narration`,e.sources.audio,[`sources.audio`,`audio`,`provided.audio`,`narrationPrompt`,`intro`,`outro`,`chunking`],`sources.audio`,e.audio.voice?`Voice chosen`:`No voice`),n(`Images`,e.sources.images,[`sources.images`,`images`,`imagePrompts`,`provided.images`],`sources.images`,e.sources.images===`generate`?`${String(r)} images`:`Supplied images`),n(`Thumbnail`,e.sources.thumbnail,[`sources.thumbnail`,`thumbnail`,`provided.thumbnail`],`sources.thumbnail`,`Cover image`),n(`Export`,e.sources.video,[`sources.video`,`imageSeconds`,`zoomPercent`,`motionStyle`,`edgeSilenceSeconds`,`videoEdit`],`sources.video`,e.sources.video===`generate`?e.sources.audio===`off`?`Silent MP4`:`MP4`:e.sources.audio===`off`?`Individual outputs`:`Combined WAV`),n(`YouTube description`,e.youtubeDescription===!0&&e.sources.audio!==`off`?`generate`:`off`,[`youtubeDescription`,`descriptionPrompt`],`youtubeDescription`,e.sources.audio===`off`?`Needs narration`:`Chapters, hashtags and tags · ${e.descriptionPrompt||`Built-in`} prompt`),n(`Shorts`,$j(e)?`generate`:`off`,[`shorts`],`shorts.enabled`,e.sources.audio===`off`?`Needs narration`:e.shorts?.enabled===!0?`${e.shorts.count} vertical clips, ${e.shorts.minSeconds}-${e.shorts.maxSeconds} s · ${e.shorts.prompt||`Built-in`} prompt`:`Vertical clips cut from the narration`),n(`Document`,e.sources.document,[`sources.document`,`document`],`sources.document`,`PDF · ${ex[e.document.theme]} theme`),n(`Style`,void 0,[`format`,`subtitles`],`format`,e.format)]}function eR({form:e,errors:t,onReveal:n,compact:r=!1}){let i=$L(e,t);return r?(0,h.jsx)(`ul`,{"aria-label":`Run readiness`,className:`mb-4 flex flex-wrap gap-x-4 gap-y-2`,children:i.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.field),"aria-label":`${e.label}: ${XL[e.readiness]}`,className:`inline-flex min-h-8 items-center gap-2 text-small text-ink2 hover:text-ink`,children:[(0,h.jsx)(jl,{state:YL[e.readiness]}),e.label,(0,h.jsx)(`span`,{"aria-hidden":`true`,className:z(`engraved`,ZL[e.readiness]),children:XL[e.readiness]})]})},e.label))}):(0,h.jsxs)(`section`,{"aria-label":`Run readiness`,className:`min-w-0`,children:[(0,h.jsx)(`h2`,{className:`engraved mb-2 text-ink3`,children:`This run`}),(0,h.jsx)(`ul`,{className:`overflow-hidden rounded-panel border border-line bg-panel`,children:i.map(e=>(0,h.jsx)(`li`,{className:`border-b border-line last:border-b-0`,children:(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.field),"aria-label":`${e.label}: ${XL[e.readiness]}. ${e.problem??e.detail}`,className:`grid w-full grid-cols-[10px_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2 text-left hover:bg-panel2`,children:[(0,h.jsx)(jl,{state:YL[e.readiness]}),(0,h.jsxs)(`span`,{className:`min-w-0`,children:[(0,h.jsx)(`span`,{className:`block font-semibold`,children:e.label}),(0,h.jsx)(`span`,{className:`block truncate text-label text-ink3`,children:e.detail})]}),(0,h.jsx)(`span`,{className:z(`engraved`,ZL[e.readiness]),children:XL[e.readiness]})]})},e.label))}),(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink3`,children:`Nothing starts until you review the costs and choose Start run.`})]})}function tR({selected:e,reviewed:t}){let n=e=>OI.find(t=>t.stage===e)?.label??e;return e?.length?(0,h.jsxs)(`div`,{className:`space-y-3 text-body`,children:[t?.length?t.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`font-medium`,children:[`Run `,e.runIndex+1,` · Before `,n(e.stage)]}),(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e.dependents.length?`Also holds: ${e.dependents.map(n).join(`, `)}.`:`No dependent steps.`})]},`${e.runIndex}-${e.checkpointId}`)):(0,h.jsxs)(`p`,{children:[`Selected: `,e.map(e=>`Before ${n(e)}`).join(`, `),`. Refresh review to confirm dependent steps.`]}),(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Approval required on the project page. Starting this run does not approve these checkpoints.`})]}):(0,h.jsx)(`p`,{className:`text-body text-ink2`,children:`No review checkpoints selected.`})}function nR({items:e,fields:t,title:n,values:r,problem:i,onChange:a}){let o=(0,m.useId)();return(0,h.jsxs)(`details`,{className:`rounded-control border border-line p-3`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-body font-medium`,children:[`Queue keyword variations `,e.length?`(${e.length+1} videos)`:``]}),(0,h.jsx)(`p`,{className:`my-3 text-small text-ink2`,children:`The setup above is video 1. Add videos with different titles and keywords. They run one at a time; a failed video releases the next, and a pause holds the queue.`}),e.map((n,r)=>(0,h.jsxs)(`fieldset`,{className:`mb-3 flex min-w-0 flex-col gap-2 border-t border-line pt-3`,children:[(0,h.jsxs)(`legend`,{className:`text-small text-ink2`,children:[`Video `,r+2]}),(0,h.jsxs)(`label`,{htmlFor:`${o}-${n.key}-title`,className:`text-small`,children:[`Title`,(0,h.jsx)(KP,{id:`${o}-${n.key}-title`,"data-play-field":`items.${n.key}.title`,"aria-invalid":i?.(`items.${r+1}.title`)!==void 0,value:n.title,maxLength:200,onChange:t=>a(e.map(e=>e.key===n.key?{...e,title:t.target.value}:e))})]}),t.map(t=>(0,h.jsxs)(`label`,{htmlFor:`${o}-${n.key}-${encodeURIComponent(t.name)}`,className:`text-small`,children:[t.name,(0,h.jsx)(KP,{id:`${o}-${n.key}-${encodeURIComponent(t.name)}`,"data-play-field":`items.${n.key}.values.${t.name}`,"aria-invalid":i?.(`items.${r+1}.values.${t.name}`)!==void 0,value:n.values[t.name]??``,onChange:r=>a(e.map(e=>e.key===n.key?{...e,values:{...e.values,[t.name]:r.target.value}}:e))})]},t.name)),(0,h.jsxs)(V,{onClick:()=>a(e.filter(e=>e.key!==n.key)),children:[`Remove video `,r+2]})]},n.key)),(0,h.jsx)(V,{disabled:e.length>=49,onClick:()=>a([...e,{key:crypto.randomUUID(),title:/\{\{[^}]+\}\}/.test(n)?n:`${n||`Video`} ${e.length+2}`,values:{...r}}]),children:`Add keyword variation`})]})}function rR({estimates:e}){let t=e.reduce((e,t)=>e+t.low,0),n=e.reduce((e,t)=>e+t.high,0),r=e.reduce((e,t)=>e+t.unknown,0),i=e[0]?.rows.map((t,n)=>({...t,low:e.some(e=>e.rows[n]?.low===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.low??0),0),high:e.some(e=>e.rows[n]?.high===null)?null:e.reduce((e,t)=>e+(t.rows[n]?.high??0),0)}))??[];return(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[` `,e.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{className:`text-title font-bold`,children:[r?`Known subtotal: `:`Estimated total: `,iR(t,n)]}),r?(0,h.jsxs)(`p`,{className:`text-body text-ink2`,children:[`Plus `,r,` stage charge`,r===1?``:`s`,` with unavailable pricing.`]}):null,(0,h.jsx)(`div`,{className:`divide-y divide-line`,children:i.map(e=>(0,h.jsx)(`div`,{className:`py-2`,children:(0,h.jsxs)(`div`,{className:`flex justify-between gap-4 text-body`,children:[(0,h.jsx)(`span`,{children:e.stage}),(0,h.jsx)(`span`,{children:e.low===null||e.high===null?`Unknown`:iR(e.low,e.high)})]})},e.stage))}),(0,h.jsxs)(`details`,{className:`border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small`,children:`Assumptions and stage details`}),(0,h.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[i.map(e=>(0,h.jsxs)(`p`,{className:`text-small text-ink2`,children:[e.stage,`: `,e.detail]},e.stage)),[...new Set(e.flatMap(e=>e.assumptions))].map(e=>(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e},e))]})]}),(0,h.jsxs)(`p`,{className:`text-small text-ink3`,children:[`Catalogue verified `,e[0]?.catalogueDate??`date unavailable`,`. Batch rows show combined costs.`]})]}):null]})}function iR(e,t){let n=e=>e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`;return e===t?n(e):`${n(e)} – ${n(t)}`}function _ee(e){let t=Xk(qk(e)),n=new Map(Xk(Lk)),r=t.filter(([e,t])=>e!==`Cuts`&&n.get(e)!==t).map(([e,t])=>e===`Animate images`?`Animated images: ${t} (paid)`:e===`Chapter cards`?`Chapter cards`:e===`Transition`?t:`${e}: ${t}`);return r.length===0?`Plain cuts, no effects`:r.join(` · `)}function vee(e){return e===void 0?{ok:!1,text:`Provider status unavailable`}:e.readiness.kind===`cli`?tN(e.readiness)?{ok:!0,text:e.readiness.version===void 0?`CLI ready`:`CLI ready · ${e.readiness.version}`}:{ok:!1,text:e.readiness.issue??`CLI not found`}:e.readiness.hasKey?{ok:!0,text:`API key saved`}:{ok:!1,text:`API key missing`}}function yee(e,t){let n=e.sources.audio===`generate`,r=[`from_prompt`,`prompt_by_llm`].includes(e.sources.thumbnail);return[...(e.sources.article===`generate`||e.sources.thumbnail===`prompt_by_llm`||mA(e)||$j(e)||n&&[`intro`,`outro`].some(n=>t.some(t=>t.category===n&&t.name===e[n]&&t.mode===`llm`)))&&e.llm?[{field:`llm.provider`,family:`llm`,label:`Text generation`,provider:e.llm.provider,model:e.llm.model}]:[],...n&&e.audio?[{field:`audio.provider`,family:`tts`,label:`Narration`,provider:e.audio.provider,model:e.audio.model,voice:e.audio.voice}]:[],...(e.sources.images===`generate`||r||$j(e)||Jk(e))&&e.images?[{field:`images.provider`,family:`image`,label:`Images`,provider:e.images.provider,model:e.images.model}]:[]]}function aR({name:e,children:t}){return(0,h.jsxs)(`section`,{"aria-label":`${e} summary`,className:`min-w-0 border-t border-line pt-5`,children:[(0,h.jsx)(`h3`,{className:`mb-4 font-semibold`,children:e}),t]})}function bee({form:e,entries:t,providers:n,voices:r,textModels:i,audioModels:a,imageModels:o,onReveal:s}){let c=yee(e,t);if(!c.length)return(0,h.jsx)(aR,{name:`Run readiness`,children:(0,h.jsx)(`p`,{className:`text-body text-ink2`,children:`No generated providers required. Supplied content is ready for processing.`})});let l={llm:i,tts:a,image:o};return(0,h.jsxs)(aR,{name:`Run readiness`,children:[(0,h.jsx)(`p`,{className:`mb-3 text-small text-ink2`,children:`These checks are refreshed with Review and checked again when you start.`}),(0,h.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Run readiness checks`,children:c.map(e=>{let t=n?.find(t=>t.id===e.provider&&t.family===e.family),i=vee(t),a=l[e.family],o=a?.models.find(t=>t.id===e.model),c=a===void 0?{ok:!0,text:`Model checked at Start`}:o!==void 0||a.allowsCustom?{ok:!0,text:`Model available`}:{ok:!1,text:`Model unavailable`},u=e.voice===void 0?void 0:r===void 0?{ok:!1,text:`Voice list unavailable`}:r.some(t=>t.provider===e.provider&&t.voiceId===e.voice)?{ok:!0,text:`Voice saved`}:{ok:!1,text:`Voice missing`},d=[i,c,...u?[u]:[]],f=d.every(e=>e.ok);return(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,h.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,h.jsx)(`span`,{className:f?`text-lime`:`text-red`,children:f?`Ready`:d.filter(e=>!e.ok).map(e=>e.text).join(` · `)}),f?null:(0,h.jsx)(V,{variant:`ghost`,onClick:()=>s(e.field),children:`Edit ↗`})]},`${e.family}:${e.provider}`)})})]})}function xee({fields:e,onReveal:t,children:n}){let{document:r,review:i}=yM(),{form:a}=r,{api:o}=B(),s=_(),c=s.getQueryData(Tb(o).queryKey),l=s.getQueryData(Ob(o).queryKey),u=s.getQueryData(Eb(o).queryKey),d=s.getQueryData(Nj),f=s.getQueryData(NI(a.llm.provider)),p=s.getQueryData(NI(a.audio.provider)),m=s.getQueryData(NI(a.images.provider)),g=a.sources.audio===`generate`,v=[`from_prompt`,`prompt_by_llm`].includes(a.sources.thumbnail),y=a.sources.article===`generate`||a.sources.thumbnail===`prompt_by_llm`||mA(a)||$j(a)||g&&[`intro`,`outro`].some(e=>l?.entries.some(t=>t.category===e&&t.name===a[e]&&t.mode===`llm`)),b=e=>c?.providers.find(t=>t.id===e)?.displayName??e,x=(e,n,r)=>(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[90px_minmax(0,1fr)_auto] items-start gap-x-3 py-1 sm:grid-cols-[145px_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(`dt`,{className:`break-words py-2 text-ink2`,children:e}),(0,h.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap break-words py-2`,children:r||`Not selected`}),n?(0,h.jsx)(`dd`,{children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`Edit ${e}`,onClick:()=>t(n),children:`Edit ↗`})}):null]},n??e),S=a.chunking.mode===`words`||a.chunking.mode===`characters`?a.chunking.mode:null;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bee,{form:a,entries:l?.entries??[],providers:c?.providers,voices:u?.voices,textModels:f,audioModels:p,imageModels:m,onReveal:t}),(0,h.jsxs)(aR,{name:`Content`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Project`,`title`,a.title||`Untitled run`),x(`Article`,`sources.article`,tM[a.sources.article]),a.sources.article===`generate`?x(`Article prompt`,`articlePrompt`,a.articlePrompt):x(`Article text`,`provided.article`,`Your article`),a.sources.article===`generate`?x(`Research`,`sources.research`,tM[a.sources.research]):x(`Research`,null,`Off · Article is provided`),a.sources.research===`provide`&&a.sources.article===`generate`?x(`Research text`,`provided.research`,a.provided.research):null,y?(0,h.jsxs)(h.Fragment,{children:[x(`Text provider`,`llm.provider`,b(a.llm.provider)),x(`Text model`,`llm.model`,f?.models.find(e=>e.id===a.llm.model)?.name??a.llm.model),a.llm.thinking||f?.models.find(e=>e.id===a.llm.model)?.thinkingModes?.length?x(`Thinking`,`llm.thinking`,a.llm.thinking??`Model default`):null]}):null,e.map(({name:e})=>x(e,`values.${e}`,a.values[e]??``))]}),n]}),(0,h.jsx)(aR,{name:`Outputs`,children:(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Narration`,`sources.audio`,tM[a.sources.audio]),g?(0,h.jsxs)(h.Fragment,{children:[x(`Audio provider`,`audio.provider`,b(a.audio.provider)),x(`Audio model`,`audio.model`,p?.models.find(e=>e.id===a.audio.model)?.name??a.audio.model),x(`Voice`,`audio.voice`,u?.voices.find(e=>e.provider===a.audio.provider&&e.voiceId===a.audio.voice)?.name??a.audio.voice),x(`Chunking`,S?`chunking.${S}`:`chunking.mode`,S?`Every ${a.chunking[S]||`(not entered)`} ${S}`:a.chunking.mode===`whole`?`Whole text`:`Paragraph`),x(`Intro`,`intro`,a.intro||`Off`),x(`Narration Preparation`,`narrationPrompt`,a.narrationPrompt?`${a.narrationPrompt} · One LLM call per narration chunk and entry`:`Off`),x(`Outro`,`outro`,a.outro||`Off`)]}):null,a.sources.audio===`provide`?x(`Narration file`,`provided.audio`,a.provided.audio?.name):null,x(`Images`,`sources.images`,tM[a.sources.images]),a.sources.images===`generate`||v||$j(a)?(0,h.jsxs)(h.Fragment,{children:[x(`Image provider`,`images.provider`,b(a.images.provider)),x(`Image model`,`images.model`,m?.models.find(e=>e.id===a.images.model)?.name??a.images.model),a.images.thinking===void 0?null:x(`Image effort`,`images.thinking`,a.images.thinking)]}):null,a.sources.images===`generate`&&a.reference!==void 0&&a.reference.source!==`off`?x(`Establishing image`,a.reference.source===`prompt`?`reference.prompt`:`provided.reference`,`${a.reference.source===`prompt`?a.reference.prompt||`(no prompt picked)`:a.provided.reference?.name??`(no file attached)`}${a.reference.thumbnail?` · thumbnail too`:``}`):null,a.sources.images===`generate`?a.imagePrompts.length?a.imagePrompts.map((e,t)=>x(e.name,`imagePrompts.${t}.number`,`${e.name} · ${e.number||`(not entered)`} images`)):x(`Image prompts`,`imagePrompts`,`None selected`):null,a.sources.images===`provide`?x(`Image files`,`provided.images`,a.provided.images.length?(0,h.jsx)(`ol`,{className:`list-inside list-decimal`,children:a.provided.images.map(e=>(0,h.jsx)(`li`,{children:e.name},e.attachmentId))}):`No files selected`):null,x(`Thumbnail`,`sources.thumbnail`,tM[a.sources.thumbnail]),v?x(`Thumbnail prompt`,`thumbnailPrompt`,a.thumbnailPrompt):null,a.sources.thumbnail===`provide`?x(`Thumbnail file`,`provided.thumbnail`,a.provided.thumbnail?.name):null,x(`Video`,`sources.video`,tM[a.sources.video]),a.sources.video===`generate`?x(`Seconds per image`,`imageSeconds`,a.imageSeconds||`(not entered)`):null,a.sources.video===`generate`?x(`Zoom`,`zoomPercent`,a.zoomPercent?`${a.zoomPercent}%`:`(not entered)`):null,a.sources.video===`generate`?x(`Motion`,`motionStyle`,$k[a.motionStyle]):null,a.sources.video===`generate`?x(`Cuts`,`videoEdit.cuts`,Vk[qk(a).cuts]):null,a.sources.video===`generate`?x(`Look`,`videoEdit`,_ee(a)):null,a.sources.audio===`off`?null:x(`Silence at start and end`,`edgeSilenceSeconds`,a.edgeSilenceSeconds?`${a.edgeSilenceSeconds} s`:`(not entered)`),a.sources.audio===`off`?null:x(`YouTube description`,`youtubeDescription`,a.youtubeDescription===!0?`${a.descriptionPrompt||`Built-in`} prompt · One LLM call after subtitle timing`:`Off`),a.sources.audio===`off`?null:x(`Shorts`,`shorts.enabled`,$j(a)&&a.shorts!==void 0?[`${a.shorts.count} shorts of ${a.shorts.minSeconds}-${a.shorts.maxSeconds} s`,`${a.shorts.prompt||`Built-in`} prompt`,`${a.shorts.imagePrompt||`Built-in`} image style`,...See(a.shorts,a.provided.shortsMusic?.name),`Vertical images and renders after subtitle timing`].join(` · `):`Off`),x(`Document`,`sources.document`,qb(a.sources,`document`)===`generate`?`PDF · ${rx(a.document)} theme`:tM.off)]})}),(0,h.jsxs)(aR,{name:`Checkpoints`,children:[(0,h.jsx)(tR,{selected:a.checkpoints,reviewed:i.valid?i.receipt?.checkpointSet:void 0}),(0,h.jsx)(V,{variant:`ghost`,"aria-label":`Edit checkpoints`,onClick:()=>t(`checkpoints`),children:`Edit checkpoints ↗`})]}),(0,h.jsxs)(aR,{name:`Style`,children:[(0,h.jsxs)(`dl`,{className:`text-body`,children:[x(`Frame`,`format`,a.format),a.sources.audio===`off`?x(`Subtitles`,null,`Off · Audio is Off`):x(`Subtitles`,`subtitles.mode`,a.subtitles.mode),a.sources.audio!==`off`&&a.subtitles.mode!==`off`?(0,h.jsxs)(h.Fragment,{children:[x(`Subtitle font`,`subtitles.fontId`,d?.fonts.find(e=>e.id===a.subtitles.fontId)?.name??a.subtitles.fontId),x(`Subtitle size`,`subtitles.fontSize`,`${a.subtitles.fontSize||`(not entered)`} px`),x(`Subtitle position`,`subtitles.position`,a.subtitles.position)]}):null]}),a.sources.audio!==`off`&&a.subtitles.mode===`files`?(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink2`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]})]})}function See(e,t){let n=Dk(e),r=n.speed,i=n.musicVolume;return[...n.titleOnScreen===!0?[`Title on screen`]:[],...r!==void 0&&r!==1?[`${r.toFixed(2)}× speed`]:[],...t===void 0?i!==void 0&&i!==15?[`Music at ${String(i)}% once added in Edit project`]:[]:[`Music: ${t} at ${String(i??15)}%`],...n.fullVideoLink===void 0?[]:[`Links ${n.fullVideoLink}`]]}function Cee({fields:e,errors:t,onReveal:n,problem:r}){let i=yM(),{document:a,review:o}=i,s=a.form,c=(0,m.useId)(),l=fM(a,i.view),u=o.starting||o.uncertain;(0,m.useEffect)(()=>{i.reviewDraft()},[i.reviewDraft]);let d=!o.valid&&!o.pending&&!o.starting&&!o.uncertain&&o.error===null&&t.length===0&&!l;(0,m.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>void i.reviewDraft(),800);return()=>clearTimeout(e)},[d,a,i.reviewDraft]);let f=o.valid?o.receipt?.runs??[]:[];return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(`p`,{className:`text-body text-ink2`,children:`Check your setup and estimated costs. Nothing starts until you choose Start run.`}),t.length?(0,h.jsx)(`ul`,{"aria-label":`Setup errors`,className:`text-small text-red`,children:t.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(V,{variant:`ghost`,onClick:()=>n(e.field),children:e.message})},`${e.field}-${e.message}`))}):null,l?(0,h.jsx)(V,{variant:`ghost`,onClick:()=>n(l),children:`Wait for uploads to finish before Start`}):null,o.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-body text-red`,children:o.error}):null,(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`h3`,{className:`flex items-center gap-1 font-semibold`,children:[`Estimated cost`,(0,h.jsx)(DI,{label:`the estimate`,children:(0,h.jsx)(`p`,{children:`Estimated provider charges in USD. Actual usage can differ. This estimate does not cap spending.`})})]}),(0,h.jsxs)(`label`,{htmlFor:c,className:`text-body`,children:[`Expected article words per video`,(0,h.jsx)(KP,{id:c,"data-play-field":`expectedWords`,type:`number`,min:1,max:1e5,value:a.expectedWords,disabled:u,onChange:e=>i.edit({...a,expectedWords:e.target.value})})]}),o.pending?(0,h.jsx)(`p`,{role:`status`,children:`Calculating estimate…`}):null,o.valid&&o.receipt?(0,h.jsx)(rR,{estimates:o.receipt.estimates}):(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Review needs refreshing before Start.`})]}),(0,h.jsx)(AI,{problem:r}),(0,h.jsx)(xee,{fields:e,onReveal:n,children:(0,h.jsxs)(`details`,{className:`mt-5 border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small`,children:s.sources.article===`provide`?`Read the supplied article and resolved prompts`:`Read the resolved prompt`}),f.length?f.map((e,t)=>(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(`h4`,{className:`font-medium`,children:e.draft.title}),e.draft.sources.article===`provide`?(0,h.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-body`,children:e.draft.provided.article}):null,Object.entries(e.rendered).map(([e,t])=>(0,h.jsxs)(`div`,{className:`mt-3`,children:[(0,h.jsx)(`h5`,{className:`text-small text-ink2`,children:e}),(0,h.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-body`,children:t})]},e))]},a.variants[t-1]?.id??i.activeId)):(0,h.jsx)(`p`,{className:`mt-3 text-small text-ink2`,children:`Refresh review to read the exact resolved inputs.`})]})}),(0,h.jsx)(`fieldset`,{disabled:u,className:`min-w-0`,children:(0,h.jsx)(nR,{fields:e,items:a.variants.map(({id:e,...t})=>({...t,key:e})),title:s.title,values:s.values,problem:r,onChange:e=>i.edit({...a,variants:e.map(({key:e,...t})=>({...t,id:e}))})})}),(0,h.jsxs)(`div`,{className:`sticky bottom-[-16px] -mx-4 -mb-4 flex flex-wrap items-center justify-end gap-3 border-t border-line bg-panel px-4 py-3`,children:[(0,h.jsx)(V,{variant:`ghost`,disabled:o.pending||u||!!l,onClick:()=>{i.reviewDraft()},children:`Refresh review`}),(0,h.jsx)(V,{variant:`play`,"data-tour":`play-start`,disabled:o.starting||!o.uncertain&&(!o.valid||o.pending||t.length>0||!!l),onClick:()=>{i.startRun()},children:o.starting?`Starting…`:o.uncertain?`Check Start result`:a.variants.length?`Queue ${a.variants.length+1} videos`:`Start run`})]})]})}var oR=[{id:`content`,label:`Content`,description:`Article and keywords`},{id:`outputs`,label:`Outputs`,description:`Voice and images`},{id:`style`,label:`Style`,description:`Frame and captions`},{id:`review`,label:`Review`,description:`Cost and start`}];function wee({section:e,underneath:t,onNavigate:n}){let r=oR.filter(e=>e.id!==`review`);return(0,h.jsxs)(`nav`,{"aria-label":`Run setup`,className:`mb-5 flex min-w-0 items-end gap-3 overflow-x-auto border-b border-line [scrollbar-width:none]`,children:[r.map((r,i)=>{let a=e===r.id,o=a||e===`review`&&t===r.id;return(0,h.jsxs)(`button`,{type:`button`,"aria-current":a?`step`:void 0,title:r.description,onClick:()=>n(r.id),className:z(`-mb-px inline-flex min-h-10 shrink-0 items-center gap-2 border-b-2 px-3 font-semibold whitespace-nowrap focus-visible:outline-offset-[-3px]`,o?`border-lamp-run text-ink`:`border-transparent text-ink2 hover:text-ink`),children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:z(`inline-flex size-5 items-center justify-center rounded-full border text-label`,o?`border-accent bg-accent text-accent-ink`:`border-line2 text-ink3`),children:i+1}),r.label]},r.id)}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(`button`,{type:`button`,"aria-current":e===`review`?`step`:void 0,"aria-expanded":e===`review`,onClick:()=>n(`review`),className:z(`mb-1 inline-flex min-h-8 shrink-0 items-center rounded-control border px-3 font-semibold whitespace-nowrap`,e===`review`?`border-accent bg-panel2 text-run-text`:`border-line2 text-ink2 hover:border-ink3 hover:text-ink`),children:`Review`})]})}function Tee(e){return e.upload?(0,h.jsx)(sR,{value:e.value,onPick:e.onPick,upload:e.upload}):(0,h.jsx)(Eee,{...e})}function Eee({value:e,onPick:t,onUploading:n}){let{api:r}=B(),i=_(),a=rt({mutationFn:e=>Fj(r,e),onSuccess:({font:e})=>{i.setQueryData(Nj,t=>({fonts:[...(t?.fonts??[]).filter(t=>t.id!==e.id),e]})),i.invalidateQueries({queryKey:Nj})}}),o=a.isPending,s=(0,m.useRef)(t);s.current=t;let c=(0,m.useRef)(n);return c.current=n,(0,m.useEffect)(()=>{c.current(o)},[o]),(0,m.useEffect)(()=>()=>c.current(!1),[]),(0,h.jsx)(sR,{value:e,onPick:t,upload:{pending:o,error:a.error?.message,pick:e=>a.mutate(e,{onSuccess:({font:e})=>s.current(e.id)})}})}function sR({value:e,onPick:t,upload:n}){let{api:r}=B(),i=(0,m.useId)(),a=(0,m.useId)(),o=I({queryKey:Nj,queryFn:()=>Pj(r),staleTime:6e4}),s=n.pending,c=o.data?.fonts??[],l=e!=="default"&&!c.some(t=>t.id===e);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,children:[(0,h.jsx)(JP,{htmlFor:i,className:`mb-1`,children:`Subtitle font`}),(0,h.jsxs)(`select`,{id:i,"data-play-field":`subtitles.fontId`,value:e,disabled:s,onChange:e=>t(e.target.value),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-[10px] text-small text-ink`,children:[c.some(e=>e.id==="default")?null:(0,h.jsx)(`option`,{value:`default`,children:`Default font · bundled`}),l?(0,h.jsxs)(`option`,{value:e,children:[e,` · saved font`]}):null,c.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.source]},e.id))]})]}),(0,h.jsxs)(`div`,{className:`min-w-0 basis-full`,children:[(0,h.jsx)(JP,{htmlFor:a,className:`mb-1`,children:`Upload font (.ttf or .otf)`}),(0,h.jsx)(`input`,{id:a,"data-play-field":`subtitles.fontUpload`,type:`file`,accept:`.ttf,.otf,font/ttf,font/otf`,disabled:s,className:`w-full text-small text-ink2 file:mr-2 file:rounded-control file:border file:border-line2 file:bg-panel2 file:px-2 file:py-1 file:text-ink`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&n.pick(t)}})]})]}),s?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink2`,children:`Uploading font…`}):null,n.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:n.error}):null,l&&o.data?(0,h.jsx)(`p`,{role:`alert`,children:`Saved font is unavailable. Choose another font or upload it again.`}):null,o.error?(0,h.jsxs)(`p`,{role:`alert`,className:`text-small text-red`,children:[`The font list couldn't be loaded. `,o.error.message]}):null]})}function cR({value:e,format:t=`16:9`,audioEnabled:n,videoEnabled:r,disabled:i=!1,onChange:a,onUploading:o,problem:s,session:c,fontUpload:l,showPreview:u=!0,illustratedPositions:d=!1,rawFontSize:f}){let p=(0,m.useId)(),g=(0,m.useId)(),_=(0,m.useId)(),v=(0,m.useId)(),[y,b]=(0,m.useState)(!1),x=s?.(`subtitles.fontId`),S=s?.(`subtitles.fontSize`),C=s?.(`subtitles.mode`)??s?.(`subtitles`);return(0,h.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Subtitles`,children:[(0,h.jsxs)(`fieldset`,{disabled:i||!n,className:`flex min-w-0 flex-col gap-3 disabled:opacity-60`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(JP,{htmlFor:p,className:`mb-1`,children:`Subtitles`}),(0,h.jsxs)(`select`,{id:p,"data-play-field":`subtitles.mode`,value:n?e.mode:`off`,disabled:l?.pending??y,"aria-describedby":_,"aria-invalid":C!==void 0,onChange:t=>a({...e,mode:t.target.value}),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-[10px] text-small text-ink`,children:[(0,h.jsx)(`option`,{value:`off`,children:`Off`}),(0,h.jsx)(`option`,{value:`files`,children:`Subtitle files (.srt + .vtt)`}),(0,h.jsx)(`option`,{value:`burn-in`,disabled:!r,children:`Burn into video + files`})]})]}),(0,h.jsx)(`span`,{className:`pb-1 text-label text-ink3`,children:`English · local · no paid API`})]}),e.mode!==`off`&&n?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Timed from your narration on this computer. First use downloads an approximately 95 MB speech model. Review the subtitles before publishing.`}),(0,h.jsxs)(`div`,{className:`grid items-start gap-5`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 240px), 1fr))`},children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(Tee,{...l?{upload:l}:{},value:e.fontId,onPick:t=>c?c.selectFont(t):a({...e,fontId:t}),onUploading:e=>{b(e),o?.(e)}}),(0,h.jsxs)(`div`,{className:d?`w-full`:`max-w-[180px]`,children:[(0,h.jsx)(JP,{htmlFor:g,className:`mb-1`,children:`Subtitle font size`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-5`,children:[d?(0,h.jsx)(`input`,{"aria-label":`Subtitle font size slider`,type:`range`,min:16,max:120,step:1,value:Math.max(16,Math.min(120,Number.isFinite(e.fontSize)?e.fontSize:48)),className:`min-w-0 flex-1 accent-accent`,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})}):null,(0,h.jsx)(KP,{className:d?`w-20`:void 0,id:g,"data-play-field":`subtitles.fontSize`,type:`number`,min:16,max:120,step:1,value:f?.value??e.fontSize,"aria-invalid":!Zj(e)||S!==void 0,onChange:t=>f?f.onChange(t.target.value):a({...e,fontSize:Number(t.target.value)})})]}),!Zj(e)||S?(0,h.jsx)(`p`,{role:`alert`,className:`mt-1 text-label text-red`,children:S??`Choose a whole font size from 16 to 120.`}):null]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(JP,{htmlFor:d?void 0:v,id:`${v}-label`,className:`mb-1`,children:`Subtitle position`}),d?(0,h.jsx)(MF,{type:`single`,"aria-labelledby":`${v}-label`,value:e.position??`bottom`,onValueChange:t=>{let n=VA.find(e=>e===t);n&&a({...e,position:n})},className:`grid w-full grid-cols-5 gap-2 overflow-visible border-0`,children:VA.map((t,n)=>(0,h.jsxs)(NF,{value:t,"aria-label":t,"data-play-field":(e.position??`bottom`)===t?`subtitles.position`:void 0,className:`flex min-w-0 flex-col items-center gap-2 rounded-control border border-line2 bg-panel px-1 py-3 text-[10px] last:border-r data-[state=on]:border-focus data-[state=on]:text-run-text data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`relative block h-11 w-7 rounded-[2px] border border-current`,children:(0,h.jsx)(`span`,{className:`absolute left-1 right-1 h-[3px] bg-current`,style:{top:`${8+n*20}%`}})}),(0,h.jsxs)(`span`,{children:[t[0]?.toUpperCase(),t.slice(1)]})]},t))}):(0,h.jsx)(`select`,{id:v,"data-play-field":`subtitles.position`,value:e.position??`bottom`,onChange:t=>{let n=VA.find(e=>e===t.target.value);n&&a({...e,position:n})},className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-[10px] text-small text-ink`,children:VA.map(e=>(0,h.jsxs)(`option`,{value:e,children:[e[0]?.toUpperCase(),e.slice(1)]},e))})]})]}),u?(0,h.jsx)(GL,{value:e,format:t,...c?{sample:c.previewText}:{}}):null]}),c?.fontUpload&&!c.fontUploading?(0,h.jsxs)(`p`,{role:`alert`,children:[`Reattach `,c.fontUpload.name,`, or select a font.`]}):null,x?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:x}):null,e.mode===`files`?(0,h.jsx)(`p`,{className:`text-label text-ink3`,children:`Font, size and position apply to burned captions. SRT/VTT players choose their own styling.`}):null]}):null]}),c?.fontUpload&&(e.mode===`off`||!n)?(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,h.jsx)(`p`,{role:c.fontUploading?`status`:`alert`,className:`text-small text-ink2`,children:c.fontUploading?`Uploading ${c.fontUpload.name}…`:`Unfinished font upload: ${c.fontUpload.name}`}),l?.error?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:l.error}):null,(0,h.jsx)(V,{"data-play-field":`subtitles.fontUpload`,disabled:i,onClick:()=>c.selectFont(e.fontId),children:`Keep current font`})]}):null,C?(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:C}):null,(0,h.jsx)(`p`,{id:_,className:`text-small text-ink2`,children:n?r?`Optional: download subtitles separately or keep them visible in the video.`:`Audio exports support separate subtitle files. Enable Video to burn captions into an MP4.`:`Turn Audio on to add subtitles.`})]})}function lR({value:e,onPick:t}){let n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:`w-full`,children:[(0,h.jsx)(JP,{id:n,className:`mb-2`,children:`Frame format`}),(0,h.jsx)(MF,{type:`single`,value:e,"aria-labelledby":n,className:`w-full max-w-[400px] gap-3 overflow-visible border-0`,onValueChange:e=>{(e===`16:9`||e===`9:16`)&&t(e)},children:[`16:9`,`9:16`].map(t=>(0,h.jsxs)(NF,{value:t,"data-play-field":e===t?`format`:void 0,"aria-label":t,className:`flex h-28 min-w-0 flex-1 items-center justify-center gap-4 rounded-control border border-line2 bg-panel p-3 last:border-r data-[state=on]:border-focus data-[state=on]:shadow-none`,children:[(0,h.jsx)(`span`,{className:`flex h-12 items-center justify-center`,"aria-hidden":`true`,children:(0,h.jsx)(`span`,{"data-format-shape":t,className:`block rounded-[2px] border-2 border-current`,style:{width:t===`16:9`?64:27,aspectRatio:t===`16:9`?`16 / 9`:`9 / 16`}})}),(0,h.jsxs)(`span`,{className:`text-left`,children:[(0,h.jsx)(`span`,{className:`block text-body font-semibold`,children:t}),(0,h.jsx)(`span`,{className:`text-label text-ink3`,children:t===`16:9`?`Landscape`:`Portrait`})]})]},t))})]})}function uR({problem:e}){let t=yM(),{document:n}=t,{form:r}=n,i=(0,m.useId)(),a=e=>t.edit({...n,form:{...r,subtitles:{...e,fontSize:r.subtitles.fontSize}}});return(0,h.jsxs)(`div`,{"data-tour":`play-subtitles`,className:`flex min-w-0 flex-col gap-6 py-6`,children:[(0,h.jsx)(`p`,{className:`text-body text-ink2`,children:`See frame and caption changes in the preview as you go.`}),(0,h.jsx)(lR,{value:r.format,onPick:e=>t.edit({...n,form:{...r,format:e}})}),(0,h.jsx)(`div`,{className:`border-t border-line pt-6`,children:(0,h.jsx)(cR,{showPreview:!1,illustratedPositions:!0,fontUpload:t.fontUpload,session:{previewText:n.previewText,fontUploading:t.fontUploading,fontUpload:n.fontUpload,selectFont:t.selectFont,uploadSubtitleFont:t.uploadSubtitleFont},value:{...r.subtitles,fontSize:Number(r.subtitles.fontSize)},rawFontSize:{value:r.subtitles.fontSize,onChange:e=>t.edit({...n,form:{...r,subtitles:{...r.subtitles,fontSize:e}}})},format:r.format,audioEnabled:r.sources.audio!==`off`,videoEnabled:r.sources.video===`generate`&&r.sources.images!==`off`,onChange:a,problem:e})}),(0,h.jsxs)(`div`,{className:`border-t border-line pt-6`,children:[(0,h.jsx)(JP,{htmlFor:i,className:`mb-2`,children:`Preview text`}),(0,h.jsx)(KP,{id:i,value:n.previewText,onChange:e=>t.edit({...n,previewText:e.target.value})}),(0,h.jsx)(`p`,{className:`mt-2 text-small text-ink3`,children:`Just a sample. Your actual captions come from the narration.`})]})]})}function dR(e,t,n){let r=e?.prompts??[],i=e?.entries??[];return{prompts:[...r,...t.filter(e=>!r.some(t=>t.kind===e.kind&&t.name.toLowerCase()===e.name.toLowerCase()))],entries:[...i,...n.filter(e=>!i.some(t=>t.category===e.category&&t.name.toLowerCase()===e.name.toLowerCase()))]}}function fR(){let e=Wi();return(0,h.jsx)(pR,{onCreated:t=>{e({to:`/projects/$projectId`,params:{projectId:t}})}})}function pR({onCreated:e}){let{api:t}=B(),n=KL(),r=ZN(),i=I(Tb(t)),a=I(Db(t)),o=I(Ob(t)),s=I(Eb(t)),c=I(Ab(t)),[l,u]=wM(),d=yM(),f=dR(d.document.librarySnapshot,a.data?.prompts??[],o.data?.entries??[]),p=d.document.variants.map(({id:e,...t})=>({...t,key:e})),g=d.fontUploading||d.document.fontUpload!==null,_=d.review.fields,[v,y]=(0,m.useState)(new Set),b=(0,m.useRef)(null),x=(0,m.useRef)(null),S=(0,m.useRef)(`content`);d.section!==`review`&&(S.current=d.section);let C=Wi(),w=(0,m.useRef)(d.activeId);(0,m.useLayoutEffect)(()=>{w.current!==d.activeId&&(w.current=d.activeId,y(new Set))},[d.activeId]);let T=(0,m.useRef)(null);(0,m.useLayoutEffect)(()=>{let e=d.reveal;if(e||(T.current=null),e&&e.sequence!==T.current&&e.section===d.section&&b.current){if(T.current=e.sequence,e.field){let t=[...b.current.querySelectorAll(`[data-play-field]`)].find(t=>t.dataset.playField===e.field)?.parentElement;for(;t&&t!==b.current;)t instanceof HTMLDetailsElement&&(t.open=!0),t=t.parentElement;if(VL(b.current,e.field))return}x.current?.focus()}},[d.reveal,d.section]);let E=e=>{let t=kI(e,l)??HL(e,l,p);y(n=>new Set([...n,e,t.field])),d.navigate(t.section,t.field)},D=async e=>{await d.flush()&&(e===`/prompts`?await C({to:`/prompts/new`,search:{kind:`article`}}):await C({to:e}))},O=e=>{u(t=>{let n={...t,...e};return{...n,subtitles:Xj(n.subtitles,n.sources)}}),d.invalidateReview(!0)},{fields:k,result:ee,blocker:A}=pI({form:l,prompts:f.prompts,entries:f.entries,silenceGapSeconds:c.data?.silenceGapSeconds??3}),j=g?{field:`subtitles.fontUpload`,hint:`Wait for the subtitle font upload to finish to play`}:A;(0,m.useEffect)(()=>{if(!d.review.created)return;let t=d.takeCreated()?.projectIds[0];t&&(r({type:`project-created`,id:t}),e(t))},[d.review.created,d.takeCreated,r,e]);let M=ee.ok?_:[...ee.fields,..._],N=(...e)=>!M.some(t=>e.some(e=>t.field===e||t.field.startsWith(`${e}.`))),P=(e,t)=>f.prompts.some(n=>n.kind===e&&n.name===t),F=e=>e?.file!==void 0&&e.error===void 0;XN({playArticleReady:N(`sources.article`,`articlePrompt`,`provided.article`)&&(l.sources.article===`provide`||P(`article`,l.articlePrompt)),playAudioReady:l.sources.audio===`off`||N(`sources.audio`,`audio`,`provided.audio`)&&(l.sources.audio!==`provide`||F(l.provided.audio)),playImagesReady:l.sources.images===`off`||N(`sources.images`,`images`,`imagePrompts`,`provided.images`)&&(l.sources.images===`provide`?l.provided.images.every(F):l.imagePrompts.every(e=>P(`image`,e.name))),playVideoReady:N(`sources.video`),playSubtitlesReady:N(`subtitles`)&&!g,playOptionsReady:N(`title`,`format`,`llm`,`intro`,`outro`),playHasKeywords:k.length>0,playKeywordsReady:N(`values`),playReady:j===void 0&&!d.review.starting});let te=e=>{let t=(kI(e,l)??HL(e,l,p)).field;return M.find(n=>(kI(n.field,l)??HL(n.field,l,p)).field===t&&(_.includes(n)||v.has(e)||v.has(t)))?.message},ne=()=>{d.navigate(`review`)},re=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ne())},ie=(e,t)=>{d.invalidateReview(!0),d.attach(e,t)},ae=(e,t)=>{u(n=>({...n,provided:e===`images`?{...n.provided,images:n.provided.images.filter(e=>e.key!==t)}:{...n.provided,[e]:void 0}}))},oe=[i,a,o,s,c].find(e=>e.error!==null)?.error?.message,se={form:l,providers:i.data?.providers??[],prompts:f.prompts,voices:s.data?.voices??[],silenceGapSeconds:c.data?.silenceGapSeconds??3,problem:te,update:O,onPickFiles:ie,onRemoveFile:ae,onReattachFile:(e,t,n)=>{d.attach(e,[n],t)}},ce=d.section===`review`?S.current:d.section,le=oR[oR.findIndex(e=>e.id===ce)+1],ue=d.error?`Your draft wasn't saved. ${d.error}`:oe;return(0,h.jsxs)(`div`,{ref:b,onKeyDown:re,onBlurCapture:e=>{let t=e.target.dataset.playField;t&&y(e=>new Set([...e,t]))},"data-play-grid":`true`,className:`min-w-0 max-[1099px]:[&_button]:min-h-11 max-[1099px]:[&_input:not([type=checkbox])]:min-h-11 max-[1099px]:[&_select]:min-h-11 max-[1099px]:[&_summary]:min-h-11`,children:[(0,h.jsx)(zP,{title:`New run`,meta:l.title.trim()===``?`Untitled draft`:l.title,actions:(0,h.jsx)(BL,{})}),(0,h.jsx)(wee,{section:d.section,underneath:ce,onNavigate:e=>{d.navigate(e)}}),n?null:(0,h.jsx)(eR,{compact:!0,form:l,errors:M,onReveal:E}),(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 items-start gap-8 min-[1100px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,h.jsxs)(`section`,{"data-tour":ce===`content`?`play-options`:void 0,className:`min-w-0`,children:[(0,h.jsx)(`h2`,{ref:d.section===`review`?void 0:x,tabIndex:-1,className:`text-row font-semibold`,children:ce===`style`?`Make it look like yours.`:oR.find(e=>e.id===ce)?.label}),!n&&ce===`style`?(0,h.jsx)(`div`,{className:`mt-5`,children:(0,h.jsx)(qL,{})}):null,ce===`content`?(0,h.jsx)(zL,{...se,fields:k,entries:f.entries,onLibrary:e=>{D(e)}}):null,ce===`outputs`?(0,h.jsx)(JL,{...se,entries:f.entries,missingKeyword:M.find(e=>e.field.startsWith(`values.`))?.field,onKeyword:E,onSettings:()=>{D(`/settings`)}}):null,ce===`style`?(0,h.jsx)(uR,{problem:te}):null]}),n?(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 min-[1100px]:sticky min-[1100px]:top-16`,children:[ce===`style`?(0,h.jsx)(qL,{}):null,(0,h.jsx)(eR,{form:l,errors:M,onReveal:E})]}):null]}),(0,h.jsxs)(DP,{status:(0,h.jsx)(EP,{tone:ue?`error`:`info`,children:ue??(j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`min-w-0 truncate`,title:j.hint,children:j.hint}),(0,h.jsx)(V,{variant:`ghost`,onClick:()=>E(j.field),children:`Fix setup`})]}):void 0)}),children:[(0,h.jsxs)(V,{variant:`ghost`,className:le&&le.id!==`review`?void 0:`invisible`,"aria-hidden":le&&le.id!==`review`?void 0:!0,tabIndex:le&&le.id!==`review`?void 0:-1,onClick:()=>{le&&le.id!==`review`&&d.navigate(le.id)},children:[`Continue to `,le&&le.id!==`review`?le.label:`Review`,` →`]}),(0,h.jsx)(V,{variant:`primary`,"aria-expanded":d.section===`review`,onClick:ne,children:`Review and start`})]}),(0,h.jsx)(dI,{open:d.section===`review`,title:`Review`,headingRef:x,onClose:()=>{d.navigate(S.current)},children:(0,h.jsx)(Cee,{fields:k,errors:M,problem:te,onReveal:E})})]})}function mR(){let{api:e}=B(),t=I({queryKey:[`batch-queue`],queryFn:async()=>$a(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=I(xb(e));return t.data?.queue.length?(0,h.jsxs)(`section`,{"aria-label":`Video queue`,className:`mb-4 overflow-hidden rounded-panel border border-line bg-panel`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2 border-b border-line px-4`,children:[(0,h.jsxs)(`h2`,{className:`engraved text-ink3`,children:[`Video queue · `,t.data.queue.length,` remaining`]}),(0,h.jsx)(DI,{label:`the video queue`,children:(0,h.jsx)(`p`,{children:`One batch video runs at a time. Pause holds the queue; failure or cancellation advances it.`})})]}),(0,h.jsx)(gR,{queue:t.data.queue,projects:n.data?.projects})]}):null}function hR(){let{api:e}=B(),t=I({queryKey:[`batch-queue`],queryFn:async()=>$a(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=I(xb(e)),r=t.data?.queue.length??0;return(0,h.jsxs)(CI,{children:[(0,h.jsx)(wI,{asChild:!0,children:(0,h.jsxs)(V,{variant:`ghost`,disabled:r===0,"aria-label":`Video queue: ${r} remaining`,children:[(0,h.jsx)(ws,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,r]})]})}),(0,h.jsxs)(EI,{align:`end`,className:`p-0`,children:[(0,h.jsx)(`p`,{className:`border-b border-line px-3 py-2 text-small text-ink2`,children:`One batch video runs at a time. Pause holds the queue; failure or cancellation advances it.`}),(0,h.jsx)(gR,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function gR({queue:e,projects:t}){return(0,h.jsx)(`ol`,{className:`max-h-40 overflow-y-auto px-4 py-2`,children:e.map((e,n)=>{let r=t?.find(t=>t.id===e.projectId);return(0,h.jsxs)(`li`,{className:`flex justify-between gap-3 py-1 text-small`,children:[(0,h.jsxs)(oa,{className:`truncate underline`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[n+1,`. `,r?.title??`Video`]}),(0,h.jsx)(`span`,{className:`shrink-0 text-ink2`,children:r?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`})]},e.projectId)})})}var _R=/^(?:[-*+]|\d+[.)])\s+/u;function vR(e){let t=e.split(/\r?\n/u).filter(e=>e.trim()!==``),n=[];for(let e of t.slice(1)){let t=e.trim().replace(_R,``).trim(),r=n.length-1;/^\s/u.test(e)&&!_R.test(e.trim())&&r>=0?n[r]=`${n[r]??``} ${t}`:t!==``&&n.push(t)}return n}var yR={};function bR(e,t){let n=t||yR;return xR(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function xR(e,t,n){if(CR(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return SR(e.children,t,n)}return Array.isArray(e)?SR(e,t,n):``}function SR(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=xR(e[i],t,n);return r.join(``)}function CR(e){return!!(e&&typeof e==`object`)}var wR=document.createElement(`i`);function TR(e){let t=`&`+e+`;`;wR.innerHTML=t;let n=wR.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function ER(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function DR(e,t){return e.length>0?(ER(e,e.length,0,t),e):t}var OR={}.hasOwnProperty;function kR(e){let t={},n=-1;for(;++n<e.length;)AR(t,e[n]);return t}function AR(e,t){let n;for(n in t){let r=(OR.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){OR.call(r,a)||(r[a]=[]);let e=i[a];jR(r[a],Array.isArray(e)?e:e?[e]:[])}}}function jR(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ER(e,0,0,r)}function MR(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function NR(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var PR=KR(/[A-Za-z]/),FR=KR(/[\dA-Za-z]/),IR=KR(/[#-'*+\--9=?A-Z^-~]/);function LR(e){return e!==null&&(e<32||e===127)}var RR=KR(/\d/),zR=KR(/[\dA-Fa-f]/),BR=KR(/[!-/:-@[-`{-~]/);function VR(e){return e!==null&&e<-2}function HR(e){return e!==null&&(e<0||e===32)}function UR(e){return e===-2||e===-1||e===32}var WR=KR(/\p{P}|\p{S}/u),GR=KR(/\s/);function KR(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function qR(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&FR(e.charCodeAt(n+1))&&FR(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function JR(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return UR(r)?(e.enter(n),s(r)):t(r)}function s(r){return UR(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var YR={tokenize:XR};function XR(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),JR(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return VR(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var ZR={tokenize:$R},QR={tokenize:ez};function $R(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ER(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(QR,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(QR,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return VR(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ER(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ez(e,t,n){return JR(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function tz(e){if(e===null||HR(e)||GR(e))return 1;if(WR(e))return 2}function nz(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var rz={name:`attention`,resolveAll:iz,tokenize:az};function iz(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};oz(d,-c),oz(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=DR(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=DR(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=DR(l,nz(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=DR(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=DR(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ER(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function az(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=tz(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=tz(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function oz(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var sz={name:`autolink`,tokenize:cz};function cz(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return PR(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||FR(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||FR(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||LR(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):IR(t)?(e.consume(t),l):n(t)}function u(e){return FR(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||FR(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var lz={partial:!0,tokenize:uz};function uz(e,t,n){return r;function r(t){return UR(t)?JR(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||VR(e)?t(e):n(e)}}var dz={continuation:{tokenize:pz},exit:mz,name:`blockQuote`,tokenize:fz};function fz(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return UR(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function pz(e,t,n){let r=this;return i;function i(t){return UR(t)?JR(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(dz,t,n)(r)}}function mz(e){e.exit(`blockQuote`)}var hz={name:`characterEscape`,tokenize:gz};function gz(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return BR(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var _z={name:`characterReference`,tokenize:vz};function vz(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=FR,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=zR,u):(e.enter(`characterReferenceValue`),a=7,o=RR,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===FR&&!TR(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var yz={partial:!0,tokenize:Sz},bz={concrete:!0,name:`codeFenced`,tokenize:xz};function xz(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),UR(t)?JR(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||VR(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(yz,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||VR(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):UR(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),JR(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||VR(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||VR(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&UR(t)?JR(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||VR(t)?e.check(yz,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||VR(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),UR(t)?JR(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),UR(t)?JR(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||VR(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Sz(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Cz={name:`codeIndented`,tokenize:Tz},wz={partial:!0,tokenize:Ez};function Tz(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),JR(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):VR(t)?e.attempt(wz,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||VR(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Ez(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):VR(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):JR(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):VR(e)?i(e):n(e)}}var Dz={name:`codeText`,previous:kz,resolve:Oz,tokenize:Az};function Oz(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function kz(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Az(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):VR(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||VR(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var jz=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Mz(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Mz(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Mz(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);Mz(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Mz(this.left,t.reverse())}}}};function Mz(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Nz(e){let t={},n=-1,r,i,a,o,s,c,l,u=new jz(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Pz(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ER(e,0,1/0,u.slice(0)),!l}function Pz(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Fz={resolve:Lz,tokenize:Rz},Iz={partial:!0,tokenize:zz};function Lz(e){return Nz(e),e}function Rz(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):VR(t)?e.check(Iz,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function zz(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),JR(e,a,`linePrefix`)}function a(i){if(i===null||VR(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Bz(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||LR(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||VR(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||HR(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||LR(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Vz(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):VR(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||VR(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!UR(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Hz(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):VR(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),JR(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||VR(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Uz(e,t){let n;return r;function r(i){return VR(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):UR(i)?JR(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Wz={name:`definition`,tokenize:Kz},Gz={partial:!0,tokenize:qz};function Kz(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Vz.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=NR(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return HR(t)?Uz(e,l)(t):l(t)}function l(t){return Bz(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Gz,d,d)(t)}function d(t){return UR(t)?JR(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||VR(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function qz(e,t,n){return r;function r(t){return HR(t)?Uz(e,i)(t):n(t)}function i(t){return Hz(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return UR(t)?JR(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||VR(e)?t(e):n(e)}}var Jz={name:`hardBreakEscape`,tokenize:Yz};function Yz(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return VR(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Xz={name:`headingAtx`,resolve:Zz,tokenize:Qz};function Zz(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ER(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Qz(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||HR(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||VR(n)?(e.exit(`atxHeading`),t(n)):UR(n)?JR(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||HR(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var $z=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),eB=[`pre`,`script`,`style`,`textarea`],tB={concrete:!0,name:`htmlFlow`,resolveTo:iB,tokenize:aB},nB={partial:!0,tokenize:sB},rB={partial:!0,tokenize:oB};function iB(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function aB(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):PR(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):PR(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return PR(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||HR(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&eB.includes(l)?(i=1,r.interrupt?t(s):O(s)):$z.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||FR(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return UR(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||PR(t)?(e.consume(t),b):UR(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||FR(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):UR(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):UR(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||VR(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||HR(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||UR(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||VR(t)?O(t):UR(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),te):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),P):VR(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(nB,ne,k)(t)):t===null||VR(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(rB,ee,ne)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return t===null||VR(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),F):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return eB.includes(n)?(e.consume(t),te):O(t)}return PR(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function P(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),te):t===45&&i===2?(e.consume(t),F):O(t)}function te(t){return t===null||VR(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(n){return e.exit(`htmlFlow`),t(n)}}function oB(e,t,n){let r=this;return i;function i(t){return VR(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function sB(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(lz,t,n)}}var cB={name:`htmlText`,tokenize:lB};function lB(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):PR(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):PR(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):VR(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):VR(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):VR(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):VR(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return PR(t)?(e.consume(t),S):n(t)}function S(t){return t===45||FR(t)?(e.consume(t),S):C(t)}function C(t){return VR(t)?(o=C,M(t)):UR(t)?(e.consume(t),C):j(t)}function w(t){return t===45||FR(t)?(e.consume(t),w):t===47||t===62||HR(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||PR(t)?(e.consume(t),E):VR(t)?(o=T,M(t)):UR(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||FR(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):VR(t)?(o=D,M(t)):UR(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):VR(t)?(o=O,M(t)):UR(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,A):t===null?n(t):VR(t)?(o=k,M(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||HR(t)?T(t):(e.consume(t),ee)}function A(e){return e===47||e===62||HR(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return UR(t)?JR(e,P,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):P(t)}function P(t){return e.enter(`htmlTextData`),o(t)}}var uB={name:`labelEnd`,resolveAll:mB,resolveTo:hB,tokenize:gB},dB={tokenize:_B},fB={tokenize:vB},pB={tokenize:yB};function mB(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ER(e,0,e.length,n),e}function hB(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=DR(s,e.slice(a+1,a+r+3)),s=DR(s,[[`enter`,u,t]]),s=DR(s,nz(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=DR(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=DR(s,e.slice(o+1)),s=DR(s,[[`exit`,c,t]]),ER(e,a,e.length,s),e}function gB(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(NR(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(dB,u,o?u:d)(t):t===91?e.attempt(fB,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(pB,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function _B(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return HR(t)?Uz(e,a)(t):a(t)}function a(t){return t===41?u(t):Bz(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return HR(t)?Uz(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Hz(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return HR(t)?Uz(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function vB(e,t,n){let r=this;return i;function i(t){return Vz.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(NR(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function yB(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var bB={name:`labelStartImage`,resolveAll:uB.resolveAll,tokenize:xB};function xB(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var SB={name:`labelStartLink`,resolveAll:uB.resolveAll,tokenize:CB};function CB(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var wB={name:`lineEnding`,tokenize:TB};function TB(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),JR(e,t,`linePrefix`)}}var EB={name:`thematicBreak`,tokenize:DB};function DB(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||VR(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),UR(t)?JR(e,s,`whitespace`)(t):s(t))}}var OB={continuation:{tokenize:MB},exit:PB,name:`list`,tokenize:jB},kB={partial:!0,tokenize:FB},AB={partial:!0,tokenize:NB};function jB(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:RR(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(EB,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return RR(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(lz,r.interrupt?n:u,e.attempt(kB,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return UR(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function MB(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(lz,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,JR(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!UR(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(AB,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,JR(e,e.attempt(OB,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function NB(e,t,n){let r=this;return JR(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function PB(e){e.exit(this.containerState.type)}function FB(e,t,n){let r=this;return JR(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!UR(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var IB={name:`setextUnderline`,resolveTo:LB,tokenize:RB};function LB(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function RB(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),UR(t)?JR(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||VR(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var zB={tokenize:BB};function BB(e){let t=this,n=e.attempt(lz,r,e.attempt(this.parser.constructs.flowInitial,i,JR(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Fz,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var VB={resolveAll:GB()},HB=WB(`string`),UB=WB(`text`);function WB(e){return{resolveAll:GB(e===`text`?KB:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function GB(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function KB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var qB=s({attentionMarkers:()=>tV,contentInitial:()=>YB,disable:()=>nV,document:()=>JB,flow:()=>ZB,flowInitial:()=>XB,insideSpan:()=>eV,string:()=>QB,text:()=>$B}),JB={42:OB,43:OB,45:OB,48:OB,49:OB,50:OB,51:OB,52:OB,53:OB,54:OB,55:OB,56:OB,57:OB,62:dz},YB={91:Wz},XB={[-2]:Cz,[-1]:Cz,32:Cz},ZB={35:Xz,42:EB,45:[IB,EB],60:tB,61:IB,95:EB,96:bz,126:bz},QB={38:_z,92:hz},$B={[-5]:wB,[-4]:wB,[-3]:wB,33:bB,38:_z,42:rz,60:[sz,cB],91:SB,92:[Jz,hz],93:uB,95:rz,96:Dz},eV={null:[rz,VB]},tV={null:[42,95]},nV={null:[]};function rV(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=DR(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=nz(a,l.events,l),l.events):[]}function f(e,t){return aV(p(e),t)}function p(e){return iV(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){VR(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ER(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function iV(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function aV(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
109
|
+
`;break;case-3:o=`\r
|
|
110
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function oV(e){let t={constructs:kR([qB,...(e||{}).extensions||[]]),content:n(YR),defined:[],document:n(ZR),flow:n(zB),lazy:{},string:n(HB),text:n(UB)};return t;function n(e){return n;function n(n){return rV(t,e,n)}}}function sV(e){for(;!Nz(e););return e}var cV=/[\0\t\n\r]/g;function lV(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(cV.lastIndex=u,c=cV.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var uV=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dV(e){return e.replace(uV,fV)}function fV(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return MR(n.slice(t?2:1),t?16:10)}return TR(n)||e}function pV(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?hV(e.position):`start`in e||`end`in e?hV(e):`line`in e||`column`in e?mV(e):``}function mV(e){return gV(e&&e.line)+`:`+gV(e&&e.column)}function hV(e){return mV(e&&e.start)+`-`+mV(e&&e.end)}function gV(e){return e&&typeof e==`number`?e:1}var _V={}.hasOwnProperty;function vV(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),yV(n)(sV(oV(n).document().write(lV()(e,t,!0))))}function yV(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(xe),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(Se),reference:re,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Ce),thematicBreak:a(Te)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(A),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(ee),htmlTextData:E,image:c(M),label:P,labelText:N,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:F,resourceTitleString:te,resource:ne,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};xV(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];_V.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||CV).call(a,void 0,e[0])}for(r.position={start:bV(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bV(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:bV(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||CV).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+pV({start:e.start,end:e.end})+`): it’s not open`);n.position.end=bV(e.end)}function u(){return bR(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=NR(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=we(),n.position={start:bV(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bV(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=bV(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=dV(t),n.identifier=NR(t).toLowerCase()}function P(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=NR(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=MR(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=TR(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=bV(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function de(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function xe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Se(){return{type:`paragraph`,children:[]}}function Ce(){return{type:`strong`,children:[]}}function we(){return{type:`text`,value:``}}function Te(){return{type:`thematicBreak`}}}function bV(e){return{line:e.line,column:e.column,offset:e.offset}}function xV(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?xV(e,r):SV(e,r)}}function SV(e,t){let n;for(n in t)if(_V.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function CV(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+pV({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pV({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+pV({start:t.start,end:t.end})+`) is still open`)}function wV(e){let t=this;t.parser=n;function n(n){return vV(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}var TV={}.hasOwnProperty;function EV(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&TV.call(t,e)){let n=String(t[e]);i=TV.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var DV={}.hasOwnProperty;function OV(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)OV(e,t.extensions[n]);for(r in t)if(DV.call(t,r))switch(r){case`extensions`:break;case`unsafe`:kV(e[r],t[r]);break;case`join`:kV(e[r],t[r]);break;case`handlers`:AV(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function kV(e,t){t&&e.push(...t)}function AV(e,t){t&&Object.assign(e,t)}function jV(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),MV);return i(),o}function MV(e,t,n){return`>`+(n?``:` `)+e}function NV(e,t){return PV(e,t.inConstruct,!0)&&!PV(e,t.notInConstruct,!1)}function PV(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function FV(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
111
|
+
`&&NV(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
112
|
+
`}function IV(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function LV(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^ \r\n]/.test(e.value)||/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function RV(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function zV(e,t,n,r){let i=RV(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(LV(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,BV);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(IV(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
113
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
114
|
+
`),a&&(u+=s.move(a+`
|
|
115
|
+
`)),u+=s.move(c),l(),u}function BV(e,t,n){return(n?``:` `)+e}function VV(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function HV(e,t,n,r){let i=VV(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
116
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function UV(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function WV(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function GV(e,t,n){let r=tz(e),i=tz(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}KV.peek=qV;function KV(e,t,n,r){let i=UV(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=GV(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=WV(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=GV(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+WV(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function qV(e,t,n){return n.options.emphasis||`*`}var JV=(function(e){if(e==null)return $V;if(typeof e==`function`)return QV(e);if(typeof e==`object`)return Array.isArray(e)?YV(e):XV(e);if(typeof e==`string`)return ZV(e);throw Error(`Expected function, string, or object as test`)});function YV(e){let t=[],n=-1;for(;++n<e.length;)t[n]=JV(e[n]);return QV(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function XV(e){let t=e;return QV(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ZV(e){return QV(t);function t(t){return t&&t.type===e}}function QV(e){return t;function t(t,n,r){return!!(eH(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function $V(){return!0}function eH(e){return typeof e==`object`&&!!e&&`type`in e}function tH(e){return e}var nH=[];function rH(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=JV(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+tH(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=nH,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=iH(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function iH(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?nH:[e]}function aH(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),rH(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function oH(e,t){let n=!1;return aH(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&bR(e)&&(t.options.setext||n))}function sH(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(oH(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
117
|
+
`,after:`
|
|
118
|
+
`});return r(),t(),o+`
|
|
119
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
120
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
121
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=WV(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}cH.peek=lH;function cH(e){return e.value||``}function lH(){return`<`}uH.peek=dH;function uH(e,t,n,r){let i=VV(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function dH(){return`!`}fH.peek=pH;function fH(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function pH(){return`!`}mH.peek=hH;function mH(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function hH(){return"`"}function gH(e,t){let n=bR(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][a-z+.-]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}_H.peek=vH;function _H(e,t,n,r){let i=VV(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(gH(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function vH(e,t,n){return gH(e,n)?`<`:`[`}yH.peek=bH;function yH(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function bH(){return`[`}function xH(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function SH(e){let t=xH(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function CH(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function wH(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function TH(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?CH(n):xH(n),s=e.ordered?o===`.`?`)`:`.`:SH(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),wH(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function EH(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function DH(e,t,n,r){let i=EH(n),a=n.bulletCurrent||xH(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function OH(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var kH=JV([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function AH(e,t,n,r){return(e.children.some(function(e){return kH(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function jH(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}MH.peek=NH;function MH(e,t,n,r){let i=jH(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=GV(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=WV(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=GV(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+WV(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function NH(e,t,n){return n.options.strong||`*`}function PH(e,t,n,r){return n.safe(e.value,r)}function FH(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function IH(e,t,n){let r=(wH(n)+(n.options.ruleSpaces?` `:``)).repeat(FH(n));return n.options.ruleSpaces?r.slice(0,-1):r}var LH={blockquote:jV,break:FV,code:zV,definition:HV,emphasis:KV,hardBreak:FV,heading:sH,html:cH,image:uH,imageReference:fH,inlineCode:mH,link:_H,linkReference:yH,list:TH,listItem:DH,paragraph:OH,root:AH,strong:MH,text:PH,thematicBreak:IH},RH=[zH];function zH(e,t,n,r){if(t.type===`code`&&LV(t,r)&&(e.type===`list`||e.type===t.type&&LV(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`)return e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&oH(t,r))?void 0:+!!n.spread}var BH=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],VH=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
|
|
122
|
+
`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`!`,after:`\\[`,inConstruct:`phrasing`,notInConstruct:BH},{character:`"`,inConstruct:`titleQuote`},{atBreak:!0,character:`#`},{character:`#`,inConstruct:`headingAtx`,after:`(?:[\r
|
|
123
|
+
]|$)`},{character:`&`,after:`[#A-Za-z]`,inConstruct:`phrasing`},{character:`'`,inConstruct:`titleApostrophe`},{character:`(`,inConstruct:`destinationRaw`},{before:`\\]`,character:`(`,inConstruct:`phrasing`,notInConstruct:BH},{atBreak:!0,before:`\\d+`,character:`)`},{character:`)`,inConstruct:`destinationRaw`},{atBreak:!0,character:`*`,after:`(?:[ \r
|
|
124
|
+
*])`},{character:`*`,inConstruct:`phrasing`,notInConstruct:BH},{atBreak:!0,character:`+`,after:`(?:[ \r
|
|
125
|
+
])`},{atBreak:!0,character:`-`,after:`(?:[ \r
|
|
126
|
+
-])`},{atBreak:!0,before:`\\d+`,character:`.`,after:`(?:[ \r
|
|
127
|
+
]|$)`},{atBreak:!0,character:`<`,after:`[!/?A-Za-z]`},{character:`<`,after:`[!/?A-Za-z]`,inConstruct:`phrasing`,notInConstruct:BH},{character:`<`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`=`},{atBreak:!0,character:`>`},{character:`>`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`[`},{character:`[`,inConstruct:`phrasing`,notInConstruct:BH},{character:`[`,inConstruct:[`label`,`reference`]},{character:`\\`,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:`]`,inConstruct:[`label`,`reference`]},{atBreak:!0,character:`_`},{character:`_`,inConstruct:`phrasing`,notInConstruct:BH},{atBreak:!0,character:"`"},{character:"`",inConstruct:[`codeFencedLangGraveAccent`,`codeFencedMetaGraveAccent`]},{character:"`",inConstruct:`phrasing`,notInConstruct:BH},{atBreak:!0,character:`~`}];function HH(e){return e.label||!e.identifier?e.label||``:dV(e.identifier)}function UH(e){if(!e._compiled){let t=(e.atBreak?`[\\r\\n][\\t ]*`:``)+(e.before?`(?:`+e.before+`)`:``);e._compiled=RegExp((t?`(`+t+`)`:``)+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?`\\`:``)+e.character+(e.after?`(?:`+e.after+`)`:``),`g`)}return e._compiled}function WH(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before,c;r.push(-1);let l=t.createTracker(n);for(;++o<i.length;){let u=i[o],d;if(r[r.length-1]=o,o+1<i.length){let n=t.handle.handlers[i[o+1].type];n&&n.peek&&(n=n.peek),d=n?n(i[o+1],e,t,{before:``,after:``,...l.current()}).charAt(0):``}else d=n.after;a.length>0&&(s===`\r`||s===`
|
|
128
|
+
`)&&u.type===`html`&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/,` `),s=` `,l=t.createTracker(n),l.move(a.join(``)));let f=t.handle(u,e,t,{...l.current(),after:d,before:s});c&&c===f.slice(0,1)&&(f=WV(c.charCodeAt(0))+f.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,c=void 0,p&&(a.length>0&&p.before&&s===a[a.length-1].slice(-1)&&(a[a.length-1]=a[a.length-1].slice(0,-1)+WV(s.charCodeAt(0))),p.after&&(c=d)),l.move(f),a.push(f),s=f.slice(-1)}return r.pop(),a.join(``)}function GH(e,t,n){let r=t.indexStack,i=e.children||[],a=t.createTracker(n),o=[],s=-1;for(r.push(-1);++s<i.length;){let n=i[s];r[r.length-1]=s,o.push(a.move(t.handle(n,e,t,{before:`
|
|
129
|
+
`,after:`
|
|
130
|
+
`,...a.current()}))),n.type!==`list`&&(t.bulletLastUsed=void 0),s<i.length-1&&o.push(a.move(KH(n,i[s+1],e,t)))}return r.pop(),o.join(``)}function KH(e,t,n,r){let i=r.join.length;for(;i--;){let a=r.join[i](e,t,n,r);if(a===!0||a===1)break;if(typeof a==`number`)return`
|
|
131
|
+
`.repeat(1+a);if(a===!1)return`
|
|
132
|
+
|
|
133
|
+
<!---->
|
|
134
|
+
|
|
135
|
+
`}return`
|
|
136
|
+
|
|
137
|
+
`}var qH=/\r?\n|\r/g;function JH(e,t){let n=[],r=0,i=0,a;for(;a=qH.exec(e);)o(e.slice(r,a.index)),n.push(a[0]),r=a.index+a[0].length,i++;return o(e.slice(r)),n.join(``);function o(e){n.push(t(e,i,!e))}}function YH(e,t,n){let r=(n.before||``)+(t||``)+(n.after||``),i=[],a=[],o={},s=-1;for(;++s<e.unsafe.length;){let t=e.unsafe[s];if(!NV(e.stack,t))continue;let n=e.compilePattern(t),a;for(;a=n.exec(r);){let e=`before`in t||!!t.atBreak,n=`after`in t,r=a.index+(e?a[1].length:0);i.includes(r)?(o[r].before&&!e&&(o[r].before=!1),o[r].after&&!n&&(o[r].after=!1)):(i.push(r),o[r]={before:e,after:n})}}i.sort(XH);let c=n.before?n.before.length:0,l=r.length-(n.after?n.after.length:0);for(s=-1;++s<i.length;){let e=i[s];e<c||e>=l||e+1<l&&i[s+1]===e+1&&o[e].after&&!o[e+1].before&&!o[e+1].after||i[s-1]===e-1&&o[e].before&&!o[e-1].before&&!o[e-1].after||(c!==e&&a.push(ZH(r.slice(c,e),`\\`)),c=e,/[!-/:-@[-`{-~]/.test(r.charAt(e))&&(!n.encode||!n.encode.includes(r.charAt(e)))?a.push(`\\`):(a.push(WV(r.charCodeAt(e))),c++))}return a.push(ZH(r.slice(c,l),n.after)),a.join(``)}function XH(e,t){return e-t}function ZH(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],a=e+t,o=-1,s=0,c;for(;c=n.exec(a);)r.push(c.index);for(;++o<r.length;)s!==r[o]&&i.push(e.slice(s,r[o])),i.push(`\\`),s=r[o];return i.push(e.slice(s)),i.join(``)}function QH(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,a=n.column||1;return{move:c,current:o,shift:s};function o(){return{now:{line:i,column:a},lineShift:r}}function s(e){r+=e}function c(e){let t=e||``,n=t.split(/\r?\n|\r/g),o=n[n.length-1];return i+=n.length-1,a=n.length===1?a+o.length:1+o.length+r,t}}function $H(e,t){let n=t||{},r={associationId:HH,containerPhrasing:rU,containerFlow:iU,createTracker:QH,compilePattern:UH,enter:a,handlers:{...LH},handle:void 0,indentLines:JH,indexStack:[],join:[...RH],options:{},safe:aU,stack:[],unsafe:[...VH]};OV(r,n),r.options.tightDefinitions&&r.join.push(nU),r.handle=EV(`type`,{invalid:eU,unknown:tU,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
|
|
138
|
+
`,after:`
|
|
139
|
+
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
140
|
+
`),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function eU(e){throw Error("Cannot handle value `"+e+"`, expected node")}function tU(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function nU(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function rU(e,t){return WH(e,this,t)}function iU(e,t){return GH(e,this,t)}function aU(e,t){return YH(this,e,t)}function oU(e){let t=this;t.compiler=n;function n(n){return $H(n,{...t.data(`settings`),...e,extensions:t.data(`toMarkdownExtensions`)||[]})}}function sU(e){if(e)throw e}var cU=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function lU(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function uU(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?dU(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function dU(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var fU=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=pV(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};fU.prototype.file=``,fU.prototype.name=``,fU.prototype.reason=``,fU.prototype.message=``,fU.prototype.stack=``,fU.prototype.column=void 0,fU.prototype.line=void 0,fU.prototype.ancestors=void 0,fU.prototype.cause=void 0,fU.prototype.fatal=void 0,fU.prototype.place=void 0,fU.prototype.ruleId=void 0,fU.prototype.source=void 0;var pU={basename:mU,dirname:hU,extname:gU,join:_U,sep:`/`};function mU(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);bU(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function hU(e){if(bU(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function gU(e){bU(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function _U(...e){let t=-1,n;for(;++t<e.length;)bU(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:vU(n)}function vU(e){bU(e);let t=e.codePointAt(0)===47,n=yU(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function yU(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function bU(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var xU={cwd:SU};function SU(){return`/`}function CU(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function wU(e){if(typeof e==`string`)e=new URL(e);else if(!CU(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return TU(e)}function TU(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var EU=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],DU=class{constructor(e){let t;t=e?CU(e)?{path:e}:typeof e==`string`||jU(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:xU.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<EU.length;){let e=EU[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)EU.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?pU.basename(this.path):void 0}set basename(e){kU(e,`basename`),OU(e,`basename`),this.path=pU.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?pU.dirname(this.path):void 0}set dirname(e){AU(this.basename,`dirname`),this.path=pU.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?pU.extname(this.path):void 0}set extname(e){if(OU(e,`extname`),AU(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=pU.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){CU(e)&&(e=wU(e)),kU(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?pU.basename(this.path,this.extname):void 0}set stem(e){kU(e,`stem`),OU(e,`stem`),this.path=pU.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new fU(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function OU(e,t){if(e&&e.includes(pU.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+pU.sep+"`")}function kU(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function AU(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function jU(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var MU=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),NU=l(cU(),1),PU={}.hasOwnProperty,FU=new class e extends MU{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=uU()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,NU.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(RU(`data`,this.frozen),this.namespace[e]=t,this):PU.call(this.namespace,e)&&this.namespace[e]||void 0:e?(RU(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=VU(e),n=this.parser||this.Parser;return IU(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),IU(`process`,this.parser||this.Parser),LU(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=VU(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);UU(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),IU(`processSync`,this.parser||this.Parser),LU(`processSync`,this.compiler||this.Compiler),this.process(e,r),BU(`processSync`,`process`,t),n;function r(e,r){t=!0,sU(e),n=r}}run(e,t,n){zU(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=VU(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),BU(`runSync`,`run`,n),r;function i(e,t){sU(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=VU(t),r=this.compiler||this.Compiler;return LU(`stringify`,r),zU(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(RU(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,NU.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];lU(o)&&lU(r)&&(r=(0,NU.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function IU(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function LU(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function RU(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zU(e){if(!lU(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function BU(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function VU(e){return HU(e)?e:new DU(e)}function HU(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function UU(e){return typeof e==`string`||WU(e)}function WU(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var GU=FU().use(wV).use(oU).freeze();function KU(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function qU(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function JU(e,t,n){let r=JV((n||{}).ignore||[]),i=YU(t),a=-1;for(;++a<i.length;)rH(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function YU(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([XU(e[0]),ZU(e[1])])}return t}function XU(e){return typeof e==`string`?new RegExp(qU(e),`g`):e}function ZU(e){return typeof e==`function`?e:function(){return e}}var QU=`phrasing`,$U=[`autolink`,`link`,`image`,`label`];function eW(){return{transforms:[cW],enter:{literalAutolink:nW,literalAutolinkEmail:rW,literalAutolinkHttp:rW,literalAutolinkWww:rW},exit:{literalAutolink:sW,literalAutolinkEmail:oW,literalAutolinkHttp:iW,literalAutolinkWww:aW}}}function tW(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:QU,notInConstruct:$U},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:QU,notInConstruct:$U},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:QU,notInConstruct:$U}]}}function nW(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function rW(e){this.config.enter.autolinkProtocol.call(this,e)}function iW(e){this.config.exit.autolinkProtocol.call(this,e)}function aW(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function oW(e){this.config.exit.autolinkEmail.call(this,e)}function sW(e){this.exit(e)}function cW(e){JU(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,lW],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,uW]],{ignore:[`link`,`linkReference`]})}function lW(e,t,n,r,i){let a=``;if(!pW(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!dW(n)))return!1;let o=fW(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function uW(e,t,n,r){return!pW(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function dW(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function fW(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=KU(e,`(`),a=KU(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function pW(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||GR(n)||WR(n))&&(!t||n!==47)}CW.peek=SW;function mW(){this.buffer()}function hW(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function gW(){this.buffer()}function _W(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function vW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=NR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yW(e){this.exit(e)}function bW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=NR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xW(e){this.exit(e)}function SW(){return`[`}function CW(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function wW(){return{enter:{gfmFootnoteCallString:mW,gfmFootnoteCall:hW,gfmFootnoteDefinitionLabelString:gW,gfmFootnoteDefinition:_W},exit:{gfmFootnoteCallString:vW,gfmFootnoteCall:yW,gfmFootnoteDefinitionLabelString:bW,gfmFootnoteDefinition:xW}}}function TW(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:CW},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
141
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?DW:EW))),s(),o}}function EW(e,t,n){return t===0?e:DW(e,t,n)}function DW(e,t,n){return(n?``:` `)+e}var OW=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];NW.peek=PW;function kW(){return{canContainEols:[`delete`],enter:{strikethrough:jW},exit:{strikethrough:MW}}}function AW(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:OW}],handlers:{delete:NW}}}function jW(e){this.enter({type:`delete`,children:[]},e)}function MW(e){this.exit(e)}function NW(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function PW(){return`~`}function FW(e){return e.length}function IW(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||FW,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=LW(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=RW(r[d]);else{let e=RW(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
142
|
+
`)}function LW(e){return e==null?``:String(e)}function RW(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function zW(){return{enter:{table:BW,tableData:WW,tableHeader:WW,tableRow:HW},exit:{codeText:GW,table:VW,tableData:UW,tableHeader:UW,tableRow:UW}}}function BW(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function VW(e){this.exit(e),this.data.inTable=void 0}function HW(e){this.enter({type:`tableRow`,children:[]},e)}function UW(e){this.exit(e)}function WW(e){this.enter({type:`tableCell`,children:[]},e)}function GW(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KW));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KW(e,t){return t===`|`?t:e}function qW(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
143
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
144
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return IW(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=LH.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function JW(){return{exit:{taskListCheckValueChecked:XW,taskListCheckValueUnchecked:XW,paragraph:ZW}}}function YW(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:QW}}}function XW(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function ZW(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function QW(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=LH.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function $W(){return[eW(),wW(),kW(),zW(),JW()]}function eG(e){return{extensions:[tW(),TW(e),AW(),qW(e),YW()]}}var tG={tokenize:hG,partial:!0},nG={tokenize:gG,partial:!0},rG={tokenize:_G,partial:!0},iG={tokenize:vG,partial:!0},aG={tokenize:yG,partial:!0},oG={name:`wwwAutolink`,tokenize:pG,previous:bG},sG={name:`protocolAutolink`,tokenize:mG,previous:xG},cG={name:`emailAutolink`,tokenize:fG,previous:SG},lG={};function uG(){return{text:lG}}for(var dG=48;dG<123;)lG[dG]=cG,dG++,dG===58?dG=65:dG===91&&(dG=97);lG[43]=cG,lG[45]=cG,lG[46]=cG,lG[95]=cG,lG[72]=[cG,sG],lG[104]=[cG,sG],lG[87]=[cG,oG],lG[119]=[cG,oG];function fG(e,t,n){let r=this,i,a;return o;function o(t){return!CG(t)||!SG.call(r,r.previous)||wG(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return CG(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(aG,u,l)(t):t===45||t===95||FR(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&PR(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function pG(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!bG.call(r,r.previous)||wG(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(tG,e.attempt(nG,e.attempt(rG,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function mG(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&xG.call(r,r.previous)&&!wG(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(PR(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||LR(t)||HR(t)||GR(t)||WR(t)?n(t):e.attempt(nG,e.attempt(rG,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function hG(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function gG(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(iG,c,s)(t):t===null||HR(t)||GR(t)||t!==45&&WR(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function _G(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(iG,t,a)(o):o===null||HR(o)||GR(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function vG(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||HR(o)||GR(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||HR(e)||GR(e)?t(e):r(e)}function a(e){return PR(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):PR(t)?(e.consume(t),o):n(t)}}function yG(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return FR(e)?n(e):t(e)}}function bG(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||HR(e)}function xG(e){return!PR(e)}function SG(e){return!(e===47||CG(e))}function CG(e){return e===43||e===45||e===46||e===95||FR(e)}function wG(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var TG={tokenize:NG,partial:!0};function EG(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:AG,continuation:{tokenize:jG},exit:MG}},text:{91:{name:`gfmFootnoteCall`,tokenize:kG},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:DG,resolveTo:OG}}}}function DG(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=NR(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function OG(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function kG(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||HR(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(NR(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return HR(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function AG(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||HR(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=NR(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return HR(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),JR(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function jG(e,t,n){return e.check(lz,t,e.attempt(TG,t,n))}function MG(e){e.exit(`gfmFootnoteDefinition`)}function NG(e,t,n){let r=this;return JR(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function PG(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ER(o,o.length,0,nz(s,e.slice(r+1,n),t)),ER(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ER(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=tz(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=tz(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var FG=class{constructor(){this.map=[]}add(e,t,n){IG(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function IG(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function LG(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function RG(){return{flow:{null:{name:`table`,tokenize:zG,resolveAll:BG}}}}function zG(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):VR(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):UR(t)?JR(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||HR(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,UR(t)?JR(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return UR(t)?JR(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||VR(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return UR(t)?JR(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||VR(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||VR(n)?(e.exit(`tableRow`),t(n)):UR(n)?JR(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||HR(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function BG(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new FG;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(HG(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=VG(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=VG(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=VG(f,t,o,i,n,d)):(o[0]=o[1],d=VG(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&HG(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=LG(t.events,n))}return e}function VG(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},UG(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=UG(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=UG(t.events,n[2]),a=UG(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},UG(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function HG(e,t,n,r,i){let a=[],o=UG(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function UG(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var WG={name:`tasklistCheck`,tokenize:KG};function GG(){return{text:{91:WG}}}function KG(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return HR(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return VR(r)?t(r):UR(r)?e.check({tokenize:qG},t,n)(r):n(r)}}function qG(e,t,n){return JR(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function JG(e){return kR([uG(),EG(),PG(e),RG(),GG()])}var YG={};function XG(e){let t=this,n=e||YG,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(JG(n)),a.push($W()),o.push(eG(n))}var ZG={blockquote:aK,break:oK,code:sK,definition:sK,delete:aK,emphasis:aK,footnoteReference:sK,footnoteDefinition:sK,heading:iK,html:sK,image:nK,imageReference:nK,inlineCode:rK,list:aK,listItem:aK,link:aK,linkReference:aK,strong:aK,table:sK,tableCell:sK,text:rK,thematicBreak:sK,toml:sK,yaml:sK},QG={},$G=[];function eK(e){let t={...ZG},n=e||QG,r=n.keep||$G,i=n.remove||$G,a=-1;for(;++a<i.length;){let e=i[a];typeof e==`string`?t[e]=sK:t[e[0]]=e[1]}let o={};if(r.length===0)o=t;else{let e;for(e in t)r.includes(e)||(o[e]=t[e]);for(a=-1;++a<r.length;)if(e=r[a],!Object.hasOwn(t,e))throw Error("Unknown node type `"+e+"` in `keep`, use a replace tuple with a handle instead: `remove: [['"+e+"', handle]]`")}return function(e){return s(e)};function s(e){let t=e.type,n=e;if(Object.hasOwn(o,t)){let e=o[t];e&&(n=e(n)||void 0)}return n=Array.isArray(n)?c(n):n,n&&`children`in n&&(n.children=c(n.children)),n}function c(e){let t=-1,n=[];for(;++t<e.length;){let r=s(e[t]);Array.isArray(r)?n.push(...c(r)):r&&n.push(r)}return tK(n)}}function tK(e){let t=-1,n=[],r;for(;++t<e.length;){let i=e[t];r&&i.type===r.type&&`value`in i&&`value`in r?r.value+=i.value:(n.push(i),r=i)}return n}function nK(e){let t=`title`in e?e.title:``,n=e.alt||t||``;return n?{type:`text`,value:n}:void 0}function rK(e){return{type:`text`,value:e.value}}function iK(e){return{type:`paragraph`,children:e.children}}function aK(e){return e.children}function oK(){return{type:`text`,value:`
|
|
145
|
+
`}}function sK(){}function cK(e){let t=GU().use(XG).use(eK),n=t.runSync(t.parse(e)).children.map(e=>{if(e.type!==`paragraph`)throw Error(`Slopify hit an internal error (the article couldn't be turned into plain text). Try again; if it happens again, use Download diagnostics in Settings and report it.`);return e.children.map(e=>{if(e.type!==`text`)throw Error(`Slopify hit an internal error (the article couldn't be turned into plain text). Try again; if it happens again, use Download diagnostics in Settings and report it.`);return e.value}).join(``)}).filter(e=>e.trim()!==``);return n.length===0?``:n.join(`
|
|
146
|
+
|
|
147
|
+
`)+`
|
|
148
|
+
`}var lK={"sources consulted":`sources`,"pronunciation glossary":`glossary`};function uK(e){let t=dK(e),n=t[0];if(n===void 0)return{body:e,sources:``,glossary:``};let r={sources:``,glossary:``};for(let[n,i]of t.entries())r[i.part]+=e.slice(i.at,t[n+1]?.at??e.length);return{body:e.slice(0,n.at),sources:r.sources,glossary:r.glossary}}function dK(e){let t=GU().use(XG).parse(e),n=[];for(let r of t.children){if(r.type!==`heading`&&r.type!==`paragraph`)continue;let t=r.position?.start.offset,i=r.position?.end.offset;if(t===void 0||i===void 0)continue;let a=fK(e.slice(t,i));a!==void 0&&n.push({part:a,at:t})}return n}function fK(e){return lK[cK(e).trim().toLowerCase().replace(/:$/,``)]}function pK(e,t){return e.filter(e=>e.stageKind===t.kind)}function mK(e,t){return e.find(e=>e.role===t)}function hK(e){let{api:t}=B();return I({...Sb(t,e),enabled:!1,select:e=>e.revisionId??null}).data??null}var gK=(e,t=null)=>[`live-writing`,e,t];function _K(e,t){let n=e=>e.callId===t.callId&&e.revisionId===t.revisionId&&e.workId===t.workId,r=e.find(n),i=(t.reset?t.text:`${r?.text??``}${t.text}`).slice(-65536),a={...t.revisionId===void 0?{}:{revisionId:t.revisionId},...t.workId===void 0?{}:{workId:t.workId},...t.workPieceId===void 0?{}:{workPieceId:t.workPieceId},stage:t.stage,callId:t.callId,...t.label===void 0?{}:{label:t.label},text:i};return(r?e.map(e=>n(e)?a:e):[...e,a]).slice(-24)}function vK({projectId:e,stage:t,className:n=`mx-5 mt-5`}){let r=(I({queryKey:gK(e,hK(e)),queryFn:()=>[],enabled:!1}).data??[]).filter(e=>e.stage===t),[i,a]=(0,m.useState)(),o=r.find(e=>e.callId===i)??r.at(-1),[s,c]=(0,m.useState)(!0),l=(0,m.useRef)(null);return(0,m.useEffect)(()=>{o?.text&&s&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[s,o?.text]),r.length===0&&t!==`research`&&t!==`article`?null:(0,h.jsxs)(`div`,{className:z(`rounded-control border border-line2 bg-panel2`,n),children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold text-run-text`,children:`Live writing`}),r.length>1?(0,h.jsx)(YP,{"aria-label":`Live writing task`,value:o?.callId??``,onChange:e=>a(e.target.value),className:`max-w-[280px]`,children:r.map((e,t)=>(0,h.jsxs)(`option`,{value:e.callId,children:[e.label??`Writing`,` · `,t+1]},e.callId))}):null,(0,h.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-label text-ink2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),`Follow output`]})]}),(0,h.jsx)(`section`,{ref:l,"aria-label":`Live writing preview`,tabIndex:0,className:`max-h-[360px] min-h-32 overflow-auto whitespace-pre-wrap break-words p-4 font-sans text-small leading-relaxed text-ink2`,children:o?.text||`Waiting for the provider's first text…`}),(0,h.jsx)(`p`,{className:`border-t border-line px-4 py-2 text-label text-ink3`,children:`Live preview. The complete output is saved when this stage finishes.`})]})}function yK(e){let t=e.role.replaceAll(`_`,`-`);return(e.role===`narration_txt`||e.role===`tts_script`)&&e.meta.segment!==void 0?`${t}-${e.meta.segment}`:e.role===`short_video`&&e.meta.short!==void 0?`${t}-${String(e.meta.short)}`:e.role===`short_image`&&e.meta.short!==void 0?`${t}-${String(e.meta.short)}-${String(e.meta.index??1)}`:e.role===`instructions`?`${e.stageKind}-${t}`:(e.role===`image`||e.role===`animated_image`)&&e.meta.index!==void 0?`${t}-${String(e.meta.index)}`:t}function bK(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var xK=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SK=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,CK={};function wK(e,t){return((t||CK).jsx?SK:xK).test(e)}var TK=/[ \t\n\f\r]/g;function EK(e){return typeof e==`object`?e.type===`text`&&DK(e.value):DK(e)}function DK(e){return e.replace(TK,``)===``}var OK=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};OK.prototype.normal={},OK.prototype.property={},OK.prototype.space=void 0;function kK(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new OK(n,r,t)}function AK(e){return e.toLowerCase()}var jK=class{constructor(e,t){this.attribute=t,this.property=e}};jK.prototype.attribute=``,jK.prototype.booleanish=!1,jK.prototype.boolean=!1,jK.prototype.commaOrSpaceSeparated=!1,jK.prototype.commaSeparated=!1,jK.prototype.defined=!1,jK.prototype.mustUseProperty=!1,jK.prototype.number=!1,jK.prototype.overloadedBoolean=!1,jK.prototype.property=``,jK.prototype.spaceSeparated=!1,jK.prototype.space=void 0;var MK=s({boolean:()=>PK,booleanish:()=>FK,commaOrSpaceSeparated:()=>zK,commaSeparated:()=>RK,number:()=>Y,overloadedBoolean:()=>IK,spaceSeparated:()=>LK}),NK=0,PK=BK(),FK=BK(),IK=BK(),Y=BK(),LK=BK(),RK=BK(),zK=BK();function BK(){return 2**++NK}var VK=Object.keys(MK),HK=class extends jK{constructor(e,t,n,r){let i=-1;if(super(e,t),UK(this,`space`,r),typeof n==`number`)for(;++i<VK.length;){let e=VK[i];UK(this,VK[i],(n&MK[e])===MK[e])}}};HK.prototype.defined=!0;function UK(e,t,n){n&&(e[t]=n)}function WK(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new HK(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[AK(r)]=r,n[AK(a.attribute)]=r}return new OK(t,n,e.space)}var GK=WK({properties:{ariaActiveDescendant:null,ariaAtomic:FK,ariaAutoComplete:null,ariaBusy:FK,ariaChecked:FK,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:LK,ariaCurrent:null,ariaDescribedBy:LK,ariaDetails:null,ariaDisabled:FK,ariaDropEffect:LK,ariaErrorMessage:null,ariaExpanded:FK,ariaFlowTo:LK,ariaGrabbed:FK,ariaHasPopup:null,ariaHidden:FK,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:LK,ariaLevel:Y,ariaLive:null,ariaModal:FK,ariaMultiLine:FK,ariaMultiSelectable:FK,ariaOrientation:null,ariaOwns:LK,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:FK,ariaReadOnly:FK,ariaRelevant:null,ariaRequired:FK,ariaRoleDescription:LK,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:FK,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function KK(e,t){return t in e?e[t]:t}function qK(e,t){return KK(e,t.toLowerCase())}var JK=WK({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:RK,acceptCharset:LK,accessKey:LK,action:null,allow:null,allowFullScreen:PK,allowPaymentRequest:PK,allowUserMedia:PK,alpha:PK,alt:null,as:null,async:PK,autoCapitalize:null,autoComplete:LK,autoFocus:PK,autoPlay:PK,blocking:LK,capture:null,charSet:null,checked:PK,cite:null,className:LK,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:FK,controls:PK,controlsList:LK,coords:Y|RK,crossOrigin:null,data:null,dateTime:null,decoding:null,default:PK,defer:PK,dir:null,dirName:null,disabled:PK,download:IK,draggable:FK,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:PK,formTarget:null,headers:LK,height:Y,hidden:IK,high:Y,href:null,hrefLang:null,htmlFor:LK,httpEquiv:LK,id:null,imageSizes:null,imageSrcSet:null,inert:PK,inputMode:null,integrity:null,is:null,isMap:PK,itemId:null,itemProp:LK,itemRef:LK,itemScope:PK,itemType:LK,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:PK,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:PK,muted:PK,name:null,nonce:null,noModule:PK,noValidate:PK,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:PK,optimum:Y,pattern:null,ping:LK,placeholder:null,playsInline:PK,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:PK,referrerPolicy:null,rel:LK,required:PK,reversed:PK,rows:Y,rowSpan:Y,sandbox:LK,scope:null,scoped:PK,seamless:PK,selected:PK,shadowRootClonable:PK,shadowRootCustomElementRegistry:PK,shadowRootDelegatesFocus:PK,shadowRootMode:null,shadowRootSerializable:PK,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:FK,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:PK,useMap:null,value:FK,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:LK,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:PK,declare:PK,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:PK,noHref:PK,noShade:PK,noWrap:PK,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:FK,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:PK,disablePictureInPicture:PK,disableRemotePlayback:PK,exportParts:RK,part:LK,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:qK}),YK=WK({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,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`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,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`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,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`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:zK,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:LK,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:PK,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:RK,g2:RK,glyphName:RK,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:zK,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Y,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:LK,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zK,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zK,rev:zK,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zK,requiredFeatures:zK,requiredFonts:zK,requiredFormats:zK,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:zK,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zK,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zK,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:KK}),XK=WK({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ZK=WK({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:qK}),QK=WK({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),$K={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},eq=/[A-Z]/g,tq=/-[a-z]/g,nq=/^data[-\w.:]+$/i;function rq(e,t){let n=AK(t),r=t,i=jK;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&nq.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(tq,aq);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!tq.test(e)){let n=e.replace(eq,iq);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=HK}return new i(r,t)}function iq(e){return`-`+e.toLowerCase()}function aq(e){return e.charAt(1).toUpperCase()}var oq=kK([GK,JK,XK,ZK,QK],`html`),sq=kK([GK,YK,XK,ZK,QK],`svg`);function cq(e){return e.join(` `).trim()}var lq=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
149
|
+
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),uq=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(lq());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),dq=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),fq=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(uq()),r=dq();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),pq=hq(`end`),mq=hq(`start`);function hq(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function gq(e){let t=mq(e),n=pq(e);if(t&&n)return{start:t,end:n}}var _q=l(fq(),1),vq={}.hasOwnProperty,yq=new Map,bq=/[A-Z]/g,xq=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Sq=new Set([`td`,`th`]),Cq=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function wq(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Fq(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Pq(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?sq:oq,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Tq(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Tq(e,t,n){if(t.type===`element`)return Eq(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Dq(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return kq(e,t,n);if(t.type===`mdxjsEsm`)return Oq(e,t);if(t.type===`root`)return Aq(e,t,n);if(t.type===`text`)return jq(e,t)}function Eq(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=sq,e.schema=i),e.ancestors.push(t);let a=Vq(e,t.tagName,!1),o=Iq(e,t),s=Rq(e,t);return xq.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!EK(e)})),Mq(e,o,a,t),Nq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Dq(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Hq(e,t.position)}function Oq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hq(e,t.position)}function kq(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=sq,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Vq(e,t.name,!0),o=Lq(e,t),s=Rq(e,t);return Mq(e,o,a,t),Nq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Aq(e,t,n){let r={};return Nq(r,Rq(e,t)),e.create(t,e.Fragment,r,n)}function jq(e,t){return t.value}function Mq(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Nq(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Pq(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Fq(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=mq(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Iq(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&vq.call(t.properties,i)){let a=zq(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Sq.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Lq(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Hq(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Hq(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Rq(e,t){let n=[],r=-1,i=e.passKeys?new Map:yq;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Tq(e,a,o);s!==void 0&&n.push(s)}return n}function zq(e,t,n){let r=rq(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?bK(n):cq(n)),r.property===`style`){let t=typeof n==`object`?n:Bq(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Uq(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?$K[r.property]||r.property:r.attribute,n]}}function Bq(e,t){try{return(0,_q.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fU("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Cq+`#cannot-parse-style-attribute`,r}}function Vq(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=wK(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=wK(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return vq.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hq(e)}function Hq(e,t){let n=new fU("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Cq+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Uq(e){let t={},n;for(n in e)vq.call(e,n)&&(t[Wq(n)]=e[n]);return t}function Wq(e){let t=e.replace(bq,Gq);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Gq(e){return`-`+e.toLowerCase()}var Kq={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]};function qq(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Jq(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
150
|
+
`}]}function Yq(e,t){let n=t.value?t.value+`
|
|
151
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Xq(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zq(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qq(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=qR(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function $q(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eJ(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function tJ(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function nJ(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tJ(e,t);let i={src:qR(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function rJ(e,t){let n={src:qR(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function iJ(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function aJ(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tJ(e,t);let i={href:qR(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function oJ(e,t){let n={href:qR(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sJ(e,t,n){let r=e.all(t),i=n?cJ(n):lJ(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
152
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
153
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function cJ(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=lJ(n[r])}return t}function lJ(e){return e.spread??e.children.length>1}function uJ(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function dJ(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fJ(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pJ(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mJ(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=mq(t.children[1]),o=pq(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function hJ(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function gJ(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var _J=9,vJ=32;function yJ(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(bJ(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(bJ(t.slice(i),i>0,!1)),a.join(``)}function bJ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===_J||t===vJ;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===_J||t===vJ;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function xJ(e,t){let n={type:`text`,value:yJ(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function SJ(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var CJ={blockquote:qq,break:Jq,code:Yq,delete:Xq,emphasis:Zq,footnoteReference:Qq,heading:$q,html:eJ,imageReference:nJ,image:rJ,inlineCode:iJ,linkReference:aJ,link:oJ,listItem:sJ,list:uJ,paragraph:dJ,root:fJ,strong:pJ,table:mJ,tableCell:gJ,tableRow:hJ,text:xJ,thematicBreak:SJ,toml:wJ,yaml:wJ,definition:wJ,footnoteDefinition:wJ};function wJ(){}var{defineProperty:TJ}=Object,EJ=typeof self==`object`?self:globalThis,DJ=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new EJ[e](t)},OJ=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?TJ(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof EJ[e]==`function`?DJ(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(DJ(a,o),i)};return r},kJ=e=>OJ(new Map,e)(0),AJ=``,{toString:jJ}={},{keys:MJ,is:NJ}=Object,PJ=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=jJ.call(e).slice(8,-1);switch(n){case`Array`:return[1,AJ];case`Object`:return[2,AJ];case`Date`:return[3,AJ];case`RegExp`:return[4,AJ];case`Map`:return[5,AJ];case`Set`:return[6,AJ];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},FJ=([e,t])=>e===0&&(t===`function`||t===`symbol`),IJ=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=PJ(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&NJ(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of MJ(o))(e||!FJ(PJ(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?AJ:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(FJ(PJ(n))||FJ(PJ(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!FJ(PJ(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},LJ=(e,{json:t,lossy:n}={})=>{let r=[];return IJ(!(t||n),!!t,new Map,r)(e),r},RJ=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?kJ(LJ(e,t)):structuredClone(e):(e,t)=>kJ(LJ(e,t));function zJ(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function BJ(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function VJ(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||zJ,r=e.options.footnoteBackLabel||BJ,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=qR(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...RJ(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
154
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
155
|
+
`}]}}var HJ={}.hasOwnProperty,UJ={};function WJ(e,t){let n=t||UJ,r=new Map,i=new Map,a={all:s,applyData:KJ,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...CJ,...n.handlers},one:o,options:n,patch:GJ,wrap:JJ};return aH(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(HJ.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=RJ(n);return r.children=a.all(e),r}return RJ(e)}return(a.options.unknownHandler||qJ)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=YJ(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=YJ(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function GJ(e,t){e.position&&(t.position=gq(e))}function KJ(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,RJ(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function qJ(e,t){let n=t.data||{},r=`value`in t&&!(HJ.call(n,`hProperties`)||HJ.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function JJ(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
156
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
157
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
158
|
+
`}),n}function YJ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function XJ(e,t){let n=WJ(e,t),r=n.one(e,void 0),i=VJ(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
159
|
+
`},i)),a}function ZJ(e,t){return e&&`run`in e?async function(n,r){let i=XJ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return XJ(n,{file:r,...e||t})}}var QJ=[],$J={allowDangerousHtml:!0},eY=/^(https?|ircs?|mailto|xmpp)$/i,tY=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function nY(e){let t=rY(e),n=iY(e);return aY(t.runSync(t.parse(n),n),e)}function rY(e){let t=e.rehypePlugins||QJ,n=e.remarkPlugins||QJ,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$J}:$J;return FU().use(wV).use(n).use(ZJ,r).use(t)}function iY(e){let t=e.children||``,n=new DU;return typeof t==`string`?n.value=t:``+t,n}function aY(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||oY;for(let e of tY)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return aH(e,l),wq(e,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Kq)if(Object.hasOwn(Kq,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Kq[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function oY(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||eY.test(e.slice(0,t))?e:``}var sY={location:GO(`docker-host`),path:W().min(1)},cY=PO([q({opened:GO(!0)}).strict(),q({opened:GO(!0),...sY}).strict(),q({opened:GO(!1),...sY}).strict()]),lY=IO(`kind`,[q({kind:GO(`allAffected`)}).strict(),q({kind:GO(`selected`),workKeys:K(W().min(1).max(200)).min(1).max(1e4)}).strict()]),uY=W().min(1).max(64),dY=q({baseRevisionId:uY,request:lY}).strict(),fY=q({baseRevisionId:uY,idempotencyKey:rO(),previewId:W().min(1).max(64),acknowledgeUnknownCosts:wO(),confirmedProvidedWorkKeys:K(W().min(1).max(200)).max(1e4)}).strict(),pY=q({stage:W(),low:G().finite().nonnegative().nullable(),high:G().finite().nonnegative().nullable(),detail:W()}),mY=q({currency:GO(`USD`),rows:K(pY),low:G().finite().nonnegative(),high:G().finite().nonnegative(),unknown:G().int().nonnegative(),expectedWords:G().finite().nonnegative(),catalogueDate:W().nullable(),assumptions:K(W())}),hY=q({revisionId:uY,admissionId:W().min(1).max(64),workIds:K(W().min(1).max(64)),replayed:wO()}),gY=q({id:W().min(1).max(64),projectId:W().min(1).max(64),baseRevisionId:uY,planFingerprint:W().min(1),selection:lY,changedInputs:K(q({path:W(),before:W().nullable(),after:W().nullable()})),work:K(q({key:W(),stage:J(Gb),kind:J([`provider`,`local`,`provided`]),disposition:J([`reuse`,`generate`,`local`,`review`,`blocked`]),requestFingerprint:W(),fingerprint:W(),dependsOn:K(W()),reason:W(),inflight:wO(),pieceIds:K(W())})),retained:K(q({slot:W(),outputId:W(),assetId:W(),state:J([`ready`,`outdated`,`review`])})),providedReuseRequired:K(W()),costs:mY,wholeRequestNotice:W().nullable(),warnings:K(W()),review:q({inputChanges:K(q({label:W(),before:W().nullable(),after:W().nullable()})),requests:K(q({key:W(),label:W(),text:W().nullable(),settings:W().nullable()}))}).optional()}),_Y=[`chapter`,`chunk`,`segment`,`image`,`prompt_written`,`article_written`],vY=[`pending`,`running`,`done`,`failed`];q({id:W(),stage_id:W(),kind:J(_Y),idx:G(),state:J(vY),payload:W().nullable()});var yY=`notes.article_md.article_txt.narration_txt.tts_script.sources.glossary.audio_body.audio_intro.audio_outro.audio_export.image.thumbnail.video.render_params.subtitles_srt.subtitles_vtt.subtitle_words.subtitle_ass.subtitle_font.instructions.document_pdf.youtube_description.youtube_tags.shorts.short_image.short_video.animated_image.reference`.split(`.`),bY=[`copying`,`staged`],xY=q({segment:J([`body`,`intro`,`outro`]).optional(),subtitleOmissions:K(q({start:G().finite().nonnegative(),text:W()})).optional(),subtitlesMode:J([`off`,`files`,`burn-in`]).optional(),promptName:W().optional(),prompt:W().optional(),index:G().optional(),short:G().optional(),sentences:BO([G(),G()]).optional(),warnings:K(W()).optional(),provider:W().optional(),model:W().optional(),voice:W().optional()}),SY=q({id:W(),projectId:W(),stageKind:J(Gb),role:J(yY),path:W(),originalFilename:W().nullable(),bytes:G().nonnegative(),durationMs:G().nonnegative().nullable(),meta:xY,createdAt:W()});q({id:W(),stageKind:J(Gb),path:W(),originalFilename:W(),bytes:G().nonnegative(),state:J(bY),createdAt:W()});var CY=W().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),wY=W().min(1).max(256),TY=HO(wY,CY),EY=q({id:CY,text:W().trim().min(1).max(1e4),start:G().finite().nonnegative(),end:G().finite().positive()}).strict().refine(e=>e.end>e.start,{path:[`end`],message:`The end time must be after the start time.`}),DY=q({articleMarkdown:W().max(5e5).optional(),articleEdited:wO().default(!1),provided:q({research:CY.optional(),article:CY.optional(),audio:CY.optional(),thumbnail:CY.optional(),reference:CY.optional()}).strict(),imageOrder:K(CY).max(60),imageDefinitions:HO(CY,q({source:J([`generate`,`provide`]),assetId:CY.nullable(),prompt:W().max(5e5).nullable(),templateKey:W().min(1).max(256).nullable().optional()}).strict()),narrationOverrides:HO(wY,IO(`kind`,[q({kind:GO(`asset`),assetId:CY}).strict(),q({kind:GO(`text`),text:W().trim().min(1).max(5e5)}).strict()])),narrationSources:HO(wY,q({text:W().min(1).max(5e5),start:G().int().nonnegative().max(5e5),bodyFingerprint:W().regex(/^[0-9a-f]{64}$/u),chunkingFingerprint:W().regex(/^[0-9a-f]{64}$/u)}).strict()).refine(e=>Object.keys(e).length<=1e4&&Object.values(e).reduce((e,t)=>e+t.text.length,0)<=5e5,`Narration source bindings exceed the article limit.`).optional(),subtitleCues:q({audioFingerprint:W().min(1),cues:K(EY)}).strict().optional(),regenerationTokens:TY,promptTemplates:HO(W().min(1),W().max(5e5).nullable()),shortsMusic:CY.optional(),shortsRanges:HO(W().regex(/^[1-9]\d?$/u),q({first:G().int().positive(),last:G().int().positive(),pick:W().min(1).max(128)}).strict()).optional()}).strict(),OY=q({baseRevisionId:CY,idempotencyKey:CY,edit:q({config:JA.strict(),content:DY,regenerate:K(wY).optional(),uploads:K(q({stagedFileId:CY,destination:IO(`kind`,[q({kind:GO(`provided`),stage:J([`audio`,`thumbnail`,`reference`])}).strict(),q({kind:GO(`image`),imageKey:CY}).strict(),q({kind:GO(`narration`),key:wY}).strict(),q({kind:GO(`shortsMusic`)}).strict()])}).strict()).max(1e4).optional()}).strict()}).strict(),kY=q({baseRevisionId:CY,idempotencyKey:CY,targetRevisionId:CY}).strict(),AY=q({id:CY,projectId:CY,parentId:CY.nullable(),restoredFromId:CY.nullable(),config:JA,content:DY,fingerprints:HO(wY,W()),createdAt:W()}),jY=q({id:CY,stageId:CY,kind:J(_Y),idx:G().int(),state:J(vY),payload:W().nullable()}),MY=q({slot:W(),workKey:wY,assetId:CY,output:SY,fingerprint:W(),state:J([`ready`,`outdated`,`review`])}),NY=q({key:wY,stageKind:J(Gb),piece:jY,assetId:CY.nullable(),fingerprint:W()}),PY={recordId:CY,publicationId:CY.nullable(),selected:wO(),available:wO()},FY=q({articleMarkdown:W().nullable(),revision:AY,outputs:K(MY.extend(PY)),pieces:K(NY.extend(PY)),current:wO()}),IY=q({id:CY,parentId:CY.nullable(),restoredFromId:CY.nullable(),title:W(),createdAt:W(),current:wO()}),LY=q({ok:GO(!0),view:FY,duplicate:wO()}),RY=q({ok:GO(!0),view:FY,created:wO()}),zY=q({title:W(),status:G(),detail:W().optional(),reason:W().optional(),currentRevisionId:W().nullable().optional(),fields:K(q({field:W(),message:W()})).optional(),errors:K(q({path:W(),message:W()})).optional()});async function BY(e,t){let n;try{n=await e.json()}catch{throw ro(e,void 0)}if(e.ok)return{ok:!0,value:uo(t,n)};let r=zY.safeParse(n);if(!r.success)throw ro(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw ro(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentRevisionId:i.currentRevisionId??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[]}}async function VY(e,t,n,r,i){return BY(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}${n}`,i===void 0?{method:`GET`}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}),r)}function HY(e,t){return VY(e,t,`/revisions/prepare`,RY,{})}function UY(e,t,n){return VY(e,t,`/revisions`,LY,OY.parse(n))}function WY(e,t,n){return VY(e,t,`/revisions/restore`,LY,kY.parse(n))}function GY(e,t){return VY(e,t,`/revisions`,q({revisions:K(IY)}))}function KY(e,t,n){return VY(e,t,`/revisions/${encodeURIComponent(n)}`,q({view:FY}))}var qY=K(W()).readonly();function JY(e,t,n){return VY(e,t,`/revisions/${encodeURIComponent(n)}/narration-chunks`,q({chunks:q({intro:qY.optional(),body:qY.optional(),outro:qY.optional()}).nullable()}))}function YY(e,t,n){return VY(e,t,`/rebuild/preview`,q({ok:GO(!0),value:gY}),dY.parse(n))}function XY(e,t,n){return VY(e,t,`/rebuild`,q({ok:GO(!0),value:hY}),fY.parse(n))}function ZY(e,t,n,r){return`${e.origin}/files/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}`}async function QY(e,t,n,r){let i=await BY(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}/open-folder`,{method:`POST`}),cY);if(!i.ok)throw Error(i.message);return i.value}function $Y(e,t,n){return ZY(e,t,n,`images.zip`)}function eX(e){return(0,h.jsx)(tX,{...e},JSON.stringify([e.projectId,e.asset,e.folder?.revisionId,e.folder?.recordId]))}function tX({projectId:e,asset:t,folder:n=null}){let{api:r}=B(),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)();async function u(){a(!0),s(void 0),l(void 0);try{let i;if(n)i=await QY(r,e,n.revisionId,n.recordId);else{let n=await r.client.projects[`:id`][`open-folder`].$post({param:{id:e},json:{asset:t}});if(!n.ok)throw ro(n,await io(n));i=cY.parse(await n.json())}i.opened||l(i.path)}catch(e){s(e instanceof Error?e.message:`The folder couldn't be opened. Try again.`)}finally{a(!1)}}return(0,h.jsxs)(CI,{open:c!==void 0||o!==void 0,onOpenChange:e=>{e||(l(void 0),s(void 0))},children:[(0,h.jsx)(TI,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void u(),title:`Locate the saved output folder on the machine running Slopify`,className:`inline-flex items-center gap-[5px] rounded-control text-small text-ink2 hover:text-ink disabled:opacity-50`,children:[(0,h.jsx)(Ss,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),i?`Locating…`:c?`Locate folder`:`Open folder`]})}),(0,h.jsxs)(EI,{className:`space-y-2`,children:[c===void 0?null:(0,h.jsxs)(`div`,{role:`status`,className:`min-w-0 space-y-2 text-small text-ink2`,children:[(0,h.jsx)(`p`,{children:`Slopify runs in Docker, which can't open windows on your desktop. Copy this path into your file manager. To have Open folder open it directly, run the Docker launcher again (npx @gentbajko/slopify@latest --docker) so it sets up the host helper.`}),(0,h.jsx)(`input`,{"aria-label":`Saved folder path`,readOnly:!0,value:c,onFocus:e=>e.currentTarget.select(),className:`w-full min-w-0 rounded-control border border-line2 bg-transparent p-2 font-mono text-small text-ink`})]}),o===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:o})]})]})}var nX=(0,m.createContext)(null);function rX({projectId:e,revisionId:t,children:n}){let{api:r}=B(),i=I({queryKey:H.revision(e,t??``),enabled:t!==null,queryFn:async()=>{if(t===null)throw Error(`This project has no saved version yet. Reload the page and try again.`);let n=await KY(r,e,t);if(!n.ok)throw Error(n.message);let i=n.value.view;if(i.revision.id!==t||i.revision.projectId!==e)throw Error(`The project changed while its files were loading. Reload the page.`);return i}});return(0,h.jsxs)(nX,{value:{projectId:e,revisionId:t,view:i.data},children:[i.error===null?null:(0,h.jsx)(`p`,{role:`alert`,children:i.error.message}),n]})}function iX(){return(0,m.useContext)(nX)?.view}function aX(e){let t=(0,m.useContext)(nX),{api:n}=B();if(e===void 0||t!==null&&t.projectId!==e.projectId)return;if(t===null||t.revisionId===null)return{url:ko(n,e.projectId,yK(e)),cacheKey:H.file(e.projectId,e.id),folder:null};let r=t.view?.outputs.find(t=>t.selected&&t.available&&t.output.id===e.id);return r===void 0?void 0:sX(n,t.projectId,t.revisionId,r)}function oX(e,t){let n=(0,m.useContext)(nX),{api:r}=B();if(n!==null&&n.projectId!==e)return;if(n===null||n.revisionId===null)return{url:ko(r,e,t),cacheKey:H.file(e,t),folder:null};let i=n.view?.outputs.find(e=>e.selected&&e.available&&(t===`images.zip`?e.output.role===`image`||e.output.role===`thumbnail`:yK(e.output)===t));if(i===void 0)return;let a=sX(r,e,n.revisionId,i);return t===`images.zip`?{...a,url:ZY(r,e,n.revisionId,`images.zip`),cacheKey:H.revisionFile(e,n.revisionId,`images.zip`)}:a}function sX(e,t,n,r){return{url:ZY(e,t,n,r.recordId),cacheKey:H.revisionFile(t,n,r.recordId),folder:{revisionId:n,recordId:r.recordId}}}function cX({children:e,className:t}){return(0,h.jsx)(`div`,{className:z(`flex min-w-0 flex-col gap-4 p-5`,t),children:e})}function lX({children:e}){return(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-4 text-small`,children:e})}function uX({children:e}){return(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:e})}var dX={h1:({children:e})=>(0,h.jsx)(pX,{size:`text-title`,children:e}),h2:({children:e})=>(0,h.jsx)(pX,{size:`text-row`,children:e}),h3:({children:e})=>(0,h.jsx)(pX,{size:`text-row`,children:e}),h4:({children:e})=>(0,h.jsx)(pX,{size:`text-row`,children:e}),h5:({children:e})=>(0,h.jsx)(pX,{size:`text-row`,children:e}),h6:({children:e})=>(0,h.jsx)(pX,{size:`text-row`,children:e}),p:({children:e})=>(0,h.jsx)(`p`,{className:`m-0`,children:e}),strong:({children:e})=>(0,h.jsx)(`strong`,{className:`font-semibold`,children:e}),ul:({children:e})=>(0,h.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5`,children:e}),ol:({children:e})=>(0,h.jsx)(`ol`,{className:`m-0 flex list-decimal flex-col gap-1 pl-5`,children:e}),li:({children:e})=>(0,h.jsx)(`li`,{className:`m-0`,children:e}),a:({children:e,href:t})=>(0,h.jsx)(`a`,{href:t,className:`rounded-control text-run-text underline underline-offset-[3px]`,target:`_blank`,rel:`noreferrer`,children:e}),code:({children:e})=>(0,h.jsx)(`code`,{className:`rounded-control bg-panel2 px-[4px] py-[1px] font-sans text-small`,children:e}),pre:({children:e})=>(0,h.jsx)(`pre`,{className:`m-0 overflow-x-auto rounded-control bg-panel2 p-[10px] font-sans text-small`,children:e}),blockquote:({children:e})=>(0,h.jsx)(`blockquote`,{className:`m-0 flex flex-col gap-2 border-l-2 border-line2 pl-3 text-ink2`,children:e}),hr:()=>(0,h.jsx)(`hr`,{className:`my-2 border-line`}),table:({children:e})=>(0,h.jsx)(`table`,{className:`w-full border-collapse text-left text-small`,children:e}),th:({children:e})=>(0,h.jsx)(`th`,{className:`engraved border-b border-line py-[6px] pr-4 text-left text-ink3`,children:e}),td:({children:e})=>(0,h.jsx)(`td`,{className:`border-b border-line py-[6px] pr-4 align-top`,children:e})},fX={p:({children:e})=>(0,h.jsx)(h.Fragment,{children:e}),strong:({children:e})=>(0,h.jsx)(`strong`,{className:`font-semibold`,children:e}),a:({children:e})=>(0,h.jsx)(h.Fragment,{children:e})};function pX({size:e,children:t}){return(0,h.jsx)(`h3`,{className:z(`mt-2 font-bold tracking-[-0.01em]`,e),children:t})}function mX({markdown:e}){return(0,h.jsx)(`div`,{className:`flex max-w-[75ch] flex-col gap-2 text-pretty text-body text-ink`,children:(0,h.jsx)(nY,{remarkPlugins:[XG],components:dX,children:e})})}function hX({markdown:e}){return(0,h.jsx)(nY,{remarkPlugins:[XG],components:fX,children:e})}var gX=/^#{1,6}[ \t]+(.*?)[ \t]*#*[ \t]*(?:\r?\n|$)/;function _X(e){let t=e.replace(/^[\s]*\n/,``),n=gX.exec(t);return n===null?{title:void 0,body:e.trim()}:{title:n[1]??``,body:t.slice(n[0].length).trim()}}function vX({message:e,onDismiss:t}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-3 rounded-control bg-red-tint px-[10px] py-[6px] text-small text-red`,children:[(0,h.jsx)(`span`,{role:`alert`,className:`min-w-0 break-words`,children:e}),(0,h.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto shrink-0 rounded-control px-2 text-ink2 hover:text-ink`,children:`Dismiss`})]})}function yX({projectId:e,asset:t,label:n=`Download`}){let r=oX(e,t);return r===void 0?null:(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,h.jsxs)(`a`,{href:r.url,download:!0,className:`inline-flex items-center gap-[5px] rounded-control text-small text-ink2 hover:text-ink`,children:[(0,h.jsx)(ys,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),n]}),(0,h.jsx)(eX,{projectId:e,asset:t,folder:r.folder})]})}function bX({output:e,label:t}){let n=aX(e);return n===void 0?null:(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,h.jsxs)(`a`,{href:n.url,download:!0,className:`inline-flex items-center gap-[5px] rounded-control text-small text-ink2 hover:text-ink`,children:[(0,h.jsx)(ys,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),t??`Download`]}),(0,h.jsx)(eX,{projectId:e.projectId,asset:yK(e),folder:n.folder})]})}function xX({files:e,label:t=`Download`}){let n=e.filter(e=>e.output!==void 0);return n.length===0?null:(0,h.jsxs)(gF,{modal:!1,children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsxs)(V,{type:`button`,children:[(0,h.jsx)(ys,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),t,(0,h.jsx)(ms,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-ink2`})]})}),(0,h.jsx)(vF,{children:n.map(e=>(0,h.jsx)(SX,{output:e.output,label:e.label},e.output.id))})]})}function SX({output:e,label:t}){let n=aX(e);return n===void 0?null:(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(`a`,{href:n.url,download:!0,children:t})})}function CX({output:e}){let t=aX(e);return e===void 0||t===void 0?null:(0,h.jsx)(eX,{projectId:e.projectId,asset:yK(e),folder:t.folder})}function wX(e){let{api:t}=B(),n=aX(e);return I({queryKey:n?.cacheKey??H.revisionFile(``,``,`unavailable`),queryFn:async()=>n===void 0?``:eo(await t.fetch(n.url)),enabled:n!==void 0,staleTime:1/0})}function TX({output:e,as:t=`prose`}){let n=wX(e);return n.error===null?n.data===void 0?(0,h.jsx)(`span`,{className:`h-4 w-[40ch] max-w-full rounded-control bg-panel2`}):t===`prose`?(0,h.jsx)(mX,{markdown:n.data}):(0,h.jsx)(`pre`,{className:`max-w-[75ch] overflow-x-auto whitespace-pre-wrap font-sans text-small text-ink2`,children:n.data}):(0,h.jsx)(`p`,{className:`text-body text-red`,children:n.error.message})}function EX({output:e}){let[t,n]=(0,m.useState)(!1);return e===void 0?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>{n(!t)},className:`rounded-control text-small text-ink2 underline underline-offset-[3px] hover:text-ink`,children:t?`Hide instructions`:`Show instructions`}),t?(0,h.jsx)(TX,{output:e,as:`plain`}):null]})}function DX({projectId:e,stage:t,notes:n}){let r=t.state===`running`;return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[r?(0,h.jsx)(vK,{projectId:e,stage:`research`,className:``}):null,r&&n===void 0?null:(0,h.jsx)(`section`,{"aria-label":`Research notes`,tabIndex:0,className:`max-h-[min(58vh,640px)] min-h-48 overflow-auto pr-3`,children:n===void 0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:OX(t)}):(0,h.jsx)(TX,{output:n})})]})}function OX(e){switch(e.state){case`failed`:case`canceled`:return`Research stopped before any notes were saved. Use Retry research above to try again.`;case`pending`:return`The research runs first; its notes appear here when it finishes.`;default:return`No notes were written.`}}var kX={research:`Generates fresh research and affected article, narration, entries, thumbnail and exports; previous outputs stay in History.`,article:`Generates a fresh article and affected narration, entries, thumbnail and exports; previous outputs stay in History.`,audio:`Regenerates narration and affected exports, keeping compatible cue preparation; previous outputs stay in History.`,images:`Regenerates generated images and affected video, keeping supplied images and narration; previous outputs stay in History.`,thumbnail:`Regenerates the thumbnail without changing the main video; previous outputs stay in History.`,video:`Rebuilds local exports from saved media without regenerating narration or images; previous outputs stay in History.`,document:`Renders the PDF again from the saved article and title without regenerating anything else; previous outputs stay in History.`};function AX(e){switch(e.kind){case`cancel`:return{title:`Cancel this run?`,consequence:`Stops every running stage; finished outputs are kept.`,verb:`Cancel run`,dismiss:`Keep running`};case`rerun`:return{title:`Re-run this stage?`,consequence:kX[e.stage],verb:`Re-run`,dismiss:`Cancel`};case`delete-image`:return{title:`Delete this image?`,consequence:`Removes the image and re-renders video when enabled.`,verb:`Delete`,dismiss:`Cancel`};case`regenerate-image`:return{title:`Regenerate this image?`,consequence:`Replaces the image with a new one and re-renders video when enabled.`,verb:`Regenerate`,dismiss:`Cancel`};case`save-article`:return{title:`Save the edited article?`,consequence:`Replaces the article, then updates the enabled narration and final export.`,verb:`Save & update outputs`,dismiss:`Cancel`};case`discard-article`:return{title:`Discard these edits?`,consequence:`The article goes back to the text on disk.`,verb:`Discard`,dismiss:`Keep editing`}}}var jX=(0,m.createContext)(!1),MX=(0,m.createContext)(void 0);function NX(e,t){let{config:n,content:r,fingerprints:i}=e.revision;switch(t){case`research`:return n.sources.research===`generate`;case`article`:return n.sources.article===`generate`&&!r.articleEdited;case`audio`:return n.sources.audio===`generate`&&Object.keys(i).some(e=>!/^audio:(body:.+|intro|outro):[0-9]+$/.test(e)&&!/^audio:(body|intro|outro):future$/.test(e)?!1:!Object.entries(r.narrationOverrides).some(([t,n])=>n.kind===`asset`&&(e===t||e.startsWith(`${t}:`))));case`images`:return n.sources.images!==`off`&&r.imageOrder.some(e=>r.imageDefinitions[e]?.source===`generate`);case`thumbnail`:return n.sources.thumbnail===`from_prompt`||n.sources.thumbnail===`prompt_by_llm`;case`video`:return n.sources.video!==`off`||n.sources.audio!==`off`;case`document`:return qb(n.sources,`document`)===`generate`}}function PX({action:e,run:t,disabled:n=!1,pending:r=!1,variant:i=`outline`,className:a,children:o}){let[s,c]=(0,m.useState)(!1),l=AX(e),u=(0,m.useContext)(jX),d=iX();return u&&e.kind!==`cancel`&&!(e.kind===`rerun`&&d!==void 0&&NX(d,e.stage))?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{type:`button`,variant:i,disabled:n||r,className:z(i===`ghost`?`px-2 text-small`:void 0,a),onClick:()=>{c(!0)},children:o}),(0,h.jsx)(wP,{open:s,title:l.title,consequence:l.consequence,verb:l.verb,dismiss:l.dismiss,pending:r,onConfirm:()=>{c(!1),t()},onCancel:()=>{c(!1)}})]})}var FX=[`article`,`audio`,`images`,`video`,`document`],IX={article:`research`,images:`thumbnail`};function LX(e){return e===`research`?`article`:e===`thumbnail`?`images`:e}function RX(e){return FX.flatMap(t=>{let n=e.find(e=>e.kind===t);if(n===void 0)return[];let r=IX[t],i=e.find(e=>e.kind===r&&e.state!==`skipped`);return[i===void 0?{kind:t,stage:n}:{kind:t,stage:n,companion:i}]})}function zX(e){let t=[e.stage,e.companion].filter(e=>e!==void 0);for(let e of[`failed`,`canceled`,`running`]){let n=t.find(t=>t.state===e);if(n!==void 0)return n}return e.stage.state===`skipped`&&e.companion!==void 0?e.companion:e.stage}function BX(e){return e.stage.state===`skipped`&&e.companion!==void 0?e.companion.kind:e.kind}function VX(e,t){let n=BX(e);return n===e.kind?iN(e.kind,t):nN[n]}function HX(e,t,n,r=!1){let i=zX(e),a=cN(i,t,n,r);return i===e.companion&&e.stage.state!==`skipped`?`${nN[i.kind]}: ${a}`:a}var UX=e=>e.state!==`pending`&&e.state!==`skipped`;function WX(e){return e.replace(/^\s*[^\n]*\n?/u,``).trim()}function GX({stage:e,companion:t,project:n,outputs:r,actions:i,busy:a}){let o=hK(n.id),s=pK(r,e),c=t?.kind===`research`?t:void 0,l=c===void 0?[]:pK(r,c),u=mK(l,`notes`),d=wX(u),f=mK(s,`article_md`)??mK(s,`article_txt`),p=mK(s,`sources`),g=mK(s,`glossary`),_=wX(f),v=I({queryKey:gK(n.id,o),queryFn:()=>[],enabled:!1}).data?.some(e=>e.stage===`article`)===!0,y=I({queryKey:H.article(n.id,o),queryFn:()=>``,enabled:!1}),b=_.data??``,x=e.state===`running`,S=_X(x?y.data??``:b),C=S.title??n.title,w=(0,m.useMemo)(()=>x?{body:S.body,sources:``,glossary:``}:uK(S.body),[x,S.body]),T=(0,m.useMemo)(()=>vR(w.sources),[w.sources]),E=WX(w.glossary),D=[{id:`article`,label:`Article`},...c===void 0?[]:[{id:`research`,label:`Research`}],...T.length>0?[{id:`sources`,label:`Sources`,badge:String(T.length)}]:[],...E===``?[]:[{id:`pronunciation`,label:`Pronunciation`}]],O=c!==void 0&&zX({kind:`article`,stage:e,companion:c})===c,[k,ee]=(0,m.useState)(),A=k??(O?`research`:`article`),j=D.some(e=>e.id===A)?A:`article`,M=(0,m.useId)().replace(/:/gu,``),[N,P]=(0,m.useState)(),F={article:`${S.title===void 0?``:`# ${S.title}\n\n`}${w.body.trim()}\n`,research:`${(d.data??``).trim()}\n`,sources:`${T.map(e=>`- ${e}`).join(`
|
|
160
|
+
`)}\n`,pronunciation:`${E}\n`},te={article:`article`,research:`research notes`,sources:`sources`,pronunciation:`pronunciation table`},ne=e=>{let t=te[e];if(!navigator.clipboard){P({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(F[e]).then(()=>P({text:`Copied the ${t} as Markdown.`,tone:`success`}),()=>P({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))};return(0,h.jsxs)(cX,{children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-[14px] text-small text-ink2`,children:[(0,h.jsx)(`span`,{className:`text-row font-semibold text-ink`,children:(0,h.jsx)(hX,{markdown:C})}),p===void 0?null:(0,h.jsx)(bX,{output:p,label:`Sources`}),g===void 0?null:(0,h.jsx)(bX,{output:g,label:`Glossary`})]}),(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Use Edit project to save changes, then Resume to recover affected work. Advanced rebuild review is optional.`}),(0,h.jsxs)(lX,{children:[j===`research`&&c!==void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:c.kind},run:()=>i.run({kind:`rerun`,stage:c.kind}),disabled:a||!UX(c),pending:i.pending,children:`Re-run research`}),(0,h.jsx)(EX,{output:mK(l,`instructions`)}),u===void 0?null:(0,h.jsx)(bX,{output:u})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>i.run({kind:`rerun`,stage:e.kind}),disabled:a||!UX(e),pending:i.pending,children:`Re-run`}),(0,h.jsx)(EX,{output:mK(s,`instructions`)}),f===void 0?null:(0,h.jsx)(bX,{output:f})]}),(j===`research`?c?.state===`running`||d.data===void 0:x||b===``)?null:(0,h.jsxs)(V,{type:`button`,onClick:()=>ne(j),children:[`Copy `,te[j]]})]}),(0,h.jsx)(EP,{tone:N?.tone??`info`,children:N?.text}),_.error===null?null:(0,h.jsx)(`p`,{className:`text-body text-red`,children:_.error.message}),D.length>1?(0,h.jsx)(xF,{items:D,value:j,onChange:e=>{ee(e),P(void 0)},label:`Article parts`,idPrefix:M}):null,(0,h.jsx)(CF,{idPrefix:M,id:`article`,active:j===`article`,children:(0,h.jsx)(`section`,{"aria-label":`Article content`,tabIndex:0,className:`max-h-[min(58vh,640px)] min-h-48 overflow-auto pr-3`,children:x&&v?(0,h.jsx)(vK,{projectId:n.id,stage:`article`,className:``}):!x&&b===``&&!UX(e)?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:c===void 0?`The article will be written when its inputs are ready.`:`The article is written once the research has finished.`}):(0,h.jsx)(mX,{markdown:w.body})})}),c===void 0?null:(0,h.jsx)(CF,{idPrefix:M,id:`research`,active:j===`research`,children:(0,h.jsx)(DX,{projectId:n.id,stage:c,notes:u})}),T.length===0?null:(0,h.jsx)(CF,{idPrefix:M,id:`sources`,active:j===`sources`,children:(0,h.jsx)(`ol`,{className:`max-h-[min(58vh,640px)] list-decimal space-y-2 overflow-auto pr-3 pl-6 text-body text-ink marker:text-ink3`,children:T.map((e,t)=>(0,h.jsx)(`li`,{className:`break-words`,children:(0,h.jsx)(hX,{markdown:e})},t))})}),E===``?null:(0,h.jsx)(CF,{idPrefix:M,id:`pronunciation`,active:j===`pronunciation`,children:(0,h.jsx)(`div`,{className:`max-h-[min(58vh,640px)] overflow-auto pr-3`,children:(0,h.jsx)(mX,{markdown:E})})})]})}function KX({projectId:e,revisionId:t}){let n=hK(e),r=t===void 0?n:t,{api:i}=B(),a=I({queryKey:H.audioPreview(e,r),queryFn:async()=>$a(await i.client.projects[`:projectId`][`audio-preview`].$get({param:{projectId:e}})),refetchInterval:1e3,staleTime:0,gcTime:0,retry:!1}),o=(a.data?.revisionId??null)===r?a.data?.previews??[]:[];return(0,h.jsxs)(`section`,{"aria-label":`Live narration`,className:`grid gap-3 rounded-control border border-line2 bg-panel2 p-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold text-ink`,children:`Listen while it generates`}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`Play any part. Each preview starts from its beginning.`})]}),a.error===null?null:(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Live preview is temporarily unavailable. Finished audio will still appear here.`}),o.length===0&&a.error===null?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Waiting for the first audio bytes…`}):null,(0,h.jsx)(`div`,{className:`grid max-h-[420px] gap-3 overflow-y-auto`,children:o.map(t=>(0,h.jsx)(qX,{preview:t,url:`${i.origin}/api/projects/${encodeURIComponent(e)}/audio-preview/${t.id}`},t.id))})]})}function qX({preview:e,url:t}){let[n,r]=(0,m.useState)(!1),i=(e.state===`streaming`||e.state===`ready`)&&e.bytes>0,a=e.state===`ready`?`Ready`:e.state===`streaming`?`Generating`:`Preview stopped`;return(0,h.jsxs)(`div`,{className:`grid gap-2 text-small`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-ink`,children:e.label}),(0,h.jsx)(`span`,{className:`text-ink2`,children:a})]}),i&&!n?(0,h.jsx)(JX,{label:e.label,url:t,onError:()=>r(!0)}):(0,h.jsx)(`p`,{className:`text-ink2`,children:e.state===`streaming`&&!n?`Waiting for audio…`:`This preview has stopped. The finished narration will be available when generation completes.`})]})}function JX({label:e,url:t,onError:n}){let r=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let e=r.current;return()=>{e!==null&&(e.pause(),e.removeAttribute(`src`),e.load())}},[]),(0,h.jsx)(`audio`,{ref:r,controls:!0,preload:`none`,"aria-label":`Live ${e} narration`,src:t,onError:n,className:`h-9 w-full max-w-[620px]`})}function YX({outputs:e}){let t=e.filter(e=>e.role===`narration_txt`||e.role===`tts_script`);return t.length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Narration text downloads`,className:`space-y-3`,children:[[`intro`,`body`,`outro`].map(e=>{let n=t.filter(t=>t.meta.segment===e);if(n.length===0)return null;let r=e===`body`?`Body`:e===`intro`?`Intro`:`Outro`;return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-small`,children:[(0,h.jsx)(uX,{children:r}),n.map(e=>(0,h.jsx)(bX,{output:e,label:`${r} ${e.role===`narration_txt`?`Clean Narration`:`TTS Script`}`},e.id))]},e)}),(0,h.jsx)(`p`,{className:`text-small text-ink3`,children:`Clean Narration is the spoken text used for captions. TTS Script includes delivery cues; blank lines separate requests. Uploaded audio has no TTS request.`})]})}var XX=[{role:`audio_intro`,name:`Intro`},{role:`audio_body`,name:`Body`},{role:`audio_outro`,name:`Outro`}];function ZX({stage:e,project:t,outputs:n,actions:r,busy:i}){let{api:a}=B(),o=I(Eb(a)),s=pK(n,e),c=XX.flatMap(e=>{let t=mK(s,e.role);return t===void 0?[]:[{...e,output:t}]}),l=c.find(e=>e.output.meta.voice!==void 0)?.output.meta,u=c.length>0?l?.voice:t.config.audio?.voice,d=c.length>0?l?.provider:t.config.audio?.provider,f=o.data?.voices.find(e=>e.voiceId===u&&e.provider===d)?.name??u;return(0,h.jsxs)(cX,{children:[e.state===`running`?(0,h.jsx)(KX,{projectId:t.id}):null,c.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`No narration has landed yet.`}):c.map(e=>(0,h.jsx)(QX,{name:e.name,output:e.output},e.role)),(0,h.jsx)(YX,{outputs:s}),(0,h.jsxs)(lX,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>{r.run({kind:`rerun`,stage:e.kind})},disabled:i,pending:r.pending,children:`Re-run`}),f===void 0?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(uX,{children:`Voice`}),(0,h.jsx)(`span`,{className:`text-small text-ink`,children:f})]}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`Chunking: ${$X(t.config.chunking)}`})]})]})}function QX({name:e,output:t}){let n=aX(t),r=pN(t.durationMs??void 0);return(0,h.jsxs)(`div`,{className:`grid grid-cols-[60px_minmax(0,1fr)_auto] items-center gap-3 text-small`,children:[(0,h.jsx)(uX,{children:e}),(0,h.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":`${e} narration`,src:n?.url,className:`h-8 w-full max-w-[520px]`}),(0,h.jsxs)(`span`,{className:`flex items-center gap-4`,children:[r===void 0?null:(0,h.jsx)(`span`,{className:`text-ink2 tabular-nums`,children:r}),(0,h.jsx)(bX,{output:t})]})]})}function $X(e){return e===void 0||e.mode===`whole`?`the whole text as one request`:e.mode===`paragraph`?`one request per paragraph`:e.mode===`characters`?`every ${String(e.characters??3e3)} characters`:`every ${String(e.words??500)} words`}function eZ({stage:e,project:t,outputs:n,actions:r,busy:i}){let a=mK(pK(n,e),`document_pdf`),o=aX(a),s=rx(t.config.document);return(0,h.jsxs)(cX,{children:[(0,h.jsx)(uX,{children:`${s} theme`}),a===void 0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e.state===`running`?`The PDF will be saved when rendering finishes.`:`No PDF has been saved yet.`}):null,(0,h.jsxs)(lX,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>{r.run({kind:`rerun`,stage:e.kind})},disabled:i,pending:r.pending,children:`Render again`}),o?.folder?(0,h.jsxs)(`a`,{href:`${o.url}?inline=1`,target:`_blank`,rel:`noopener`,className:`inline-flex items-center gap-[5px] rounded-control text-small text-ink2 hover:text-ink`,children:[(0,h.jsx)(xs,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Open PDF`]}):null,a===void 0?null:(0,h.jsx)(bX,{output:a,label:`Download PDF`})]})]})}function tZ({stage:e,project:t,outputs:n,actions:r,busy:i}){let a=(0,m.useId)(),o=mK(pK(n,e),`thumbnail`),s=aX(o),c=t.format===`9:16`;return(0,h.jsxs)(`section`,{"aria-labelledby":`${a}-title`,className:`flex min-w-0 flex-col gap-[10px]`,children:[(0,h.jsx)(`h3`,{id:`${a}-title`,className:`engraved text-ink3`,children:`Thumbnail`}),(0,h.jsx)(`div`,{className:z(`w-full overflow-hidden rounded-control border border-line bg-panel2`,c?`aspect-[9/16] max-w-[320px]`:`aspect-video max-w-[720px]`),children:o===void 0?(0,h.jsx)(`p`,{className:`flex h-full items-center justify-center p-4 text-center text-small text-ink2`,children:nZ(e)}):(0,h.jsx)(`img`,{src:s?.url,alt:`Thumbnail for ${t.title}`,className:`block size-full object-cover animate-tick-in motion-reduce:animate-none`})}),(0,h.jsxs)(lX,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>{r.run({kind:`rerun`,stage:e.kind})},disabled:i||e.state===`pending`,pending:r.pending,children:`Regenerate thumbnail`}),o===void 0?null:(0,h.jsx)(bX,{output:o,label:`Download thumbnail`})]})]})}function nZ(e){switch(e.state){case`running`:return`Making the thumbnail…`;case`failed`:case`canceled`:return`No thumbnail was made. Use Retry thumbnail above to try again.`;default:return`No thumbnail has landed yet.`}}function rZ(e,t){let n=e.filter(e=>e.role===`image`),r=new Map;for(let e of n){let t=e.meta.promptName??`Images`;r.set(t,[...r.get(t)??[],e])}let i=t.filter(e=>r.has(e)),a=[...r.keys()].filter(e=>!i.includes(e)).sort();return[...i,...a].flatMap(e=>{let t=r.get(e);return t===void 0?[]:[{name:e,images:[...t].sort(iZ)}]})}function iZ(e,t){return(e.meta.index??0)-(t.meta.index??0)}function aZ(e){return e===`9:16`?`aspect-[9/16]`:`aspect-video`}function oZ({stage:e,companion:t,project:n,outputs:r,actions:i,busy:a}){let o=rZ(pK(r,e),n.config.imagePrompts?.map(e=>e.name)??[]),s=t?.kind===`thumbnail`?(0,h.jsx)(tZ,{stage:t,project:n,outputs:r,actions:i,busy:a}):null;return e.state===`skipped`?(0,h.jsx)(cX,{children:s}):(0,h.jsxs)(cX,{children:[s,s===null?null:(0,h.jsx)(`h3`,{className:`engraved border-t border-line pt-4 text-ink3`,children:`Slideshow images`}),(0,h.jsxs)(lX,{children:[(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>{i.run({kind:`rerun`,stage:e.kind})},disabled:a||e.state===`pending`,pending:i.pending,children:`Re-run stage`}),(0,h.jsx)(yX,{projectId:n.id,asset:`images.zip`,label:`Download all`})]}),o.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`No images have landed yet.`}):null,o.map(e=>(0,h.jsx)(cZ,{name:e.name,count:e.images.length,children:t=>e.images.slice(0,t).map(e=>(0,h.jsx)(lZ,{image:e,format:n.format,actions:i,busy:a},e.id))},e.name)),n.config.reference===void 0?null:(0,h.jsx)(sZ,{image:mK(pK(r,e),`reference`),format:n.format,generated:n.config.reference.source===`prompt`,actions:i,busy:a})]})}function sZ({image:e,format:t,generated:n,actions:r,busy:i}){let a=aX(e);return(0,h.jsxs)(`section`,{"aria-label":`Establishing image`,className:`flex flex-col gap-[10px]`,children:[(0,h.jsx)(uX,{children:`Establishing image · reference, not in the video`}),(0,h.jsx)(`div`,{className:`grid grid-cols-3 gap-2 min-[900px]:grid-cols-6`,children:(0,h.jsx)(`figure`,{className:`m-0 overflow-hidden rounded-control border border-line bg-panel2`,children:e===void 0?(0,h.jsx)(`p`,{className:z(`flex items-center justify-center p-2 text-center text-label text-ink2`,aZ(t)),children:`Not made yet`}):(0,h.jsx)(`img`,{src:a?.url,alt:e.meta.prompt??`Establishing image`,className:z(`block w-full object-cover`,aZ(t))})})}),(0,h.jsxs)(lX,{children:[e!==void 0&&n?(0,h.jsx)(PX,{action:{kind:`regenerate-image`,outputId:e.id},run:()=>{r.run({kind:`regenerate-image`,outputId:e.id})},disabled:i,pending:r.pending,children:`Regenerate establishing image`}):null,e===void 0?null:(0,h.jsx)(bX,{output:e,label:`Download establishing image`})]})]})}function cZ({name:e,count:t,children:n}){let[r,i]=(0,m.useState)(!1),a=t>12&&!r;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-[10px]`,children:[(0,h.jsx)(uX,{children:`${e} × ${String(t)}`}),(0,h.jsx)(`div`,{className:`grid grid-cols-3 gap-2 min-[900px]:grid-cols-6`,children:n(a?12:t)}),t>12?(0,h.jsx)(V,{variant:`ghost`,"aria-expanded":r,className:`self-start`,onClick:()=>i(e=>!e),children:r?`Show fewer`:`Show all ${String(t)} images`}):null]})}function lZ({image:e,format:t,actions:n,busy:r}){let i=aX(e),a=e.meta.index===void 0?``:` ${String(e.meta.index)}`;return(0,h.jsxs)(`figure`,{className:`group relative m-0 overflow-hidden rounded-control border border-line bg-panel2`,children:[/\.(mp4|mov|m4v|webm|mkv)$/i.test(e.path)?(0,h.jsx)(`video`,{src:i?.url,muted:!0,loop:!0,controls:!0,preload:`metadata`,"aria-label":`Video clip${a}`,className:z(`block w-full object-cover`,aZ(t))}):(0,h.jsx)(`img`,{src:i?.url,loading:`lazy`,alt:e.meta.prompt??`Slideshow image${a}`,className:z(`block w-full object-cover animate-tick-in motion-reduce:animate-none`,aZ(t))}),(0,h.jsxs)(`figcaption`,{className:`absolute inset-x-0 bottom-0 flex flex-wrap items-center justify-between gap-1 bg-panel/90 p-1 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none`,children:[(0,h.jsx)(bX,{output:e}),(0,h.jsx)(PX,{action:{kind:`regenerate-image`,outputId:e.id},run:()=>{n.run({kind:`regenerate-image`,outputId:e.id})},disabled:r,pending:n.pending,variant:`ghost`,children:`Regenerate`}),(0,h.jsx)(PX,{action:{kind:`delete-image`,outputId:e.id},run:()=>{n.run({kind:`delete-image`,outputId:e.id})},disabled:r,pending:n.pending,variant:`ghost`,children:`Delete`})]})]})}var uZ=q({number:G().int().positive(),first:G().int().positive(),last:G().int().positive(),start:G().finite().nonnegative(),end:G().finite().positive(),title:W(),description:W(),hashtags:K(W()),why:W(),text:W(),seed:W().nullable().optional()}),dZ=.25,fZ=.4;function pZ(e,t,n,r){let i=e[t-1],a=e[n-1];if(i===void 0||a===void 0||t>n)return;let o=e[t-2]?.end??0,s=e[n]?.start??r,c=Math.max(0,i.start-Math.max(0,Math.min(dZ,(i.start-o)/2))),l=Math.min(r,a.end+Math.max(0,Math.min(fZ,(s-a.end)/2)));return{start:mZ(c),end:mZ(l)}}q({first:PO([G(),W()]),last:PO([G(),W()]),title:W(),description:W(),hashtags:K(W()),why:W().optional()});function mZ(e){return Math.round(e*1e3)/1e3}var hZ=q({shorts:K(uZ),durationSeconds:G().finite().nonnegative().optional(),sentences:K(q({start:G().finite().nonnegative(),end:G().finite().nonnegative(),text:W()})).optional()});function gZ(e){if(e!=null)try{let t=hZ.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function _Z(e,t,n,r,i,a=[]){let o=e.sentences;if(o===void 0||o.length===0)return`These shorts were picked before clips could be adjusted by hand. Use Pick different moments, then adjust the new clips.`;if(!e.shorts.some(e=>e.number===t))return`There is no short ${String(t)} any more. Reload the page and choose again.`;if(!Number.isInteger(n)||!Number.isInteger(r)||n<1||r>o.length||n>r)return`Choose a start sentence that comes before the end sentence, between 1 and ${String(o.length)}.`;let s=pZ(o,n,r,vZ(e));if(s===void 0)return`Choose a start and an end sentence from the transcript.`;let c=s.end-s.start;if(c<i.minSeconds-.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, shorter than the ${String(i.minSeconds)}-second minimum. Start it earlier or end it later.`;if(c>i.maxSeconds+.01)return`Short ${String(t)} would last ${String(Math.round(c))} seconds, longer than the ${String(i.maxSeconds)}-second maximum. Start it later or end it earlier.`;let l=a.find(e=>e.number!==t&&n<=e.last&&r>=e.first);if(l!==void 0)return`Short ${String(t)} would share sentences with short ${String(l.number)} (sentences ${String(l.first)}-${String(l.last)}). Choose a range that doesn't overlap it.`}function vZ(e){return e.durationSeconds??e.sentences?.at(-1)?.end??0}function yZ(e){let t=Object.fromEntries(Object.entries(e.content.imageDefinitions).map(([t,n])=>{let r=n.templateKey===null||n.templateKey===void 0?null:e.content.promptTemplates[n.templateKey]??null;return[t,r===null||n.source!==`generate`?n:{...n,prompt:JF(r,e.config.values)}]}));return{...e,content:{...e.content,imageDefinitions:t},config:{...e.config,rendered:{...e.config.rendered,...Object.fromEntries(Object.entries(e.content.promptTemplates).map(([t,n])=>[t,n===null?e.config.rendered[t]??``:JF(n,e.config.values)]))}}}}function bZ(e,t,n){let r={...e.config.sources,[t]:n,...t===`images`&&n===`off`?{video:`off`}:{}};return{...e,config:{...e.config,sources:r,subtitles:Xj(e.config.subtitles,r)}}}function xZ(e,t,n){return yZ({...e,content:{...e.content,promptTemplates:{...e.content.promptTemplates,[t]:n}}})}function SZ(e){return new Promise((t,n)=>{if(e.aborted){n(Error(`Upload canceled.`));return}let r=()=>{clearTimeout(i),n(Error(`Upload canceled.`))},i=setTimeout(()=>{e.removeEventListener(`abort`,r),t()},200);e.addEventListener(`abort`,r,{once:!0})})}function CZ({label:e,kind:t,disabled:n=!1,onReady:r,onPending:i,accept:a}){let{api:o}=B(),s=(0,m.useId)(),[c,l]=(0,m.useState)(),[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(void 0),p=(0,m.useRef)(r);p.current=r;let g=(0,m.useRef)(i);g.current=i;let _=(0,m.useRef)(!0);(0,m.useEffect)(()=>(_.current=!0,()=>{_.current=!1,f.current?.abort(),g.current(!1)}),[]);async function v(e){if(n||f.current!==void 0)return;let r=new AbortController;f.current=r,d(!0),g.current(!0),l(void 0);let i;try{let n=await wo(o,t,e);for(i=n.id,r.signal.throwIfAborted();n.state!==`staged`;){await SZ(r.signal);let e=(await So(o)).files.find(e=>e.id===n.id);if(r.signal.throwIfAborted(),e===void 0)throw Error(`The upload stopped before the file finished copying. Choose the file again.`);n=e}p.current(n)}catch(e){let t=r.signal.aborted?`Upload canceled.`:e instanceof Error?e.message:String(e);if(i!==void 0)try{await To(o,i)}catch(e){t+=` The partial upload couldn't be removed (${e instanceof Error?e.message:String(e)}); use Clean orphan files in Settings → Backup & storage to clear it.`}_.current?l(t):t.includes(`partial upload couldn't be removed`)&&console.error(t)}finally{f.current===r&&(f.current=void 0,_.current&&(d(!1),g.current(!1)))}}return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsxs)(`label`,{htmlFor:s,className:`block space-y-1 text-small`,children:[e,(0,h.jsx)(KP,{id:s,type:`file`,disabled:u||n,accept:a??(t===`audio`?`audio/*`:`image/png,image/jpeg,image/webp`),onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&v(t)}})]}),u?(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink2`,children:`Copying upload…`}),(0,h.jsx)(V,{type:`button`,onClick:()=>f.current?.abort(),children:`Cancel upload`})]}):null,c===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:c})]})}var wZ=`shorts:pick`,TZ=e=>`shorts:${String(e)}`;function EZ(e){let{shortsRanges:t,...n}=e.content;return{...e,content:n,regenerate:[...new Set([...e.regenerate??[],wZ])]}}function DZ(e,t){return{...e,regenerate:[...new Set([...e.regenerate??[],TZ(t)])]}}function OZ(e){let t=e.pieces.find(e=>e.key===`shorts:pick`&&e.selected&&e.piece.state===`done`),n=gZ(t?.piece.payload);return t===void 0||n===void 0?void 0:{fingerprint:t.fingerprint,picked:n}}function kZ({edit:e,view:t,prompts:n,problem:r,onChange:i,onPending:a}){let o=e.config.shorts??_k,[s,c]=(0,m.useState)({count:String(o.count),minSeconds:String(o.minSeconds),maxSeconds:String(o.maxSeconds),...Ok(o)}),l=[...n,...NZ(t,`shorts`,`shorts`,t.revision.config.shorts?.prompt,n),...NZ(t,`image`,`shortsImage`,t.revision.config.shorts?.imagePrompt,n)],u={enabled:o.enabled,...s,prompt:o.prompt??``,imagePrompt:o.imagePrompt??``,...o.titleOnScreen===void 0?{}:{titleOnScreen:o.titleOnScreen}},d=e.regenerate?.includes(wZ)===!0,f=OZ(t);return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(SL,{value:u,prompts:l,narrated:e.config.sources.audio!==`off`,problem:r,music:(0,h.jsx)(AZ,{edit:e,disabled:!o.enabled,onChange:i,onPending:a}),onChange:t=>{c({count:t.count,minSeconds:t.minSeconds,maxSeconds:t.maxSeconds,...t.musicVolume===void 0?{}:{musicVolume:t.musicVolume},...t.speed===void 0?{}:{speed:t.speed},...t.fullVideoLink===void 0?{}:{fullVideoLink:t.fullVideoLink}});let n=e;for(let[e,r,i,a]of[[`shorts`,`shorts`,u.prompt,t.prompt],[`shortsImage`,`image`,u.imagePrompt,t.imagePrompt]]){if(i===a)continue;let t=l.find(e=>e.kind===r&&e.name===a);n=t===void 0?PZ(n,e):xZ(n,e,t.body)}let r=e=>{let t=Number(e);return e.trim()===``||!Number.isFinite(t)?0:t},a=Dk(t);i({...n,config:{...n.config,shorts:{enabled:t.enabled,count:r(t.count),minSeconds:r(t.minSeconds),maxSeconds:r(t.maxSeconds),...t.prompt===``?{}:{prompt:t.prompt},...t.imagePrompt===``?{}:{imagePrompt:t.imagePrompt},...a,...a.musicVolume!==void 0&&!Number.isFinite(a.musicVolume)?{musicVolume:-1}:{},...a.speed!==void 0&&!Number.isFinite(a.speed)?{speed:0}:{}}}})}}),f!==void 0&&o.enabled?(0,h.jsx)(jZ,{edit:e,view:t,pick:f,settings:o,again:d,problem:r,onChange:i}):null]})}function AZ({edit:e,disabled:t,onChange:n,onPending:r}){let i=(e.uploads??[]).some(e=>e.destination.kind===`shortsMusic`),a=e.content.shortsMusic!==void 0;return(0,h.jsxs)(`div`,{className:`basis-full space-y-2`,children:[i||a?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-ink2`,children:[i?`New background music chosen. It is mixed under every short when you save and Resume.`:`Background music plays quietly under every short and dips while the narrator speaks.`,(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:t,onClick:()=>{let{shortsMusic:t,...r}=e.content;n({...e,content:r,uploads:(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`)})},children:`Remove the music`})]}):null,(0,h.jsx)(CZ,{label:i||a?`Replace the background music`:`Background music (optional): an audio file, looped if shorter than a short`,kind:`audio`,disabled:t,onPending:r,onReady:t=>n({...e,uploads:[...(e.uploads??[]).filter(e=>e.destination.kind!==`shortsMusic`),{stagedFileId:t.id,destination:{kind:`shortsMusic`}}]})})]})}function jZ({edit:e,view:t,pick:n,settings:r,again:i,problem:a,onChange:o}){let s=(0,m.useId)(),c=t.revision.config.shorts,l=i||c===void 0||c.count!==r.count||c.minSeconds!==r.minSeconds||c.maxSeconds!==r.maxSeconds||(c.prompt??``)!==(r.prompt??``),u=Object.fromEntries(Object.entries(e.content.shortsRanges??{}).filter(([,e])=>e.pick===n.fingerprint)),d=n.picked.sentences??[],f=n.picked.durationSeconds??d.at(-1)?.end??0,p=n.picked.shorts.map(e=>{let t=u[String(e.number)],n=t===void 0?void 0:pZ(d,t.first,t.last,f);return t===void 0||n===void 0?e:{...e,first:t.first,last:t.last,...n}}),g=(t,r,i)=>{let a=n.picked.shorts.find(e=>e.number===t.number),{[String(t.number)]:s,...c}=u,l=a!==void 0&&a.first===r&&a.last===i?c:{...c,[String(t.number)]:{first:r,last:i,pick:n.fingerprint}},{shortsRanges:d,...f}=e.content;o({...e,content:Object.keys(l).length===0?f:{...f,shortsRanges:l}})};return(0,h.jsxs)(`section`,{"aria-labelledby":`${s}-clips`,className:`space-y-3 border-t border-line pt-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsx)(`h4`,{id:`${s}-clips`,className:`engraved text-ink3`,children:`Picked clips`}),i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-done`,children:[`The moments will be picked again when you save and Resume; clips on the same sentences keep their images.`,(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>o({...e,regenerate:(e.regenerate??[]).filter(e=>e!==wZ)}),children:`Keep the current moments`})]}):(0,h.jsx)(V,{type:`button`,onClick:()=>o(EZ(e)),children:`Pick different moments`})]}),l&&!i?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`These settings pick the moments again when you save and Resume, so the clips below can be adjusted once the new ones are picked.`}):null,(0,h.jsx)(`ol`,{className:`space-y-3`,children:p.map(t=>(0,h.jsx)(MZ,{clip:t,picked:n.picked,adjusted:u[String(t.number)]!==void 0,locked:l,remade:e.regenerate?.includes(TZ(t.number))===!0,problem:(()=>{let e=u[String(t.number)];return e===void 0?a(`content.shortsRanges.${String(t.number)}`):_Z(n.picked,t.number,e.first,e.last,r,p)})(),onRange:(e,n)=>g(t,e,n),onRemake:n=>o(n?DZ(e,t.number):{...e,regenerate:(e.regenerate??[]).filter(e=>e!==TZ(t.number))})},t.number))})]})}function MZ({clip:e,picked:t,adjusted:n,locked:r,remade:i,problem:a,onRange:o,onRemake:s}){let c=(0,m.useId)(),l=t.sentences??[],[u,d]=(0,m.useState)(!1),f=String(e.number),p=e=>l[e-1]?.text??``,g=(e,t,n,i)=>(0,h.jsx)(V,{type:`button`,variant:`ghost`,"aria-label":`${e} of short ${f}`,disabled:r||!i,onClick:()=>o(t,n),children:e.split(` `)[0]}),_=Math.round(e.end-e.start);return(0,h.jsxs)(`li`,{"aria-labelledby":`${c}-title`,className:`space-y-2 rounded-control border border-line p-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,h.jsxs)(`h5`,{id:`${c}-title`,className:`min-w-0 text-small font-semibold text-ink`,children:[`Short `,f,` · `,e.title]}),(0,h.jsxs)(`span`,{className:`text-label text-ink3`,children:[`Sentences `,String(e.first),`-`,String(e.last),` · `,String(_),` s`,n?` · set by hand`:``]})]}),l.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`These shorts were picked before clips could be moved by hand. Use Pick different moments to adjust them.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Starts: “`,p(e.first),`”`]}),g(`Earlier start`,e.first-1,e.last,e.first>1),g(`Later start`,e.first+1,e.last,e.first<e.last)]}),(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-small text-ink2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Ends: “`,p(e.last),`”`]}),g(`Earlier end`,e.first,e.last-1,e.last>e.first),g(`Later end`,e.first,e.last+1,e.last<l.length)]}),u?(0,h.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[`first`,`last`].map(t=>(0,h.jsxs)(`label`,{htmlFor:`${c}-${t}`,className:`flex items-center gap-2 text-small`,children:[t===`first`?`Start sentence`:`End sentence`,(0,h.jsx)(YP,{id:`${c}-${t}`,className:`w-auto max-w-[320px]`,value:String(e[t]),disabled:r,onChange:n=>{let r=Number(n.target.value);o(t===`first`?r:e.first,t===`last`?r:e.last)},children:l.map((e,t)=>(0,h.jsxs)(`option`,{value:String(t+1),children:[String(t+1),`.`,` `,e.text.length>70?`${e.text.slice(0,69)}…`:e.text]},String(t+1)))})]},t))}):null]}),a===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:a}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.length===0?null:(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:r,onClick:()=>d(!u),children:u?`Hide the sentence lists`:`Use my own range`}),n?(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:r,onClick:()=>{let n=t.shorts.find(t=>t.number===e.number);n!==void 0&&o(n.first,n.last)},children:`Back to the AI's choice`}):null,i?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-done`,children:[`Short `,f,` will be made again, with new images, when you save and Resume.`,(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>s(!1),children:`Keep this short`})]}):(0,h.jsx)(V,{type:`button`,disabled:r,onClick:()=>s(!0),children:`Make this short again`})]})]})}function NZ(e,t,n,r,i){let a=e.revision.content.promptTemplates[n]??e.revision.config.rendered[n];return!r||a==null||i.some(e=>e.kind===t&&e.name===r)?[]:[{id:`saved-${n}`,kind:t,name:r,body:a,slots:[],updatedAt:e.revision.createdAt}]}function PZ(e,t){let{[t]:n,...r}=e.content.promptTemplates,{[t]:i,...a}=e.config.rendered;return yZ({...e,config:{...e.config,rendered:a},content:{...e.content,promptTemplates:r}})}var FZ=q({shorts:K(q({number:G(),first:G().optional(),last:G().optional(),start:G(),end:G(),title:W(),description:W(),hashtags:K(W())}))});function IZ({stage:e,project:t,outputs:n}){let r=(0,m.useId)(),i=pK(n,e),a=mK(i,`shorts`),o=BZ(i),[s,c]=(0,m.useState)(),l=RZ(i,`short_video`,o),u=t.config.shorts,d=(0,m.use)(jX),f=(0,m.use)(MX);if(u?.enabled!==!0&&a===void 0&&l.length===0)return null;let p=d&&f!==void 0&&u?.enabled===!0,g=e=>{let t=Ck(e,u?.fullVideoLink),n={text:`Couldn't copy short ${String(e.number)}. Select its text and copy it.`,tone:`error`};if(!navigator.clipboard){c(n);return}navigator.clipboard.writeText(t).then(()=>c({text:`Copied short ${String(e.number)}.`,tone:`success`}),()=>c(n))};return(0,h.jsxs)(`section`,{"aria-labelledby":`${r}-title`,className:`flex min-w-0 flex-col gap-3 border-t border-line pt-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsx)(`h3`,{id:`${r}-title`,className:`engraved text-ink3`,children:`Shorts`}),p&&o.length>0?(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>f({section:`shorts`,change:EZ}),children:`Pick different moments`}):null]}),o.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e.state===`running`?`The clips are picked after the subtitle timing.`:`Not made yet. They are made with the video.`}):(0,h.jsx)(`ul`,{className:`grid grid-cols-2 gap-x-4 gap-y-6 sm:grid-cols-3`,children:o.map(n=>(0,h.jsx)(LZ,{clip:n,video:l.find(e=>zZ(e,n)),images:RZ(i,`short_image`,o).filter(e=>zZ(e,n)).length,link:Sk(u?.fullVideoLink),wanted:Ek(n.end-n.start,t.config.imageSeconds),state:e.state,failed:HZ(e.failureReason,n.number),onCopy:()=>g(n),...p?{onRemake:()=>f({section:`shorts`,change:e=>DZ(e,n.number)})}:{}},n.number))}),(0,h.jsx)(EP,{tone:s?.tone??`info`,children:s?.text})]})}function LZ({clip:e,video:t,images:n,wanted:r,state:i,failed:a,link:o,onCopy:s,onRemake:c}){let l=(0,m.useId)(),u=aX(t),d=a?`Couldn't make this short. Open Error details above to see why, then Retry stage.`:i===`running`?n<r?`Making images · ${String(n)} of ${String(r)}`:`Rendering`:`Not made yet. It is made with the video.`;return(0,h.jsxs)(`li`,{"aria-labelledby":`${l}-title`,className:`flex min-w-0 flex-col gap-2`,children:[t!==void 0&&u!==void 0?(0,h.jsx)(`video`,{controls:!0,preload:`metadata`,src:u.url,"aria-label":`Short ${String(e.number)}`,className:`aspect-[9/16] w-full rounded-control bg-screen`},t.id):(0,h.jsx)(`div`,{className:`flex aspect-[9/16] w-full items-center justify-center rounded-control bg-panel2 p-3 text-center text-small ${a?`text-red`:`text-ink2`}`,children:d}),(0,h.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,h.jsx)(`h4`,{id:`${l}-title`,className:`min-w-0 break-words text-small font-semibold text-ink`,children:e.title}),(0,h.jsxs)(V,{type:`button`,variant:`ghost`,"aria-label":`Copy short ${String(e.number)}'s title, description and hashtags`,onClick:s,children:[(0,h.jsx)(vs,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]})]}),(0,h.jsx)(`p`,{className:`text-label text-ink3`,children:pN(t?.durationMs??Math.round((e.end-e.start)*1e3))}),(0,h.jsx)(`p`,{className:`break-words text-small text-ink2`,children:e.description}),(0,h.jsx)(`p`,{className:`break-words text-label text-ink3`,children:o}),(0,h.jsx)(`p`,{className:`break-words text-small text-ink2`,children:e.hashtags.join(` `)}),t!==void 0&&u!==void 0?(0,h.jsxs)(`a`,{href:u.url,download:!0,className:`inline-flex items-center gap-[5px] self-start rounded-control text-small text-ink2 hover:text-ink`,children:[(0,h.jsx)(ys,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Download`]}):null,c===void 0?null:(0,h.jsx)(V,{type:`button`,variant:`ghost`,className:`self-start`,"aria-label":`Make short ${String(e.number)} again`,onClick:c,children:`Make this short again`})]})}function RZ(e,t,n){let r=e.find(e=>e.role===`shorts`);return e.filter(e=>e.role===t&&(r===void 0||e.createdAt>=r.createdAt||n.some(t=>zZ(e,t)&&e.meta.sentences?.[0]===t.first&&e.meta.sentences?.[1]===t.last)))}function zZ(e,t){return e.meta.short===t.number}function BZ(e){return VZ(wX(mK(e,`shorts`)).data)}function VZ(e){if(e===void 0)return[];try{let t=FZ.safeParse(JSON.parse(e));return t.success?t.data.shorts:[]}catch{return[]}}function HZ(e,t){return e?.startsWith(`Short ${String(t)}:`)===!0||e?.startsWith(`Short ${String(t)} `)===!0}function UZ({stage:e,project:t,outputs:n}){let r=(0,m.useId)(),i=pK(n,e),a=mK(i,`youtube_description`),o=mK(i,`youtube_tags`),s=wX(a).data,c=wX(o).data,[l,u]=(0,m.useState)();if(t.config.youtubeDescription!==!0&&a===void 0)return null;let d=(e,t)=>{if(e!==void 0){if(!navigator.clipboard){u({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>u({text:`Copied the ${t}.`,tone:`success`}),()=>u({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))}},f=e.state===`running`?`Written after the subtitle timing.`:`Not written yet. It is made with the video.`;return(0,h.jsxs)(`section`,{"aria-labelledby":`${r}-title`,className:`flex min-w-0 flex-col gap-3 border-t border-line pt-4`,children:[(0,h.jsx)(`h3`,{id:`${r}-title`,className:`engraved text-ink3`,children:`YouTube`}),(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)] gap-x-8 gap-y-4 lg:grid-cols-[minmax(0,75ch)_minmax(0,1fr)]`,children:[(0,h.jsx)(WZ,{id:`${r}-description`,label:`Description`,placeholder:f,empty:s===void 0,copy:s===void 0?void 0:()=>d(s,`description`),children:s}),(0,h.jsx)(WZ,{id:`${r}-tags`,label:`Tags`,placeholder:f,empty:c===void 0,copy:c===void 0?void 0:()=>d(c,`tags`),children:c===void 0?void 0:(0,h.jsx)(GZ,{text:c})})]}),(0,h.jsx)(EP,{tone:l?.tone??`info`,children:l?.text})]})}function WZ({id:e,label:t,placeholder:n,empty:r,copy:i,children:a}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-8 items-center justify-between gap-3`,children:[(0,h.jsx)(`h4`,{id:`${e}-label`,className:`text-small font-semibold text-ink2`,children:t}),(0,h.jsxs)(V,{type:`button`,variant:`ghost`,disabled:i===void 0,"aria-label":`Copy ${t.toLowerCase()}`,onClick:i,children:[(0,h.jsx)(vs,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]})]}),(0,h.jsx)(`section`,{"aria-labelledby":`${e}-label`,tabIndex:0,className:z(`max-h-64 overflow-auto whitespace-pre-wrap break-words text-small`,r?`text-ink3`:`text-ink`),children:r?n:a})]})}function GZ({text:e}){let t=e.split(`,`).map(e=>e.trim()).filter(e=>e!==``);return(0,h.jsx)(`ul`,{className:`flex flex-wrap gap-[6px] whitespace-normal`,children:t.map((e,t)=>(0,h.jsx)(`li`,{className:`rounded-full border border-line bg-panel2 px-[9px] py-[2px] text-small text-ink`,children:e},t))})}function KZ({stage:e,project:t,outputs:n,actions:r,busy:i,subtitleControls:a}){let o=t.config.sources.video===`off`&&t.config.sources.audio!==`off`,s=mK(pK(n,e),o?`audio_export`:`video`),c=pK(n,e),l=mK(c,`subtitles_srt`),u=mK(c,`subtitles_vtt`),d=mK(c,`youtube_description`),f=mK(c,`youtube_tags`),p=RZ(c,`short_video`,BZ(c)).toSorted((e,t)=>(e.meta.short??0)-(t.meta.short??0)),m=aX(s),g=aX(u),_=s?.meta.subtitlesMode??t.config.subtitles?.mode,v=e.state===`running`,y=mN(e.progressCurrent??0,e.progressTotal??0);return t.config.sources.video===`off`&&!o?(0,h.jsx)(cX,{children:a}):(0,h.jsxs)(cX,{children:[v?(0,h.jsx)(`p`,{className:`text-small text-run-text`,children:aN(e,t.config)?`Preparing subtitles · ${String(mN(e.progressCurrent??0,35))}%`:o?`Exporting combined audio`:e.progressTotal===null?`Re-rendering`:`Re-rendering · ${String(y)}%`}):null,s===void 0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:o?`No combined audio export has landed yet.`:`No render has landed yet.`}):o?(0,h.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":`Combined narration`,src:m?.url,className:`h-9 w-full max-w-[720px]`},s.id):(0,h.jsx)(`video`,{controls:!0,preload:`metadata`,src:m?.url,"aria-label":`Generated video`,className:z(`mx-auto block max-h-[min(58vh,560px)] w-auto max-w-full rounded-control bg-screen`,t.format===`9:16`?`aspect-[9/16]`:`aspect-video`),children:_===`files`&&u&&g?(0,h.jsx)(`track`,{kind:`captions`,srcLang:`en`,label:`English`,default:!0,src:g?.url},u.id):null},s.id),s?.meta.warnings?.length?(0,h.jsx)(`ul`,{"aria-label":`Render notes`,className:`space-y-1 text-small text-ink2`,children:s.meta.warnings.map(e=>(0,h.jsx)(`li`,{children:e},e))}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-small`,children:[e.state===`pending`||e.state===`skipped`?null:(0,h.jsx)(PX,{action:{kind:`rerun`,stage:e.kind},run:()=>{r.run({kind:`rerun`,stage:e.kind})},disabled:i||![`done`,`failed`,`canceled`].includes(e.state),pending:r.pending,children:o?`Re-export`:`Re-render`}),(0,h.jsx)(`span`,{className:`text-ink2`,children:[pN(s?.durationMs??void 0),o?`WAV · stereo · 48 kHz`:t.format].filter(e=>e!==void 0).join(` · `)}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(xX,{files:[{output:s,label:o?`Audio (.wav)`:`Video (.mp4)`},{output:l,label:`Subtitles (.srt)`},{output:u,label:`Subtitles (.vtt)`},{output:d,label:`YouTube description (.txt)`},{output:f,label:`YouTube tags (.txt)`},...p.map(e=>({output:e,label:`Short ${String(e.meta.short??``)} (.mp4)`}))]}),(0,h.jsx)(CX,{output:s})]}),s?.meta.subtitleOmissions?.length?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3 text-small`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer font-semibold`,children:[`Subtitles recovered after missing narration (`,s.meta.subtitleOmissions.length,`)`]}),(0,h.jsx)(`p`,{className:`mt-2 text-ink2`,children:`These transcript passages could not be matched to the audio and were left out of the captions. The audio is unchanged. Review these passages before sharing.`}),(0,h.jsx)(`ul`,{className:`mt-2 space-y-2`,children:s.meta.subtitleOmissions.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`strong`,{children:new Date(e.start*1e3).toISOString().slice(11,19)}),` —`,` `,e.text]},`${e.start}-${e.text}`))})]}):null,(0,h.jsx)(UZ,{stage:e,project:t,outputs:n}),(0,h.jsx)(IZ,{stage:e,project:t,outputs:n}),a?(0,h.jsxs)(`details`,{className:`border-t border-line pt-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-small font-semibold`,children:`Subtitles & fonts`}),a]}):null]})}function qZ(e){switch(e.stage.kind){case`article`:return(0,h.jsx)(GX,{...e});case`audio`:return(0,h.jsx)(ZX,{...e});case`images`:return(0,h.jsx)(oZ,{...e});case`video`:return(0,h.jsx)(KZ,{...e});case`document`:return(0,h.jsx)(eZ,{...e});case`research`:case`thumbnail`:return null}}var JZ=q({revisionId:W(),checkpoints:K(EA.unwrap().extend({currentFingerprint:W().regex(/^[a-f0-9]{64}$/),dependents:K(J(Gb)),workKeys:K(W())}))}),YZ=q({revisionId:W().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),stages:K(TA).max(3).refine(e=>new Set(e).size===e.length).readonly()}).strict(),XZ=q({title:W(),status:G(),detail:W().optional(),reason:J([`duplicate`,`not-found`,`conflict`,`invalid-input`]).optional()}),ZZ=DA.unwrap().omit({projectId:!0,checkpointId:!0,approvedAt:!0}),QZ=e=>[`checkpoints`,e],$Z=(e,t)=>[...QZ(e),t];async function eQ(e,t){let n;try{n=await e.json()}catch{throw ro(e,void 0)}if(e.ok)return{ok:!0,value:uo(t,n)};let r=XZ.safeParse(n);if(!r.success)throw ro(e,void 0);if(![400,404,409].includes(e.status))throw Error(r.data.detail??r.data.title);return{ok:!1,reason:r.data.reason??`invalid-input`,message:r.data.detail??r.data.title}}async function tQ(e,t){return eQ(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/checkpoints`),JZ)}async function nQ(e,t,n,r){return eQ(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/checkpoints/${encodeURIComponent(n)}/approve`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(ZZ.parse(r))}),q({checkpoint:EA,replayed:wO()}))}async function rQ(e,t,n){return eQ(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/checkpoints`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(YZ.parse(n))}),JZ)}var iQ=[{stage:`audio`,name:`Audio`},{stage:`images`,name:`Images`},{stage:`video`,name:`Video / export`}];function aQ({projectId:e,revisionId:t,gates:n,stages:r,reload:i,saved:a}){let{api:o}=B(),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(!1),g=(0,m.useRef)(!0),_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=JSON.stringify([t,n.map(e=>[e.stage,e.checkpointId]).toSorted()]),b=s!==null&&s.baseIdentity!==y,x=s?.stages??n.map(e=>e.stage),S=iQ.some(({stage:e})=>x.includes(e)!==n.some(t=>t.stage===e)),C=b||d!==null&&d.kind!==`success`,w=b?{kind:`refused`,message:`Checkpoint choices changed elsewhere. Press Reload checkpoint choices before saving, then make your change again.`}:d;(0,m.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]),(0,m.useEffect)(()=>{(d||b)&&_.current?.focus()},[d,b]);async function T(){if(!(p.current||!S||C)){p.current=!0,u(!0);try{let n=await rQ(o,e,{revisionId:t,stages:x});if(!g.current)return;n.ok?n.value.revisionId===t?(a(n.value),c(null),f({kind:`success`,message:`Checkpoint choices saved.`})):f({kind:`refused`,message:`The project was edited elsewhere. Press Reload checkpoint choices to see its current choices.`}):f({kind:`refused`,message:n.message})}catch(e){g.current&&f({kind:`transport`,message:`${co(e instanceof Error?e.message:`Slopify didn't confirm the change`)} It may or may not have saved. Press Reload checkpoint choices before changing anything else.`})}finally{p.current=!1,g.current&&u(!1)}}}async function E(){if(!p.current){p.current=!0,u(!0);try{let e=await i();g.current&&e&&(c(null),f(null),v.current?.focus())}finally{p.current=!1,g.current&&u(!1)}}}return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsxs)(`fieldset`,{ref:v,tabIndex:-1,className:`space-y-2`,children:[(0,h.jsx)(`legend`,{children:`Checkpoint choices`}),(0,h.jsx)(`p`,{children:`Change checkpoints before a step starts. Removing one lets its already-admitted work continue when ready; project pause still applies.`}),iQ.map(({stage:e,name:t})=>{let n=r.find(t=>t.kind===e),i=n?.state===`pending`&&(e===`video`?n.source!==`off`||r.some(e=>e.kind===`audio`&&e.source!==`off`&&e.state!==`skipped`):(n.source??`generate`)===`generate`);return(0,h.jsxs)(`label`,{className:`flex min-h-10 items-center gap-3`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),disabled:!i||l||C,onChange:t=>{c({baseIdentity:s?.baseIdentity??y,stages:t.target.checked?[...x,e]:x.filter(t=>t!==e)}),f(null)}}),`Before `,t]},e)})]}),w?(0,h.jsx)(`p`,{ref:_,tabIndex:-1,role:w.kind===`success`?`status`:`alert`,children:w.message}):null,(0,h.jsx)(V,{type:`button`,disabled:!S||l||C,onClick:()=>void T(),children:l?`Saving…`:`Save checkpoints`}),C?(0,h.jsx)(V,{type:`button`,disabled:l,onClick:()=>void E(),children:`Reload checkpoint choices`}):null]})}var oQ=e=>e.charAt(0).toUpperCase()+e.slice(1);function sQ(e){return e.revisionId===null?null:(0,h.jsx)(cQ,{...e,revisionId:e.revisionId},`${e.projectId}:${e.revisionId}`)}function cQ({projectId:e,revisionId:t,paused:n,stages:r}){let{api:i}=B(),a=_(),o=I({queryKey:$Z(e,t),queryFn:()=>tQ(i,e),retry:!1}),s=o.data,c=async()=>{let e=await o.refetch();return!e.isError&&e.data?.ok===!0&&e.data.value.revisionId===t?e.data.value:void 0},l=async()=>{let e=await o.refetch();return!e.isError&&e.data?.ok===!0&&e.data.value.revisionId===t};return o.isPending?null:o.error||s?.ok===!1?(0,h.jsxs)(`section`,{"aria-label":`Review checkpoints`,children:[(0,h.jsx)(`p`,{role:`alert`,children:o.error?.message??(s?.ok===!1?s.message:`Checkpoints couldn't be loaded. Press Reload checkpoints.`)}),(0,h.jsx)(V,{type:`button`,onClick:()=>void l(),children:`Reload checkpoints`})]}):s?.ok?s.value.revisionId===t?(0,h.jsxs)(`section`,{"aria-label":`Review checkpoints`,className:`space-y-3 rounded-panel border border-line bg-panel p-4`,children:[(0,h.jsx)(`h2`,{children:`Review checkpoints`}),n?(0,h.jsx)(`p`,{children:`Project is paused. Resume it before approving held work.`}):null,(0,h.jsx)(aQ,{projectId:e,revisionId:t,gates:s.value.checkpoints,stages:r,reload:c,saved:n=>{a.setQueryData($Z(e,t),{ok:!0,value:n}),a.invalidateQueries({queryKey:H.project(e)}),a.invalidateQueries({queryKey:H.projects})}}),s.value.checkpoints.map(i=>(0,h.jsx)(lQ,{gate:i,disabled:n||i.projectId!==e||i.revisionId!==t||r.some(e=>e.kind===i.stage&&[`running`,`canceled`].includes(e.state)),reload:l},`${i.checkpointId}:${i.fingerprint}`))]}):(0,h.jsx)(`section`,{"aria-label":`Review checkpoints`,children:(0,h.jsx)(`p`,{role:`alert`,children:`The project was edited after these checkpoints loaded. Press Reload checkpoints before approving.`})}):null}function lQ({gate:e,disabled:t,reload:n}){let{api:r}=B(),i=_(),a=(0,m.useRef)(null),o=(0,m.useRef)(!1),s=(0,m.useRef)(!0),c=(0,m.useRef)(null),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(null);(0,m.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,m.useEffect)(()=>{d!==null&&c.current?.focus()},[d]);let p=[`configured`,`pending-review`,`held`].includes(e.state)&&e.fingerprint===e.currentFingerprint;async function g(){if(!(o.current||t||!p||d?.kind===`refused`||d?.kind===`success`)){o.current=!0,u(!0),a.current??={revisionId:e.revisionId,fingerprint:e.fingerprint,idempotencyKey:crypto.randomUUID()};try{let t=await nQ(r,e.projectId,e.checkpointId,a.current);a.current=null,s.current&&f(t.ok?{kind:`success`,message:t.value.replayed?`Checkpoint already approved.`:`Checkpoint approved. Work will run when its dependencies are ready.`}:{kind:`refused`,message:t.message}),i.invalidateQueries({queryKey:QZ(e.projectId)}),i.invalidateQueries({queryKey:H.project(e.projectId)}),i.invalidateQueries({queryKey:H.projects})}catch(e){s.current&&f({kind:`transport`,message:`${co(e instanceof Error?e.message:`Slopify didn't confirm the approval`)} Press Retry approval to check whether it went through.`})}finally{o.current=!1,s.current&&u(!1)}}}return(0,h.jsxs)(`div`,{className:`space-y-2 rounded-control border border-line p-3`,children:[(0,h.jsxs)(`h3`,{children:[oQ(e.stage),` checkpoint`]}),(0,h.jsx)(`p`,{children:e.state===`released`&&e.approvedAt!==null?`Authorized for this revision. Work can run when dependencies are ready and the project is resumed.`:e.state===`satisfied`?`Checkpoint satisfied. Its reviewed work is complete.`:e.state===`invalidated`||e.fingerprint!==e.currentFingerprint?`Inputs changed. Review the current revision before approving.`:p?`${oQ(e.stage)} is held for your review. Its dependent work waits for this approval; independent work can continue.`:`Checkpoint ${e.state}.`}),(0,h.jsxs)(`p`,{children:[`Reviewed revision: `,e.revisionId]}),e.dependents.length?(0,h.jsx)(`ul`,{"aria-label":`Dependent work`,children:e.dependents.map(e=>(0,h.jsx)(`li`,{children:oQ(e)},e))}):(0,h.jsx)(`p`,{children:`No dependent stages.`}),d?(0,h.jsx)(`p`,{ref:c,tabIndex:-1,role:d.kind===`success`?`status`:`alert`,children:d.message}):null,p?(0,h.jsx)(V,{type:`button`,disabled:t||l||d?.kind===`refused`||d?.kind===`success`,onClick:()=>void g(),children:l?`Approving…`:d?.kind===`transport`?`Retry approval`:`Approve ${oQ(e.stage)} checkpoint`}):null,d?.kind===`refused`?(0,h.jsx)(V,{type:`button`,onClick:async()=>{await n()&&f(null)},children:`Reload checkpoints`}):null]})}function uQ({project:e,prompts:t,actions:n,inFlight:r,resumable:i,primaryOutput:a,children:o}){let s=e.status===`running`,[c,l]=(0,m.useState)(!1),u=s||e.status===`pending`&&!i,d=i||e.status===`paused`||e.status===`failed`||e.status===`canceled`,f=AX({kind:`cancel`});return(0,h.jsx)(zP,{back:{to:`/`,label:`Projects`},lead:(0,h.jsx)(jl,{state:e.status}),title:e.title,status:(0,h.jsx)(kl,{state:e.status,announce:`Project`}),meta:dQ(e,t),actions:(0,h.jsxs)(h.Fragment,{children:[o,u?(0,h.jsx)(V,{disabled:n.pending,onClick:()=>n.run({kind:`pause`}),children:`Pause`}):(0,h.jsx)(V,{disabled:!d||n.pending||r,onClick:()=>n.run({kind:`resume`}),children:n.performing?.kind===`resume`?`Resuming…`:`Resume`}),a?(0,h.jsx)(`span`,{className:`inline-flex h-8 items-center rounded-control border border-accent bg-accent px-3 [&_a]:font-semibold [&_a]:text-accent-ink [&_button]:text-accent-ink`,children:(0,h.jsx)(bX,{output:a,label:a.role===`video`?`Download video`:a.role===`audio_export`?`Download audio`:`Download article`})}):(0,h.jsx)(V,{disabled:!0,title:`Available once the final output has been made`,children:`Download`}),(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`More project actions`,className:`size-8 p-0`,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsx)(vF,{children:(0,h.jsx)(yF,{disabled:!s||n.pending,onSelect:()=>l(!0),children:`Cancel run`})})]}),(0,h.jsx)(wP,{open:c,title:f.title,consequence:f.consequence,verb:f.verb,dismiss:f.dismiss,pending:n.pending,onConfirm:()=>{l(!1),n.run({kind:`cancel`})},onCancel:()=>l(!1)})]})})}function dQ(e,t){let n=e.config.articlePrompt,r=t===void 0||t.some(e=>e.name===n);return[n===void 0||n===``?void 0:r?n:`${n} (deleted)`,e.format,`started ${ul(e.createdAt)}`].filter(e=>e!==void 0).join(` · `)}var fQ=e=>e.state===`done`||e.state===`provided`;function pQ(e){let t=RX(e).map(e=>[e.stage,e.companion].filter(e=>e!==void 0&&e.state!==`skipped`)).filter(e=>e.length>0),n=t.length,r=t.filter(e=>e.every(fQ)).length,i=t.reduce((e,t)=>e+t.reduce((e,t)=>e+mQ(t),0)/t.length,0);return{completed:r,total:n,percent:n===0?0:Math.min(r===n?100:99,Math.round(i/n*100))}}function mQ(e){return fQ(e)?1:e.progressTotal===null||e.progressTotal<=0?0:Math.min(.99,Math.max(0,(e.progressCurrent??0)/e.progressTotal))}function hQ(e){let t=e.find(e=>e.state===`failed`)??e.find(e=>e.state===`running`);if(t)return t.kind;let n=e.find(e=>e.kind===`video`&&fQ(e));if(n)return n.kind;let r=e.find(e=>e.state===`pending`);return r?r.kind:e.find(e=>e.kind===`article`&&fQ(e))?.kind??e.find(e=>e.state!==`skipped`)?.kind??`article`}function gQ({stages:e,project:t,outputs:n,selected:r,onSelect:i,resumable:a=!1}){let o=pQ(e);return(0,h.jsxs)(`div`,{className:`mb-4 grid min-w-0 grid-cols-1 overflow-hidden rounded-panel border border-line bg-panel sm:grid-cols-[112px_minmax(0,1fr)]`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-line px-4 py-3 sm:flex-col sm:items-start sm:justify-center sm:gap-1 sm:border-r sm:border-b-0`,children:[(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:`Run`}),(0,h.jsxs)(`span`,{className:`text-row font-bold tabular-nums`,children:[o.percent,`%`]}),(0,h.jsx)(`div`,{role:`progressbar`,"aria-label":`Overall progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o.percent,"aria-valuetext":`${o.percent} percent; ${o.completed} of ${o.total} stages finished`,title:`${o.completed} of ${o.total} stages finished`,className:`h-1 min-w-16 flex-1 overflow-hidden rounded-control bg-panel2 sm:w-full sm:flex-none`,children:(0,h.jsx)(`div`,{className:z(`h-full origin-left bg-lamp-run transition-transform duration-200 motion-reduce:transition-none`,t.status===`failed`&&`bg-red`),style:{transform:`scaleX(${o.percent/100})`}})})]}),(0,h.jsx)(`nav`,{"aria-label":`Project stages`,className:`relative min-w-0 overflow-x-auto [scrollbar-width:thin]`,children:(0,h.jsx)(`div`,{className:`grid min-w-[560px] grid-cols-5`,children:RX(e).map(e=>{let o=e.kind===r,s=VX(e,t.config),c=zX(e);return(0,h.jsxs)(`button`,{type:`button`,"aria-label":`${s}, ${c.state}`,"aria-current":o?`step`:void 0,onClick:()=>i(e.kind),className:z(`flex min-w-0 flex-col items-start gap-1 border-r border-line px-3 py-3 text-left last:border-r-0 hover:bg-panel2 focus-visible:outline-offset-[-3px]`,o&&`bg-panel2 shadow-[inset_0_-2px_0_var(--color-lamp-run)]`,c.state===`skipped`&&`text-ink3`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,h.jsx)(jl,{state:c.state}),(0,h.jsx)(`span`,{className:`truncate font-semibold`,children:s})]}),(0,h.jsx)(kl,{state:c.state,announce:s}),(0,h.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1 text-label text-ink2`,children:[(0,h.jsx)(wl,{kind:BX(e),className:`size-[13px] shrink-0 text-ink3`}),(0,h.jsx)(`span`,{className:`truncate`,children:HX(e,n,t,a)})]})]},e.stage.id)})})})]})}function _Q(e){let t=[],n=[],r=0,i=()=>{let e=n[0],r=n.at(-1);e!==void 0&&r!==void 0&&t.push({start:e.start,end:r.end,text:vQ(n.map(e=>e.text))}),n=[]};for(let t of e){if(!Number.isFinite(t.start)||!Number.isFinite(t.end)||t.start<r-.001||t.end<=t.start)throw Error(`The saved caption timing is damaged. Use Re-run section on Video to time them again, then Retry stage.`);let e=n[0];e!==void 0&&(t.start-r>.7||t.end-e.start>5||vQ([...n.map(e=>e.text),t.text]).split(`
|
|
161
|
+
`).length>2)&&i(),n.push({...t,text:t.text.replace(/\s+/g,` `).trim()}),r=t.end,/[.!?]["'’”)]*$/.test(t.text)&&i()}return i(),t}function vQ(e){let t=[],n=``;for(let r of e)n!==``&&n.length+r.length+1>42&&(t.push(n),n=``),n=n===``?r:`${n} ${r}`;return n!==``&&t.push(n),t.join(`
|
|
162
|
+
`)}function yQ({cues:e,duration:t,onChange:n,onPending:r}){let i=(0,m.useId)(),[a,o]=(0,m.useState)(()=>e.map(e=>({...e,start:String(e.start),end:String(e.end)}))),[s,c]=(0,m.useState)(),[l,u]=(0,m.useState)(!1),d=(0,m.useRef)(r);d.current=r,(0,m.useEffect)(()=>{d.current(l)},[l]),(0,m.useEffect)(()=>()=>d.current(!1),[]);function f(){let e=[],r=new Set,i=0;if(!Number.isFinite(t)||t<=0){c(`The narration length isn't known yet, so captions can't be checked. Reload the page and try again.`);return}for(let[n,o]of a.entries()){let a=o.start.trim()===``?NaN:Number(o.start),s=o.end.trim()===``?NaN:Number(o.end);if(r.has(o.id)){c(`Caption ${n+1}: this caption is listed twice. Remove the copy.`);return}if(r.add(o.id),!Number.isFinite(a)||a<0||a<i){c(`Caption ${n+1}: start must be a number of seconds, no earlier than the previous caption's end.`);return}if(!Number.isFinite(s)||s<=a||s>t){c(`Caption ${n+1}: end must be after its start and no later than the end of the narration.`);return}if(o.text.trim()===``){c(`Caption ${n+1}: enter caption text.`);return}e.push({id:o.id,text:o.text,start:a,end:s}),i=s}n(e),c(void 0),u(!1)}return(0,h.jsxs)(`section`,{"aria-label":`Edit caption cues`,className:`space-y-3`,children:[(0,h.jsx)(`h3`,{children:`Caption text and timing`}),a.map((e,t)=>(0,h.jsxs)(`fieldset`,{className:`space-y-2 rounded-control border border-line2 p-3`,children:[(0,h.jsxs)(`legend`,{children:[`Caption `,t+1]}),(0,h.jsxs)(`label`,{htmlFor:`${i}-${e.id}-text`,className:`block text-small`,children:[`Text for caption `,t+1,(0,h.jsx)(qP,{id:`${i}-${e.id}-text`,value:e.text,onChange:n=>{u(!0),o(a.with(t,{...e,text:n.target.value}))}})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`label`,{htmlFor:`${i}-${e.id}-start`,className:`block text-small`,children:[`Start for caption `,t+1,(0,h.jsx)(KP,{id:`${i}-${e.id}-start`,inputMode:`decimal`,value:e.start,onChange:n=>{u(!0),o(a.with(t,{...e,start:n.target.value}))}})]}),(0,h.jsxs)(`label`,{htmlFor:`${i}-${e.id}-end`,className:`block text-small`,children:[`End for caption `,t+1,(0,h.jsx)(KP,{id:`${i}-${e.id}-end`,inputMode:`decimal`,value:e.end,onChange:n=>{u(!0),o(a.with(t,{...e,end:n.target.value}))}})]})]})]},e.id)),s===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-red`,children:s}),(0,h.jsx)(V,{type:`button`,onClick:f,children:`Apply caption edits to draft`}),l?(0,h.jsx)(`p`,{children:`Apply these caption edits before saving the project.`}):null]})}function bQ({edit:e,view:t,imageKey:n,index:r}){let{api:i}=B(),a=e.content.imageDefinitions[n];if(a===void 0)return null;let o=t?.outputs.filter(e=>e.output.stageKind===`images`&&e.output.role===`image`)??[],s=o.find(e=>e.selected&&e.workKey===`image:${n}`),c=e.uploads?.some(e=>e.destination.kind===`image`&&e.destination.imageKey===n)??!1,l=a.source===`generate`||c||s?.assetId===a.assetId?s:o.find(e=>e.assetId===a.assetId&&e.available),u=l?.available===!0,d=!u&&(l!==void 0||a.source===`provide`&&a.assetId!==null),f=c?u?`Replacement ready to save; previous image shown until Save`:`Replacement ready to save; preview available after Save`:d?`Image file unavailable`:u?a.source===`provide`&&l!==s?`Provided image selected`:l.state===`review`?`Image retained; review required`:l.state===`outdated`?`Outdated image retained until rebuilt`:`Current image retained`:`No completed image yet`,p=u&&/\.(mp4|mov|m4v|webm|mkv)$/i.test(l.output.path);return(0,h.jsxs)(h.Fragment,{children:[!u||t===void 0?null:p?(0,h.jsx)(`video`,{className:`max-h-32 rounded-control object-contain`,"aria-label":`Video clip ${r+1}`,muted:!0,loop:!0,controls:!0,preload:`metadata`,src:ZY(i,t.revision.projectId,t.revision.id,l.recordId)}):(0,h.jsx)(`img`,{className:`max-h-32 rounded-control object-contain`,alt:`Retained scene ${r+1}`,src:ZY(i,t.revision.projectId,t.revision.id,l.recordId)}),(0,h.jsx)(`p`,{children:p?`${f} · video clip, played muted`:f})]})}function xQ(e,t,n){let r=t+n,i=e[t],a=e[r];if(i===void 0||a===void 0)return e;let o=[...e];return o[t]=a,o[r]=i,o}function SQ({edit:e,onChange:t,onPending:n,view:r,getEdit:i}){let a=(0,m.useId)(),[o,s]=(0,m.useState)({}),{content:c}=e,l=(0,m.useRef)(e);l.current=e;function u(e){let n=e.content.imageOrder.flatMap(t=>{let n=e.content.imageDefinitions[t];return n===void 0?[]:[n]}),r=e.content.imageOrder.length===0||e.config.sources.images===`off`?`off`:n.some(e=>e.source===`generate`)?`generate`:`provide`,i={...e,config:{...e.config,sources:{...e.config.sources,images:r,...r===`off`?{video:`off`}:{}}}};l.current=i,t(i)}function d(e,t){let n=i?.()??l.current,r=n.content.imageDefinitions[e];if(r===void 0)return;let a=r.templateKey??`image:${e}`;s(t=>({...t,[e]:(t[e]??0)+1})),u(xZ({...n,...n.uploads===void 0?{}:{uploads:n.uploads.filter(t=>t.destination.kind!==`image`||t.destination.imageKey!==e)},content:{...n.content,imageDefinitions:{...n.content.imageDefinitions,[e]:{...r,templateKey:a}}}},a,t))}function f(e){let t=i?.()??l.current,n=t.content,r=crypto.randomUUID();u({...t,config:{...t.config,sources:{...t.config.sources,images:t.config.sources.images===`off`?`provide`:t.config.sources.images}},content:{...n,imageOrder:[...n.imageOrder,r],imageDefinitions:{...n.imageDefinitions,[r]:{source:`provide`,assetId:null,prompt:null}}},uploads:[...t.uploads??[],{stagedFileId:e.id,destination:{kind:`image`,imageKey:r}}]})}return(0,h.jsxs)(`section`,{"aria-label":`Edit images`,className:`space-y-3`,children:[(0,h.jsx)(`h3`,{children:`Images`}),c.imageOrder.map((t,s)=>{let f=c.imageDefinitions[t];return f===void 0?(0,h.jsxs)(`p`,{role:`alert`,children:[`Image definition missing: `,t]},t):(0,h.jsxs)(`fieldset`,{className:`space-y-2 rounded-control border border-line2 p-3`,children:[(0,h.jsxs)(`legend`,{children:[`Image `,s+1]}),(0,h.jsx)(bQ,{edit:e,view:r,imageKey:t,index:s}),f.source===`generate`?(0,h.jsxs)(`label`,{htmlFor:`${a}-${t}-prompt`,children:[`Prompt for image `,s+1,(0,h.jsx)(qP,{id:`${a}-${t}-prompt`,value:f.templateKey===void 0||f.templateKey===null?f.prompt??``:c.promptTemplates[f.templateKey]??f.prompt??``,onChange:e=>d(t,e.target.value)})]}):null,f.source===`generate`&&f.templateKey==null?(0,h.jsxs)(V,{type:`button`,onClick:()=>d(t,f.prompt??``),children:[`Use saved wording as template for image `,s+1]}):null,(0,h.jsx)(CZ,{label:`Replace image ${s+1}`,kind:`images`,onPending:e=>n(`image:${t}`,e),onReady:e=>{let n=i?.()??l.current,r=n.content,a=r.imageDefinitions[t];a!==void 0&&r.imageOrder.includes(t)&&u({...n,regenerate:(n.regenerate??[]).filter(e=>e!==`image:${t}`),uploads:[...(n.uploads??[]).filter(e=>e.destination.kind!==`image`||e.destination.imageKey!==t),{stagedFileId:e.id,destination:{kind:`image`,imageKey:t}}],content:{...r,imageDefinitions:{...r.imageDefinitions,[t]:{...a,source:`provide`,prompt:null,templateKey:null}}}})}},`${t}:${o[t]??0}:${e.config.sources.images===`off`}`),(0,h.jsxs)(V,{type:`button`,disabled:s===0,onClick:()=>u({...e,content:{...c,imageOrder:xQ(c.imageOrder,s,-1)}}),children:[`Move image `,s+1,` earlier`]}),(0,h.jsxs)(V,{type:`button`,disabled:s===c.imageOrder.length-1,onClick:()=>u({...e,content:{...c,imageOrder:xQ(c.imageOrder,s,1)}}),children:[`Move image `,s+1,` later`]}),(0,h.jsxs)(V,{type:`button`,onClick:()=>{let n=c.imageOrder.filter(e=>e!==t);u({...e,config:n.length===0?{...e.config,sources:{...e.config.sources,images:`off`,video:`off`}}:e.config,content:{...c,imageOrder:n,imageDefinitions:Object.fromEntries(Object.entries(c.imageDefinitions).filter(([e])=>e!==t))},regenerate:(e.regenerate??[]).filter(e=>e!==`image:${t}`),uploads:(e.uploads??[]).filter(e=>e.destination.kind!==`image`||e.destination.imageKey!==t)})},children:[`Delete image `,s+1,c.imageOrder.length===1?` and turn Images and Video Off`:``]}),f.source===`generate`?(0,h.jsxs)(V,{type:`button`,onClick:()=>u({...e,regenerate:[...new Set([...e.regenerate??[],`image:${t}`])]}),children:[`Regenerate image `,s+1,` after review`]}):null]},t)}),(0,h.jsx)(V,{type:`button`,disabled:c.imageOrder.length>=60,onClick:()=>{if(c.imageOrder.length>=60)return;let t=crypto.randomUUID();u({...e,config:{...e.config,sources:{...e.config.sources,images:`generate`}},content:{...c,imageOrder:[...c.imageOrder,t],promptTemplates:{...c.promptTemplates,[`image:${t}`]:``},imageDefinitions:{...c.imageDefinitions,[t]:{source:`generate`,assetId:null,prompt:``,templateKey:`image:${t}`}}}})},children:`Add generated image`}),c.imageOrder.length>=60?(0,h.jsx)(`p`,{children:`At most 60 images can be included.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(CZ,{label:`Add provided image`,kind:`images`,onPending:e=>n(`image:new`,e),onReady:f},`new-image:${e.config.sources.images===`off`}`),(0,h.jsx)(CZ,{label:`Add a video clip`,kind:`images`,accept:`video/mp4,video/quicktime,video/webm,video/x-matroska,.mp4,.mov,.m4v,.webm,.mkv`,onPending:e=>n(`clip:new`,e),onReady:f},`new-clip:${e.config.sources.images===`off`}`)]})]})}var CQ=q({logicalKey:W().min(1),logicalText:W(),segment:J([`body`,`intro`,`outro`]),text:W()});function wQ(e,t){if(t==null)return e;let n=[...t.intro??[],...t.body??[],...t.outro??[]];return n.length===0?e:n.flatMap(t=>e.filter(e=>e.key===t))}function TQ(e){let t=new Map,n=new Set,r=0;for(let i of e.pieces){if(!i.selected||i.stageKind!==`audio`||i.piece.kind!==`chunk`)continue;let e;try{e=i.piece.payload===null?null:JSON.parse(i.piece.payload)}catch{r++;continue}let a=CQ.safeParse(e);if(!a.success){r++;continue}let{logicalKey:o,logicalText:s}=a.data;if(n.has(o)){r++;continue}let c=t.get(o);if(c!==void 0&&c.text!==s){r+=c.parts+1,t.delete(o),n.add(o);continue}t.set(o,{key:o,text:s,parts:(c?.parts??0)+1})}return{groups:[...t.values()],unmapped:r}}function EQ({view:e,edit:t,onChange:n,onPending:r,getEdit:i}){let a=(0,m.useId)(),{api:o}=B(),s=I({queryKey:[`narration-chunks`,e.revision.projectId,e.revision.id],queryFn:async()=>{let t=await JY(o,e.revision.projectId,e.revision.id);return t.ok?t.value.chunks:null},staleTime:1/0}),c=TQ(e),l=wQ(c.groups,s.data),u=c.unmapped,d=(0,m.useRef)(t);d.current=t;let[f,p]=(0,m.useState)({});function g(e){d.current=e,n(e)}return(0,h.jsxs)(`section`,{"aria-label":`Edit narration`,className:`space-y-3`,children:[(0,h.jsx)(`h3`,{children:`Narration`}),t.config.chunking?.mode===`whole`||t.config.chunking===void 0?(0,h.jsx)(`p`,{children:`This narration uses one whole request. Editing its text rebuilds the whole narration request.`}):null,u===0?null:(0,h.jsx)(`p`,{children:`Some older audio cannot be matched reliably to its narration text. Replace the provided narration or rebuild from the article to edit those chunks.`}),l.map((e,n)=>{let o=t.content.narrationOverrides[e.key];return(0,h.jsxs)(`fieldset`,{className:`space-y-2 rounded-control border border-line2 p-3`,children:[(0,h.jsxs)(`legend`,{children:[`Narration chunk `,n+1]}),(0,h.jsxs)(`p`,{children:[e.parts,` audio `,e.parts===1?`part`:`parts`,` in this narration chunk.`]}),(0,h.jsxs)(`label`,{htmlFor:`${a}-${e.key}-text`,className:`block text-small`,children:[`Text for narration chunk `,n+1,(0,h.jsx)(qP,{id:`${a}-${e.key}-text`,value:o?.kind===`text`?o.text:e.text,onChange:n=>{p(t=>({...t,[e.key]:(t[e.key]??0)+1})),g({...t,...t.uploads===void 0?{}:{uploads:t.uploads.filter(t=>t.destination.kind!==`narration`||t.destination.key!==e.key)},content:{...t.content,narrationOverrides:{...t.content.narrationOverrides,[e.key]:{kind:`text`,text:n.target.value}}}})}})]}),(0,h.jsx)(CZ,{label:`Replace narration chunk ${n+1}`,kind:`audio`,onPending:t=>r(`narration:${e.key}`,t),onReady:t=>{let n=i?.()??d.current;g({...n,regenerate:(n.regenerate??[]).filter(t=>t!==e.key),uploads:[...(n.uploads??[]).filter(t=>t.destination.kind!==`narration`||t.destination.key!==e.key),{stagedFileId:t.id,destination:{kind:`narration`,key:e.key}}]})}},`${e.key}:${f[e.key]??0}`),t.regenerate?.includes(e.key)?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-done`,children:[`Narration chunk `,n+1,` will be regenerated when you save and Resume.`,(0,h.jsxs)(V,{type:`button`,variant:`ghost`,onClick:()=>{let t=i?.()??d.current;g({...t,regenerate:(t.regenerate??[]).filter(t=>t!==e.key)})},children:[`Keep narration chunk `,n+1]})]}):(0,h.jsxs)(V,{type:`button`,onClick:()=>{let t=i?.()??d.current,n={...t.content.narrationOverrides};n[e.key]?.kind===`asset`&&delete n[e.key],p(t=>({...t,[e.key]:(t[e.key]??0)+1})),g({...t,content:{...t.content,narrationOverrides:n},uploads:t.uploads?.filter(t=>t.destination.kind!==`narration`||t.destination.key!==e.key),regenerate:[...new Set([...t.regenerate??[],e.key])]})},children:[`Regenerate narration chunk `,n+1,` after review`]})]},e.key)})]})}function DQ(e){let{config:t,fingerprints:n}=e.revision;if(t.sources.audio===`off`)return;let r=t.sources.audio===`provide`?[{key:`audio:provided`,role:`audio_body`}]:[...t.intro===void 0?[]:[{key:`audio:intro`,role:`audio_intro`}],{key:`audio:body:concat`,role:`audio_body`},...t.outro===void 0?[]:[{key:`audio:outro`,role:`audio_outro`}]],i=e.outputs.filter(e=>e.selected&&e.state===`ready`&&e.available&&e.fingerprint===n[e.workKey]),a=r.map(({key:e,role:t})=>i.find(n=>n.workKey===e&&n.output.role===t));if(a.some(e=>e===void 0))return;let o=a.map(e=>e?.output.durationMs);if(o.every(OQ))return o.reduce((e,t)=>e+t,0)/1e3+Math.max(0,r.length-1)*t.silenceGapSeconds+2*t.edgeSilenceSeconds;let s=i.find(e=>(e.output.role===`audio_export`||e.output.role===`video`)&&OQ(e.output.durationMs))?.output.durationMs;return OQ(s)?s/1e3:void 0}function OQ(e){return e!=null&&Number.isFinite(e)&&e>0}function kQ({edit:e,prompts:t,problem:n,onChange:r,onPending:i,getEdit:a}){let{config:o}=e;if(o.sources.images!==`generate`)return null;let s=o.reference,c=s===void 0?uL:{source:s.source,prompt:s.prompt??``,thumbnail:s.thumbnail!==!1},l=e=>({...e,uploads:(e.uploads??[]).filter(e=>e.destination.kind!==`provided`||e.destination.stage!==`reference`)});return(0,h.jsx)(`section`,{"aria-label":`Establishing image`,className:`space-y-3`,children:(0,h.jsx)(fL,{value:c,prompts:t,problem:n,onChange:n=>{let{reference:i,...a}=o;if(n.source===`off`){r(l({...e,config:a}));return}let s={source:n.source,...n.source===`prompt`?{prompt:n.prompt}:{},...n.thumbnail?{}:{thumbnail:!1}},u=n.source===`prompt`&&n.prompt!==c.prompt?t.find(e=>e.kind===`image`&&e.name===n.prompt):void 0,d={...e,config:{...a,reference:s}},f=u===void 0?d:xZ(d,`referencePrompt`,u.body);r(n.source===`provide`?f:l(f))},upload:(0,h.jsx)(CZ,{label:e.content.provided.reference===void 0?`Upload the establishing image`:`Replace the establishing image`,kind:`images`,accept:`image/png,image/jpeg`,onPending:i,onReady:t=>{let n=l(a?.()??e);n.config.reference?.source===`provide`&&r({...n,uploads:[...n.uploads??[],{stagedFileId:t.id,destination:{kind:`provided`,stage:`reference`}}]})}})})})}var AQ=q({words:K(q({text:W().trim().min(1),start:G().finite().nonnegative(),end:G().finite().positive(),confidence:G().optional()})).min(1)});function jQ(e){let{config:t,content:n}=e;return JSON.stringify({source:t.sources.audio,audio:n.provided.audio,uploads:e.uploads?.filter(e=>e.destination.kind===`narration`||e.destination.kind===`provided`&&e.destination.stage===`audio`)??[],edge:t.edgeSilenceSeconds,...t.sources.audio===`generate`?{choice:t.audio,chunking:t.chunking,article:n.articleMarkdown??t.provided.article,articleSource:t.sources.article,renderedArticle:t.rendered.article,intro:t.intro,outro:t.outro,renderedIntro:t.rendered.intro,renderedOutro:t.rendered.outro,gap:t.silenceGapSeconds,overrides:n.narrationOverrides,regenerate:e.regenerate?.filter(e=>/^(audio:|article:|entry:)/.test(e))??[]}:{}})}function MQ({view:e,edit:t,fields:n,onChange:r,onPending:i,section:a}){let{api:o}=B(),s=I(Db(o)).data?.prompts??[],c=jQ(t),l=t.config.sources.audio!==`off`&&c===jQ({config:e.revision.config,content:e.revision.content}),u=e.revision.fingerprints[`subtitles:timing`],d=l?DQ(e):void 0,f=d!==void 0&&u!==void 0&&u!==``,p=(0,m.useRef)({edit:t,onChange:r,revisionId:e.revision.id,identity:c});p.current={edit:t,onChange:r,revisionId:e.revision.id,identity:c};let g=(0,m.useRef)(i);g.current=i;let[_,v]=(0,m.useState)(new Set),[y,b]=(0,m.useState)(),x=(0,m.useRef)(void 0),S=(0,m.useRef)(!0),C=(0,m.useCallback)((e,t)=>{S.current&&v(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,m.useEffect)(()=>{g.current(_.size>0)},[_]),(0,m.useEffect)(()=>(S.current=!0,()=>{S.current=!1,x.current?.abort(),g.current(!1)}),[]),(0,m.useEffect)(()=>{let t=e.revision.id;return()=>{(p.current.revisionId!==t||p.current.identity!==c)&&x.current?.abort()}},[e.revision.id,c]);function w(e){let t=p.current.onChange;p.current={...p.current,edit:e,identity:jQ(e)},t(e)}async function T(){if(x.current!==void 0)return;let t=new AbortController;x.current=t;let n=p.current;C(`captions:load`,!0),b(void 0);try{let r=e.outputs.find(e=>e.selected&&e.state===`ready`&&e.output.role===`subtitle_words`&&e.available);if(!f||d===void 0||u===void 0||r===void 0)throw Error(`Captions can't be edited until the current narration has finished and its subtitle timing is ready.`);let i=await o.fetch(ZY(o,e.revision.projectId,e.revision.id,r.recordId),{signal:t.signal});if(!i.ok)throw Error(`The subtitle timing file couldn't be read. Reload the page and try again; if it still fails, use Re-run section on Audio.`);let a=AQ.parse(await i.json()),s=0;for(let e of a.words){if(e.start<s||e.end<=e.start||e.end>d)throw Error(`The saved subtitle timing doesn't match the current narration. Use Re-run section on Audio to rebuild it.`);s=e.end}let c=_Q(a.words).map(e=>({...e,id:crypto.randomUUID()})),l=p.current;if(!S.current||t.signal.aborted||l.revisionId!==n.revisionId||l.identity!==n.identity||l.edit.content.subtitleCues!==n.edit.content.subtitleCues)return;w({...l.edit,content:{...l.edit.content,subtitleCues:{audioFingerprint:u,cues:c}}})}catch(e){S.current&&!t.signal.aborted&&b(e instanceof Error?e.message:String(e))}finally{x.current===t&&(x.current=void 0),C(`captions:load`,!1)}}let E=t.content.subtitleCues,D=e=>a===void 0||a===e;return(0,h.jsxs)(`div`,{className:`space-y-5`,children:[(0,h.jsxs)(`section`,{"aria-label":`Images`,hidden:!D(`images`),className:`space-y-5`,children:[(0,h.jsx)(kQ,{edit:t,prompts:s,problem:e=>n.find(t=>t.field===e||t.field===`content.${e}`)?.message,getEdit:()=>p.current.edit,onChange:w,onPending:e=>C(`provided:reference`,e)}),[`audio`,`thumbnail`].map(e=>t.config.sources[e]===`provide`?(0,h.jsx)(CZ,{label:`Replace provided ${e}`,kind:e,onPending:t=>C(`provided:${e}`,t),onReady:t=>{let n=p.current;n.edit.config.sources[e]===`provide`&&w({...n.edit,uploads:[...(n.edit.uploads??[]).filter(t=>t.destination.kind!==`provided`||t.destination.stage!==e),{stagedFileId:t.id,destination:{kind:`provided`,stage:e}}]})}},e):null),(0,h.jsx)(SQ,{getEdit:()=>p.current.edit,view:e,edit:t,onChange:w,onPending:C})]}),(0,h.jsx)(`section`,{"aria-label":`Narration`,hidden:!D(`narration`),className:`space-y-5`,children:t.config.sources.audio===`generate`?(0,h.jsx)(EQ,{getEdit:()=>p.current.edit,view:e,edit:t,onChange:w,onPending:C}):null}),y===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-red`,children:y}),(0,h.jsxs)(`section`,{"aria-label":`Captions`,hidden:!D(`captions`),className:`space-y-5`,children:[f?null:(0,h.jsx)(`p`,{children:`Captions can be edited once the current narration has finished and its subtitle timing is ready.`}),E===void 0?(0,h.jsx)(V,{type:`button`,disabled:!f||_.has(`captions:load`),onClick:()=>void T(),children:`Edit existing caption cues`}):(0,h.jsxs)(h.Fragment,{children:[E.audioFingerprint===u?null:(0,h.jsx)(`p`,{children:`These caption edits belong to an earlier narration. Review their text and timing against the current narration, then apply your corrections and save the project.`}),f&&d!==void 0?(0,h.jsx)(yQ,{cues:E.cues,duration:d,onPending:e=>C(`captions:dirty`,e),onChange:e=>{let t=p.current,n=t.edit.content.subtitleCues;n!==void 0&&w({...t.edit,content:{...t.edit.content,subtitleCues:{...n,cues:e}}})}},`${e.revision.id}:${u}`):null,(0,h.jsx)(V,{type:`button`,onClick:()=>w({...t,content:{...t.content,subtitleCues:void 0}}),children:`Discard caption edits`})]})]})]})}function NQ({edit:e,view:t,prompts:n,error:r,onChange:i}){let a=(0,m.useRef)(e.config.narrationPrompt);if(e.config.sources.audio!==`generate`)return null;let o=t.revision.config.narrationPrompt,s=t.revision.content.promptTemplates.narration??t.revision.config.rendered.narration,c=o&&s!==void 0&&!n.some(e=>e.kind===`narration`&&e.name===o)?[...n,{id:`saved-narration`,kind:`narration`,name:o,body:s,slots:[],updatedAt:t.revision.createdAt}]:n;return(0,h.jsx)(sL,{value:e.config.narrationPrompt??``,prompts:c,libraryLinks:!1,supported:e.config.audio?.provider===`inworld`&&e.config.audio.model===`inworld-tts-2`,error:r,onChange:t=>{let n=e.config.narrationPrompt||a.current;t===``&&(a.current=e.config.narrationPrompt);let r=c.find(e=>e.kind===`narration`&&e.name===t),o=r===void 0||t===n?e:xZ(e,`narration`,r.body);i({...o,config:{...o.config,narrationPrompt:t}})}})}function PQ({edit:e,prompts:t,entries:n,onChange:r}){let i=(0,m.useId)(),a=[...new Set([...Object.keys(e.config.rendered),...Object.keys(e.content.promptTemplates),...e.config.sources.article===`generate`?[`article`]:[],...fA(e.config)?[`narration`]:[],...mA(e.config)&&e.config.descriptionPrompt?[`description`]:[],...vA(e.config)&&e.config.shorts?.prompt?[`shorts`]:[],...vA(e.config)&&e.config.shorts?.imagePrompt?[`shortsImage`]:[],...[`from_prompt`,`prompt_by_llm`].includes(e.config.sources.thumbnail)?[`thumbnailPrompt`]:[],...gA(e.config)&&e.config.reference?.source===`prompt`?[`referencePrompt`]:[],...e.config.intro===void 0?[]:[`intro`],...e.config.outro===void 0?[]:[`outro`]])],o=[...new Set([...Object.keys(e.config.values),...Object.values(e.content.promptTemplates).flatMap(e=>e===null?[]:KF(e).names)])];return(0,h.jsxs)(`section`,{"aria-label":`Prompt snapshots`,className:`space-y-3`,children:[a.map(a=>{let o=LQ(a),s=e.content.promptTemplates[a]??null,c=a===`intro`||a===`outro`?n.filter(e=>e.category===a):t.filter(e=>e.kind===(a===`article`?`article`:a===`narration`?`narration`:a===`description`?`description`:a===`shorts`?`shorts`:a===`thumbnailPrompt`?`thumbnail`:`image`));return(0,h.jsxs)(`fieldset`,{className:`min-w-0 space-y-3 rounded-control border border-line p-3`,children:[(0,h.jsx)(`legend`,{className:`px-1 text-small font-semibold`,children:o}),s===null?(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(`p`,{children:`Original template unavailable. The saved rendered prompt stays frozen until you choose or write a template.`}),(0,h.jsx)(V,{type:`button`,"aria-label":`Use saved wording as template for ${o}`,onClick:()=>r(xZ(e,a,e.config.rendered[a]??``)),children:`Use saved wording as template`})]}):null,(0,h.jsx)(IQ,{label:o,raw:s,library:FQ(e,a,c),onUse:t=>r(xZ(e,a,t))}),(0,h.jsxs)(`label`,{htmlFor:`${i}-library-${a}`,className:`flex min-w-0 flex-col gap-1 text-small`,children:[`Use saved template for `,o,(0,h.jsxs)(YP,{id:`${i}-library-${a}`,value:``,onChange:t=>{let n=c.find(e=>e.id===t.target.value);if(n===void 0)return;let i=xZ(e,a,n.body),o=`category`in n?{...i.config,[n.category]:{name:n.name,mode:n.mode}}:a===`article`?{...i.config,articlePrompt:n.name}:a===`narration`?{...i.config,narrationPrompt:n.name}:a===`description`?{...i.config,descriptionPrompt:n.name}:(a===`shorts`||a===`shortsImage`)&&i.config.shorts!==void 0?{...i.config,shorts:{...i.config.shorts,[a===`shorts`?`prompt`:`imagePrompt`]:n.name}}:a===`thumbnailPrompt`?{...i.config,thumbnailPrompt:n.name}:a===`referencePrompt`&&i.config.reference!==void 0?{...i.config,reference:{...i.config.reference,prompt:n.name}}:i.config;r({...i,config:o})},children:[(0,h.jsx)(`option`,{value:``,children:`Choose explicitly`}),c.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(`label`,{htmlFor:`${i}-raw-${a}`,className:`block space-y-1 text-small`,children:[`Raw prompt for `,o,(0,h.jsx)(qP,{id:`${i}-raw-${a}`,rows:4,value:s??``,onChange:t=>r(xZ(e,a,t.target.value))})]}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`Saved rendered prompt`}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.config.rendered[a]??``})]})]},a)}),o.map(t=>(0,h.jsxs)(`label`,{htmlFor:`${i}-keyword-${t}`,className:`block space-y-1 text-small`,children:[`Keyword `,t,(0,h.jsx)(KP,{id:`${i}-keyword-${t}`,maxLength:200,value:e.config.values[t]??``,onChange:n=>r(yZ({...e,config:{...e.config,values:{...e.config.values,[t]:n.target.value}}}))})]},t))]})}function FQ(e,t,n){let{config:r}=e,i=/^imagePrompts\.(\d+)$/.exec(t),a=t===`article`?r.articlePrompt:t===`narration`?r.narrationPrompt:t===`description`?r.descriptionPrompt:t===`shorts`?r.shorts?.prompt:t===`shortsImage`?r.shorts?.imagePrompt:t===`thumbnailPrompt`?r.thumbnailPrompt:t===`referencePrompt`?r.reference?.prompt:i?.[1]===void 0?void 0:r.imagePrompts[Number(i[1])]?.name;if(a!==void 0&&a!==``)return n.find(e=>!(`category`in e)&&e.name===a)}function IQ({label:e,raw:t,library:n,onUse:r}){return n===void 0||t===null||n.body===t?null:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-control border border-line bg-panel2 px-3 py-2 text-small`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`The Library's “`,n.name,`” has changed since this project copied it. The project still uses its own copy below.`]}),(0,h.jsx)(V,{type:`button`,"aria-label":`Use the Library version for ${e}`,onClick:()=>{r(n.body)},children:`Use the Library version`})]})}function LQ(e){if(e===`article`)return`Article`;if(e===`narration`)return`Narration Preparation`;if(e===`description`)return`YouTube description`;if(e===`shorts`)return`Shorts`;if(e===`shortsImage`)return`Shorts image style`;if(e===`thumbnailPrompt`)return`Thumbnail`;if(e===`referencePrompt`)return`Establishing image`;if(e===`intro`)return`Intro`;if(e===`outro`)return`Outro`;let t=/^imagePrompts\.(\d+)$/.exec(e);return t?.[1]===void 0?e.replace(/[._-]/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`):`Image prompt ${Number(t[1])+1}`}function RQ(e,t,n){let{api:r}=B(),[i,a]=(0,m.useState)({busy:!1}),{config:o}=t,s=o.audio,c=async()=>{if(s!==void 0){a({busy:!0});try{let i=await es(r,e),{sharedGlossary:c,...l}=o;n({...t,config:{...l,audio:{...s,shareGlossary:!0},...i.entries.length===0?{}:{sharedGlossary:i.entries}}}),a({busy:!1,projects:i.projects})}catch(e){a({busy:!1,error:e instanceof Error?e.message:String(e)})}}},l=()=>{if(s===void 0)return;let{sharedGlossary:e,...r}=o;n({...t,config:{...r,audio:{...s,shareGlossary:!1}}})},u=o.sharedGlossary?.length??0,d=s?.shareGlossary===!0?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-label text-ink2`,children:[i.error===void 0?u===0?`No pronunciations from other projects are copied yet.`:`${String(u)} ${u===1?`term`:`terms`} copied from ${i.projects===void 0?`your other projects`:`${String(i.projects)} other ${i.projects===1?`project`:`projects`}`}.`:`Couldn't read your other projects' pronunciations: ${i.error}`,(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:i.busy,onClick:()=>void c(),children:i.busy?`Copying…`:`Update from other projects`})]}):void 0;return{value:s?.shareGlossary===!0,onChange:e=>{e?c():l()},note:d}}function zQ({projectId:e,edit:t,providers:n,voices:r,onChange:i}){let{config:a}=t,o=a.llm??{provider:``,model:``},s=a.audio??{provider:``,model:``,voice:``},c=RQ(e,t,i),l=a.images??{provider:``,model:``},u=fA(a)||a.sources.research===`generate`||a.sources.article===`generate`||a.sources.thumbnail===`prompt_by_llm`||a.sources.audio===`generate`&&(a.intro?.mode===`llm`||a.outro?.mode===`llm`),d=a.sources.images===`generate`||a.sources.thumbnail===`from_prompt`||a.sources.thumbnail===`prompt_by_llm`,f=r.filter(e=>e.provider===s.provider).map(e=>({value:e.voiceId,label:e.name}));return(0,h.jsxs)(`section`,{"aria-label":`Generation providers`,className:`grid min-w-0 gap-3 sm:grid-cols-2`,children:[u?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UI,{label:`Text provider`,family:`llm`,providers:n,value:o.provider,problem:void 0,onPick:e=>i({...t,config:{...a,llm:{provider:e,model:``}}})}),(0,h.jsx)(WI,{label:`Text model`,provider:o.provider,value:o.model,problem:void 0,onPick:e=>i({...t,config:{...a,llm:{...o,model:e}}})}),(0,h.jsx)(pL,{choice:o,onChange:e=>i({...t,config:{...a,llm:e}})})]}):null,a.sources.audio===`generate`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UI,{label:`Narration provider`,family:`tts`,providers:n,value:s.provider,problem:void 0,onPick:e=>i({...t,config:{...a,audio:{...s,provider:e,model:``,voice:``}}})}),(0,h.jsx)(WI,{label:`Narration model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>i({...t,config:{...a,audio:{...s,model:e}}})}),(0,h.jsx)(BI,{label:`Narration voice`,value:s.voice,problem:void 0,placeholder:`Choose a saved voice`,options:s.voice!==``&&!f.some(e=>e.value===s.voice)?[{value:s.voice,label:`${s.voice} (saved voice)`},...f]:f,onPick:e=>i({...t,config:{...a,audio:{...s,voice:e}}})}),(0,h.jsx)(JI,{value:a.chunking??{mode:`whole`},onPick:e=>i({...t,config:{...a,chunking:e}})}),(0,h.jsx)(cL,{shared:c,value:s.usePronunciationGlossary,supported:SA({sources:a.sources,audio:{...s,usePronunciationGlossary:!0}}),onChange:e=>i({...t,config:{...a,audio:{...s,usePronunciationGlossary:e}}})})]}):null,d?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UI,{label:`Image provider`,family:`image`,providers:n,value:l.provider,problem:void 0,onPick:e=>i({...t,config:{...a,images:{provider:e,model:``}}})}),(0,h.jsx)(WI,{label:`Image model`,provider:l.provider,value:l.model,problem:void 0,onPick:e=>i({...t,config:{...a,images:{...l,model:e}}})}),(0,h.jsx)(pL,{field:`images.thinking`,label:`Effort`,choice:l,onChange:e=>i({...t,config:{...a,images:e}})})]}):null]})}function BQ({edit:e,view:t,prompts:n,problem:r,onChange:i}){let a=t.revision.config.descriptionPrompt,o=t.revision.content.promptTemplates.description??t.revision.config.rendered.description,s=a&&o!==void 0&&!n.some(e=>e.kind===`description`&&e.name===a)?[...n,{id:`saved-description`,kind:`description`,name:a,body:o,slots:[],updatedAt:t.revision.createdAt}]:n,c=t.outputs.some(e=>e.selected&&e.workKey===VQ&&e.state===`ready`),l=e.regenerate?.includes(VQ)===!0;return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(DL,{enabled:e.config.youtubeDescription===!0,prompt:e.config.descriptionPrompt??``,prompts:s,narrated:e.config.sources.audio!==`off`,problem:r,onChange:({youtubeDescription:t,descriptionPrompt:n})=>{let r=s.find(e=>e.kind===`description`&&e.name===n),a=n===(e.config.descriptionPrompt??``)?e:r===void 0?HQ(e):xZ(e,`description`,r.body),{descriptionPrompt:o,...c}=a.config;i({...a,config:{...c,youtubeDescription:t,...n===``?{}:{descriptionPrompt:n}}})}}),c&&e.config.youtubeDescription===!0?l?(0,h.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-done`,children:[`The YouTube description will be written again when you save and Resume.`,(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>{i({...e,regenerate:(e.regenerate??[]).filter(e=>e!==VQ)})},children:`Keep the current description`})]}):(0,h.jsx)(V,{type:`button`,onClick:()=>{i({...e,regenerate:[...new Set([...e.regenerate??[],VQ])]})},children:`Write the description again after review`}):null]})}var VQ=`youtube:description`;function HQ(e){let{description:t,...n}=e.content.promptTemplates,{description:r,...i}=e.config.rendered;return yZ({config:{...e.config,rendered:i},content:{...e.content,promptTemplates:n}})}function UQ(e){let{view:t,edit:n,onChange:r,onPending:i,fields:a}=e,o=(0,m.useId)(),[s,c]=(0,m.useState)(e.focus?.section??`inputs`);(0,m.useEffect)(()=>{e.focus!==void 0&&c(e.focus.section)},[e.focus]);let[l,u]=(0,m.useState)({font:!1,content:!1,music:!1});(0,m.useEffect)(()=>{i(l.font||l.content||l.music)},[i,l]);let d=(0,m.useCallback)(e=>{u(t=>t.font===e?t:{...t,font:e})},[]),f=(0,m.useCallback)(e=>{u(t=>t.content===e?t:{...t,content:e})},[]),p=(0,m.useCallback)(e=>{u(t=>t.music===e?t:{...t,music:e})},[]),{api:g}=B(),_=I(Tb(g)),v=I(Eb(g)),y=I(Db(g)),b=I(Ob(g)),{config:x}=n,S=e=>a.find(t=>t.field===e||t.field===`config.${e}`||t.field===`edit.config.${e}`)?.message,C=kL({value:x.videoEdit,narrated:x.sources.audio!==`off`,imageProvider:x.images?.provider??``,problem:S,onChange:e=>r({...n,config:{...x,videoEdit:e}})}),w=[{id:`inputs`,label:`Inputs`},{id:`article`,label:`Article`,...n.content.articleEdited?{badge:`edited`}:{}},{id:`providers`,label:`Providers`},{id:`prompts`,label:`Prompts`},...x.sources.audio!==`off`||x.shorts?.enabled===!0?[{id:`shorts`,label:`Shorts`,...x.shorts?.enabled?{badge:`on`}:{}}]:[],{id:`subtitles`,label:`Subtitles`},{id:`images`,label:`Images`,badge:String(n.content.imageOrder.length)},...x.sources.audio===`generate`?[{id:`narration`,label:`Narration`}]:[],{id:`captions`,label:`Captions`,...n.content.subtitleCues===void 0?{}:{badge:String(n.content.subtitleCues.cues.length)}}],T=w.some(e=>e.id===s)?s:`inputs`,E=e=>z(`min-w-0 space-y-3`,T===e?void 0:`hidden`);return(0,h.jsxs)(`div`,{className:`grid min-w-0 gap-6 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,h.jsx)(`nav`,{"aria-label":`Edit sections`,className:`min-w-0 md:sticky md:top-16 md:self-start`,children:(0,h.jsx)(`ul`,{className:`flex gap-1 overflow-x-auto [scrollbar-width:none] md:flex-col`,children:w.map(e=>(0,h.jsx)(`li`,{className:`shrink-0`,children:(0,h.jsxs)(`button`,{type:`button`,"aria-current":e.id===T?`page`:void 0,onClick:()=>c(e.id),className:z(`flex min-h-9 w-full items-center justify-between gap-3 rounded-control px-3 text-left whitespace-nowrap`,e.id===T?`bg-panel2 font-semibold text-ink shadow-[inset_2px_0_0_var(--color-lamp-run)]`:`text-ink2 hover:bg-panel2 hover:text-ink`),children:[e.label,e.badge===void 0?null:(0,h.jsx)(`span`,{className:`text-label font-normal text-ink3`,children:e.badge})]})},e.id))})}),(0,h.jsxs)(`div`,{className:`min-w-0 space-y-3 rounded-panel border border-line bg-panel p-4`,children:[Object.entries({providers:_.error,voices:v.error,prompts:y.error,entries:b.error}).flatMap(([e,t])=>t===null?[]:[(0,h.jsx)(`p`,{role:`alert`,className:`text-small text-red`,children:t.message},e)]),a.length===0?null:(0,h.jsx)(`ul`,{role:`alert`,children:a.map(e=>(0,h.jsxs)(`li`,{children:[e.field,`: `,e.message]},`${e.field}-${e.message}`))}),(0,h.jsxs)(`section`,{"aria-label":`Inputs`,hidden:T!==`inputs`,className:E(`inputs`),children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-title`,className:`block space-y-1 text-small`,children:[`Project title`,(0,h.jsx)(KP,{id:`${o}-title`,value:x.title,maxLength:200,onChange:e=>r({...n,config:{...x,title:e.target.value}})})]}),(0,h.jsx)(lR,{value:x.format,onPick:e=>r({...n,config:{...x,format:e}})}),Gb.map(e=>(0,h.jsxs)(`label`,{htmlFor:`${o}-source-${e}`,className:`flex min-w-0 flex-col gap-1 text-small`,children:[e,` source`,(0,h.jsx)(YP,{id:`${o}-source-${e}`,value:qb(x.sources,e),onChange:i=>{let a=nM(e).find(e=>e.value===i.target.value);if(a===void 0)return;let o=bZ(n,e,a.value);r(e===`article`&&a.value===`provide`&&!n.content.articleEdited?{...o,content:{...o.content,articleMarkdown:t.articleMarkdown??n.content.articleMarkdown}}:o)},children:nM(e).map(t=>(0,h.jsx)(`option`,{value:t.value,disabled:e===`video`&&t.value===`generate`&&x.sources.images===`off`,children:t.label},t.value))})]},e)),x.sources.images===`off`?(0,h.jsx)(`p`,{children:`Images are Off. Video is also Off in these changes.`}):null,(0,h.jsxs)(`label`,{htmlFor:`${o}-document-theme`,className:`flex min-w-0 flex-col gap-1 text-small`,children:[`Document theme`,(0,h.jsx)(KI,{id:`${o}-document-theme`,disabled:qb(x.sources,`document`)===`off`,value:x.document,onChange:e=>{r({...n,config:{...x,document:e}})}})]}),(0,h.jsxs)(`label`,{htmlFor:`${o}-gap`,className:`block space-y-1 text-small`,children:[`Silence gap (seconds)`,(0,h.jsx)(KP,{id:`${o}-gap`,type:`number`,min:0,max:30,step:.1,value:Number.isFinite(x.silenceGapSeconds)?x.silenceGapSeconds:``,onChange:e=>r({...n,config:{...x,silenceGapSeconds:Number(e.target.value)}})})]}),x.sources.audio===`off`?null:(0,h.jsxs)(`div`,{className:`space-y-1 text-small`,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-edge`,className:`block space-y-1`,children:[`Silence at start and end (seconds)`,(0,h.jsx)(KP,{id:`${o}-edge`,"aria-describedby":`${o}-edge-hint`,type:`number`,min:0,max:30,step:.5,"aria-invalid":S(`edgeSilenceSeconds`)!==void 0,value:Number.isFinite(x.edgeSilenceSeconds)?x.edgeSilenceSeconds:``,onChange:e=>r({...n,config:{...x,edgeSilenceSeconds:Number(e.target.value)}})})]}),(0,h.jsx)(`p`,{id:`${o}-edge-hint`,className:`text-label text-ink3`,children:`Quiet time before the narration starts and after it ends.`}),S(`edgeSilenceSeconds`)?(0,h.jsx)(`p`,{className:`text-label text-red`,children:S(`edgeSilenceSeconds`)}):null]}),x.sources.video===`off`?null:(0,h.jsxs)(`div`,{className:`space-y-1 text-small`,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-image-seconds`,className:`block space-y-1`,children:[`Seconds per image`,(0,h.jsx)(KP,{id:`${o}-image-seconds`,"aria-describedby":`${o}-image-seconds-hint`,type:`number`,min:1,max:600,step:1,"aria-invalid":S(`imageSeconds`)!==void 0,value:Number.isFinite(x.imageSeconds)?x.imageSeconds:``,onChange:e=>r({...n,config:{...x,imageSeconds:Number(e.target.value)}})})]}),(0,h.jsx)(`p`,{id:`${o}-image-seconds-hint`,className:`text-label text-ink3`,children:`Each image stays on screen this long, then the next one; after the last image they start again.`}),S(`imageSeconds`)?(0,h.jsx)(`p`,{className:`text-label text-red`,children:S(`imageSeconds`)}):null]}),x.sources.video===`off`?null:(0,h.jsxs)(`div`,{className:`space-y-1 text-small`,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-zoom`,className:`block space-y-1`,children:[`Zoom (%)`,(0,h.jsx)(KP,{id:`${o}-zoom`,"aria-describedby":`${o}-zoom-hint`,type:`number`,min:0,max:50,step:.5,"aria-invalid":S(`zoomPercent`)!==void 0,value:Number.isFinite(x.zoomPercent)?x.zoomPercent:``,onChange:e=>r({...n,config:{...x,zoomPercent:Number(e.target.value)}})})]}),(0,h.jsx)(`p`,{id:`${o}-zoom-hint`,className:`text-label text-ink3`,children:`How far each image zooms in or out over its time on screen. 0 keeps images still.`}),S(`zoomPercent`)?(0,h.jsx)(`p`,{className:`text-label text-red`,children:S(`zoomPercent`)}):null]}),x.sources.video===`off`?null:(0,h.jsxs)(`div`,{className:`space-y-1 text-small`,children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-motion`,className:`flex min-w-0 flex-col gap-1`,children:[`Motion`,(0,h.jsx)(YP,{id:`${o}-motion`,"aria-describedby":`${o}-motion-hint`,value:x.motionStyle,onChange:e=>r({...n,config:{...x,motionStyle:e.target.value}}),children:Jb.map(e=>(0,h.jsx)(`option`,{value:e,children:$k[e]},e))})]}),(0,h.jsx)(`p`,{id:`${o}-motion-hint`,className:`text-label text-ink3`,children:`How each image moves while it's on screen.`})]}),x.sources.video===`off`?null:C.cuts,x.sources.video===`off`?null:C.look,[`intro`,`outro`].map(e=>(0,h.jsxs)(`label`,{htmlFor:`${o}-entry-${e}`,className:`flex min-w-0 flex-col gap-1 text-small`,children:[e,(0,h.jsxs)(YP,{id:`${o}-entry-${e}`,value:x[e]?.name??``,onChange:t=>{let i=b.data?.entries.find(n=>n.category===e&&n.name===t.target.value),a={...x};i===void 0?delete a[e]:a[e]={name:i.name,mode:i.mode},r(yZ({...n,config:a,content:i===void 0?n.content:{...n.content,promptTemplates:{...n.content.promptTemplates,[e]:i.body}}}))},children:[(0,h.jsx)(`option`,{value:``,children:`Off`}),x[e]!==void 0&&!b.data?.entries.some(t=>t.category===e&&t.name===x[e]?.name)?(0,h.jsxs)(`option`,{value:x[e]?.name,children:[x[e]?.name,` (saved entry)`]}):null,b.data?.entries.filter(t=>t.category===e).map(e=>(0,h.jsx)(`option`,{value:e.name,children:e.name},e.id))]})]},e)),x.sources.research===`provide`?(0,h.jsxs)(`label`,{htmlFor:`${o}-research`,className:`block space-y-1 text-small`,children:[`Research notes`,(0,h.jsx)(qP,{id:`${o}-research`,rows:6,value:x.provided.research??``,onChange:e=>r({...n,config:{...x,provided:{...x.provided,research:e.target.value}}})})]}):null]}),(0,h.jsxs)(`section`,{"aria-label":`Article`,hidden:T!==`article`,className:E(`article`),children:[(0,h.jsxs)(`label`,{htmlFor:`${o}-article`,className:`block space-y-1 text-small`,children:[`Article text`,(0,h.jsx)(qP,{id:`${o}-article`,rows:6,maxLength:5e5,value:(n.content.articleEdited?n.content.articleMarkdown:t.articleMarkdown)??n.content.articleMarkdown??x.provided.article??``,onChange:e=>r({...n,content:{...n.content,articleMarkdown:e.target.value,articleEdited:!0}})})]}),n.content.articleEdited?(0,h.jsx)(`p`,{children:`Your edited article is retained when other settings change. Explicit regeneration replaces it after rebuild review.`}):null,x.sources.article===`generate`?(0,h.jsx)(V,{type:`button`,onClick:()=>r({...n,regenerate:[...new Set([...n.regenerate??[],`article:body`])]}),children:`Regenerate article after review`}):null]}),(0,h.jsxs)(`section`,{"aria-label":`Providers`,hidden:T!==`providers`,className:E(`providers`),children:[(0,h.jsx)(zQ,{projectId:t.revision.projectId,edit:n,providers:_.data?.providers??[],voices:v.data?.voices??[],onChange:r}),(0,h.jsx)(NQ,{edit:n,view:t,prompts:y.data?.prompts??[],error:S(`narrationPrompt`),onChange:r})]}),(0,h.jsxs)(`section`,{"aria-label":`Prompts`,hidden:T!==`prompts`,className:E(`prompts`),children:[(0,h.jsx)(BQ,{edit:n,view:t,prompts:y.data?.prompts??[],problem:S,onChange:r}),(0,h.jsx)(PQ,{edit:n,prompts:y.data?.prompts??[],entries:b.data?.entries??[],onChange:r})]}),(0,h.jsx)(`section`,{"aria-label":`Shorts`,hidden:T!==`shorts`,className:E(`shorts`),children:(0,h.jsx)(kZ,{edit:n,view:t,prompts:y.data?.prompts??[],problem:S,onChange:r,onPending:p})}),(0,h.jsx)(`section`,{"aria-label":`Subtitles`,hidden:T!==`subtitles`,className:E(`subtitles`),children:(0,h.jsx)(`div`,{"data-tour":`project-subtitles`,children:(0,h.jsx)(cR,{value:x.subtitles??UA,format:x.format,audioEnabled:x.sources.audio!==`off`,videoEnabled:x.sources.video!==`off`,onChange:e=>r({...n,config:{...x,subtitles:Xj(e,x.sources)}}),onUploading:d,problem:S})})}),e.renderContent?.({view:t,edit:n,fields:a,onChange:r,onPending:f,section:T})]})]})}function WQ({title:e,info:t,children:n}){return(0,h.jsxs)(`div`,{className:`mb-4 flex min-h-8 flex-wrap items-center gap-2`,children:[(0,h.jsx)(`h2`,{className:`text-row font-semibold`,children:e}),t===void 0?null:(0,h.jsx)(DI,{label:e,children:(0,h.jsx)(`p`,{children:t})}),n===void 0?null:(0,h.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:n})]})}var GQ={notes:`Research notes`,article_md:`Article (Markdown)`,article_txt:`Article text`,narration_txt:`Clean Narration`,tts_script:`TTS Script`,sources:`Research sources`,glossary:`Glossary`,audio_body:`Narration`,audio_intro:`Intro narration`,audio_outro:`Outro narration`,audio_export:`Audio export`,image:`Image`,thumbnail:`Thumbnail`,video:`Video`,render_params:`Export settings`,subtitles_srt:`Subtitles (SRT)`,subtitles_vtt:`Subtitles (VTT)`,subtitle_words:`Subtitle timing`,subtitle_ass:`Styled subtitles`,subtitle_font:`Subtitle font`,instructions:`Generation instructions`,document_pdf:`Document (PDF)`,youtube_description:`YouTube description`,youtube_tags:`YouTube tags`,shorts:`Shorts list`,short_image:`Short image`,short_video:`Short`,animated_image:`Animated image`,reference:`Establishing image (reference)`};function KQ(e){return(e.role===`narration_txt`||e.role===`tts_script`)&&e.meta.segment?`${e.meta.segment===`body`?`Body`:e.meta.segment===`intro`?`Intro`:`Outro`} ${GQ[e.role]}`:e.role===`short_video`&&typeof e.meta.short==`number`?`Short ${String(e.meta.short)}`:e.role===`short_image`&&typeof e.meta.short==`number`?`Short ${String(e.meta.short)} image ${String(e.meta.index??1)}`:e.role===`animated_image`&&typeof e.meta.index==`number`?`Animated image ${String(e.meta.index)}`:e.role===`image`&&typeof e.meta.index==`number`?`Image ${e.meta.index}`:GQ[e.role]}function qQ(e){if(e.startsWith(`image:`))return`Image`;if(e.startsWith(`animate:`))return GQ.animated_image;if(/^shorts:\d+:render$/.test(e))return GQ.short_video;if(/^shorts:\d+:image:\d+$/.test(e))return GQ.short_image;if(e===`document:pdf`)return GQ.document_pdf;let t=e.split(`:`).at(-1);return Object.entries(GQ).find(([e])=>e===t)?.[1]??`Saved output`}function JQ({preview:e,pending:t,feedback:n,onStart:r,onCancel:i}){let a=QQ(e),[o,s]=(0,m.useState)([]),[c,l]=(0,m.useState)(!1),u=e=>e===null?`Unknown`:new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,maximumFractionDigits:4}).format(e),d=!e.work.some(e=>e.disposition===`blocked`)&&e.providedReuseRequired.every(e=>o.includes(e))&&(e.costs.unknown===0||c);return(0,h.jsxs)(`section`,{"aria-label":`Review affected rebuild`,className:`space-y-3`,children:[e.review?.inputChanges.length?(0,h.jsxs)(`details`,{open:!0,children:[(0,h.jsx)(`summary`,{children:`Changed inputs since the previous revision`}),(0,h.jsx)(`dl`,{className:`space-y-3`,children:e.review.inputChanges.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`font-semibold`,children:e.label}),(0,h.jsxs)(`dd`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`Before`}),(0,h.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words text-small`,children:e.before??`Not set`})]}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`After`}),(0,h.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words text-small`,children:e.after??`Not set`})]})]})]},e.label))})]}):null,(0,h.jsx)(`ul`,{children:e.changedInputs.map(e=>(0,h.jsxs)(`li`,{children:[a(e.path),`:`,` `,e.after===null?`Removed`:e.before===null?`New output`:`Inputs changed`]},e.path))}),(0,h.jsx)(`ul`,{children:e.work.map(t=>(0,h.jsxs)(`li`,{children:[a(t.key),`: `,YQ[t.disposition],`. `,t.reason,t.inflight?` An already submitted request may still be billed.`:``,e.review?.requests.filter(e=>e.key===t.key).map(e=>(0,h.jsxs)(`div`,{children:[e.settings===null?null:(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:e.settings}),e.text===null?null:(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`View request text`}),(0,h.jsx)(`pre`,{className:`max-h-56 overflow-auto whitespace-pre-wrap break-words text-small`,children:e.text})]})]},e.key))]},t.key))}),(0,h.jsxs)(`p`,{children:[`Retained outputs:`,` `,e.retained.map(e=>qQ(e.slot)).join(`, `)||`None`]}),e.wholeRequestNotice===null?null:(0,h.jsx)(`p`,{children:e.wholeRequestNotice}),(0,h.jsx)(`ul`,{children:e.costs.rows.map(e=>(0,h.jsxs)(`li`,{children:[a(e.stage),`: `,u(e.low),`–`,u(e.high),`. `,e.detail]},`${e.stage}-${e.detail}`))}),(0,h.jsxs)(`p`,{children:[`Known estimate: `,u(e.costs.low),`–`,u(e.costs.high)]}),e.warnings.map(e=>(0,h.jsx)(`p`,{children:e},e)),e.providedReuseRequired.map(e=>(0,h.jsxs)(`label`,{className:`block`,children:[(0,h.jsx)(`input`,{type:`checkbox`,disabled:t,checked:o.includes(e),onChange:t=>s(t.target.checked?[...o,e]:o.filter(t=>t!==e))}),`Keep the provided content for `,a(e)]},e)),e.costs.unknown===0?null:(0,h.jsxs)(`label`,{className:`block`,children:[(0,h.jsx)(`input`,{type:`checkbox`,disabled:t,checked:c,onChange:e=>l(e.target.checked)}),`I understand that `,e.costs.unknown,` cost estimates are unknown.`]}),n,(0,h.jsxs)(`div`,{className:`sticky bottom-[-16px] -mx-4 flex flex-wrap gap-3 border-t border-line bg-panel px-4 py-3`,children:[(0,h.jsx)(V,{variant:`primary`,type:`button`,disabled:t||!d,onClick:()=>r({acknowledgeUnknownCosts:c,confirmedProvidedWorkKeys:o}),children:t?`Starting rebuild…`:`Start rebuild`}),(0,h.jsx)(V,{type:`button`,disabled:t,onClick:i,children:`Cancel rebuild`})]})]})}var YQ={reuse:`Reuse`,generate:`Generate`,local:`Build locally`,review:`Review required`,blocked:`Unavailable`},XQ={"export:wav":`Audio export (WAV)`,"export:video":`Video export`,"subtitles:timing":`Subtitle timing`,"subtitles:cues":`Caption text and timing`,"subtitles:files":`Subtitle files`,"article:body":`Article`,"audio:provided":`Provided narration`,"audio:body:concat":`Combined narration`,"audio:intro":`Combined intro narration`,"audio:outro":`Combined outro narration`,"research:planner":`Research plan`,"research:notes":`Research notes`,"entry:intro:text":`Intro text`,"entry:outro:text":`Outro text`};function ZQ(e){let t=XQ[e];return t===void 0?{image:`Image request`,images:`Images`,audio:`Narration request`,article:`Article`,research:`Research`,thumbnail:`Thumbnail`,subtitles:`Subtitles`,video:`Video export`,export:`Export`,entry:`Intro or outro`}[e.split(`:`)[0]??``]??`Output`:t}function QQ(e){let t=new Map,n=new Map;for(let t of e.work){let e=ZQ(t.key);n.set(e,(n.get(e)??0)+1)}let r=new Map;for(let i of e.work){let e=ZQ(i.key),a=(r.get(e)??0)+1;r.set(e,a),t.set(i.key,(n.get(e)??0)>1?`${e} ${a}`:e)}for(let n of e.review?.requests??[])t.set(n.key,n.label);return e=>t.get(e)??ZQ(e)}var $Q={llm:`Text generation`,image:`Images`,images:`Images`,tts:`Audio`,audio:`Audio`};function e$({error:e,refusal:t}){let n=(0,m.useRef)(null);return(0,m.useEffect)(()=>{(e!==void 0||t!==void 0)&&n.current?.focus()},[e,t]),e===void 0&&t===void 0?null:(0,h.jsxs)(`div`,{ref:n,role:`alert`,tabIndex:-1,className:`space-y-2 rounded-control border border-red p-3 text-red`,children:[(0,h.jsx)(`p`,{children:e??(t?.reason===`readiness`?t.fields.length>0?`This can't start yet. Fix the items below, then try again.`:`Slopify couldn't check your providers. Open Settings → Providers, make sure each one you use is set up, then try again.`:t?.message)}),t?.fields.length?(0,h.jsx)(`ul`,{className:`list-disc pl-5`,children:t.fields.map(({field:e,message:t})=>(0,h.jsxs)(`li`,{children:[$Q[e.split(`.`)[0]??``]??`Project`,`: `,t]},`${e}:${t}`))}):null]})}var Dee=q({text:W().optional(),logicalText:W().optional(),title:W().optional(),notes:W().optional(),outline:K(W()).optional(),prompt:W().optional()});function t$(e){if(e===null)return`No text was recorded for this part.`;try{let t=Dee.safeParse(JSON.parse(e));if(!t.success)return`Recorded text cannot be decoded.`;let{logicalText:n,text:r,title:i,notes:a,outline:o,prompt:s}=t.data;return[n,r,a?.trim()?[i,a].filter(e=>e?.trim()).join(`
|
|
163
|
+
|
|
164
|
+
`):void 0,o?.filter(e=>e.trim()).map((e,t)=>`${t+1}. ${e}`).join(`
|
|
165
|
+
`),s].find(e=>e?.trim())??`No text was recorded for this part.`}catch{return`Recorded text cannot be decoded.`}}function n$({projectId:e,pending:t,onRestore:n}){let{api:r}=B(),[i,a]=(0,m.useState)(),o=I({queryKey:H.revisions(e),queryFn:async()=>{let t=await GY(r,e);if(!t.ok)throw Error(t.message);return t.value.revisions}}),s=I({queryKey:H.revision(e,i??``),enabled:i!==void 0,queryFn:async()=>{if(i===void 0)throw Error(`Choose a version from History first.`);let t=await KY(r,e,i);if(!t.ok)throw Error(t.message);return t.value.view}}),c=s.data,l=c?.outputs.find(e=>e.selected&&e.available&&(e.output.role===`image`||e.output.role===`thumbnail`));return(0,h.jsxs)(`section`,{"aria-label":`Project history`,className:`space-y-3 rounded-panel border border-line bg-panel p-4`,children:[(0,h.jsx)(`h2`,{children:`Project history`}),o.error===null?null:(0,h.jsx)(`p`,{role:`alert`,children:o.error.message}),(0,h.jsx)(`ol`,{className:`space-y-2`,children:o.data?.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(V,{type:`button`,onClick:()=>a(e.id),children:[e.title,` · `,e.createdAt,e.current?` · Current`:``]})},e.id))}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,children:s.error.message}),c===void 0?null:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsx)(`h3`,{children:c.revision.config.title}),l===void 0?null:(0,h.jsxs)(`span`,{className:`inline-flex gap-3`,children:[(0,h.jsx)(`a`,{href:$Y(r,e,c.revision.id),download:!0,children:`Download all images`}),(0,h.jsx)(eX,{projectId:e,asset:``,folder:{revisionId:c.revision.id,recordId:l.recordId}})]}),(0,h.jsx)(`ul`,{className:`space-y-3`,children:c.outputs.map(t=>(0,h.jsxs)(`li`,{className:`space-y-2 rounded-control border border-line p-3`,children:[KQ(t.output),` · `,t.state,t.selected?``:` · Earlier result`,`:`,` `,t.available?(0,h.jsx)(`a`,{href:ZY(r,e,c.revision.id,t.recordId),children:`Download`}):`File missing`,t.available?(0,h.jsx)(eX,{projectId:e,asset:``,folder:{revisionId:c.revision.id,recordId:t.recordId}}):null,t.available?(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`Preview retained output`}),t.output.role===`video`?(0,h.jsx)(`video`,{className:`max-h-[480px] max-w-full`,controls:!0,preload:`metadata`,src:ZY(r,e,c.revision.id,t.recordId)}):[`audio_export`,`audio_body`,`audio_intro`,`audio_outro`].includes(t.output.role)?(0,h.jsx)(`audio`,{className:`max-w-full`,controls:!0,preload:`metadata`,src:ZY(r,e,c.revision.id,t.recordId)}):t.output.role===`image`||t.output.role===`thumbnail`?(0,h.jsx)(`img`,{className:`max-h-[480px] max-w-full object-contain`,alt:KQ(t.output),loading:`lazy`,src:ZY(r,e,c.revision.id,t.recordId)}):(0,h.jsx)(`p`,{children:`Use Download to inspect this retained file.`})]}):null]},t.recordId))}),(0,h.jsx)(`ul`,{"aria-label":`Retained narration parts`,children:c.pieces.filter(e=>e.stageKind===`audio`&&e.assetId!==null).map(t=>(0,h.jsxs)(`li`,{children:[`Narration part `,t.piece.idx,t.selected?``:` · Earlier result`,t.available?(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`Preview retained audio part`}),(0,h.jsx)(`audio`,{className:`max-w-full`,controls:!0,preload:`metadata`,src:ZY(r,e,c.revision.id,t.recordId)}),(0,h.jsx)(`a`,{href:ZY(r,e,c.revision.id,t.recordId),children:`Download narration part`}),(0,h.jsx)(eX,{projectId:e,asset:``,folder:{revisionId:c.revision.id,recordId:t.recordId}})]}):(0,h.jsx)(`span`,{children:` · File missing`})]},t.recordId))}),(0,h.jsx)(`ul`,{"aria-label":`Retained text parts`,children:c.pieces.filter(e=>e.assetId===null).map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(`details`,{children:[(0,h.jsxs)(`summary`,{children:[e.stageKind,` part `,e.piece.idx]}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:t$(e.piece.payload)})]})},e.recordId))}),(0,h.jsx)(V,{type:`button`,disabled:t,onClick:()=>n(c.revision.id),children:`Restore this revision`})]})]})}function r$(e,t,n){let r=JSON.stringify(t);return e?.payload===r?e:{payload:r,idempotencyKey:n()}}function i$({projectId:e,currentRevisionId:t,renderEditor:n,tab:r,onTab:i,output:a,checkpoints:o,checkpointBadge:s,trailing:c}){let[l,u]=(0,m.useState)(a===void 0?`edit`:`output`),d=r??l,f=e=>{u(e),i?.(e)},{api:p}=B(),g=_(),v=I({queryKey:H.revision(e,t??``),enabled:t!==null,queryFn:async()=>{if(t===null)throw Error(`This project has no saved settings to show yet. Reload the page and try again.`);let n=await KY(p,e,t);if(!n.ok)throw Error(n.message);return n.value.view}}),[y,b]=(0,m.useState)(),[x,S]=(0,m.useState)(),[C,w]=(0,m.useState)(),[T,E]=(0,m.useState)(),[D,O]=(0,m.useState)(!1),[k,ee]=(0,m.useState)(!1),[A,j]=(0,m.useState)(),[M,N]=(0,m.useState)(),P=(0,m.useRef)(void 0),F=(0,m.useRef)(void 0),te=(0,m.useRef)(void 0),ne=(0,m.useMemo)(()=>x!==void 0&&(y===void 0||(x.regenerate?.length??0)>0||(x.uploads?.length??0)>0||JSON.stringify(x.config)!==JSON.stringify(y.revision.config)||JSON.stringify(x.content)!==JSON.stringify(y.revision.content)),[x,y]),re=x!==void 0&&y!==void 0&&t!==null&&t!==y.revision.id,ie=(0,m.useRef)(!1);async function ae(e){if(!ie.current){ie.current=!0,O(!0),j(void 0),N(void 0);try{await e()}catch(e){j(e instanceof Error?e.message:String(e))}finally{ie.current=!1,O(!1)}}}async function oe(t){let n=await HY(p,e);if(!n.ok){N(n);return}return N(void 0),b(n.value.view),t&&S({config:structuredClone(n.value.view.revision.config),content:structuredClone(n.value.view.revision.content)}),n.value.view}function se(e){ae(async()=>{let t=y,n=x;if(t===void 0||n===void 0){if(t=await oe(!1),t===void 0)return;n={config:structuredClone(t.revision.config),content:structuredClone(t.revision.content)}}S(e.change(n,t)),E({section:e.section}),f(`edit`)})}async function ce(t){let n=await bo(p,e);if(g.setQueryData(H.project(e),n),await g.invalidateQueries({queryKey:H.revisions(e)}),!t.current||n.revisionId!==t.revision.id){N({ok:!1,reason:`conflict`,message:`The project changed again. Your draft is preserved.`,currentRevisionId:n.revisionId,fields:[]});return}b(t),S(void 0),N(void 0),w(void 0)}async function le(){if(k||y===void 0||x===void 0)return;let t={baseRevisionId:y.revision.id,edit:x},n=r$(P.current,t,()=>crypto.randomUUID());P.current=n;let r=await UY(p,e,{...t,idempotencyKey:n.idempotencyKey});if(!r.ok){N(r);return}await ce(r.value.view),P.current=void 0}async function ue(){let t=await oe(!1);if(t===void 0)return;let n=await YY(p,e,{baseRevisionId:t.revision.id,request:{kind:`allAffected`}});if(!n.ok){N(n);return}w(n.value.value),te.current=void 0}async function de(t){if(C===void 0)return;let n={baseRevisionId:C.baseRevisionId,previewId:C.id,...t},r=r$(te.current,n,()=>crypto.randomUUID());te.current=r;let i=await XY(p,e,{...n,idempotencyKey:r.idempotencyKey});if(!i.ok){N(i),(i.reason===`stale-preview`||i.reason===`conflict`)&&w(void 0);return}te.current=void 0,w(void 0),await g.invalidateQueries({queryKey:H.project(e)})}async function fe(t){let n=y??v.data??await oe(!1);if(n===void 0)return;let r={baseRevisionId:n.revision.id,targetRevisionId:t},i=r$(F.current,r,()=>crypto.randomUUID());F.current=i;let a=await WY(p,e,{...r,idempotencyKey:i.idempotencyKey});if(!a.ok){N(a);return}await ce(a.value.view),F.current=void 0}let pe=D||k||x!==void 0||C!==void 0,me=(0,h.jsx)(V,{type:`button`,disabled:D,onClick:()=>void ae(async()=>{F.current=void 0,te.current=void 0,w(void 0),await oe(!1),await g.invalidateQueries({queryKey:H.project(e)})}),children:`Reload current revision`}),he=[...a===void 0?[]:[{id:`output`,label:`Output`}],{id:`edit`,label:`Edit`,...ne?{badge:`· unsaved`}:{}},{id:`history`,label:`History`},...o===void 0?[]:[{id:`checkpoints`,label:`Checkpoints`,...s===void 0?{}:{badge:s}}]];return(0,h.jsxs)(`section`,{"aria-label":`Project revisions`,children:[(0,h.jsx)(xF,{items:he,value:d,onChange:f,label:`Project views`,idPrefix:`project`,trailing:c,className:`mb-4`}),a===void 0?null:(0,h.jsx)(CF,{idPrefix:`project`,id:`output`,active:d===`output`,children:(0,h.jsx)(MX,{value:D||C!==void 0?void 0:se,children:a})}),(0,h.jsx)(CF,{idPrefix:`project`,id:`edit`,active:d===`edit`,children:y===void 0||x===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(WQ,{title:`Saved revision`,info:`Resume uses the current saved revision. Edit project saves a new revision without starting work; Rebuild affected outputs opens optional Advanced rebuild review for selection, cost details and supplied-content confirmation.`}),v.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`mb-3 text-small text-red`,children:v.error.message}),v.data===void 0?null:(0,h.jsx)(`ul`,{"aria-label":`Saved output status`,className:`overflow-hidden rounded-panel border border-line bg-panel`,children:v.data.outputs.filter(e=>e.selected).map(e=>(0,h.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-x-4 border-b border-line px-4 py-2 text-small last:border-b-0`,children:[(0,h.jsxs)(`span`,{className:`font-semibold`,children:[KQ(e.output),`: `]}),(0,h.jsx)(`span`,{className:`text-ink2`,children:e.available?e.state===`ready`?`Ready`:e.state===`outdated`?`Needs rebuild; retained output available`:`Provided content needs review`:`Retained file missing`})]},e.recordId))}),C===void 0&&d===`edit`?(0,h.jsx)(e$,{error:A,refusal:M}):null,(0,h.jsxs)(DP,{children:[M?.reason===`conflict`&&d===`edit`?me:null,(0,h.jsx)(V,{type:`button`,disabled:pe,onClick:()=>void ae(ue),children:`Rebuild affected outputs`}),(0,h.jsx)(V,{type:`button`,variant:`primary`,disabled:pe,onClick:()=>void ae(async()=>{await oe(!0)}),children:`Edit project`})]})]}):(0,h.jsxs)(`form`,{"aria-label":`Edit project`,onSubmit:e=>{e.preventDefault(),ae(le)},children:[(0,h.jsx)(`fieldset`,{disabled:D,className:`min-w-0`,children:n({view:y,edit:x,fields:M?.fields??[],onChange:S,onPending:ee,...T===void 0?{}:{focus:T}})}),C===void 0?(0,h.jsx)(e$,{error:A,refusal:M}):null,(0,h.jsxs)(DP,{status:(0,h.jsx)(EP,{tone:re?`warning`:`info`,children:re?`A newer revision is available. Your unsaved changes are kept below.`:k?`Waiting for uploads to finish…`:void 0}),children:[re||M?.reason===`conflict`?(0,h.jsx)(V,{type:`button`,disabled:D||k,onClick:()=>void ae(async()=>{P.current=void 0,ee(!1),await oe(!0),N(void 0)}),children:`Reload current revision and discard my draft`}):null,(0,h.jsx)(V,{type:`button`,disabled:D||k,onClick:()=>{S(void 0),N(void 0),ee(!1),P.current=void 0},children:`Discard changes`}),(0,h.jsx)(V,{variant:`primary`,type:`submit`,disabled:D||k,children:`Save changes`})]})]})}),(0,h.jsxs)(CF,{idPrefix:`project`,id:`history`,active:d===`history`,children:[d===`history`&&C===void 0&&(A||M)?(0,h.jsxs)(`div`,{className:`mb-4 space-y-3`,children:[(0,h.jsx)(e$,{error:A,refusal:M}),x===void 0&&M?.reason===`conflict`?me:null]}):null,d===`history`?(0,h.jsx)(n$,{projectId:e,pending:pe,onRestore:e=>void ae(()=>fe(e))}):null]}),o===void 0?null:(0,h.jsx)(CF,{idPrefix:`project`,id:`checkpoints`,active:d===`checkpoints`,children:o}),(0,h.jsx)(dI,{open:C!==void 0,title:`Review affected rebuild`,onClose:()=>{D||(w(void 0),te.current=void 0)},children:C===void 0?null:(0,h.jsx)(JQ,{preview:C,feedback:(0,h.jsx)(e$,{error:A,refusal:M}),pending:D,onStart:e=>void ae(()=>de(e)),onCancel:()=>{w(void 0),te.current=void 0}},C.id)})]})}var a$=q({id:rO(),name:W(),version:G().int().positive(),updatedAt:W()}),o$=a$.extend({document:oj}),s$=PO([o$,q({template:o$}).transform(e=>e.template)]),c$=q({title:W(),detail:W().optional(),reason:W().optional()}),l$=[`project-templates`],u$=e=>`${e.origin}/api/project-templates`;async function d$(e,t){let n;try{n=await e.json()}catch{throw ro(e,void 0)}if(e.ok)return{ok:!0,value:uo(t,n)};let r=c$.safeParse(n);if(!r.success)throw ro(e,void 0);let i=r.data.detail??r.data.title;if(![400,404,409].includes(e.status))throw Error(i);return{ok:!1,message:i,reason:r.data.reason??`invalid-request`}}var f$=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});async function p$(e){return d$(await e.fetch(u$(e)),q({templates:K(a$)}).transform(e=>e.templates))}function m$(e){return{queryKey:l$,queryFn:async()=>{let t=await p$(e);if(!t.ok)throw Error(t.message);return t.value}}}async function h$(e,t){return d$(await e.fetch(`${u$(e)}/${encodeURIComponent(t)}`),s$)}async function g$(e,t){let n=q({id:rO(),name:W().trim().min(1),document:oj}).parse(t);return d$(await e.fetch(u$(e),f$(`POST`,n)),s$)}async function _$(e,t,n){let r=q({id:rO(),name:W().trim().min(1).max(200),revisionId:W().min(1).max(64)}).parse(n);return d$(await e.fetch(`${u$(e)}/from-project/${encodeURIComponent(t)}`,f$(`POST`,r)),s$)}async function v$(e,t){let n=await e.fetch(`${u$(e)}/${encodeURIComponent(t.id)}`,f$(`DELETE`,{baseVersion:t.version}));return n.ok?{ok:!0,value:null}:d$(n,EO())}async function y$(e,t,n){let r=q({id:rO(),version:G().int().positive()}).parse({id:n,version:t.version});return d$(await e.fetch(`${u$(e)}/${encodeURIComponent(t.id)}/instantiate`,f$(`POST`,r)),PO([gj,q({draft:gj}).transform(e=>e.draft)]))}function b$({projectId:e,revisionId:t,title:n}){let{api:r}=B(),i=_(),a=(0,m.useId)(),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(null),f=ml(),p=(0,m.useRef)(!1),g=(0,m.useRef)(null);async function v(){if(!o||p.current||!o.name.trim())return;p.current=!0,l(!0),d(null);let t=JSON.stringify([e,o.revisionId,o.name.trim()]);g.current?.key!==t&&(g.current={key:t,id:crypto.randomUUID()});try{let t=await _$(r,e,{id:g.current.id,name:o.name.trim(),revisionId:o.revisionId});if(!t.ok){g.current=null,d(t.message);return}g.current=null,s(null),f(`Template saved.`,`success`),await i.invalidateQueries({queryKey:l$})}catch(e){d(e instanceof Error?e.message:`The template wasn't saved. Try again.`)}finally{p.current=!1,l(!1)}}return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(V,{disabled:t===null||c,onClick:()=>{t!==null&&(s({revisionId:t,name:n}),d(null))},children:`Save as template`}),(0,h.jsx)(hb,{open:o!==null,onOpenChange:e=>{!e&&!p.current&&s(null)},children:(0,h.jsxs)(vb,{children:[(0,h.jsx)(yb,{children:`Save as template`}),(0,h.jsx)(bb,{children:`Save this revision’s setup for a fresh Play draft. This does not rebuild the project.`}),(0,h.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,h.jsx)(`label`,{htmlFor:a,children:`Template name`}),(0,h.jsx)(KP,{id:a,autoFocus:!0,required:!0,maxLength:200,disabled:c,value:o?.name??``,onChange:e=>{let t=e.target.value;s(e=>e&&{...e,name:t})}}),u?(0,h.jsx)(`p`,{role:`alert`,className:`text-red`,children:u}):null,(0,h.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,h.jsx)(V,{type:`button`,disabled:c,onClick:()=>s(null),children:`Cancel`}),(0,h.jsx)(V,{type:`submit`,disabled:c||!o?.name.trim(),children:`Save template`})]})]})]})})]})}function x$({children:e,onClick:t,disabled:n,items:r,menuLabel:i,variant:a=`outline`,className:o,title:s}){return(0,h.jsxs)(`span`,{className:z(`inline-flex items-stretch`,o),children:[(0,h.jsx)(V,{type:`button`,variant:a,disabled:n,onClick:t,title:s,className:`rounded-r-none`,children:e}),(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{type:`button`,variant:a,"aria-label":i,className:`rounded-l-none border-l-0 px-2`,children:(0,h.jsx)(ms,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsx)(vF,{className:`max-w-[320px]`,children:r.map(e=>(0,h.jsxs)(yF,{disabled:e.disabled??!1,onSelect:e.onSelect,className:`flex-col items-start gap-0.5 py-2 data-disabled:opacity-45`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:e.label}),e.hint?(0,h.jsx)(`span`,{className:`text-label text-ink3`,children:e.hint}):null]},e.label))})]})]})}function S$(e,t){switch(e){case`research`:case`article`:return t.llm?.provider;case`audio`:return t.audio?.provider;case`images`:case`thumbnail`:return t.images?.provider;case`video`:case`document`:return}}function C$(e,t,n){if(e===`audio`&&t.narrationPrompt&&fA(t)){let e=C$(`article`,t,n);if(e!==void 0)return e}if(e===`video`&&mA(t)){let e=C$(`article`,t,n);if(e!==void 0)return e}if(e===`video`&&vA(t)){let e=C$(`article`,t,n)??C$(`images`,t,n);if(e!==void 0)return e}if(e===`video`&&Jk(t)){let e=C$(`images`,t,n);if(e!==void 0)return e}let r=S$(e,t);if(r===void 0||r===``)return;let i=n.find(e=>e.id===r);if(i===void 0)return;let a=RI(i.readiness);return a===void 0?void 0:{label:a,provider:r}}var w$={research:`Research notes`,article:`Article workspace`,audio:`Narration`,images:`Image library`,thumbnail:`Thumbnail`,video:`Preview & export`,document:`Document`};function T$({section:e,project:t,outputs:n,providers:r,actions:i,children:a,active:o=!0,resumable:s=!1}){let{stage:c,companion:l}=e,u=l===void 0?[c]:[c,l],d=VX(e,t.config),f=BX(e),p=zX(e),m=u.some(e=>i.refusal?.stage===e.kind)?i.refusal?.message:void 0,g=n.some(e=>u.some(t=>e.stageKind===t.kind)&&e.role!==`instructions`)||u.some(e=>e.state===`running`||e.state===`done`||e.state===`provided`)||c.kind===`video`&&c.state!==`skipped`||l!==void 0&&E$(l),_=p.progressTotal===null||p.progressTotal<=0?void 0:Math.min(100,Math.max(0,Math.round((p.progressCurrent??0)/p.progressTotal*100)));return(0,h.jsxs)(`section`,{"data-tour":`project-${c.kind}`,hidden:!o,"aria-label":`${d} workspace`,className:o?`min-w-0 rounded-panel border border-line bg-panel`:`hidden`,children:[(0,h.jsxs)(`div`,{className:`relative flex min-h-14 flex-wrap items-center gap-3 border-b border-line px-5 py-3`,children:[(0,h.jsx)(wl,{kind:f,className:`text-ink2`}),(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`h2`,{className:`text-row font-bold`,children:c.kind===`video`&&d===`Audio export`?`Listen & export`:w$[f]}),(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:HX(e,n,t,s)})]}),(0,h.jsx)(`span`,{className:`text-small text-run-text tabular-nums`,children:p.state===`running`?_===void 0?`Waiting for provider progress`:`${_}%`:null}),(0,h.jsx)(kl,{state:p.state}),(0,h.jsx)(`div`,{...p.state===`running`?{role:`progressbar`,"aria-label":`${iN(p.kind,t.config)} progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":_}:{"aria-hidden":!0},className:`absolute inset-x-0 bottom-0 h-[2px] overflow-hidden`,children:(0,h.jsx)(`div`,{className:`h-full origin-left bg-lamp-run transition-transform duration-200 motion-reduce:transition-none`,style:{transform:`scaleX(${p.state===`running`?(_??0)/100:0})`}})})]}),u.filter(E$).map(e=>(0,h.jsx)(D$,{stage:e,own:e===c,project:t,providers:r,actions:i},e.id)),m?(0,h.jsx)(`div`,{className:`border-b border-line px-5 py-3`,children:(0,h.jsx)(vX,{message:m,onDismiss:i.dismissRefusal})}):null,c.state===`running`&&c.kind!==`article`&&c.kind!==`images`&&c.kind!==`video`&&c.kind!==`document`?(0,h.jsx)(vK,{projectId:t.id,stage:c.kind}):null,g?a:u.some(E$)?null:(0,h.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,h.jsx)(wl,{kind:f,className:`size-8 text-ink3`}),(0,h.jsx)(`p`,{className:`text-body text-ink2`,children:c.state===`skipped`?`${d} was switched off for this run.`:t.status===`paused`?`Resume the project when you are ready to continue.`:`This stage will start when its inputs are ready.`}),(0,h.jsx)(`p`,{className:`max-w-md text-small text-ink3`,children:c.state===`skipped`?`The other stages are available from the list.`:`You can review completed outputs while the project runs.`})]})]})}var E$=e=>e.state===`failed`||e.state===`canceled`;function D$({stage:e,own:t,project:n,providers:r,actions:i}){let a=(0,m.useContext)(jX),o=iX(),[s,c]=(0,m.useState)(!1),l=iN(e.kind,n.config),u=n.status===`paused`?{...i,pending:!0}:i,d=C$(e.kind,n.config,r),f=t?`Retry stage`:`Retry ${l.toLowerCase()}`,p=i.performing?.kind===`retry`&&i.performing.stage===e.kind?`Retrying…`:a?f:d?.label??f,g=a&&o!==void 0&&NX(o,e.kind),_=AX({kind:`rerun`,stage:e.kind});return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-red/30 bg-red-tint px-5 py-3`,children:[(0,h.jsx)(`p`,{className:`min-w-0 text-small text-red`,children:e.state===`failed`?e.failureReason?`${l} stopped with an error. Open Error details to see why.`:`${l} stopped with an error.`:`${l} was canceled.`}),(0,h.jsx)(`span`,{className:`text-label text-ink2`,children:lN(e)}),e.failureReason?(0,h.jsxs)(CI,{children:[(0,h.jsx)(wI,{className:`text-small text-red underline underline-offset-4`,children:`Error details`}),(0,h.jsx)(EI,{className:`max-h-48 w-[min(560px,calc(100vw-24px))] overflow-auto whitespace-pre-wrap break-words text-label`,children:e.failureReason})]}):null,d?(0,h.jsxs)(`p`,{className:`text-small text-ink2`,children:[d.label,` for `,d.provider,`.`,` `,(0,h.jsx)(oa,{to:`/settings`,search:{section:`providers`},className:`underline underline-offset-4`,children:`Open Settings`})]}):null,(0,h.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,h.jsx)(DI,{label:`recovering ${l}`,children:(0,h.jsx)(`p`,{children:a?`Resume recovers unfinished work across the project; Retry stage keeps this section's completed outputs. Use Edit project for changed inputs or optional Advanced rebuild review for supplied-content conflicts.`:n.status===`paused`?`Resume the project to continue with its saved settings.`:`Retry keeps completed outputs. To change the provider or model, open the Edit tab and choose Edit project.`})}),(0,h.jsx)(x$,{variant:`danger`,disabled:a?i.pending:d!==void 0||u.pending,onClick:()=>i.run({kind:`retry`,stage:e.kind}),menuLabel:`More ways to recover ${l}`,items:[{label:`Re-run section`,hint:`Replaces this section's outputs; earlier ones stay in History.`,disabled:!g||i.pending,onSelect:()=>c(!0)}],children:p})]}),(0,h.jsx)(wP,{open:s,title:_.title,consequence:_.consequence,verb:_.verb,dismiss:_.dismiss,pending:i.pending,onConfirm:()=>{c(!1),i.run({kind:`rerun`,stage:e.kind})},onCancel:()=>c(!1)})]})}var O$=q({baseRevisionId:W().min(1).max(64),idempotencyKey:rO()}).strict(),k$=IO(`kind`,[q({kind:GO(`resume`)}).strict(),q({kind:GO(`retry`),stage:J(Gb)}).strict(),q({kind:GO(`rerun`),stage:J(Gb)}).strict()]);O$.extend({action:k$}).strict();var A$=IO(`ok`,[q({ok:GO(!0),value:hY.and(q({warnings:K(W()).readonly()}))}),q({ok:GO(!1),reason:J([`no-project`,`no-revision`,`conflict`,`idempotency-conflict`,`invalid-edit`,`stale-preview`,`invalid-selection`,`review-required`,`cost-ack-required`,`readiness`,`running`,`accepted-job`,`control-changed`]),fields:K(q({field:W(),message:W()})).readonly().optional(),intentRevisionId:W().optional(),currentRevisionId:W().nullable().optional()})]),j$=new Set([400,404,409]);async function M$(e,t,n){return U$(e,t,`cancel`,n)}async function N$(e,t,n){return U$(e,t,`pause`,n)}function P$(e,t,n){return W$(e,t,`resume`,n)}function F$(e,t,n,r){return W$(e,t,`stages/${n}/retry`,r)}function I$(e,t,n,r){return W$(e,t,`stages/${n}/rerun`,r)}async function L$(e,t,n){return H$(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/providers`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}))}async function R$(e,t,n){return H$(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/subtitles`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}))}async function z$(e,t,n){return H$(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/article`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({markdown:n})}))}async function B$(e,t,n){return H$(await e.client.projects[`:id`].images[`:outputId`].$delete({param:{id:t,outputId:n}}))}async function V$(e,t,n){return H$(await e.client.projects[`:id`].images[`:outputId`].regenerate.$post({param:{id:t,outputId:n}}))}async function H$(e){if(e.ok)return{ok:!0,value:await e.json()};let t=await io(e);if(t!==void 0&&j$.has(e.status))return{ok:!1,message:ro(e,t).message};throw ro(e,t)}async function U$(e,t,n,r){let i=O$.parse(r);return H$(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}))}async function W$(e,t,n,r){let i=await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(O$.parse(r))});if(i.ok){let e=A$.parse(await i.json());if(!e.ok)throw Error(lo);return{ok:!0,value:e.value,warnings:e.value.warnings}}let a=await io(i);if(a!==void 0&&j$.has(i.status))return{ok:!1,message:ro(i,a).message};throw ro(i,a)}function G$(e){let{api:t}=B(),n=_(),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(),s=(0,m.useRef)(new Map),c=(0,m.useRef)(!1),l=rt({mutationFn:async e=>{let r=e.action;if(![`pause`,`cancel`,`resume`,`retry`,`rerun`].includes(r.kind))return q$(t,e.projectId,r);let i=r.kind===`retry`||r.kind===`rerun`?r.stage:``,a=`${e.projectId}:${r.kind}:${i}`,o=s.current.get(a);if(!o){let r=n.getQueryData(H.project(e.projectId))?.revisionId;if(!r){let n=await HY(t,e.projectId);if(!n.ok)return{ok:!1,message:n.message};r=n.value.view.revision.id}o={baseRevisionId:r,idempotencyKey:crypto.randomUUID()},s.current.set(a,o)}let c=await q$(t,e.projectId,r,o);return s.current.delete(a),c.ok&&await bo(t,e.projectId).then(t=>n.setQueryData(H.project(e.projectId),t),e=>console.warn(`Project refresh after an accepted action failed`,e)),c},onMutate:()=>{i(void 0),o(void 0)},onSuccess:async(e,t)=>{e.ok?(o(`warnings`in e&&e.warnings.length>0?e.warnings.join(` `):void 0),n.invalidateQueries({queryKey:H.projects})):i({message:e.message,stage:K$(t.action)}),await n.invalidateQueries({queryKey:H.project(t.projectId)})},onSettled:()=>{c.current=!1},onError:(e,t)=>{i({message:e.message,stage:K$(t.action)})}});return{run:(t,n)=>{c.current||(c.current=!0,l.mutate({projectId:e,action:t},{onSuccess:e=>{e.ok&&n?.()}}))},pending:l.isPending,performing:l.isPending?l.variables?.action:void 0,refusal:r,dismissRefusal:()=>{i(void 0)},notice:a}}function K$(e){switch(e.kind){case`cancel`:case`pause`:case`resume`:case`providers`:return;case`retry`:case`rerun`:return e.stage;case`subtitles`:return`video`;case`save-article`:return`article`;case`delete-image`:case`regenerate-image`:return`images`}}function q$(e,t,n,r){let i=()=>{if(!r)throw Error(`A saved revision and request identity are required.`);return r};switch(n.kind){case`pause`:return N$(e,t,i());case`cancel`:return M$(e,t,i());case`resume`:return P$(e,t,i());case`retry`:return F$(e,t,n.stage,i());case`rerun`:return I$(e,t,n.stage,i());case`providers`:return L$(e,t,n.choices);case`subtitles`:return R$(e,t,n.subtitles);case`save-article`:return z$(e,t,n.markdown);case`delete-image`:return B$(e,t,n.outputId);case`regenerate-image`:return V$(e,t,n.outputId)}}var J$=200;function Y$(e,t=null){let{api:n,openEvents:r}=B(),i=_();(0,m.useEffect)(()=>{i.setQueryData(H.article(e,t),``),i.setQueryData(gK(e,t),[]);let a=()=>i.getQueryData(H.project(e))?.revisionId??null,o=XM(()=>{i.invalidateQueries({queryKey:H.project(e)}),i.invalidateQueries({queryKey:H.projects}),i.invalidateQueries({queryKey:QZ(e)})},J$),s=Bb(r,ns(n,`projects/${e}`),{refetch:o.ask,accept:e=>e.type===`project.updated`||e.type===`project.state`&&e.revisionId===void 0||(e.revisionId??null)===a()||(o.ask(),!1),previewWriting:t=>{i.setQueryData(gK(e,a()),e=>_K(e??[],t))},appendArticle:t=>{i.setQueryData(H.article(e,a()),e=>`${e??``}${t}`)},patch:t=>{if(t.type===`stage.state`&&t.state===`running`&&(i.setQueryData(gK(e,a()),e=>(e??[]).filter(e=>e.stage!==t.stage||e.workId!==t.workId||e.revisionId!==t.revisionId)),t.stage===`article`&&i.setQueryData(H.article(e,a()),``)),t.type!==`project.state`&&t.workId!==void 0){o.ask();return}i.setQueryData(H.project(e),e=>JM(e,t))}});return()=>{s(),o.stop()}},[n,r,i,e,t])}function X$({projectId:e}){return(0,h.jsx)(Z$,{projectId:e},e)}function Z$({projectId:e}){let{api:t}=B(),n=I(Sb(t,e)),r=I(Tb(t)),i=I(Db(t)),a=G$(e),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)(`output`),u=QN(e),d=(0,m.useRef)(void 0);(0,m.useEffect)(()=>{if(u===void 0){d.current=void 0;return}n.data!==void 0&&d.current!==u&&(d.current=u,l(`output`),u===`download`&&s({projectId:e,stage:rN(n.data.project.config)===`article`?`article`:`video`}))},[u,e,n.data]),Y$(e,n.data?.revisionId??null);let f=n.data?.revisionId??null,p=I({queryKey:$Z(e,f??``),queryFn:()=>tQ(t,e),enabled:f!==null,retry:!1}),g=p.data?.ok===!0?p.data.value.checkpoints.filter(e=>e.state===`held`).length:0;if(n.error!==null)return(0,h.jsx)(`p`,{className:`text-body text-red`,children:n.error.message});if(n.data===void 0)return(0,h.jsx)(Q$,{});let{project:_,stages:v,outputs:y}=n.data,b=o?.projectId===e?o.stage:LX(hQ(v)),x=t=>s({projectId:e,stage:t}),S=y.find(e=>e.role===`video`||e.role===`audio_export`)??(_.config.sources.video===`off`&&_.config.sources.audio===`off`?y.find(e=>e.role===`article_md`)??y.find(e=>e.role===`article_txt`):void 0),C=v.some(e=>e.state===`running`),w=_.status===`running`||_.status===`paused`||C||a.pending,T=a.refusal?.stage===void 0?a.refusal:void 0;return(0,h.jsx)(rX,{projectId:e,revisionId:n.data.revisionId,children:(0,h.jsx)(jX,{value:n.data.revisionId!==null,children:(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{"data-tour":`project-controls`,children:[(0,h.jsx)(uQ,{project:_,prompts:i.data?.prompts,actions:a,inFlight:C,resumable:n.data.resumable,primaryOutput:S,children:(0,h.jsx)(b$,{projectId:e,revisionId:n.data.revisionId,title:_.title})}),(0,h.jsx)(`div`,{className:`mb-2 flex min-h-8 items-center gap-2`,children:T===void 0?(0,h.jsx)(EP,{tone:`info`,children:a.notice}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(EP,{tone:`error`,children:T.message}),(0,h.jsx)(V,{variant:`ghost`,onClick:a.dismissRefusal,children:`Dismiss`})]})}),(0,h.jsx)(gQ,{stages:v,project:_,outputs:y,selected:b,resumable:n.data.resumable,onSelect:e=>{x(e),l(`output`)}})]}),(0,h.jsx)(i$,{projectId:e,currentRevisionId:n.data.revisionId,tab:c,onTab:l,trailing:(0,h.jsx)(hR,{}),...g===0?{}:{checkpointBadge:`· ${String(g)} held`},renderEditor:e=>(0,h.jsx)(UQ,{...e,renderContent:e=>(0,h.jsx)(MQ,{...e},e.view.revision.id)}),output:(0,h.jsx)(`div`,{className:`min-w-0`,children:RX(v).map(e=>(0,h.jsx)(T$,{active:e.kind===b,section:e,project:_,outputs:y,providers:r.data?.providers??[],actions:a,resumable:n.data.resumable,children:(0,h.jsx)(qZ,{stage:e.stage,...e.companion===void 0?{}:{companion:e.companion},project:_,outputs:y,actions:a,busy:n.data.revisionId===null?w:a.pending||e.stage.state===`running`||e.companion?.state===`running`})},e.stage.id))}),...n.data.revisionId===null?{}:{checkpoints:(0,h.jsx)(sQ,{projectId:e,revisionId:n.data.revisionId,paused:_.status===`paused`,stages:v})}})]})})})}function Q$(){return(0,h.jsxs)(`div`,{role:`status`,"aria-label":`Loading project`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-12 items-center gap-3 pb-3`,children:[(0,h.jsx)(`span`,{className:`h-4 w-20 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-5 w-64 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`ml-auto h-8 w-72 rounded-control bg-panel2`})]}),(0,h.jsx)(`div`,{className:`mb-2 min-h-8`}),(0,h.jsxs)(`div`,{className:`mb-4 grid h-[78px] grid-cols-[112px_repeat(5,minmax(0,1fr))] overflow-hidden rounded-panel border border-line bg-panel`,children:[(0,h.jsx)(`span`,{className:`border-r border-line`}),FX.map(e=>(0,h.jsxs)(`span`,{className:`flex items-start gap-2 border-r border-line p-3 last:border-r-0`,children:[(0,h.jsx)(`span`,{className:`size-[10px] shrink-0 rounded-full bg-panel2`}),(0,h.jsx)(`span`,{className:`h-3 w-16 rounded-control bg-panel2`})]},e))]}),(0,h.jsx)(`div`,{className:`mb-4 flex h-10 gap-3 border-b border-line`,children:[0,1,2,3].map(e=>(0,h.jsx)(`span`,{className:`my-3 h-4 w-16 rounded-control bg-panel2`},e))}),(0,h.jsx)(`div`,{className:`h-[560px] rounded-panel border border-line bg-panel`})]})}var $$=`relative grid grid-cols-[14px_minmax(0,1fr)_auto_32px] items-center gap-x-[14px] gap-y-[4px] border-b border-line px-4 py-[14px] last:border-b-0 md:grid-cols-[14px_minmax(0,1fr)_140px_100px_32px]`,e1=`col-start-2 row-start-2 text-small text-ink2 tabular-nums md:col-start-3 md:row-start-1`,t1=`col-start-3 row-start-1 justify-end md:col-start-4`,n1=`relative z-10 col-start-4 row-start-1 size-8 p-0 md:col-start-5`;function r1(){let{api:e}=B(),t=_(),n=I(xb(e)),[r,i]=(0,m.useState)(void 0),a=rt({mutationFn:t=>xo(e,t),onSettled:async()=>{i(void 0),await t.invalidateQueries({queryKey:H.projects})}});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{title:`Projects`,actions:(0,h.jsx)(V,{variant:`accent`,asChild:!0,children:(0,h.jsx)(oa,{to:`/play`,children:`New run`})})}),(0,h.jsx)(mR,{}),n.data?.projects.length===0?(0,h.jsx)(eP,{}):null,n.error===null?null:(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:n.error.message})}),n.data===void 0?n.error===null?(0,h.jsx)(s1,{}):null:n.data.projects.length===0?(0,h.jsx)(MP,{children:(0,h.jsxs)(`p`,{className:`px-4 py-7 text-body text-ink2`,children:[`No projects yet. Set up a run on`,` `,(0,h.jsx)(oa,{to:`/play`,className:`rounded-control text-ink underline underline-offset-[3px]`,children:`Play`}),`.`]})}):(0,h.jsx)(MP,{children:n.data.projects.map(e=>(0,h.jsx)(i1,{project:e,onDelete:()=>{i(e)}},e.id))}),a.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`mt-[10px] text-label text-red`,children:a.error.message}),(0,h.jsx)(wP,{open:r!==void 0,title:r===void 0?``:`Delete "${r.title}"?`,consequence:`Deletes the project and every file it produced.`,verb:`Delete`,pending:a.isPending,onConfirm:()=>{r!==void 0&&a.mutate(r.id)},onCancel:()=>{i(void 0)}})]})}function i1({project:e,onDelete:t}){return(0,h.jsxs)(`div`,{className:$$,children:[(0,h.jsx)(jl,{state:e.status,className:`col-start-1 row-start-1`}),(0,h.jsxs)(`span`,{className:`col-start-2 row-start-1 flex min-w-0 flex-wrap items-baseline gap-x-3`,children:[(0,h.jsx)(oa,{to:`/projects/$projectId`,params:{projectId:e.id},className:`rounded-control font-semibold after:absolute after:inset-0 after:content-['']`,children:e.title}),(0,h.jsx)(`span`,{className:`truncate text-small text-ink2`,children:a1(e)})]}),(0,h.jsx)(`span`,{className:e1,children:ul(e.createdAt)}),(0,h.jsx)(kl,{state:e.status,announce:e.title,className:t1}),(0,h.jsx)(o1,{project:e,onDelete:t}),e.status===`running`?(0,h.jsx)(PP,{current:e.progress,total:1}):null]})}function a1(e){let t=e.config.articlePrompt;return[t===void 0||t===``?void 0:t,e.format].filter(e=>e!==void 0).join(` · `)}function o1({project:e,onDelete:t}){let n=e.status===`running`;return(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`More for ${e.title}`,className:n1,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsxs)(vF,{children:[(0,h.jsx)(`span`,{title:n?`Cancel the run first`:void 0,children:(0,h.jsx)(yF,{disabled:n,onSelect:t,children:`Delete`})}),n?(0,h.jsx)(`p`,{className:`engraved px-[10px] py-[5px] text-ink3`,children:`Cancel the run first`}):null]})]})}function s1(){return(0,h.jsx)(MP,{children:[0,1,2,3,4,5].map(e=>(0,h.jsxs)(`div`,{className:$$,children:[(0,h.jsx)(`span`,{className:`col-start-1 row-start-1 size-[10px] rounded-full bg-panel2`}),(0,h.jsx)(`span`,{className:`col-start-2 row-start-1 h-3 w-2/5 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`col-start-3 row-start-1 h-[10px] w-[90px] rounded-control bg-panel2 md:col-start-3`}),(0,h.jsx)(`span`,{className:`col-start-4 row-start-1 h-[10px] w-14 justify-self-end rounded-control bg-panel2 md:col-start-4`})]},e))})}var c1=`Prepare restrained delivery cues for a documentary narrator. Let the facts carry the scene. Use a measured pace and make only occasional changes where the supplied wording clearly calls for emphasis, reflection or tension. Prefer no cue to an unnecessary cue. Avoid theatrical emotion, invented reactions and routine laughter or sighs. Never rewrite, summarize, translate or add spoken words. Return only the cue annotations required by the supplied format contract.`;function l1({promptId:e,kind:t,from:n,onLeave:r}){let{api:i}=B(),a=_(),o=ZN(),s=I(Db(i)),c=(0,m.useId)(),l=(0,m.useId)(),u=(0,m.useId)(),d=(0,m.useId)(),f=(0,m.useId)(),[p,g]=SM(JSON.stringify(e===void 0?[`new`,t,n??null]:[`prompt`,e])),[v,y]=(0,m.useState)([]),[b,x]=(0,m.useState)(void 0),S=b!==void 0,[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(!1),D=s.data?.prompts,O=e??n,k=O===void 0?void 0:D?.find(e=>e.id===O),ee=k===void 0?{kind:t,name:``,body:``}:e===void 0?{kind:k.kind,name:`${k.name} copy`,body:k.body}:{kind:k.kind,name:k.name,body:k.body},A=p??b??ee,j=rt({mutationFn:t=>Ko(i,t,e),onSuccess:async(e,t)=>{if(!e.ok){y(e.fields);return}x(e.value),g(e=>e===t?void 0:e),o({type:`prompt-saved`,id:e.value.id,kind:e.value.kind}),await a.invalidateQueries({queryKey:Db(i).queryKey})}}),M=rt({mutationFn:e=>qo(i,e),onSuccess:async()=>{w(!1),g(void 0),await a.invalidateQueries({queryKey:Db(i).queryKey}),r(A.kind)}});kP(S,()=>{r(A.kind)});let N=(e,t)=>{g(e),y(e=>e.filter(e=>e.field!==t))},P=tI(A,v),F=nI(P),te=aI(A.body),ne=A.body.trim()===``?[]:rI(P),re=A.name.trim()===``?[]:iI(P);return XN({promptNamed:A.name.trim()!==``&&re.length===0,promptBodyReady:A.body.trim()!==``&&ne.length===0,promptHasKeywords:te.length>0&&ne.length===0,promptSaveReady:F===void 0&&!j.isPending&&!S,promptSaving:j.isPending||S,promptIsArticle:A.kind===`article`,promptIsImage:A.kind===`image`}),s.error===null?O!==void 0&&D===void 0?(0,h.jsx)(IP,{}):O!==void 0&&k===void 0?(0,h.jsx)(d1,{kind:t,children:`That prompt is gone. It may have been deleted in another tab.`}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{back:{to:`/prompts`,label:`Prompts`,search:{kind:A.kind}},title:e===void 0?`New prompt`:`Edit prompt`}),(0,h.jsxs)(`div`,{"data-tour":`prompt-editor`,className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${FP} flex min-w-0 flex-col gap-[14px]`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-[14px]`,children:[(0,h.jsxs)(`div`,{"data-tour":`prompt-name`,className:`flex-1`,children:[(0,h.jsx)(JP,{htmlFor:c,className:`mb-[5px]`,children:`Name`}),(0,h.jsx)(KP,{id:c,value:A.name,"aria-invalid":re.length>0,"aria-describedby":re.length===0?void 0:l,onChange:e=>{N({...A,name:e.target.value},`name`)}}),re.length===0?null:(0,h.jsx)(`p`,{id:l,className:`mt-1 text-label text-red`,children:re.map(e=>e.message).join(` `)})]}),(0,h.jsx)(HF,{label:`Kind`,value:A.kind,options:xP,onPick:e=>{N({...A,kind:e},`name`)}})]}),(0,h.jsxs)(`div`,{"data-tour":`prompt-body`,children:[(0,h.jsxs)(`div`,{className:`mb-[5px] flex min-h-8 items-end justify-between gap-3`,children:[(0,h.jsx)(JP,{htmlFor:u,children:`Body`}),u1(A.kind)?(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>{let e=u1(A.kind);e!==void 0&&(A.body.trim()===``?N({...A,body:e.body},`body`):E(!0))},children:u1(A.kind)?.label}):null]}),(0,h.jsx)(cI,{id:u,value:A.body,invalid:ne.length>0,describedBy:ne.length===0?void 0:d,onChange:e=>{N({...A,body:e},`body`)}})]}),(0,h.jsx)(`div`,{"data-tour":`prompt-save`,children:(0,h.jsx)(jP,{onDelete:e===void 0?void 0:()=>{w(!0)},blocked:F,blockedId:f,pending:j.isPending,saved:S,cancel:(0,h.jsx)(V,{asChild:!0,children:(0,h.jsx)(oa,{to:`/prompts`,search:{kind:A.kind},onClick:()=>{g(void 0)},children:`Cancel`})}),errors:[j.error,M.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{j.mutate(A)}})})]}),(0,h.jsx)(`div`,{"data-tour":`prompt-slots`,className:`${FP} flex flex-col gap-3 lg:sticky lg:top-16`,children:(0,h.jsx)(VF,{slots:te,body:A.body,lint:ne,lintId:d})})]}),(0,h.jsx)(wP,{open:T,title:`Replace this prompt body?`,consequence:`The starter replaces the text in this editor. Nothing is saved until you choose Save.`,verb:`Use starter`,pending:!1,onConfirm:()=>{let e=u1(A.kind);e!==void 0&&N({...A,body:e.body},`body`),E(!1)},onCancel:()=>E(!1)}),(0,h.jsx)(wP,{open:C,title:`Delete "${A.name}"?`,consequence:`Projects that used it keep their text.`,verb:`Delete`,pending:M.isPending,onConfirm:()=>{e!==void 0&&M.mutate(e)},onCancel:()=>{w(!1)}})]}):(0,h.jsx)(d1,{kind:A.kind,children:s.error.message})}function u1(e){if(e===`narration`)return{label:`Use Documentary Starter`,body:c1};if(e===`description`)return{label:`Use Built-in Starter`,body:wL};if(e===`shorts`)return{label:`Use Built-in Starter`,body:Tk}}function d1({kind:e,children:t}){return(0,h.jsx)(LP,{back:(0,h.jsx)(oa,{to:`/prompts`,search:{kind:e},className:RP,children:`Back to Prompts`}),children:t})}var f1=`grid grid-cols-[minmax(0,1fr)_32px] items-center gap-x-[14px] gap-y-[6px] border-b border-line px-4 py-[10px] last:border-b-0 md:grid-cols-[260px_minmax(0,1fr)_32px]`,p1=`col-span-2 col-start-1 row-start-2 flex flex-wrap gap-[6px] md:col-span-1`,m1=`md:col-start-2 md:row-start-1`;function h1({kind:e,onKind:t}){let{api:n}=B(),r=_(),i=I(Db(n)),[a,o]=(0,m.useState)(void 0),s=rt({mutationFn:e=>qo(n,e),onSettled:async()=>{o(void 0),await r.invalidateQueries({queryKey:H.prompts})}}),c=i.data?.prompts.filter(t=>t.kind===e);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EF,{action:(0,h.jsx)(g1,{kind:e}),children:(0,h.jsx)(MF,{type:`single`,value:e,"aria-label":`Prompt kind`,className:`flex-wrap`,onValueChange:e=>{let n=xP.find(t=>t.value===e);n!==void 0&&t(n.value)},children:xP.map(e=>(0,h.jsx)(NF,{value:e.value,children:e.label},e.value))})}),i.error===null?null:(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:i.error.message})}),c===void 0?i.error===null?(0,h.jsx)(y1,{}):null:c.length===0?(0,h.jsx)(_1,{kind:e}):(0,h.jsx)(MP,{children:c.map(e=>(0,h.jsxs)(`div`,{className:f1,children:[(0,h.jsx)(oa,{to:`/prompts/$promptId`,params:{promptId:e.id},className:`col-start-1 row-start-1 min-w-0 truncate font-semibold hover:underline`,children:e.name}),(0,h.jsx)(`span`,{className:z(p1,m1),children:e.slots.map(e=>(0,h.jsx)(jF,{name:e},e))}),(0,h.jsx)(v1,{prompt:e,onDelete:()=>{o(e)}})]},e.id))}),s.error===null?null:(0,h.jsx)(`p`,{className:`mt-[10px] text-label text-red`,children:s.error.message}),(0,h.jsx)(wP,{open:a!==void 0,title:a===void 0?``:`Delete "${a.name}"?`,consequence:`Projects that used it keep their text.`,verb:`Delete`,pending:s.isPending,onConfirm:()=>{a!==void 0&&s.mutate(a.id)},onCancel:()=>{o(void 0)}})]})}function g1({kind:e}){return(0,h.jsx)(V,{asChild:!0,children:(0,h.jsxs)(oa,{to:`/prompts/new`,search:{kind:e},children:[(0,h.jsx)(Ts,{"aria-hidden":`true`,className:`size-[14px]`}),`New prompt`]})})}function _1({kind:e}){return(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`max-w-[75ch] px-4 py-6 text-ink2`,children:`No ${e} prompts yet. A prompt is text with {{keywords}}; each keyword becomes a field on Play.`})})}function v1({prompt:e,onDelete:t}){return(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{variant:`ghost`,"aria-label":`More for ${e.name}`,className:`col-start-2 row-start-1 size-8 p-0 md:col-start-3`,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsxs)(vF,{children:[(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/prompts/$promptId`,params:{promptId:e.id},children:`Edit`})}),(0,h.jsx)(yF,{asChild:!0,children:(0,h.jsx)(oa,{to:`/prompts/new`,search:{kind:e.kind,from:e.id},children:`Duplicate`})}),(0,h.jsx)(yF,{onSelect:t,children:`Delete`})]})]})}function y1(){return(0,h.jsx)(MP,{children:[0,1,2].map(e=>(0,h.jsxs)(`div`,{className:f1,children:[(0,h.jsx)(`span`,{className:`col-start-1 row-start-1 h-3 w-40 rounded-control bg-panel2`}),(0,h.jsxs)(`span`,{className:z(p1,m1),children:[(0,h.jsx)(`span`,{className:`h-[18px] w-14 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-[18px] w-[72px] rounded-control bg-panel2`})]})]},e))})}var b1=IO(`kind`,[q({kind:GO(`once`),at:W().datetime({offset:!0})}).strict(),q({kind:GO(`daily`),time:W().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}).strict(),q({kind:GO(`weekly`),time:W().regex(/^([01]\d|2[0-3]):[0-5]\d$/),days:K(G().int().min(0).max(6)).min(1).max(7).readonly()}).strict()]);function x1(e){try{return new Intl.DateTimeFormat(`en`,{timeZone:e}).format(),!0}catch{return!1}}var S1=rO(),C1=W().min(1).max(200).refine(e=>e===e.trim(),`Remove the spaces at the start or end of the keyword name.`),w1=HO(C1,W().max(1e4)).readonly(),T1=q({title:W().trim().min(1).max(200),values:w1}).strict().readonly(),E1=J([`skip`,`run-once`]);q({id:S1,name:W().trim().min(1).max(200),templateId:S1,templateVersion:G().int().positive(),cadence:b1,timezone:W().min(1).max(100).refine(x1,`Choose a time zone from the list, such as Europe/London.`),missedPolicy:E1.default(`skip`),overlapPolicy:GO(`skip`).default(`skip`),spendLimitCents:G().int().nonnegative().nullable().default(null),items:K(T1).max(500).default([]).readonly(),topicKeyword:C1.nullable().default(null),values:w1.default({})}).strict().readonly().unwrap().extend({baseVersion:G().int().positive(),mutationId:S1}).strict().readonly(),q({id:S1,baseVersion:G().int().positive()}).strict().readonly(),q({id:S1,baseVersion:G().int().positive()}).strict().readonly();var D1=q({id:S1,name:W(),templateId:S1,templateVersion:G().int().positive(),cadence:b1,timezone:W(),missedPolicy:E1,overlapPolicy:GO(`skip`),spendLimitCents:G().int().nonnegative().nullable(),items:K(T1).readonly(),topicKeyword:W().nullable().default(null),values:w1.default({}),status:J([`active`,`paused`,`completed`,`canceled`]),version:G().int().positive(),nextRunAt:W().datetime({offset:!0}).nullable(),createdAt:W(),updatedAt:W(),deletedAt:W().datetime({offset:!0}).nullable()}).strict().readonly(),O1=q({id:S1,scheduleId:S1,scheduledFor:W().datetime({offset:!0}),status:J([`running`,`succeeded`,`failed`,`skipped`]),requestId:S1.nullable(),projectIds:K(W()).readonly(),estimate:OO().nullable(),startedAt:W().datetime({offset:!0}),endedAt:W().datetime({offset:!0}).nullable(),error:W().nullable()}).strict().readonly(),k1=q({title:W(),detail:W().optional(),reason:W().optional()}),A1=q({schedules:K(D1)}),j1=q({schedule:D1,runs:K(O1)}),M1=e=>`${e.origin}/api/schedules`;async function N1(e,t){let n;try{n=await e.json()}catch{throw ro(e,void 0)}if(e.ok)return{ok:!0,value:uo(t,n)};let r=k1.safeParse(n);if(!r.success)throw ro(e,void 0);let i=r.data.detail??r.data.title;if(![400,404,409].includes(e.status))throw Error(i);return{ok:!1,message:i,reason:r.data.reason??`invalid-request`}}var P1=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),F1=[`schedules`];function I1(e){return{queryKey:F1,queryFn:async()=>{let t=await N1(await e.fetch(M1(e)),A1);if(!t.ok)throw Error(t.message);return t.value.schedules},refetchInterval:3e4}}async function L1(e,t){return N1(await e.fetch(`${M1(e)}/${encodeURIComponent(t)}`),j1)}async function R1(e,t){return N1(await e.fetch(M1(e),P1(`POST`,t)),D1)}async function z1(e,t,n){return N1(await e.fetch(`${M1(e)}/${encodeURIComponent(t)}`,P1(`PUT`,n)),D1)}async function B1(e,t,n,r){return N1(await e.fetch(`${M1(e)}/${encodeURIComponent(t)}/${n}`,P1(`POST`,{baseVersion:r})),D1)}async function V1(e,t,n){return N1(await e.fetch(`${M1(e)}/${encodeURIComponent(t)}`,P1(`DELETE`,{baseVersion:n})),q({deleted:GO(!0)}))}var X=l(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n||=self,n.JSBI=r())})(e,function(){var e=Math.imul,t=Math.clz32;function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){if(Array.isArray(e))return e}function i(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function a(e,t,n){return t=d(t),_(e,m()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&v(i,n.prototype),i}function c(e,t){for(var n,r=0;r<t.length;r++)n=t[r],n.enumerable=n.enumerable||!1,n.configurable=!0,`value`in n&&(n.writable=!0),Object.defineProperty(e,x(n.key),n)}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
166
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m=function(){return!!e})()}function h(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function g(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
167
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return i(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function y(e,t){return r(e)||h(e,t)||C(e,t)||g()}function b(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x(e){var t=b(e,`string`);return typeof t==`symbol`?t:t+``}function S(e){"@babel/helpers - typeof";return S=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S(e)}function C(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function w(e){var t=typeof Map==`function`?new Map:void 0;return w=function(e){function n(){return s(e,arguments,d(this).constructor)}if(e===null||!p(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)},w(e)}var T=function(e){var t=Math.abs,n=Math.max,r=Math.floor;function i(e,t){var n;if(o(this,i),n=a(this,i,[e]),n.sign=t,Object.setPrototypeOf(n,i.prototype),e>i.__kMaxLength)throw RangeError(`Maximum BigInt size exceeded`);return n}return f(i,e),l(i,[{key:`toDebugString`,value:function(){var e,t=[`BigInt[`],n=u(this);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push((r&&(r>>>0).toString(16))+`, `)}}catch(e){n.e(e)}finally{n.f()}return t.push(`]`),t.join(``)}},{key:`toString`,value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10;if(2>e||36<e)throw RangeError(`toString() radix argument must be between 2 and 36`);return this.length===0?`0`:e&e-1?i.__toStringGeneric(this,e,!1):i.__toStringBasePowerOfTwo(this,e)}},{key:`valueOf`,value:function(){throw Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:`__copy`,value:function(){for(var e=new i(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:`__trim`,value:function(){for(var e=this.length,t=this[e-1];t===0;)e--,t=this[e-1],this.pop();return e===0&&(this.sign=!1),this}},{key:`__initializeDigits`,value:function(){for(var e=0;e<this.length;e++)this[e]=0}},{key:`__clzmsd`,value:function(){return i.__clz30(this.__digit(this.length-1))}},{key:`__inplaceMultiplyAdd`,value:function(e,t,n){n>this.length&&(n=this.length);for(var r=32767&e,a=e>>>15,o=0,s=t,c=0;c<n;c++){var l=this.__digit(c),u=32767&l,d=l>>>15,f=i.__imul(u,r),p=i.__imul(u,a),m=i.__imul(d,r),h=i.__imul(d,a),g=s+f+o;o=g>>>30,g&=1073741823,g+=((32767&p)<<15)+((32767&m)<<15),o+=g>>>30,s=h+(p>>>15)+(m>>>15),this.__setDigit(c,1073741823&g)}if(o!==0||s!==0)throw Error(`implementation bug`)}},{key:`__inplaceAdd`,value:function(e,t,n){for(var r,i=0,a=0;a<n;a++)r=this.__halfDigit(t+a)+e.__halfDigit(a)+i,i=r>>>15,this.__setHalfDigit(t+a,32767&r);return i}},{key:`__inplaceSub`,value:function(e,t,n){var r=n-1>>>1,i=0;if(1&t){t>>=1;for(var a=this.__digit(t),o=32767&a,s=0;s<r;s++){var c=e.__digit(s),l=(a>>>15)-(32767&c)-i;i=1&l>>>15,this.__setDigit(t+s,(32767&l)<<15|32767&o),a=this.__digit(t+s+1),o=(32767&a)-(c>>>15)-i,i=1&o>>>15}var u=e.__digit(s),d=(a>>>15)-(32767&u)-i;i=1&d>>>15,this.__setDigit(t+s,(32767&d)<<15|32767&o);var f=u>>>15;if(t+s+1>=this.length)throw RangeError(`out of bounds`);!(1&n)&&(a=this.__digit(t+s+1),o=(32767&a)-f-i,i=1&o>>>15,this.__setDigit(t+e.length,1073709056&a|32767&o))}else{t>>=1;for(var p=0;p<e.length-1;p++){var m=this.__digit(t+p),h=e.__digit(p),g=(32767&m)-(32767&h)-i;i=1&g>>>15;var _=(m>>>15)-(h>>>15)-i;i=1&_>>>15,this.__setDigit(t+p,(32767&_)<<15|32767&g)}var v=this.__digit(t+p),y=e.__digit(p),b=(32767&v)-(32767&y)-i;i=1&b>>>15;var x=0;!(1&n)&&(x=(v>>>15)-(y>>>15)-i,i=1&x>>>15),this.__setDigit(t+p,(32767&x)<<15|32767&b)}return i}},{key:`__inplaceRightShift`,value:function(e){if(e!==0){for(var t,n=this.__digit(0)>>>e,r=this.length-1,i=0;i<r;i++)t=this.__digit(i+1),this.__setDigit(i,1073741823&t<<30-e|n),n=t>>>e;this.__setDigit(r,n)}}},{key:`__digit`,value:function(e){return this[e]}},{key:`__unsignedDigit`,value:function(e){return this[e]>>>0}},{key:`__setDigit`,value:function(e,t){this[e]=0|t}},{key:`__setDigitGrow`,value:function(e,t){this[e]=0|t}},{key:`__halfDigitLength`,value:function(){var e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:`__halfDigit`,value:function(e){return 32767&this[e>>>1]>>>15*(1&e)}},{key:`__setHalfDigit`,value:function(e,t){var n=e>>>1,r=this.__digit(n),i=1&e?32767&r|t<<15:1073709056&r|32767&t;this.__setDigit(n,i)}}],[{key:`BigInt`,value:function(e){var t=Number.isFinite;if(typeof e==`number`){if(e===0)return i.__zero();if(i.__isOneDigitInt(e))return 0>e?i.__oneDigit(-e,!0):i.__oneDigit(e,!1);if(!t(e)||r(e)!==e)throw RangeError(`The number `+e+` cannot be converted to BigInt because it is not an integer`);return i.__fromDouble(e)}if(typeof e==`string`){var n=i.__fromString(e);if(n===null)throw SyntaxError(`Cannot convert `+e+` to a BigInt`);return n}if(typeof e==`boolean`)return!0===e?i.__oneDigit(1,!1):i.__zero();if(S(e)===`object`){if(e.constructor===i)return e;var a=i.__toPrimitive(e);return i.BigInt(a)}throw TypeError(`Cannot convert `+e+` to a BigInt`)}},{key:`toNumber`,value:function(e){var t=e.length;if(t===0)return 0;if(t===1){var n=e.__unsignedDigit(0);return e.sign?-n:n}var r=e.__digit(t-1),a=i.__clz30(r),o=30*t-a;if(1024<o)return e.sign?-1/0:1/0;var s=o-1,c=r,l=t-1,u=a+3,d=u===32?0:c<<u;d>>>=12;var f=u-12,p=12<=u?0:c<<20+u,m=20+u;for(0<f&&0<l&&(l--,c=e.__digit(l),d|=c>>>30-f,p=c<<f+2,m=f+2);0<m&&0<l;)l--,c=e.__digit(l),p|=30<=m?c<<m-30:c>>>30-m,m-=30;var h=i.__decideRounding(e,m,l,c);if((h===1||h===0&&(1&p)==1)&&(p=p+1>>>0,p===0&&(d++,d>>>20&&(d=0,s++,1023<s))))return e.sign?-1/0:1/0;var g=e.sign?-2147483648:0;return s=s+1023<<20,i.__kBitConversionInts[i.__kBitConversionIntHigh]=g|s|d,i.__kBitConversionInts[i.__kBitConversionIntLow]=p,i.__kBitConversionDouble[0]}},{key:`unaryMinus`,value:function(e){if(e.length===0)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:`bitwiseNot`,value:function(e){return e.sign?i.__absoluteSubOne(e).__trim():i.__absoluteAddOne(e,!0)}},{key:`exponentiate`,value:function(e,t){if(t.sign)throw RangeError(`Exponent must be positive`);if(t.length===0)return i.__oneDigit(1,!1);if(e.length===0)return e;if(e.length===1&&e.__digit(0)===1)return e.sign&&!(1&t.__digit(0))?i.unaryMinus(e):e;if(1<t.length)throw RangeError(`BigInt too big`);var n=t.__unsignedDigit(0);if(n===1)return e;if(n>=i.__kMaxLengthBits)throw RangeError(`BigInt too big`);if(e.length===1&&e.__digit(0)===2){var r=1+(0|n/30),a=new i(r,e.sign&&!!(1&n));a.__initializeDigits();var o=1<<n%30;return a.__setDigit(r-1,o),a}var s=null,c=e;for(1&n&&(s=e),n>>=1;n!==0;n>>=1)c=i.multiply(c,c),1&n&&(s=s===null?c:i.multiply(s,c));return s}},{key:`multiply`,value:function(e,t){if(e.length===0)return e;if(t.length===0)return t;var n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--;var r=new i(n,e.sign!==t.sign);r.__initializeDigits();for(var a=0;a<e.length;a++)i.__multiplyAccumulate(t,e.__digit(a),r,a);return r.__trim()}},{key:`divide`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return i.__zero();var n,r=e.sign!==t.sign,a=t.__unsignedDigit(0);if(t.length===1&&32767>=a){if(a===1)return r===e.sign?e:i.unaryMinus(e);n=i.__absoluteDivSmall(e,a,null)}else n=i.__absoluteDivLarge(e,t,!0,!1);return n.sign=r,n.__trim()}},{key:`remainder`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return e;var n=t.__unsignedDigit(0);if(t.length===1&&32767>=n){if(n===1)return i.__zero();var r=i.__absoluteModSmall(e,n);return r===0?i.__zero():i.__oneDigit(r,e.sign)}var a=i.__absoluteDivLarge(e,t,!1,!0);return a.sign=e.sign,a.__trim()}},{key:`add`,value:function(e,t){var n=e.sign;return n===t.sign?i.__absoluteAdd(e,t,n):0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n)}},{key:`subtract`,value:function(e,t){var n=e.sign;return n===t.sign?0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n):i.__absoluteAdd(e,t,n)}},{key:`leftShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__rightShiftByAbsolute(e,t):i.__leftShiftByAbsolute(e,t)}},{key:`signedRightShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__leftShiftByAbsolute(e,t):i.__rightShiftByAbsolute(e,t)}},{key:`unsignedRightShift`,value:function(){throw TypeError(`BigInts have no unsigned right shift; use >> instead`)}},{key:`lessThan`,value:function(e,t){return 0>i.__compareToBigInt(e,t)}},{key:`lessThanOrEqual`,value:function(e,t){return 0>=i.__compareToBigInt(e,t)}},{key:`greaterThan`,value:function(e,t){return 0<i.__compareToBigInt(e,t)}},{key:`greaterThanOrEqual`,value:function(e,t){return 0<=i.__compareToBigInt(e,t)}},{key:`equal`,value:function(e,t){if(e.sign!==t.sign||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}},{key:`notEqual`,value:function(e,t){return!i.equal(e,t)}},{key:`bitwiseAnd`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length)+1,a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteOr(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}return i.__absoluteAndNot(e,i.__absoluteSubOne(t)).__trim()}},{key:`bitwiseXor`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length),a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return i.__absoluteXor(a,o,a).__trim()}var s=n(e.length,t.length)+1;if(e.sign){var c=[t,e];e=c[0],t=c[1]}var l=i.__absoluteSubOne(t,s);return l=i.__absoluteXor(l,e,l),i.__absoluteAddOne(l,!0,l).__trim()}},{key:`bitwiseOr`,value:function(e,t){var r=n(e.length,t.length);if(!e.sign&&!t.sign)return i.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteAnd(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}var c=i.__absoluteSubOne(t,r);return c=i.__absoluteAndNot(c,e,c),i.__absoluteAddOne(c,!0,c).__trim()}},{key:`asIntN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&a<o)return t;if((a&o)!==o)return i.__truncateToNBits(e,t);if(!t.sign)return i.__truncateAndSubFromPowerOfTwo(e,t,!0);if(!(a&o-1)){for(var s=n-2;0<=s;s--)if(t.__digit(s)!==0)return i.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&a===o?t:i.__truncateToNBits(e,t)}return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:`asUintN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(t.sign){if(e>i.__kMaxLengthBits)throw RangeError(`BigInt too big`);return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=e%30;return t.length==n&&(a===0||!(t.__digit(n-1)>>>a))?t:i.__truncateToNBits(e,t)}},{key:`ADD`,value:function(e,t){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`)return typeof t!=`string`&&(t=t.toString()),e+t;if(typeof t==`string`)return e.toString()+t;if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)&&i.__isBigInt(t))return i.add(e,t);if(typeof e==`number`&&typeof t==`number`)return e+t;throw TypeError(`Cannot mix BigInt and other types, use explicit conversions`)}},{key:`LT`,value:function(e,t){return i.__compare(e,t,0)}},{key:`LE`,value:function(e,t){return i.__compare(e,t,1)}},{key:`GT`,value:function(e,t){return i.__compare(e,t,2)}},{key:`GE`,value:function(e,t){return i.__compare(e,t,3)}},{key:`EQ`,value:function(e,t){for(;;){if(i.__isBigInt(e))return i.__isBigInt(t)?i.equal(e,t):i.EQ(t,e);if(typeof e==`number`){if(i.__isBigInt(t))return i.__equalToNumber(t,e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`string`){if(i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.equal(e,t);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`boolean`){if(i.__isBigInt(t))return i.__equalToNumber(t,+e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`symbol`){if(i.__isBigInt(t))return!1;if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`object`){if(S(t)===`object`&&t.constructor!==i)return e==t;e=i.__toPrimitive(e)}else return e==t}}},{key:`NE`,value:function(e,t){return!i.EQ(e,t)}},{key:`DataViewGetBigInt64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return i.asIntN(64,i.DataViewGetBigUint64(e,t,n))}},{key:`DataViewGetBigUint64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2],r=y(n?[4,0]:[0,4],2),a=r[0],o=r[1],s=e.getUint32(t+a,n),c=e.getUint32(t+o,n),l=new i(3,!1);return l.__setDigit(0,1073741823&c),l.__setDigit(1,(268435455&s)<<2|c>>>30),l.__setDigit(2,s>>>28),l.__trim()}},{key:`DataViewSetBigInt64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];i.DataViewSetBigUint64(e,t,n,r)}},{key:`DataViewSetBigUint64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];n=i.asUintN(64,n);var a=0,o=0;if(0<n.length&&(o=n.__digit(0),1<n.length)){var s=n.__digit(1);o|=s<<30,a=s>>>2,2<n.length&&(a|=n.__digit(2)<<28)}var c=y(r?[4,0]:[0,4],2),l=c[0],u=c[1];e.setUint32(t+l,a,r),e.setUint32(t+u,o,r)}},{key:`__zero`,value:function(){return new i(0,!1)}},{key:`__oneDigit`,value:function(e,t){var n=new i(1,t);return n.__setDigit(0,e),n}},{key:`__decideRounding`,value:function(e,t,n,r){if(0<t)return-1;var i;if(0>t)i=-t-1;else{if(n===0)return-1;n--,r=e.__digit(n),i=29}var a=1<<i;if((r&a)==0)return-1;if(--a,(r&a)!=0)return 1;for(;0<n;)if(n--,e.__digit(n)!==0)return 1;return 0}},{key:`__fromDouble`,value:function(e){var t=0>e;i.__kBitConversionDouble[0]=e;var n,r=(2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20)-1023,a=(0|r/30)+1,o=new i(a,t),s=1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh]|1048576,c=i.__kBitConversionInts[i.__kBitConversionIntLow],l=20,u=r%30,d=0;if(u<l){var f=l-u;d=f+32,n=s>>>f,s=s<<32-f|c>>>f,c<<=32-f}else if(u===l)d=32,n=s,s=c,c=0;else{var p=u-l;d=32-p,n=s<<p|c>>>32-p,s=c<<p,c=0}o.__setDigit(a-1,n);for(var m=a-2;0<=m;m--)0<d?(d-=30,n=s>>>2,s=s<<30|c>>>2,c<<=30):n=0,o.__setDigit(m,n);return o.__trim()}},{key:`__isWhitespace`,value:function(e){return 13>=e&&9<=e||(159>=e?e==32:131071>=e?e==160||e==5760:196607>=e?(e&=131071,10>=e||e==40||e==41||e==47||e==95||e==4096):e==65279)}},{key:`__fromString`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,n=0,r=e.length,a=0;if(a===r)return i.__zero();for(var o=e.charCodeAt(a);i.__isWhitespace(o);){if(++a===r)return i.__zero();o=e.charCodeAt(a)}if(o===43){if(++a===r)return null;o=e.charCodeAt(a),n=1}else if(o===45){if(++a===r)return null;o=e.charCodeAt(a),n=-1}if(t===0){if(t=10,o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(t=16,++a===r)return null;o=e.charCodeAt(a)}else if(o===79||o===111){if(t=8,++a===r)return null;o=e.charCodeAt(a)}else if(o===66||o===98){if(t=2,++a===r)return null;o=e.charCodeAt(a)}}}else if(t===16&&o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(++a===r)return null;o=e.charCodeAt(a)}}if(n!==0&&t!==10)return null;for(;o===48;){if(++a===r)return i.__zero();o=e.charCodeAt(a)}var s=r-a,c=i.__kMaxBitsPerChar[t],l=i.__kBitsPerCharTableMultiplier-1;if(s>1073741824/c)return null;var u=new i(0|((c*s+l>>>i.__kBitsPerCharTableShift)+29)/30,!1),d=10>t?t:10,f=10<t?t-10:0;if(t&t-1){u.__initializeDigits();var p=!1,m=0;do{for(var h,g=0,_=1;;){if(h=void 0,o-48>>>0<d)h=o-48;else if((32|o)-97>>>0<f)h=(32|o)-87;else{p=!0;break}var v=_*t;if(1073741823<v)break;if(_=v,g=g*t+h,m++,++a===r){p=!0;break}o=e.charCodeAt(a)}l=30*i.__kBitsPerCharTableMultiplier-1;var y=0|(c*m+l>>>i.__kBitsPerCharTableShift)/30;u.__inplaceMultiplyAdd(_,g,y)}while(!p)}else{c>>=i.__kBitsPerCharTableShift;var b=[],x=[],S=!1;do{for(var C,w=0,T=0;;){if(C=void 0,o-48>>>0<d)C=o-48;else if((32|o)-97>>>0<f)C=(32|o)-87;else{S=!0;break}if(T+=c,w=w<<c|C,++a===r){S=!0;break}if(o=e.charCodeAt(a),30<T+c)break}b.push(w),x.push(T)}while(!S);i.__fillFromParts(u,b,x)}if(a!==r){if(!i.__isWhitespace(o))return null;for(a++;a<r;a++)if(o=e.charCodeAt(a),!i.__isWhitespace(o))return null}return u.sign=n===-1,u.__trim()}},{key:`__fillFromParts`,value:function(e,t,n){for(var r=0,i=0,a=0,o=t.length-1;0<=o;o--){var s=t[o],c=n[o];i|=s<<a,a+=c,a===30?(e.__setDigit(r++,i),a=0,i=0):30<a&&(e.__setDigit(r++,1073741823&i),a-=30,i=s>>>c-a)}if(i!==0){if(r>=e.length)throw Error(`implementation bug`);e.__setDigit(r++,i)}for(;r<e.length;r++)e.__setDigit(r,0)}},{key:`__toStringBasePowerOfTwo`,value:function(e,t){var n=e.length,r=t-1;r=(85&r>>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);var a=r,o=t-1,s=e.__digit(n-1),c=i.__clz30(s),l=0|(30*n-c+a-1)/a;if(e.sign&&l++,268435456<l)throw Error(`string too long`);for(var u=Array(l),d=l-1,f=0,p=0,m=0;m<n-1;m++){var h=e.__digit(m),g=(f|h<<p)&o;u[d--]=i.__kConversionChars[g];var _=a-p;for(f=h>>>_,p=30-_;p>=a;)u[d--]=i.__kConversionChars[f&o],f>>>=a,p-=a}var v=(f|s<<p)&o;for(u[d--]=i.__kConversionChars[v],f=s>>>a-p;f!==0;)u[d--]=i.__kConversionChars[f&o],f>>>=a;if(e.sign&&(u[d--]=`-`),d!==-1)throw Error(`implementation bug`);return u.join(``)}},{key:`__toStringGeneric`,value:function(e,t,n){var r=e.length;if(r===0)return``;if(r===1){var a=e.__unsignedDigit(0).toString(t);return!1===n&&e.sign&&(a=`-`+a),a}var o=30*r-i.__clz30(e.__digit(r-1)),s=i.__kMaxBitsPerChar[t]-1,c=o*i.__kBitsPerCharTableMultiplier;c+=s-1,c=0|c/s;var l,u,d=c+1>>1,f=i.exponentiate(i.__oneDigit(t,!1),i.__oneDigit(d,!1)),p=f.__unsignedDigit(0);if(f.length===1&&32767>=p){l=new i(e.length,!1),l.__initializeDigits();for(var m,h=0,g=2*e.length-1;0<=g;g--)m=h<<15|e.__halfDigit(g),l.__setHalfDigit(g,0|m/p),h=0|m%p;u=h.toString(t)}else{var _=i.__absoluteDivLarge(e,f,!0,!0);l=_.quotient;var v=_.remainder.__trim();u=i.__toStringGeneric(v,t,!0)}l.__trim();for(var y=i.__toStringGeneric(l,t,!0);u.length<d;)u=`0`+u;return!1===n&&e.sign&&(y=`-`+y),y+u}},{key:`__unequalSign`,value:function(e){return e?-1:1}},{key:`__absoluteGreater`,value:function(e){return e?-1:1}},{key:`__absoluteLess`,value:function(e){return e?1:-1}},{key:`__compareToBigInt`,value:function(e,t){var n=e.sign;if(n!==t.sign)return i.__unequalSign(n);var r=i.__absoluteCompare(e,t);return 0<r?i.__absoluteGreater(n):0>r?i.__absoluteLess(n):0}},{key:`__compareToNumber`,value:function(e,n){if(i.__isOneDigitInt(n)){var r=e.sign,a=0>n;if(r!==a)return i.__unequalSign(r);if(e.length===0){if(a)throw Error(`implementation bug`);return n===0?0:-1}if(1<e.length)return i.__absoluteGreater(r);var o=t(n),s=e.__unsignedDigit(0);return s>o?i.__absoluteGreater(r):s<o?i.__absoluteLess(r):0}return i.__compareToDouble(e,n)}},{key:`__compareToDouble`,value:function(e,t){if(t!==t)return t;if(t===1/0)return-1;if(t===-1/0)return 1;var n=e.sign;if(n!==0>t)return i.__unequalSign(n);if(t===0)throw Error(`implementation bug: should be handled elsewhere`);if(e.length===0)return-1;i.__kBitConversionDouble[0]=t;var r=2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20;if(r==2047)throw Error(`implementation bug: handled elsewhere`);var a=r-1023;if(0>a)return i.__absoluteGreater(n);var o=e.length,s=e.__digit(o-1),c=i.__clz30(s),l=30*o-c,u=a+1;if(l<u)return i.__absoluteLess(n);if(l>u)return i.__absoluteGreater(n);var d=1048576|1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh],f=i.__kBitConversionInts[i.__kBitConversionIntLow],p=20,m=29-c;if(m!==(0|(l-1)%30))throw Error(`implementation bug`);var h,g=0;if(m<p){var _=p-m;g=_+32,h=d>>>_,d=d<<32-_|f>>>_,f<<=32-_}else if(m===p)g=32,h=d,d=f,f=0;else{var v=m-p;g=32-v,h=d<<v|f>>>32-v,d=f<<v,f=0}if(s>>>=0,h>>>=0,s>h)return i.__absoluteGreater(n);if(s<h)return i.__absoluteLess(n);for(var y=o-2;0<=y;y--){0<g?(g-=30,h=d>>>2,d=d<<30|f>>>2,f<<=30):h=0;var b=e.__unsignedDigit(y);if(b>h)return i.__absoluteGreater(n);if(b<h)return i.__absoluteLess(n)}if(d!==0||f!==0){if(g===0)throw Error(`implementation bug`);return i.__absoluteLess(n)}return 0}},{key:`__equalToNumber`,value:function(e,n){return i.__isOneDigitInt(n)?n===0?e.length===0:e.length===1&&e.sign===0>n&&e.__unsignedDigit(0)===t(n):i.__compareToDouble(e,n)===0}},{key:`__comparisonResultToBool`,value:function(e,t){return t===0?0>e:t===1?0>=e:t===2?0<e:t===3?0<=e:void 0}},{key:`__compare`,value:function(e,t,n){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`&&typeof t==`string`)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(i.__isBigInt(e)&&typeof t==`string`)return t=i.__fromString(t),t!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof e==`string`&&i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)){if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof t!=`number`)throw Error(`implementation bug`);return i.__comparisonResultToBool(i.__compareToNumber(e,t),n)}if(typeof e!=`number`)throw Error(`implementation bug`);if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToNumber(t,e),2^n);if(typeof t!=`number`)throw Error(`implementation bug`);return n===0?e<t:n===1?e<=t:n===2?e>t:n===3?e>=t:void 0}},{key:`__absoluteAdd`,value:function(e,t,n){if(e.length<t.length)return i.__absoluteAdd(t,e,n);if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);var r=e.length;(e.__clzmsd()===0||t.length===e.length&&t.__clzmsd()===0)&&r++;for(var a,o=new i(r,n),s=0,c=0;c<t.length;c++)a=e.__digit(c)+t.__digit(c)+s,s=a>>>30,o.__setDigit(c,1073741823&a);for(;c<e.length;c++){var l=e.__digit(c)+s;s=l>>>30,o.__setDigit(c,1073741823&l)}return c<o.length&&o.__setDigit(c,s),o.__trim()}},{key:`__absoluteSub`,value:function(e,t,n){if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);for(var r,a=new i(e.length,n),o=0,s=0;s<t.length;s++)r=e.__digit(s)-t.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);for(;s<e.length;s++){var c=e.__digit(s)-o;o=1&c>>>30,a.__setDigit(s,1073741823&c)}return a.__trim()}},{key:`__absoluteAddOne`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length;n===null?n=new i(r,t):n.sign=t;for(var a,o=1,s=0;s<r;s++)a=e.__digit(s)+o,o=a>>>30,n.__setDigit(s,1073741823&a);return o!==0&&n.__setDigitGrow(r,1),n}},{key:`__absoluteSubOne`,value:function(e,t){var n=e.length;t||=n;for(var r,a=new i(t,!1),o=1,s=0;s<n;s++)r=e.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);if(o!==0)throw Error(`implementation bug`);for(var c=n;c<t;c++)a.__setDigit(c,0);return a}},{key:`__absoluteAnd`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=o;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)&t.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteAndNot`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;r<a&&(o=r);var s=r;n===null?n=new i(s,!1):s=n.length;for(var c=0;c<o;c++)n.__setDigit(c,e.__digit(c)&~t.__digit(c));for(;c<r;c++)n.__setDigit(c,e.__digit(c));for(;c<s;c++)n.__setDigit(c,0);return n}},{key:`__absoluteOr`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)|t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteXor`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)^t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteCompare`,value:function(e,t){var n=e.length-t.length;if(n!=0)return n;for(var r=e.length-1;0<=r&&e.__digit(r)===t.__digit(r);)r--;return 0>r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}},{key:`__multiplyAccumulate`,value:function(e,t,n,r){if(t!==0){for(var a=32767&t,o=t>>>15,s=0,c=0,l=0;l<e.length;l++,r++){var u=n.__digit(r),d=e.__digit(l),f=32767&d,p=d>>>15,m=i.__imul(f,a),h=i.__imul(f,o),g=i.__imul(p,a),_=i.__imul(p,o);u+=c+m+s,s=u>>>30,u&=1073741823,u+=((32767&h)<<15)+((32767&g)<<15),s+=u>>>30,c=_+(h>>>15)+(g>>>15),n.__setDigit(r,1073741823&u)}for(;s!==0||c!==0;r++){var v=n.__digit(r);v+=s+c,c=0,s=v>>>30,n.__setDigit(r,1073741823&v)}}}},{key:`__internalMultiplyAdd`,value:function(e,t,n,r,a){for(var o=n,s=0,c=0;c<r;c++){var l=e.__digit(c),u=i.__imul(32767&l,t),d=i.__imul(l>>>15,t),f=u+((32767&d)<<15)+s+o;o=f>>>30,s=d>>>15,a.__setDigit(c,1073741823&f)}if(a.length>r)for(a.__setDigit(r++,o+s);r<a.length;)a.__setDigit(r++,0);else if(o+s!==0)throw Error(`implementation bug`)}},{key:`__absoluteDivSmall`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;n===null&&(n=new i(e.length,!1));for(var r=0,a=2*e.length-1;0<=a;a-=2){var o=(r<<15|e.__halfDigit(a))>>>0,s=0|o/t;r=0|o%t,o=(r<<15|e.__halfDigit(a-1))>>>0;var c=0|o/t;r=0|o%t,n.__setDigit(a>>>1,s<<15|c)}return n}},{key:`__absoluteModSmall`,value:function(e,t){for(var n,r=0,i=2*e.length-1;0<=i;i--)n=(r<<15|e.__halfDigit(i))>>>0,r=0|n%t;return r}},{key:`__absoluteDivLarge`,value:function(e,t,n,r){var a=t.__halfDigitLength(),o=t.length,s=e.__halfDigitLength()-a,c=null;n&&(c=new i(s+2>>>1,!1),c.__initializeDigits());var l=new i(a+2>>>1,!1);l.__initializeDigits();var u=i.__clz15(t.__halfDigit(a-1));0<u&&(t=i.__specialLeftShift(t,u,0));for(var d=i.__specialLeftShift(e,u,1),f=t.__halfDigit(a-1),p=0,m=s;0<=m;m--){var h=32767,g=d.__halfDigit(m+a);if(g!==f){var _=(g<<15|d.__halfDigit(m+a-1))>>>0;h=0|_/f;for(var v=0|_%f,y=t.__halfDigit(a-2),b=d.__halfDigit(m+a-2);i.__imul(h,y)>>>0>(v<<16|b)>>>0&&(h--,v+=f,!(32767<v)););}i.__internalMultiplyAdd(t,h,0,o,l);var x=d.__inplaceSub(l,m,a+1);x!==0&&(x=d.__inplaceAdd(t,m,a),d.__setHalfDigit(m+a,32767&d.__halfDigit(m+a)+x),h--),n&&(1&m?p=h<<15:c.__setDigit(m>>>1,p|h))}if(r)return d.__inplaceRightShift(u),n?{quotient:c,remainder:d}:d;if(n)return c;throw Error(`unreachable`)}},{key:`__clz15`,value:function(e){return i.__clz30(e)-15}},{key:`__specialLeftShift`,value:function(e,t,n){var r=e.length,a=new i(r+n,!1);if(t===0){for(var o=0;o<r;o++)a.__setDigit(o,e.__digit(o));return 0<n&&a.__setDigit(r,0),a}for(var s,c=0,l=0;l<r;l++)s=e.__digit(l),a.__setDigit(l,1073741823&s<<t|c),c=s>>>30-t;return 0<n&&a.__setDigit(r,c),a}},{key:`__leftShiftByAbsolute`,value:function(e,t){var n=i.__toShiftAmount(t);if(0>n)throw RangeError(`BigInt too big`);var r=0|n/30,a=n%30,o=e.length,s=a!==0&&!!(e.__digit(o-1)>>>30-a),c=o+r+ +!!s,l=new i(c,e.sign);if(a===0){for(var u=0;u<r;u++)l.__setDigit(u,0);for(;u<c;u++)l.__setDigit(u,e.__digit(u-r))}else{for(var d=0,f=0;f<r;f++)l.__setDigit(f,0);for(var p,m=0;m<o;m++)p=e.__digit(m),l.__setDigit(m+r,1073741823&p<<a|d),d=p>>>30-a;if(s)l.__setDigit(o+r,d);else if(d!==0)throw Error(`implementation bug`)}return l.__trim()}},{key:`__rightShiftByAbsolute`,value:function(e,t){var n=e.length,r=e.sign,a=i.__toShiftAmount(t);if(0>a)return i.__rightShiftByMaximum(r);var o=0|a/30,s=a%30,c=n-o;if(0>=c)return i.__rightShiftByMaximum(r);var l=!1;if(r){var u=(1<<s)-1;if((e.__digit(o)&u)!=0)l=!0;else for(var d=0;d<o;d++)if(e.__digit(d)!==0){l=!0;break}}l&&s===0&&~e.__digit(n-1)==0&&c++;var f=new i(c,r);if(s===0){f.__setDigit(c-1,0);for(var p=o;p<n;p++)f.__setDigit(p-o,e.__digit(p))}else{for(var m,h=e.__digit(o)>>>s,g=n-o-1,_=0;_<g;_++)m=e.__digit(_+o+1),f.__setDigit(_,1073741823&m<<30-s|h),h=m>>>s;f.__setDigit(g,h)}return l&&(f=i.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:`__rightShiftByMaximum`,value:function(e){return e?i.__oneDigit(1,!0):i.__zero()}},{key:`__toShiftAmount`,value:function(e){if(1<e.length)return-1;var t=e.__unsignedDigit(0);return t>i.__kMaxLengthBits?-1:t}},{key:`__toPrimitive`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:`default`;if(S(e)!==`object`||e.constructor===i)return e;if(typeof Symbol<`u`&&S(Symbol.toPrimitive)===`symbol`&&e[Symbol.toPrimitive]){var n=e[Symbol.toPrimitive](t);if(S(n)!==`object`)return n;throw TypeError(`Cannot convert object to primitive value`)}var r=e.valueOf;if(r){var a=r.call(e);if(S(a)!==`object`)return a}var o=e.toString;if(o){var s=o.call(e);if(S(s)!==`object`)return s}throw TypeError(`Cannot convert object to primitive value`)}},{key:`__toNumeric`,value:function(e){return i.__isBigInt(e)?e:+e}},{key:`__isBigInt`,value:function(e){return S(e)===`object`&&e!==null&&e.constructor===i}},{key:`__truncateToNBits`,value:function(e,t){for(var n=0|(e+29)/30,r=new i(n,t.sign),a=n-1,o=0;o<a;o++)r.__setDigit(o,t.__digit(o));var s=t.__digit(a);if(e%30!=0){var c=32-e%30;s=s<<c>>>c}return r.__setDigit(a,s),r.__trim()}},{key:`__truncateAndSubFromPowerOfTwo`,value:function(e,t,n){for(var r=Math.min,a,o=0|(e+29)/30,s=new i(o,n),c=0,l=o-1,u=0,d=r(l,t.length);c<d;c++)a=0-t.__digit(c)-u,u=1&a>>>30,s.__setDigit(c,1073741823&a);for(;c<l;c++)s.__setDigit(c,0|1073741823&-u);var f,p=l<t.length?t.__digit(l):0,m=e%30;if(m===0)f=0-p-u,f&=1073741823;else{var h=32-m;p=p<<h>>>h;var g=1<<32-h;f=g-p-u,f&=g-1}return s.__setDigit(l,f),s.__trim()}},{key:`__digitPow`,value:function(e,t){for(var n=1;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}},{key:`__detectBigEndian`,value:function(){return i.__kBitConversionDouble[0]=-0,i.__kBitConversionInts[0]!==0}},{key:`__isOneDigitInt`,value:function(e){return(1073741823&e)===e}}])}(w(Array));return T.__kMaxLength=33554432,T.__kMaxLengthBits=T.__kMaxLength<<5,T.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],T.__kBitsPerCharTableShift=5,T.__kBitsPerCharTableMultiplier=1<<T.__kBitsPerCharTableShift,T.__kConversionChars=`0123456789abcdefghijklmnopqrstuvwxyz`.split(``),T.__kBitConversionBuffer=new ArrayBuffer(8),T.__kBitConversionDouble=new Float64Array(T.__kBitConversionBuffer),T.__kBitConversionInts=new Int32Array(T.__kBitConversionBuffer),T.__kBitConversionIntHigh=+!T.__detectBigEndian(),T.__kBitConversionIntLow=+!!T.__detectBigEndian(),T.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return e===0?30:0|29-(0|n(e>>>0)/t)},T.__imul=e||function(e,t){return 0|e*t},T})}))(),1),H1=X.default.BigInt(0),U1=X.default.BigInt(1),W1=X.default.BigInt(2),G1=X.default.BigInt(10),K1=X.default.BigInt(24),q1=X.default.BigInt(60),J1=X.default.BigInt(1e3),Y1=X.default.BigInt(1e6),X1=X.default.BigInt(1e9),Z1=X.default.multiply(X.default.BigInt(3600),X1),Q1=X.default.multiply(q1,X1),$1=X.default.multiply(Z1,K1);function e0(e){return typeof e==`bigint`?X.default.BigInt(e.toString(10)):e}function t0(e){return X.default.equal(X.default.remainder(e,W1),H1)}function n0(e){return X.default.lessThan(e,H1)?X.default.unaryMinus(e):e}function r0(e,t){return X.default.lessThan(e,t)?-1:+!!X.default.greaterThan(e,t)}function i0(e,t){return{quotient:X.default.divide(e,t),remainder:X.default.remainder(e,t)}}var a0,o0,s0=`slot-epochNanoSeconds`,c0=`slot-iso-date`,l0=`slot-iso-date-time`,u0=`slot-time`,Z=`slot-calendar`,d0=`slot-date-brand`,f0=`slot-year-month-brand`,p0=`slot-month-day-brand`,m0=`slot-time-zone`,h0=`slot-years`,g0=`slot-months`,_0=`slot-weeks`,v0=`slot-days`,y0=`slot-hours`,b0=`slot-minutes`,x0=`slot-seconds`,S0=`slot-milliseconds`,C0=`slot-microseconds`,w0=`slot-nanoseconds`,T0=`date`,E0=`ym`,D0=`md`,O0=`time`,k0=`datetime`,A0=`instant`,j0=`original`,M0=`timezone-canonical`,N0=`timezone-original`,P0=`calendar-id`,F0=`locale`,I0=`options`,L0=new WeakMap,R0=Symbol.for(`@@Temporal__GetSlots`);(a0=globalThis)[R0]||(a0[R0]=function(e){return L0.get(e)});var z0=globalThis[R0],B0=Symbol.for(`@@Temporal__CreateSlots`);(o0=globalThis)[B0]||(o0[B0]=function(e){L0.set(e,Object.create(null))});var V0=globalThis[B0];function H0(e,...t){if(!e||typeof e!=`object`)return!1;let n=z0(e);return!!n&&t.every((e=>e in n))}function Q(e,t){let n=z0(e)?.[t];if(n===void 0)throw TypeError(`Missing internal slot ${t}`);return n}function U0(e,t,n){let r=z0(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t])throw TypeError(`${t} already has set`);r[t]=n}var W0={};function G0(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});let n=Object.getOwnPropertyNames(e);for(let t=0;t<n.length;t++){let r=n[t],i=Object.getOwnPropertyDescriptor(e,r);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e,r,i))}let r=Object.getOwnPropertyNames(e.prototype);for(let t=0;t<r.length;t++){let n=r[t],i=Object.getOwnPropertyDescriptor(e.prototype,n);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e.prototype,n,i))}K0(t,e),K0(`${t}.prototype`,e.prototype)}function K0(e,t){let n=`%${e}%`;if(W0[n]!==void 0)throw Error(`intrinsic ${e} already exists`);W0[n]=t}function q0(e){return W0[e]}function J0(e,t){let n=e;if(n===0)return{div:n,mod:n};let r=Math.sign(n);n=Math.abs(n);let i=Math.trunc(1+Math.log10(n));if(t>=i)return{div:0*r,mod:r*n};if(t===0)return{div:r*n,mod:0*r};let a=n.toPrecision(i);return{div:r*Number.parseInt(a.slice(0,i-t),10),mod:r*Number.parseInt(a.slice(i-t),10)}}function Y0(e,t,n){let r=e,i=n;if(r===0)return i;let a=Math.sign(r)||Math.sign(i);r=Math.abs(r),i=Math.abs(i);let o=r.toPrecision(Math.trunc(1+Math.log10(r)));if(i===0)return a*Number.parseInt(o+`0`.repeat(t),10);let s=o+i.toPrecision(Math.trunc(1+Math.log10(i))).padStart(t,`0`);return a*Number.parseInt(s,10)}function X0(e,t){let n=t===`negative`;switch(e){case`ceil`:return n?`zero`:`infinity`;case`floor`:return n?`infinity`:`zero`;case`expand`:return`infinity`;case`trunc`:return`zero`;case`halfCeil`:return n?`half-zero`:`half-infinity`;case`halfFloor`:return n?`half-infinity`:`half-zero`;case`halfExpand`:return`half-infinity`;case`halfTrunc`:return`half-zero`;case`halfEven`:return`half-even`}}function Z0(e,t,n,r,i){return i===`zero`?e:i===`infinity`?t:n<0?e:n>0?t:i===`half-zero`?e:i===`half-infinity`?t:r?e:t}var Q0=class e{constructor(e){this.totalNs=e0(e),this.sec=X.default.toNumber(X.default.divide(this.totalNs,X1)),this.subsec=X.default.toNumber(X.default.remainder(this.totalNs,X1))}static validateNew(t,n){if(X.default.greaterThan(n0(t),e.MAX))throw RangeError(`${n} of duration time units cannot exceed ${e.MAX} s`);return new e(t)}static fromEpochNsDiff(t,n){let r=X.default.subtract(e0(t),e0(n));return new e(r)}static fromComponents(t,n,r,i,a,o){let s=X.default.add(X.default.add(X.default.add(X.default.add(X.default.add(X.default.BigInt(o),X.default.multiply(X.default.BigInt(a),J1)),X.default.multiply(X.default.BigInt(i),Y1)),X.default.multiply(X.default.BigInt(r),X1)),X.default.multiply(X.default.BigInt(n),Q1)),X.default.multiply(X.default.BigInt(t),Z1));return e.validateNew(s,`total`)}abs(){return new e(n0(this.totalNs))}add(t){return e.validateNew(X.default.add(this.totalNs,t.totalNs),`sum`)}add24HourDays(t){return e.validateNew(X.default.add(this.totalNs,X.default.multiply(X.default.BigInt(t),$1)),`sum`)}addToEpochNs(e){return X.default.add(e0(e),this.totalNs)}cmp(e){return r0(this.totalNs,e.totalNs)}divmod(t){let{quotient:n,remainder:r}=i0(this.totalNs,X.default.BigInt(t));return{quotient:X.default.toNumber(n),remainder:new e(r)}}fdiv(e){let t=e0(e),n=X.default.BigInt(t),{quotient:r,remainder:i}=i0(this.totalNs,n),a=[],o,s=(X.default.lessThan(this.totalNs,H1)?-1:1)*Math.sign(X.default.toNumber(t));for(;!X.default.equal(i,H1)&&a.length<50;)i=X.default.multiply(i,G1),{quotient:o,remainder:i}=i0(i,n),a.push(Math.abs(X.default.toNumber(o)));return s*Number(n0(r).toString()+`.`+a.join(``))}isZero(){return X.default.equal(this.totalNs,H1)}round(t,n){let r=e0(t);if(X.default.equal(r,U1))return this;let{quotient:i,remainder:a}=i0(this.totalNs,r),o=X.default.lessThan(this.totalNs,H1)?`negative`:`positive`,s=X.default.multiply(n0(i),r),c=X.default.add(s,r),l=r0(n0(X.default.multiply(a,W1)),r),u=X0(n,o),d=X.default.equal(n0(this.totalNs),s)?s:Z0(s,c,l,t0(i),u),f=o===`positive`?d:X.default.unaryMinus(d);return e.validateNew(f,`rounding`)}sign(){return this.cmp(new e(H1))}subtract(t){return e.validateNew(X.default.subtract(this.totalNs,t.totalNs),`difference`)}};Q0.MAX=X.default.BigInt(`9007199254740991999999999`),Q0.ZERO=new Q0(H1);var $0=/[A-Za-z._][A-Za-z._0-9+-]*/,e2=RegExp(`(?:(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)|(?:${$0.source})(?:\\/(?:${$0.source}))*)`),t2=/(?:[+-]\d{6}|\d{4})/,n2=/(?:0[1-9]|1[0-2])/,r2=/(?:0[1-9]|[12]\d|3[01])/,i2=RegExp(`(${t2.source})(?:-(${n2.source})-(${r2.source})|(${n2.source})(${r2.source}))`),a2=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,o2=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,s2=RegExp(`([zZ])|${o2.source}?`),c2=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,l2=new RegExp([`^${i2.source}`,`(?:(?:[tT]|\\s+)${a2.source}(?:${s2.source})?)?`,`(?:\\[!?(${e2.source})\\])?`,`((?:${c2.source})*)$`].join(``)),u2=new RegExp([`^[tT]?${a2.source}`,`(?:${s2.source})?`,`(?:\\[!?${e2.source}\\])?`,`((?:${c2.source})*)$`].join(``)),d2=RegExp(`^(${t2.source})-?(${n2.source})(?:\\[!?${e2.source}\\])?((?:${c2.source})*)$`),f2=RegExp(`^(?:--)?(${n2.source})-?(${r2.source})(?:\\[!?${e2.source}\\])?((?:${c2.source})*)$`),p2=/(\d+)(?:[.,](\d{1,9}))?/,m2=RegExp(`(?:${p2.source}H)?(?:${p2.source}M)?(?:${p2.source}S)?`),h2=RegExp(`^([+-])?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?!$)${m2.source})?$`,`i`),g2=864e5,_2=1e6*g2,v2=6e10,y2=1e8*g2,b2=v8(y2),x2=X.default.unaryMinus(b2),S2=X.default.add(X.default.subtract(x2,$1),U1),C2=X.default.subtract(X.default.add(b2,$1),U1),w2=146097*g2,T2=-271821,E2=275760,D2=Date.UTC(1847,0,1),O2=[`iso8601`,`hebrew`,`islamic`,`islamic-umalqura`,`islamic-tbla`,`islamic-civil`,`islamic-rgsa`,`islamicc`,`persian`,`ethiopic`,`ethioaa`,`ethiopic-amete-alem`,`coptic`,`chinese`,`dangi`,`roc`,`indian`,`buddhist`,`japanese`,`gregory`],k2=new Set([`ACT`,`AET`,`AGT`,`ART`,`AST`,`BET`,`BST`,`CAT`,`CNT`,`CST`,`CTT`,`EAT`,`ECT`,`IET`,`IST`,`JST`,`MIT`,`NET`,`NST`,`PLT`,`PNT`,`PRT`,`PST`,`SST`,`VST`]);function A2(e){return typeof e==`object`&&!!e||typeof e==`function`}function j2(e){if(typeof e==`bigint`)throw TypeError(`Cannot convert BigInt to number`);return Number(e)}function M2(e){if(typeof e==`symbol`)throw TypeError(`Cannot convert a Symbol value to a String`);return String(e)}function N2(e){let t=j2(e);if(t===0)return 0;if(Number.isNaN(t)||t===1/0||t===-1/0)throw RangeError(`invalid number value`);let n=Math.trunc(t);return n===0?0:n}function P2(e,t){let n=N2(e);if(n<=0)throw RangeError(t===void 0?`Cannot convert a number less than one to a positive integer`:`property '${t}' cannot be a a number less than one`);return n}function F2(e){let t=j2(e);if(Number.isNaN(t))throw RangeError(`not a number`);if(t===1/0||t===-1/0)throw RangeError(`infinity is out of range`);if(!function(e){if(typeof e!=`number`||Number.isNaN(e)||e===1/0||e===-1/0)return!1;let t=Math.abs(e);return Math.floor(t)===t}(t))throw RangeError(`unsupported fractional value ${e}`);return t===0?0:t}function I2(e,t){return String(e).padStart(t,`0`)}function L2(e){if(typeof e!=`string`)throw TypeError(`expected a string, not ${String(e)}`);return e}function R2(e,t){if(A2(e)){let t=e?.toString();if(typeof t==`string`||typeof t==`number`)return t;throw TypeError(`Cannot convert object to primitive value`)}return e}var z2=[`era`,`eraYear`,`year`,`month`,`monthCode`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],B2={era:M2,eraYear:N2,year:N2,month:P2,monthCode:function(e){let t=L2(R2(e));if(t.length<3||t.length>4||t[0]!==`M`||`0123456789`.indexOf(t[1])===-1||`0123456789`.indexOf(t[2])===-1||t[1]+t[2]===`00`&&t[3]!==`L`||t[3]!==`L`&&t[3]!==void 0)throw RangeError(`bad month code ${t}; must match M01-M99 or M00L-M99L`);return t},day:P2,hour:N2,minute:N2,second:N2,millisecond:N2,microsecond:N2,nanosecond:N2,offset:function(e){let t=L2(R2(e));return G3(t),t},timeZone:C3},V2={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},H2=[[`years`,`year`,`date`],[`months`,`month`,`date`],[`weeks`,`week`,`date`],[`days`,`day`,`date`],[`hours`,`hour`,`time`],[`minutes`,`minute`,`time`],[`seconds`,`second`,`time`],[`milliseconds`,`millisecond`,`time`],[`microseconds`,`microsecond`,`time`],[`nanoseconds`,`nanosecond`,`time`]],U2=Object.fromEntries(H2.map((e=>[e[0],e[1]]))),W2=Object.fromEntries(H2.map((([e,t])=>[t,e]))),G2=H2.map((([,e])=>e)),K2={day:_2,hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},q2=[`days`,`hours`,`microseconds`,`milliseconds`,`minutes`,`months`,`nanoseconds`,`seconds`,`weeks`,`years`],J2=Intl.DateTimeFormat,Y2=new Map;function X2(e){let t=D8(e),n=Y2.get(t);return n===void 0&&(n=new J2(`en-us`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Y2.set(t,n)),n}function Z2(e){return H0(e,s0)&&!H0(e,m0,Z)}function Q2(e){return H0(e,h0,g0,v0,y0,b0,x0,S0,C0,w0)}function $2(e){return H0(e,d0)}function e4(e){return H0(e,u0)}function t4(e){return H0(e,l0)}function n4(e){return H0(e,f0)}function r4(e){return H0(e,p0)}function i4(e){return H0(e,s0,m0,Z)}function $(e,t){if(!t(e))throw TypeError(`invalid receiver: method called with the wrong type of this-object`)}function a4(e){if(H0(e,Z)||H0(e,m0))throw TypeError(`with() does not support a calendar or timeZone property`);if(e4(e))throw TypeError(`with() does not accept Temporal.PlainTime, use withPlainTime() instead`);if(e.calendar!==void 0)throw TypeError(`with() does not support a calendar property`);if(e.timeZone!==void 0)throw TypeError(`with() does not support a timeZone property`)}function o4(e,t){return t===`never`||t===`auto`&&e===`iso8601`?``:`[${t===`critical`?`!`:``}u-ca=${e}]`}function s4(e){let t,n,r=!1;for(c2.lastIndex=0;n=c2.exec(e);){let{1:i,2:a,3:o}=n;if(a===`u-ca`){if(t===void 0)t=o,r=i===`!`;else if(i===`!`||r)throw RangeError(`Invalid annotations in ${e}: more than one u-ca present with critical flag`)}else if(i===`!`)throw RangeError(`Unrecognized annotation: !${a}=${o}`)}return t}function c4(e){let t=l2.exec(e);if(!t)throw RangeError(`invalid RFC 9557 string: ${e}`);let n=s4(t[16]),r=t[1];if(r===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);let i=+r,a=+(t[2]??t[4]??1),o=+(t[3]??t[5]??1),s=t[6]!==void 0,c=+(t[6]??0),l=+(t[7]??t[10]??0),u=+(t[8]??t[11]??0);u===60&&(u=59);let d=(t[9]??t[12]??``)+`000000000`,f=+d.slice(0,3),p=+d.slice(3,6),m=+d.slice(6,9),h,g=!1;t[13]?(h=void 0,g=!0):t[14]&&(h=t[14]);let _=t[15];return S6(i,a,o,c,l,u,f,p,m),{year:i,month:a,day:o,time:s?{hour:c,minute:l,second:u,millisecond:f,microsecond:p,nanosecond:m}:`start-of-day`,tzAnnotation:_,offset:h,z:g,calendar:n}}function l4(e){let t=u2.exec(e),n,r,i,a,o,s,c;if(t){c=s4(t[10]),n=+(t[1]??0),r=+(t[2]??t[5]??0),i=+(t[3]??t[6]??0),i===60&&(i=59);let e=(t[4]??t[7]??``)+`000000000`;if(a=+e.slice(0,3),o=+e.slice(3,6),s=+e.slice(6,9),t[8])throw RangeError(`Z designator not supported for PlainTime`)}else{let t,l;if({time:t,z:l,calendar:c}=c4(e),t===`start-of-day`)throw RangeError(`time is missing in string: ${e}`);if(l)throw RangeError(`Z designator not supported for PlainTime`);({hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s}=t)}if(x6(n,r,i,a,o,s),/[tT ][0-9][0-9]/.test(e))return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c};try{let{month:t,day:n}=d4(e);y6(1972,t,n)}catch{try{let{year:t,month:n}=u4(e);y6(t,n,1)}catch{return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c}}}throw RangeError(`invalid RFC 9557 time-only string ${e}; may need a T prefix`)}function u4(e){let t=d2.exec(e),n,r,i,a;if(t){i=s4(t[3]);let o=t[1];if(o===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);if(n=+o,r=+t[2],a=1,i!==void 0&&i!==`iso8601`)throw RangeError(`YYYY-MM format is only valid with iso8601 calendar`)}else{let t;if({year:n,month:r,calendar:i,day:a,z:t}=c4(e),t)throw RangeError(`Z designator not supported for PlainYearMonth`)}return{year:n,month:r,calendar:i,referenceISODay:a}}function d4(e){let t=f2.exec(e),n,r,i,a;if(t){if(i=s4(t[3]),n=+t[1],r=+t[2],i!==void 0&&i!==`iso8601`)throw RangeError(`MM-DD format is only valid with iso8601 calendar`)}else{let t;if({month:n,day:r,calendar:i,year:a,z:t}=c4(e),t)throw RangeError(`Z designator not supported for PlainMonthDay`)}return{month:n,day:r,calendar:i,referenceISOYear:a}}var f4=RegExp(`^${e2.source}$`,`i`),p4=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?$`);function m4(e){let t=k8.test(e)?`Seconds not allowed in offset time zone`:`Invalid time zone`;throw RangeError(`${t}: ${e}`)}function h4(e){return f4.test(e)||m4(e),p4.test(e)?{offsetMinutes:G3(e)/6e10}:{tzName:e}}function g4(e,t,n,r){let i=e,a=t,o=n;switch(r){case`reject`:y6(i,a,o);break;case`constrain`:({year:i,month:a,day:o}=_6(i,a,o))}return{year:i,month:a,day:o}}function _4(e,t,n,r,i,a,o){let s=e,c=t,l=n,u=r,d=i,f=a;switch(o){case`reject`:x6(s,c,l,u,d,f);break;case`constrain`:s=g6(s,0,23),c=g6(c,0,59),l=g6(l,0,59),u=g6(u,0,999),d=g6(d,0,999),f=g6(f,0,999)}return{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function v4(e){if(!A2(e))throw TypeError(`invalid duration-like`);let t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},n=!1;for(let r=0;r<q2.length;r++){let i=q2[r],a=e[i];a!==void 0&&(n=!0,t[i]=F2(a))}if(!n)throw TypeError(`invalid duration-like`);return t}function y4({years:e,months:t,weeks:n,days:r},i,a,o){return{years:e,months:o??t,weeks:a??n,days:i??r}}function b4(e,t){return{isoDate:e,time:t}}function x4(e){return T8(e,`overflow`,[`constrain`,`reject`],`constrain`)}function S4(e){return T8(e,`disambiguation`,[`compatible`,`earlier`,`later`,`reject`],`compatible`)}function C4(e,t){return T8(e,`roundingMode`,[`ceil`,`floor`,`expand`,`trunc`,`halfCeil`,`halfFloor`,`halfExpand`,`halfTrunc`,`halfEven`],t)}function w4(e,t){return T8(e,`offset`,[`prefer`,`use`,`ignore`,`reject`],t)}function T4(e){return T8(e,`calendarName`,[`auto`,`always`,`never`,`critical`],`auto`)}function E4(e){let t=e.roundingIncrement;if(t===void 0)return 1;let n=N2(t);if(n<1||n>1e9)throw RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return n}function D4(e,t,n){let r=n?t:t-1;if(e>r)throw RangeError(`roundingIncrement must be at least 1 and less than ${r}, not ${e}`);if(t%e!=0)throw RangeError(`Rounding increment must divide evenly into ${t}`)}function O4(e){let t=e.fractionalSecondDigits;if(t===void 0)return`auto`;if(typeof t!=`number`){if(M2(t)!==`auto`)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return`auto`}let n=Math.floor(t);if(!Number.isFinite(n)||n<0||n>9)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return n}function k4(e,t){switch(e){case`minute`:return{precision:`minute`,unit:`minute`,increment:1};case`second`:return{precision:0,unit:`second`,increment:1};case`millisecond`:return{precision:3,unit:`millisecond`,increment:1};case`microsecond`:return{precision:6,unit:`microsecond`,increment:1};case`nanosecond`:return{precision:9,unit:`nanosecond`,increment:1}}switch(t){case`auto`:return{precision:t,unit:`nanosecond`,increment:1};case 0:return{precision:t,unit:`second`,increment:1};case 1:case 2:case 3:return{precision:t,unit:`millisecond`,increment:10**(3-t)};case 4:case 5:case 6:return{precision:t,unit:`microsecond`,increment:10**(6-t)};case 7:case 8:case 9:return{precision:t,unit:`nanosecond`,increment:10**(9-t)};default:throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`)}}var A4=Symbol(`~required~`);function j4(e,t,n,r,i=[]){let a=[];for(let e=0;e<H2.length;e++){let t=H2[e],r=t[1],i=t[2];n!==`datetime`&&n!==i||a.push(r)}a=a.concat(i);let o=r;o===A4?o=void 0:o!==void 0&&a.push(o);let s=[];s=s.concat(a);for(let e=0;e<a.length;e++){let t=W2[a[e]];t!==void 0&&s.push(t)}let c=T8(e,t,s,o);if(c===void 0&&r===A4)throw RangeError(`${t} is required`);return c&&c in U2?U2[c]:c}function M4(e){let t=e.relativeTo;if(t===void 0)return{};let n,r,i,a,o,s=`option`,c=!1;if(A2(t)){if(i4(t))return{zonedRelativeTo:t};if($2(t))return{plainRelativeTo:t};if(t4(t))return{plainRelativeTo:e3(Q(t,l0).isoDate,Q(t,Z))};i=v3(t);let e=B4(i,t,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[]);({isoDate:n,time:r}=U4(i,e,`constrain`)),{offset:o,timeZone:a}=e,o===void 0&&(s=`wall`)}else{let e,l,u,d,f;if({year:u,month:d,day:f,time:r,calendar:i,tzAnnotation:e,offset:o,z:l}=c4(L2(t)),e)a=C3(e),l?s=`exact`:o||(s=`wall`),c=!0;else if(l)throw RangeError(`Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone`);i||=`iso8601`,i=E8(i),n={year:u,month:d,day:f}}return a===void 0?{plainRelativeTo:e3(n,i)}:{zonedRelativeTo:f3(Z4(n,r,s,s===`option`?G3(o):0,a,`compatible`,`reject`,c),a,i)}}function N4(e){return Q(e,h0)===0?Q(e,g0)===0?Q(e,_0)===0?Q(e,v0)===0?Q(e,y0)===0?Q(e,b0)===0?Q(e,x0)===0?Q(e,S0)===0?Q(e,C0)===0?`nanosecond`:`microsecond`:`millisecond`:`second`:`minute`:`hour`:`day`:`week`:`month`:`year`}function P4(e,t){return G2.indexOf(e)>G2.indexOf(t)?t:e}function F4(e){return e===`year`||e===`month`||e===`week`}function I4(e){return F4(e)||e===`day`?`date`:`time`}function L4(e){return q0(`%calendarImpl%`)(e)}function R4(e){return q0(`%calendarImpl%`)(Q(e,Z))}function z4(e,t,n=`date`){let r=Object.create(null),i=L4(e).isoToDate(t,{year:!0,monthCode:!0,day:!0});return r.monthCode=i.monthCode,n!==`month-day`&&n!==`date`||(r.day=i.day),n!==`year-month`&&n!==`date`||(r.year=i.year),r}function B4(e,t,n,r,i){let a=L4(e).extraFields(n),o=n.concat(r,a),s=Object.create(null),c=!1;o.sort();for(let e=0;e<o.length;e++){let n=o[e],r=t[n];if(r!==void 0)c=!0,s[n]=(0,B2[n])(r);else if(i!==`partial`){if(i.includes(n))throw TypeError(`required property '${n}' missing or undefined`);s[n]=V2[n]}}if(i===`partial`&&!c)throw TypeError(`no supported properties found`);return s}function V4(e,t=`complete`){let n=[`hour`,`microsecond`,`millisecond`,`minute`,`nanosecond`,`second`],r=!1,i=Object.create(null);for(let a=0;a<n.length;a++){let o=n[a],s=e[o];s===void 0?t===`complete`&&(i[o]=0):(i[o]=N2(s),r=!0)}if(!r)throw TypeError(`invalid time-like`);return i}function H4(e,t){if(A2(e)){if($2(e))return x4(C8(t)),e3(Q(e,c0),Q(e,Z));if(i4(e)){let n=D3(Q(e,m0),Q(e,s0));return x4(C8(t)),e3(n.isoDate,Q(e,Z))}if(t4(e))return x4(C8(t)),e3(Q(e,l0).isoDate,Q(e,Z));let n=v3(e);return e3(b3(n,B4(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),x4(C8(t))),n)}let{year:n,month:r,day:i,calendar:a,z:o}=c4(L2(e));if(o)throw RangeError(`Z designator not supported for PlainDate`);return a||=`iso8601`,a=E8(a),x4(C8(t)),e3({year:n,month:r,day:i},a)}function U4(e,t,n){return b4(b3(e,t,n),_4(t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond,n))}function W4(e,t){let n,r,i;if(A2(e)){if(t4(e))return x4(C8(t)),n3(Q(e,l0),Q(e,Z));if(i4(e)){let n=D3(Q(e,m0),Q(e,s0));return x4(C8(t)),n3(n,Q(e,Z))}if($2(e))return x4(C8(t)),n3(b4(Q(e,c0),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Q(e,Z));i=v3(e);let a=B4(i,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],[]),o=x4(C8(t));({isoDate:n,time:r}=U4(i,a,o))}else{let a,o,s,c;if({year:o,month:s,day:c,time:r,calendar:i,z:a}=c4(L2(e)),a)throw RangeError(`Z designator not supported for PlainDateTime`);r===`start-of-day`&&(r={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),S6(o,s,c,r.hour,r.minute,r.second,r.millisecond,r.microsecond,r.nanosecond),i||=`iso8601`,i=E8(i),x4(C8(t)),n={year:o,month:s,day:c}}return n3(b4(n,r),i)}function G4(e){let t=q0(`%Temporal.Duration%`);if(Q2(e))return new t(Q(e,h0),Q(e,g0),Q(e,_0),Q(e,v0),Q(e,y0),Q(e,b0),Q(e,x0),Q(e,S0),Q(e,C0),Q(e,w0));if(!A2(e))return function(e){let{years:t,months:n,weeks:r,days:i,hours:a,minutes:o,seconds:s,milliseconds:c,microseconds:l,nanoseconds:u}=function(e){let t=h2.exec(e);if(!t||t.every(((e,t)=>t<2||e===void 0)))throw RangeError(`invalid duration: ${e}`);let n=t[1]===`-`?-1:1,r=t[2]===void 0?0:N2(t[2])*n,i=t[3]===void 0?0:N2(t[3])*n,a=t[4]===void 0?0:N2(t[4])*n,o=t[5]===void 0?0:N2(t[5])*n,s=t[6]===void 0?0:N2(t[6])*n,c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=0,m=0,h=0;if(c!==void 0){if(l??u??d??f)throw RangeError(`only the smallest unit can be fractional`);h=3600*N2((c+`000000000`).slice(0,9))*n}else if(p=l===void 0?0:N2(l)*n,u!==void 0){if(d??f)throw RangeError(`only the smallest unit can be fractional`);h=60*N2((u+`000000000`).slice(0,9))*n}else m=d===void 0?0:N2(d)*n,f!==void 0&&(h=N2((f+`000000000`).slice(0,9))*n);let g=h%1e3,_=Math.trunc(h/1e3)%1e3,v=Math.trunc(h/1e6)%1e3;return m+=Math.trunc(h/1e9)%60,p+=Math.trunc(h/6e10),D6(r,i,a,o,s,p,m,v,_,g),{years:r,months:i,weeks:a,days:o,hours:s,minutes:p,seconds:m,milliseconds:v,microseconds:_,nanoseconds:g}}(e);return new(q0(`%Temporal.Duration%`))(t,n,r,i,a,o,s,c,l,u)}(L2(e));let n={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=v4(e);for(let e=0;e<q2.length;e++){let t=q2[e],i=r[t];i!==void 0&&(n[t]=i)}return new t(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function K4(e){let t;if(A2(e)){if(Z2(e)||i4(e))return u3(Q(e,s0));t=R2(e)}else t=e;let{year:n,month:r,day:i,time:a,offset:o,z:s}=function(e){let t=c4(e);if(!t.z&&!t.offset)throw RangeError(`Temporal.Instant requires a time zone offset`);return t}(L2(t)),{hour:c=0,minute:l=0,second:u=0,millisecond:d=0,microsecond:f=0,nanosecond:p=0}=a===`start-of-day`?{}:a,m=f6(n,r,i,c,l,u,d,f,p-(s?0:G3(o)));return P6(m.isoDate),u3(e6(m))}function q4(e,t){if(A2(e)){if(r4(e))return x4(C8(t)),i3(Q(e,c0),Q(e,Z));let n;return H0(e,Z)?n=Q(e,Z):(n=e.calendar,n===void 0&&(n=`iso8601`),n=_3(n)),i3(S3(n,B4(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),x4(C8(t))),n)}let{month:n,day:r,referenceISOYear:i,calendar:a}=d4(L2(e));if(a===void 0&&(a=`iso8601`),a=E8(a),x4(C8(t)),a===`iso8601`)return i3({year:1972,month:n,day:r},a);let o={year:i,month:n,day:r};return b6(o),o=S3(a,z4(a,o,`month-day`),`constrain`),i3(o,a)}function J4(e,t){let n;if(A2(e)){if(e4(e))return x4(C8(t)),o3(Q(e,u0));if(t4(e))return x4(C8(t)),o3(Q(e,l0).time);if(i4(e)){let n=D3(Q(e,m0),Q(e,s0));return x4(C8(t)),o3(n.time)}let{hour:r,minute:i,second:a,millisecond:o,microsecond:s,nanosecond:c}=V4(e);n=_4(r,i,a,o,s,c,x4(C8(t)))}else n=l4(L2(e)),x4(C8(t));return o3(n)}function Y4(e){return e===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:Q(J4(e),u0)}function X4(e,t){if(A2(e)){if(n4(e))return x4(C8(t)),c3(Q(e,c0),Q(e,Z));let n=v3(e);return c3(x3(n,B4(n,e,[`year`,`month`,`monthCode`],[],[]),x4(C8(t))),n)}let{year:n,month:r,referenceISODay:i,calendar:a}=u4(L2(e));a===void 0&&(a=`iso8601`),a=E8(a),x4(C8(t));let o={year:n,month:r,day:i};return E6(o),o=x3(a,z4(a,o,`year-month`),`constrain`),c3(o,a)}function Z4(e,t,n,r,i,a,o,s){if(t===`start-of-day`)return j3(i,e);let c=b4(e,t);if(n===`wall`||o===`ignore`)return O3(i,c,a);if(n===`exact`||o===`use`){let n=f6(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond-r);P6(n.isoDate);let i=e6(n);return T6(i),i}P6(e);let l=e6(c),u=A3(i,c);for(let e=0;e<u.length;e++){let t=u[e],n=X.default.toNumber(X.default.subtract(l,t)),i=s8(n,6e10,`halfExpand`);if(n===r||s&&i===r)return t}if(o===`reject`){let e=E3(r),t=B3(c,`iso8601`,`auto`);throw RangeError(`Offset ${e} is invalid for ${t} in ${i}`)}return k3(u,i,c,a)}function Q4(e,t){let n,r,i,a,o,s,c,l=!1,u=`option`;if(A2(e)){if(i4(e)){let n=C8(t);return S4(n),w4(n,`reject`),x4(n),f3(Q(e,s0),Q(e,m0),Q(e,Z))}o=v3(e);let l=B4(o,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[`timeZone`]);({offset:a,timeZone:i}=l),a===void 0&&(u=`wall`);let d=C8(t);s=S4(d),c=w4(d,`reject`);let f=x4(d);({isoDate:n,time:r}=U4(o,l,f))}else{let d,f,p,m,h;({year:p,month:m,day:h,time:r,tzAnnotation:d,offset:a,z:f,calendar:o}=function(e){let t=c4(e);if(!t.tzAnnotation)throw RangeError(`Temporal.ZonedDateTime requires a time zone ID in brackets`);return t}(L2(e))),i=C3(d),f?u=`exact`:a||(u=`wall`),o||=`iso8601`,o=E8(o),l=!0;let g=C8(t);s=S4(g),c=w4(g,`reject`),x4(g),n={year:p,month:m,day:h}}let d=0;return u===`option`&&(d=G3(a)),f3(Z4(n,r,u,d,i,s,c,l),i,o)}function $4(e,t,n){b6(t),V0(e),U0(e,c0,t),U0(e,Z,n),U0(e,d0,!0)}function e3(e,t){let n=q0(`%Temporal.PlainDate%`),r=Object.create(n.prototype);return $4(r,e,t),r}function t3(e,t,n){C6(t),V0(e),U0(e,l0,t),U0(e,Z,n)}function n3(e,t){let n=q0(`%Temporal.PlainDateTime%`),r=Object.create(n.prototype);return t3(r,e,t),r}function r3(e,t,n){b6(t),V0(e),U0(e,c0,t),U0(e,Z,n),U0(e,p0,!0)}function i3(e,t){let n=q0(`%Temporal.PlainMonthDay%`),r=Object.create(n.prototype);return r3(r,e,t),r}function a3(e,t){V0(e),U0(e,u0,t)}function o3(e){let t=q0(`%Temporal.PlainTime%`),n=Object.create(t.prototype);return a3(n,e),n}function s3(e,t,n){E6(t),V0(e),U0(e,c0,t),U0(e,Z,n),U0(e,f0,!0)}function c3(e,t){let n=q0(`%Temporal.PlainYearMonth%`),r=Object.create(n.prototype);return s3(r,e,t),r}function l3(e,t){T6(t),V0(e),U0(e,s0,t)}function u3(e){let t=q0(`%Temporal.Instant%`),n=Object.create(t.prototype);return l3(n,e),n}function d3(e,t,n,r){T6(t),V0(e),U0(e,s0,t),U0(e,m0,n),U0(e,Z,r)}function f3(e,t,n=`iso8601`){let r=q0(`%Temporal.ZonedDateTime%`),i=Object.create(r.prototype);return d3(i,e,t,n),i}function p3(e){return z2.filter((t=>e[t]!==void 0))}function m3(e,t,n){let r=p3(n),i=L4(e).fieldKeysToIgnore(r),a=Object.create(null),o=p3(t);for(let e=0;e<z2.length;e++){let s,c=z2[e];o.includes(c)&&!i.includes(c)&&(s=t[c]),r.includes(c)&&(s=n[c]),s!==void 0&&(a[c]=s)}return a}function h3(e,t,n,r){let i=L4(e).dateAdd(t,n,r);return b6(i),i}function g3(e,t,n,r){return L4(e).dateUntil(t,n,r)}function _3(e){if(A2(e)&&H0(e,Z))return Q(e,Z);let t=L2(e);try{return E8(t)}catch{}let n;try{({calendar:n}=c4(t))}catch{try{({calendar:n}=l4(t))}catch{try{({calendar:n}=u4(t))}catch{({calendar:n}=d4(t))}}}return n||=`iso8601`,E8(n)}function v3(e){if(H0(e,Z))return Q(e,Z);let{calendar:t}=e;return t===void 0?`iso8601`:_3(t)}function y3(e,t){return E8(e)===E8(t)}function b3(e,t,n){let r=L4(e);r.resolveFields(t,`date`);let i=r.dateToISO(t,n);return b6(i),i}function x3(e,t,n){let r=L4(e);r.resolveFields(t,`year-month`),t.day=1;let i=r.dateToISO(t,n);return E6(i),i}function S3(e,t,n){let r=L4(e);r.resolveFields(t,`month-day`);let i=r.monthDayToISOReferenceDate(t,n);return b6(i),i}function C3(e){if(A2(e)&&i4(e))return Q(e,m0);let t=L2(e);if(t===`UTC`)return`UTC`;let{tzName:n,offsetMinutes:r}=function(e){let{tzAnnotation:t,offset:n,z:r}=function(e){if(f4.test(e))return{tzAnnotation:e,offset:void 0,z:!1};try{let{tzAnnotation:t,offset:n,z:r}=c4(e);if(r||t||n)return{tzAnnotation:t,offset:n,z:r}}catch{}m4(e)}(e);return t?h4(t):r?h4(`UTC`):n?h4(n):void 0}(t);if(r!==void 0)return Z3(r);let i=J3(n);if(!i)throw RangeError(`Unrecognized time zone ${n}`);return i.identifier}function w3(e,t){if(e===t)return!0;let n=h4(e).offsetMinutes,r=h4(t).offsetMinutes;if(n===void 0&&r===void 0){let n=J3(t);if(!n)return!1;let r=J3(e);return!!r&&r.primaryIdentifier===n.primaryIdentifier}return n===r}function T3(e,t){let n=h4(e).offsetMinutes;return n===void 0?X3(e,t):6e10*n}function E3(e){let t=e<0?`-`:`+`,n=Math.abs(e),r=Math.floor(n/36e11),i=Math.floor(n/6e10)%60,a=Math.floor(n/1e9)%60,o=n%1e9;return`${t}${F3(r,i,a,o,a===0&&o===0?`minute`:`auto`)}`}function D3(e,t){let n=T3(e,t),{isoDate:{year:r,month:i,day:a},time:{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d}}=t6(t);return f6(r,i,a,o,s,c,l,u,d+n)}function O3(e,t,n){return k3(A3(e,t),e,t,n)}function k3(e,t,n,r){let i=e.length;if(i===1)return e[0];if(i)switch(r){case`compatible`:case`earlier`:return e[0];case`later`:return e[i-1];case`reject`:throw RangeError(`multiple instants found`)}if(r===`reject`)throw RangeError(`multiple instants found`);let a=e6(n),o=X.default.subtract(a,$1);T6(o);let s=T3(t,o),c=X.default.add(a,$1);T6(c);let l=T3(t,c)-s;switch(r){case`earlier`:{let e=Q0.fromComponents(0,0,0,0,0,-l),r=Z6(n.time,e);return A3(t,b4(d6(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r))[0]}case`compatible`:case`later`:{let e=Q0.fromComponents(0,0,0,0,0,l),r=Z6(n.time,e),i=A3(t,b4(d6(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r));return i[i.length-1]}}}function A3(e,t){if(e===`UTC`)return P6(t.isoDate),[e6(t)];let n=h4(e).offsetMinutes;if(n!==void 0){let e=f6(t.isoDate.year,t.isoDate.month,t.isoDate.day,t.time.hour,t.time.minute-n,t.time.second,t.time.millisecond,t.time.microsecond,t.time.nanosecond);P6(e.isoDate);let r=e6(e);return T6(r),[r]}return P6(t.isoDate),function(e,t){let n=e6(t),r=X.default.subtract(n,$1);X.default.lessThan(r,x2)&&(r=n);let i=X.default.add(n,$1);X.default.greaterThan(i,b2)&&(i=n);let a=X3(e,r),o=X3(e,i);return(a===o?[a]:[a,o]).map((r=>{let i=X.default.subtract(n,X.default.BigInt(r));if(h8(t,function(e,t){let{epochMilliseconds:n,time:{millisecond:r,microsecond:i,nanosecond:a}}=t6(t),{year:o,month:s,day:c,hour:l,minute:u,second:d}=i6(e,n);return f6(o,s,c,l,u,d,r,i,a)}(e,i))===0)return T6(i),i})).filter((e=>e!==void 0))}(e,t)}function j3(e,t){let n=b4(t,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),r=A3(e,n);if(r.length)return r[0];let i=e6(n),a=X.default.subtract(i,$1);return T6(a),n6(e,a)}function M3(e){let t;return t=e<0||e>9999?(e<0?`-`:`+`)+I2(Math.abs(e),6):I2(e,4),t}function N3(e){return I2(e,2)}function P3(e,t){let n;if(t===`auto`){if(e===0)return``;n=I2(e,9).replace(/0+$/,``)}else{if(t===0)return``;n=I2(e,9).slice(0,t)}return`.${n}`}function F3(e,t,n,r,i){let a=`${N3(e)}:${N3(t)}`;return i===`minute`||(a+=`:${N3(n)}`,a+=P3(r,i)),a}function I3(e,t,n){let r=t;r===void 0&&(r=`UTC`);let i=Q(e,s0),a=B3(D3(r,i),`iso8601`,n,`never`),o=`Z`;return t!==void 0&&(o=Q3(T3(r,i))),`${a}${o}`}function L3(e,t){let n=Q(e,h0),r=Q(e,g0),i=Q(e,_0),a=Q(e,v0),o=Q(e,y0),s=Q(e,b0),c=s6(e),l=``;n!==0&&(l+=`${Math.abs(n)}Y`),r!==0&&(l+=`${Math.abs(r)}M`),i!==0&&(l+=`${Math.abs(i)}W`),a!==0&&(l+=`${Math.abs(a)}D`);let u=``;o!==0&&(u+=`${Math.abs(o)}H`),s!==0&&(u+=`${Math.abs(s)}M`);let d=Q0.fromComponents(0,0,Q(e,x0),Q(e,S0),Q(e,C0),Q(e,w0));d.isZero()&&![`second`,`millisecond`,`microsecond`,`nanosecond`].includes(N4(e))&&t===`auto`||(u+=`${Math.abs(d.sec)}${P3(Math.abs(d.subsec),t)}S`);let f=`${c<0?`-`:``}P${l}`;return u&&(f=`${f}T${u}`),f}function R3(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,c0);return`${M3(n)}-${N3(r)}-${N3(i)}${o4(Q(e,Z),t)}`}function z3({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){return F3(e,t,n,1e6*r+1e3*i+a,o)}function B3(e,t,n,r=`auto`){let{isoDate:{year:i,month:a,day:o},time:{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}=e;return`${M3(i)}-${N3(a)}-${N3(o)}T${F3(s,c,l,1e6*u+1e3*d+f,n)}${o4(t,r)}`}function V3(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,c0),a=`${N3(r)}-${N3(i)}`,o=Q(e,Z);t!==`always`&&t!==`critical`&&o===`iso8601`||(a=`${M3(n)}-${a}`);let s=o4(o,t);return s&&(a+=s),a}function H3(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,c0),a=`${M3(n)}-${N3(r)}`,o=Q(e,Z);t!==`always`&&t!==`critical`&&o===`iso8601`||(a+=`-${N3(i)}`);let s=o4(o,t);return s&&(a+=s),a}function U3(e,t,n=`auto`,r=`auto`,i=`auto`,a=void 0){let o=Q(e,s0);if(a){let{unit:e,increment:t,roundingMode:n}=a;o=c8(o,t,e,n)}let s=Q(e,m0),c=T3(s,o),l=B3(D3(s,o),`iso8601`,t,`never`);return i!==`never`&&(l+=Q3(c)),r!==`never`&&(l+=`[${r===`critical`?`!`:``}${s}]`),l+=o4(Q(e,Z),n),l}function W3(e){return p4.test(e)}function G3(e){let t=A8.exec(e);if(!t)throw RangeError(`invalid time zone offset: ${e}; must match ±HH:MM[:SS.SSSSSSSSS]`);return(t[1]===`-`?-1:1)*(1e9*(60*(60*t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+`000000000`).slice(0,9))}var K3,q3=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function J3(e){if(K3===void 0){let e=Intl.supportedValuesOf?.(`timeZone`);if(e){K3=new Map;for(let t=0;t<e.length;t++){let n=e[t];K3.set(D8(n),n)}}else K3=null}let t=D8(e),n=K3?.get(t);if(n)return{identifier:n,primaryIdentifier:n};try{n=X2(e).resolvedOptions().timeZone}catch{return}if(t===`antarctica/south_pole`&&(n=`Antarctica/McMurdo`),k2.has(e))throw RangeError(`${e} is a legacy time zone identifier from ICU. Use ${n} instead`);let r=[...t].map(((e,n)=>n===0||q3[t[n-1]]?e.toUpperCase():e)).join(``).split(`/`);if(r.length===1)return t===`gb-eire`?{identifier:`GB-Eire`,primaryIdentifier:n}:{identifier:t.length<=3||/[-0-9]/.test(t)?t.toUpperCase():r[0],primaryIdentifier:n};if(r[0]===`Etc`)return{identifier:`Etc/${[`Zulu`,`Greenwich`,`Universal`].includes(r[1])?r[1]:r[1].toUpperCase()}`,primaryIdentifier:n};if(r[0]===`Us`)return{identifier:`US/${r[1]}`,primaryIdentifier:n};let i=new Map([[`Act`,`ACT`],[`Lhi`,`LHI`],[`Nsw`,`NSW`],[`Dar_Es_Salaam`,`Dar_es_Salaam`],[`Port_Of_Spain`,`Port_of_Spain`],[`Port-Au-Prince`,`Port-au-Prince`],[`Isle_Of_Man`,`Isle_of_Man`],[`Comodrivadavia`,`ComodRivadavia`],[`Knox_In`,`Knox_IN`],[`Dumontdurville`,`DumontDUrville`],[`Mcmurdo`,`McMurdo`],[`Denoronha`,`DeNoronha`],[`Easterisland`,`EasterIsland`],[`Bajanorte`,`BajaNorte`],[`Bajasur`,`BajaSur`]]);return r[1]=i.get(r[1])??r[1],r.length>2&&(r[2]=i.get(r[2])??r[2]),{identifier:r.join(`/`),primaryIdentifier:n}}function Y3(e,t){let{year:n,month:r,day:i,hour:a,minute:o,second:s}=i6(e,t),c=t%1e3;return c<0&&(c+=1e3),1e6*($3({isoDate:{year:n,month:r,day:i},time:{hour:a,minute:o,second:s,millisecond:c}})-t)}function X3(e,t){return Y3(e,_8(t,`floor`))}function Z3(e){let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${F3(Math.floor(n/60),n%60,0,0,`minute`)}`}function Q3(e){return Z3(s8(e,v2,`halfExpand`)/6e10)}function $3({isoDate:{year:e,month:t,day:n},time:{hour:r,minute:i,second:a,millisecond:o}}){let s=e%400,c=(e-s)/400,l=new Date;return l.setUTCHours(r,i,a,o),l.setUTCFullYear(s,t-1,n),l.getTime()+w2*c}function e6(e){let t=$3(e),n=1e3*e.time.microsecond+e.time.nanosecond;return X.default.add(v8(t),X.default.BigInt(n))}function t6(e){let t=_8(e,`trunc`),n=X.default.toNumber(X.default.remainder(e,Y1));n<0&&(n+=1e6,--t);let r=Math.floor(n/1e3)%1e3,i=n%1e3,a=new Date(t);return{epochMilliseconds:t,isoDate:{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()},time:{hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:r,nanosecond:i}}}function n6(e,t){if(e===`UTC`)return null;let n=_8(t,`floor`);if(n<D2)return n6(e,v8(D2));let r=Math.max(n,Date.now())+366*g2*3,i=n,a=Y3(e,i),o=i,s=a;for(;a===s&&i<r;){if(o=i+2*g2*7,o>y2)return null;s=Y3(e,o),a===s&&(i=o)}return a===s?null:v8(j8((t=>Y3(e,t)),i,o,a,s))}function r6(e,t){if(e===`UTC`)return null;let n=_8(t,`ceil`),r=Date.now(),i=r+366*g2*3;if(n>i){let t=r6(e,v8(i));if(t===null||X.default.lessThan(t,v8(r)))return t}if(e===`Africa/Casablanca`||e===`Africa/El_Aaiun`){let t=Date.UTC(2088,0,1);if(t<n)return r6(e,v8(t))}let a=n-1;if(a<D2)return null;let o=Y3(e,a),s=a,c=o;for(;o===c&&a>D2;){if(s=a-2*g2*7,s<D2)return null;c=Y3(e,s),o===c&&(a=s)}return o===c?null:v8(j8((t=>Y3(e,t)),s,a,c,o))}function i6(e,t){return function(e){let t=e.split(/[^\w]+/);if(t.length!==7)throw RangeError(`expected 7 parts in "${e}`);let n=+t[0],r=+t[1],i=+t[2],a=t[3];if(a[0]===`b`||a[0]===`B`)i=1-i;else if(a[0]!==`a`&&a[0]!==`A`)throw RangeError(`Unknown era ${a} in "${e}`);let o=t[4]===`24`?0:+t[4],s=+t[5],c=+t[6];if(!(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(s)&&Number.isFinite(c)))throw RangeError(`Invalid number in "${e}`);return{year:i,month:n,day:r,hour:o,minute:s,second:c}}(X2(e).format(t))}function a6(e){return e!==void 0&&!(e%4!=0||e%100==0&&e%400!=0)}function o6(e,t){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[a6(e)?`leapyear`:`standard`][t-1]}function s6(e){let t=[Q(e,h0),Q(e,g0),Q(e,_0),Q(e,v0),Q(e,y0),Q(e,b0),Q(e,x0),Q(e,S0),Q(e,C0),Q(e,w0)];for(let e=0;e<t.length;e++){let n=t[e];if(n!==0)return n<0?-1:1}return 0}function c6(e){let t=[`years`,`months`,`weeks`,`days`];for(let n=0;n<t.length;n++){let r=e[t[n]];if(r!==0)return r<0?-1:1}return 0}function l6(e){let t=c6(e.date);return t===0?e.time.sign():t}function u6(e,t){let n=e,r=t;if(!Number.isFinite(n)||!Number.isFinite(r))throw RangeError(`infinity is out of range`);return--r,n+=Math.floor(r/12),r%=12,r<0&&(r+=12),r+=1,{year:n,month:r}}function d6(e,t,n){let r=e,i=t,a=n;if(!Number.isFinite(a))throw RangeError(`infinity is out of range`);({year:r,month:i}=u6(r,i));let o=146097;if(Math.abs(a)>o){let e=Math.trunc(a/o);r+=400*e,a-=e*o}let s=0,c=i>2?r:r-1;for(;s=a6(c)?366:365,a<-s;)--r,--c,a+=s;for(c+=1;s=a6(c)?366:365,a>s;)r+=1,c+=1,a-=s;for(;a<1;)({year:r,month:i}=u6(r,i-1)),a+=o6(r,i);for(;a>o6(r,i);)a-=o6(r,i),{year:r,month:i}=u6(r,i+1);return{year:r,month:i,day:a}}function f6(e,t,n,r,i,a,o,s,c){let l=p6(r,i,a,o,s,c);return b4(d6(e,t,n+l.deltaDays),l)}function p6(e,t,n,r,i,a){let o,s=e,c=t,l=n,u=r,d=i,f=a;({div:o,mod:f}=J0(f,3)),d+=o,f<0&&(--d,f+=1e3),{div:o,mod:d}=J0(d,3),u+=o,d<0&&(--u,d+=1e3),l+=Math.trunc(u/1e3),u%=1e3,u<0&&(--l,u+=1e3),c+=Math.trunc(l/60),l%=60,l<0&&(--c,l+=60),s+=Math.trunc(c/60),c%=60,c<0&&(--s,c+=60);let p=Math.trunc(s/24);return s%=24,s<0&&(--p,s+=24),p+=0,s+=0,c+=0,l+=0,u+=0,d+=0,f+=0,{deltaDays:p,hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function m6(e,t){let n=y4(e,0);if(c6(n)===0)return e.days;let r=Q(t,c0),i=h3(Q(t,Z),r,n,`constrain`),a=N6(r.year,r.month-1,r.day),o=N6(i.year,i.month-1,i.day)-a;return e.days+o}function h6(e){return new(q0(`%Temporal.Duration%`))(-Q(e,h0),-Q(e,g0),-Q(e,_0),-Q(e,v0),-Q(e,y0),-Q(e,b0),-Q(e,x0),-Q(e,S0),-Q(e,C0),-Q(e,w0))}function g6(e,t,n){return Math.min(n,Math.max(t,e))}function _6(e,t,n){let r=g6(t,1,12);return{year:e,month:r,day:g6(n,1,o6(e,r))}}function v6(e,t,n){if(e<t||e>n)throw RangeError(`value out of range: ${t} <= ${e} <= ${n}`)}function y6(e,t,n){v6(t,1,12),v6(n,1,o6(e,t))}function b6(e){C6(b4(e,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function x6(e,t,n,r,i,a){v6(e,0,23),v6(t,0,59),v6(n,0,59),v6(r,0,999),v6(i,0,999),v6(a,0,999)}function S6(e,t,n,r,i,a,o,s,c){y6(e,t,n),x6(r,i,a,o,s,c)}function C6(e){let t=e6(e);(X.default.lessThan(t,S2)||X.default.greaterThan(t,C2))&&T6(t)}function w6(e){e6(e)}function T6(e){if(X.default.lessThan(e,x2)||X.default.greaterThan(e,b2))throw RangeError(`date/time value is outside of supported range`)}function E6({year:e,month:t}){v6(e,T2,E2),e===T2?v6(t,4,12):e===E2&&v6(t,1,9)}function D6(e,t,n,r,i,a,o,s,c,l){let u=0,d=[e,t,n,r,i,a,o,s,c,l];for(let e=0;e<d.length;e++){let t=d[e];if(t===1/0||t===-1/0)throw RangeError(`infinite values not allowed as duration fields`);if(t!==0){let e=t<0?-1:1;if(u!==0&&e!==u)throw RangeError(`mixed-sign values not allowed as duration fields`);u=e}}if(Math.abs(e)>=2**32||Math.abs(t)>=2**32||Math.abs(n)>=2**32)throw RangeError(`years, months, and weeks must be < 2³²`);let f=J0(s,3),p=J0(c,6),m=J0(l,9),h=J0(1e6*f.mod+1e3*p.mod+m.mod,9).div,g=86400*r+3600*i+60*a+o+f.div+p.div+m.div+h;if(!Number.isSafeInteger(g))throw RangeError(`total of duration time units cannot exceed 9007199254740991.999999999 s`)}function O6(e){return{date:{years:Q(e,h0),months:Q(e,g0),weeks:Q(e,_0),days:Q(e,v0)},time:Q0.fromComponents(Q(e,y0),Q(e,b0),Q(e,x0),Q(e,S0),Q(e,C0),Q(e,w0))}}function k6(e){let t=Q0.fromComponents(Q(e,y0),Q(e,b0),Q(e,x0),Q(e,S0),Q(e,C0),Q(e,w0)).add24HourDays(Q(e,v0));return{date:{years:Q(e,h0),months:Q(e,g0),weeks:Q(e,_0),days:0},time:t}}function A6(e){let t=k6(e),n=Math.trunc(t.time.sec/86400);return D6(t.date.years,t.date.months,t.date.weeks,n,0,0,0,0,0,0),{...t.date,days:n}}function j6(e,t){let n=e.time.sign(),r=e.time.abs().subsec,i=0,a=0,o=e.time.abs().sec,s=0,c=0,l=0;switch(t){case`year`:case`month`:case`week`:case`day`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60,l=Math.trunc(c/24),c%=24;break;case`hour`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60;break;case`minute`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60;break;case`second`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3;break;case`millisecond`:i=Math.trunc(r/1e3),r%=1e3,a=Y0(o,3,Math.trunc(i/1e3)),i%=1e3,o=0;break;case`microsecond`:i=Y0(o,6,Math.trunc(r/1e3)),r%=1e3,o=0;break;case`nanosecond`:r=Y0(o,9,r),o=0}return new(q0(`%Temporal.Duration%`))(e.date.years,e.date.months,e.date.weeks,e.date.days+n*l,n*c,n*s,n*o,n*a,n*i,n*r)}function M6(e,t){return c6(e),t.sign(),{date:e,time:t}}function N6(e,t,n){return $3({isoDate:{year:e,month:t+1,day:n},time:{hour:0,minute:0,second:0,millisecond:0}})/g2}function P6({year:e,month:t,day:n}){if(Math.abs(N6(e,t-1,n))>1e8)throw RangeError(`date/time value is outside the supported range`)}function F6(e,t){let n=t.hour-e.hour,r=t.minute-e.minute,i=t.second-e.second,a=t.millisecond-e.millisecond,o=t.microsecond-e.microsecond,s=t.nanosecond-e.nanosecond;return Q0.fromComponents(n,r,i,a,o,s)}function I6(e,t,n,r,i){let a=Q0.fromEpochNsDiff(t,e);return a=d8(a,n,r,i),M6({years:0,months:0,weeks:0,days:0},a)}function L6(e,t,n,r){w6(e),w6(t);let i=F6(e.time,t.time),a=i.sign(),o=p8(e.isoDate,t.isoDate),s=t.isoDate;o===a&&(s=d6(s.year,s.month,s.day+a),i=i.add24HourDays(-a));let c=P4(`day`,r),l=g3(n,e.isoDate,s,c);return r!==c&&(i=i.add24HourDays(l.days),l.days=0),M6(l,i)}function R6(e,t,n,r,i){let a=X.default.subtract(t,e);if(X.default.equal(a,H1))return{date:{years:0,months:0,weeks:0,days:0},time:Q0.ZERO};let o=X.default.lessThan(a,H1)?-1:1,s=D3(n,e),c=D3(n,t),l,u=0,d=o===1?2:1,f=F6(s.time,c.time);for(f.sign()===-o&&u++;u<=d;u++){l=b4(d6(c.isoDate.year,c.isoDate.month,c.isoDate.day-u*o),s.time);let e=O3(n,l,`compatible`);if(f=Q0.fromEpochNsDiff(t,e),f.sign()!==-o)break}let p=P4(`day`,i);return M6(g3(r,s.isoDate,l.isoDate,p),f)}function z6(e,t,n,r,i,a,o,s,c){let l,u,d,f,p=t;switch(s){case`year`:{let t=s8(p.date.years,o,`trunc`);l=t,u=t+o*e,d={years:l,months:0,weeks:0,days:0},f={...d,years:u};break}case`month`:{let t=s8(p.date.months,o,`trunc`);l=t,u=t+o*e,d=y4(p.date,0,0,l),f=y4(p.date,0,0,u);break}case`week`:{let t=y4(p.date,0,0),n=h3(a,r.isoDate,t,`constrain`),i=g3(a,n,d6(n.year,n.month,n.day+p.date.days),`week`),s=s8(p.date.weeks+i.weeks,o,`trunc`);l=s,u=s+o*e,d=y4(p.date,0,l),f=y4(p.date,0,u);break}case`day`:{let t=s8(p.date.days,o,`trunc`);l=t,u=t+o*e,d=y4(p.date,l),f=y4(p.date,u);break}}let m=h3(a,r.isoDate,d,`constrain`),h=h3(a,r.isoDate,f,`constrain`),g,_,v=b4(m,r.time),y=b4(h,r.time);i?(g=O3(i,v,`compatible`),_=O3(i,y,`compatible`)):(g=e6(v),_=e6(y));let b=Q0.fromEpochNsDiff(n,g),x=Q0.fromEpochNsDiff(_,g),S=X0(c,e<0?`negative`:`positive`),C=b.add(b).abs().subtract(x.abs()).sign(),w=Math.abs(l)/o%2==0,T=b.isZero()?Math.abs(l):b.cmp(x)?Z0(Math.abs(l),Math.abs(u),C,w,S):Math.abs(u),E=new Q0(X.default.add(X.default.multiply(x.totalNs,X.default.BigInt(l)),X.default.multiply(b.totalNs,X.default.BigInt(o*e)))).fdiv(x.totalNs),D=T===Math.abs(u);return p={date:D?f:d,time:Q0.ZERO},{nudgeResult:{duration:p,nudgedEpochNs:D?_:g,didExpandCalendarUnit:D},total:E}}function B6(e,t,n,r,i,a,o,s,c){let l=e,u=F4(s)||r&&s===`day`,d=l6(l)<0?-1:1,f;return u?{nudgeResult:f}=z6(d,l,t,n,r,i,o,s,c):f=r?function(e,t,n,r,i,a,o,s){let c=t,l=h3(i,n.isoDate,c.date,`constrain`),u=b4(l,n.time),d=b4(d6(l.year,l.month,l.day+e),n.time),f=O3(r,u,`compatible`),p=O3(r,d,`compatible`),m=Q0.fromEpochNsDiff(p,f);if(m.sign()!==e)throw RangeError(`time zone returned inconsistent Instants`);let h=X.default.BigInt(K2[o]*a),g=c.time.round(h,s),_=g.subtract(m),v=_.sign()!==-e,y,b;return v?(y=e,g=_.round(h,s),b=g.addToEpochNs(p)):(y=0,b=g.addToEpochNs(f)),{duration:M6(y4(c.date,c.date.days+y),g),nudgedEpochNs:b,didExpandCalendarUnit:v}}(d,l,n,r,i,o,s,c):function(e,t,n,r,i,a){let o=e,s=o.time.add24HourDays(o.date.days),c=s.round(X.default.BigInt(r*K2[i]),a),l=c.subtract(s),{quotient:u}=s.divmod(_2),{quotient:d}=c.divmod(_2),f=Math.sign(d-u)===s.sign(),p=l.addToEpochNs(t),m=0,h=c;return I4(n)===`date`&&(m=d,h=c.add(Q0.fromComponents(24*-d,0,0,0,0,0))),{duration:{date:y4(o.date,m),time:h},nudgedEpochNs:p,didExpandCalendarUnit:f}}(l,t,a,o,s,c),l=f.duration,f.didExpandCalendarUnit&&s!==`week`&&(l=function(e,t,n,r,i,a,o,s){let c=t;if(s===o)return c;let l=G2.indexOf(o);for(let t=G2.indexOf(s)-1;t>=l;t--){let s=G2[t];if(s===`week`&&o!==`week`)continue;let l;switch(s){case`year`:l={years:c.date.years+e,months:0,weeks:0,days:0};break;case`month`:{let t=c.date.months+e;l=y4(c.date,0,0,t);break}case`week`:{let t=c.date.weeks+e;l=y4(c.date,0,t);break}}let u=b4(h3(a,r.isoDate,l,`constrain`),r.time),d;if(d=i?O3(i,u,`compatible`):e6(u),r0(n,d)===-e)break;c={date:l,time:Q0.ZERO}}return c}(d,l,f.nudgedEpochNs,n,r,i,a,P4(s,`day`))),l}function V6(e,t,n,r,i,a){return F4(a)||r&&a===`day`?z6(l6(e)<0?-1:1,e,t,n,r,i,1,a,`trunc`).total:f8(e.time.add24HourDays(e.date.days),a)}function H6(e,t,n,r,i,a,o){if(h8(e,t)==0)return{date:{years:0,months:0,weeks:0,days:0},time:Q0.ZERO};C6(e),C6(t);let s=L6(e,t,n,r);return a===`nanosecond`&&i===1?s:B6(s,e6(t),e,null,n,r,i,a,o)}function U6(e,t,n,r,i,a,o,s){if(I4(i)===`time`)return I6(e,t,a,o,s);let c=R6(e,t,n,r,i);return o===`nanosecond`&&a===1?c:B6(c,t,D3(n,e),n,r,i,a,o,s)}function W6(e,t,n,r,i,a){let o=H2.reduce(((e,t)=>{let i=t[0],a=t[1],o=t[2];return n!==`datetime`&&o!==n||r.includes(a)||e.push(a,i),e}),[]),s=j4(t,`largestUnit`,n,`auto`);if(r.includes(s))throw RangeError(`largestUnit must be one of ${o.join(`, `)}, not ${s}`);let c=E4(t),l=C4(t,`trunc`);e===`since`&&(l=function(e){switch(e){case`ceil`:return`floor`;case`floor`:return`ceil`;case`halfCeil`:return`halfFloor`;case`halfFloor`:return`halfCeil`;default:return e}}(l));let u=j4(t,`smallestUnit`,n,i);if(r.includes(u))throw RangeError(`smallestUnit must be one of ${o.join(`, `)}, not ${u}`);let d=P4(a,u);if(s===`auto`&&(s=d),P4(s,u)!==s)throw RangeError(`largestUnit ${s} cannot be smaller than smallestUnit ${u}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[u];return f!==void 0&&D4(c,f,!1),{largestUnit:s,roundingIncrement:c,roundingMode:l,smallestUnit:u}}function G6(e,t,n,r){let i=K4(n),a=W6(e,C8(r),`time`,[],`nanosecond`,`second`),o=j6(I6(Q(t,s0),Q(i,s0),a.roundingIncrement,a.smallestUnit,a.roundingMode),a.largestUnit);return e===`since`&&(o=h6(o)),o}function K6(e,t,n,r){let i=H4(n),a=Q(t,Z),o=Q(i,Z);if(!y3(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=W6(e,C8(r),`date`,[],`day`,`day`),c=q0(`%Temporal.Duration%`),l=Q(t,c0),u=Q(i,c0);if(p8(l,u)===0)return new c;let d={date:g3(a,l,u,s.largestUnit),time:Q0.ZERO};if(s.smallestUnit!==`day`||s.roundingIncrement!==1){let e=b4(l,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});d=B6(d,e6(b4(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let f=j6(d,`day`);return e===`since`&&(f=h6(f)),f}function q6(e,t,n,r){let i=W4(n),a=Q(t,Z),o=Q(i,Z);if(!y3(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=W6(e,C8(r),`datetime`,[],`nanosecond`,`day`),c=q0(`%Temporal.Duration%`),l=Q(t,l0),u=Q(i,l0);if(h8(l,u)===0)return new c;let d=j6(H6(l,u,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);return e===`since`&&(d=h6(d)),d}function J6(e,t,n,r){let i=J4(n),a=W6(e,C8(r),`time`,[],`nanosecond`,`hour`),o=F6(Q(t,u0),Q(i,u0));o=d8(o,a.roundingIncrement,a.smallestUnit,a.roundingMode);let s=j6(M6({years:0,months:0,weeks:0,days:0},o),a.largestUnit);return e===`since`&&(s=h6(s)),s}function Y6(e,t,n,r){let i=X4(n),a=Q(t,Z),o=Q(i,Z);if(!y3(a,o))throw RangeError(`cannot compute difference between months of ${a} and ${o} calendars`);let s=W6(e,C8(r),`date`,[`week`,`day`],`month`,`year`),c=q0(`%Temporal.Duration%`);if(p8(Q(t,c0),Q(i,c0))==0)return new c;let l=z4(a,Q(t,c0),`year-month`);l.day=1;let u=b3(a,l,`constrain`),d=z4(a,Q(i,c0),`year-month`);d.day=1;let f=b3(a,d,`constrain`),p={date:y4(g3(a,u,f,s.largestUnit),0,0),time:Q0.ZERO};if(s.smallestUnit!==`month`||s.roundingIncrement!==1){let e=b4(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});p=B6(p,e6(b4(f,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let m=j6(p,`day`);return e===`since`&&(m=h6(m)),m}function X6(e,t,n,r){let i=Q4(n),a=Q(t,Z),o=Q(i,Z);if(!y3(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=W6(e,C8(r),`datetime`,[],`nanosecond`,`hour`),c=Q(t,s0),l=Q(i,s0),u=q0(`%Temporal.Duration%`),d;if(I4(s.largestUnit)!==`date`)d=j6(I6(c,l,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);else{let e=Q(t,m0);if(!w3(e,Q(i,m0)))throw RangeError(`When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.`);if(X.default.equal(c,l))return new u;d=j6(U6(c,l,e,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),`hour`)}return e===`since`&&(d=h6(d)),d}function Z6({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){let s=n,c=a;return s+=o.sec,c+=o.subsec,p6(e,t,s,r,i,c)}function Q6(e,t){let n=t.addToEpochNs(e);return T6(n),n}function $6(e,t,n,r,i=`constrain`){if(c6(r.date)===0)return Q6(e,r.time);let a=D3(t,e);return Q6(O3(t,b4(h3(n,a.isoDate,r.date,i),a.time),`compatible`),r.time)}function e8(e,t,n){let r=G4(n);e===`subtract`&&(r=h6(r));let i=P4(N4(t),N4(r));if(F4(i))throw RangeError(`For years, months, or weeks arithmetic, use date arithmetic relative to a starting point`);let a=k6(t),o=k6(r);return j6(M6({years:0,months:0,weeks:0,days:0},a.time.add(o.time)),i)}function t8(e,t,n){let r=G4(n);e===`subtract`&&(r=h6(r));let i=N4(r);if(I4(i)===`date`)throw RangeError(`Duration field ${i} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let a=k6(r);return u3(Q6(Q(t,s0),a.time))}function n8(e,t,n,r){let i=Q(t,Z),a=G4(n);e===`subtract`&&(a=h6(a));let o=A6(a),s=x4(C8(r));return e3(h3(i,Q(t,c0),o,s),i)}function r8(e,t,n,r){let i=G4(n);e===`subtract`&&(i=h6(i));let a=x4(C8(r)),o=Q(t,Z),s=k6(i),c=Q(t,l0),l=Z6(c.time,s.time),u=y4(s.date,l.deltaDays);return D6(u.years,u.months,u.weeks,u.days,0,0,0,0,0,0),n3(b4(h3(o,c.isoDate,u,a),l),o)}function i8(e,t,n){let r=G4(n);e===`subtract`&&(r=h6(r));let i=k6(r),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Z6(Q(t,u0),i.time);return o3(_4(a,o,s,c,l,u,`reject`))}function a8(e,t,n,r){let i=G4(n);e===`subtract`&&(i=h6(i));let a=x4(C8(r)),o=s6(i),s=Q(t,Z),c=z4(s,Q(t,c0),`year-month`);c.day=1;let l=b3(s,c,`constrain`);if(o<0){let e=h3(s,l,{months:1},`constrain`);l=d6(e.year,e.month,e.day-1)}let u=A6(i);return b6(l),c3(x3(s,z4(s,h3(s,l,u,a),`year-month`),a),s)}function o8(e,t,n,r){let i=G4(n);e===`subtract`&&(i=h6(i));let a=x4(C8(r)),o=Q(t,m0),s=Q(t,Z),c=O6(i);return f3($6(Q(t,s0),o,s,c,a),o,s)}function s8(e,t,n){let r=Math.trunc(e/t),i=e%t,a=e<0?`negative`:`positive`,o=Math.abs(r),s=o+1,c=S8(Math.abs(2*i)-t),l=o%2==0,u=X0(n,a),d=i===0?o:Z0(o,s,c,l,u);return t*(a===`positive`?d:-d)}function c8(e,t,n,r){let i=K2[n]*t;return function(e,t,n){let r=e0(e),i=e0(t),a=X.default.divide(r,i),o=X.default.remainder(r,i),s=X0(n,`positive`),c,l;X.default.lessThan(r,H1)?(c=X.default.subtract(a,U1),l=a):(c=a,l=X.default.add(a,U1));let u=r0(n0(X.default.multiply(o,W1)),i)*(X.default.lessThan(r,H1)?-1:1)+0,d=X.default.equal(o,H1)?a:Z0(c,l,u,t0(c),s);return X.default.multiply(d,i)}(e,X.default.BigInt(i),r)}function l8(e,t,n,r){w6(e);let{year:i,month:a,day:o}=e.isoDate,s=u8(e.time,t,n,r);return b4(d6(i,a,o+s.deltaDays),s)}function u8({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o,s,c){let l;switch(s){case`day`:case`hour`:l=1e3*(1e3*(1e3*(60*(60*e+t)+n)+r)+i)+a;break;case`minute`:l=1e3*(1e3*(1e3*(60*t+n)+r)+i)+a;break;case`second`:l=1e3*(1e3*(1e3*n+r)+i)+a;break;case`millisecond`:l=1e3*(1e3*r+i)+a;break;case`microsecond`:l=1e3*i+a;break;case`nanosecond`:l=a}let u=K2[s],d=s8(l,u*o,c)/u;switch(s){case`day`:return{deltaDays:d,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case`hour`:return p6(d,0,0,0,0,0);case`minute`:return p6(e,d,0,0,0,0);case`second`:return p6(e,t,d,0,0,0);case`millisecond`:return p6(e,t,n,d,0,0);case`microsecond`:return p6(e,t,n,r,d,0);case`nanosecond`:return p6(e,t,n,r,i,d);default:throw Error(`Invalid unit ${s}`)}}function d8(e,t,n,r){let i=K2[n];return e.round(X.default.BigInt(i*t),r)}function f8(e,t){let n=K2[t];return e.fdiv(X.default.BigInt(n))}function p8(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:S8(e.day-t.day):S8(e.month-t.month):S8(e.year-t.year)}function m8(e,t){return e.hour===t.hour?e.minute===t.minute?e.second===t.second?e.millisecond===t.millisecond?e.microsecond===t.microsecond?e.nanosecond===t.nanosecond?0:S8(e.nanosecond-t.nanosecond):S8(e.microsecond-t.microsecond):S8(e.millisecond-t.millisecond):S8(e.second-t.second):S8(e.minute-t.minute):S8(e.hour-t.hour)}function h8(e,t){let n=p8(e.isoDate,t.isoDate);return n===0?m8(e.time,t.time):n}function g8(e){let t=y8(e);return globalThis.BigInt===void 0?t:globalThis.BigInt(t.toString(10))}function _8(e,t){let{quotient:n,remainder:r}=i0(e0(e),Y1),i=X.default.toNumber(n);return t===`floor`&&X.default.toNumber(r)<0&&--i,t===`ceil`&&X.default.toNumber(r)>0&&(i+=1),i}function v8(e){if(!Number.isInteger(e))throw RangeError(`epoch milliseconds must be an integer`);return X.default.multiply(X.default.BigInt(e),Y1)}function y8(e){let t=e;if(typeof e==`object`){let n=e[Symbol.toPrimitive];n&&typeof n==`function`&&(t=n.call(e,`number`))}if(typeof t==`number`)throw TypeError(`cannot convert number to bigint`);return typeof t==`bigint`?X.default.BigInt(t.toString(10)):X.default.BigInt(t)}var b8=(()=>{let e=X.default.BigInt(Date.now()%1e6);return()=>{let t=Date.now(),n=X.default.BigInt(t),r=X.default.add(v8(t),e);return e=X.default.remainder(n,Y1),X.default.greaterThan(r,b2)?b2:X.default.lessThan(r,x2)?x2:r}})();function x8(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function S8(e){return e<0?-1:e>0?1:e}function C8(e){if(e===void 0)return Object.create(null);if(A2(e)&&e!==null)return e;throw TypeError(`Options parameter must be an object, not `+(e===null?`null`:typeof e))}function w8(e,t){let n=Object.create(null);return n[e]=t,n}function T8(e,t,n,r){let i=e[t];if(i!==void 0){if(i=M2(i),!n.includes(i))throw RangeError(`${t} must be one of ${n.join(`, `)}, not ${i}`);return i}if(r===A4)throw RangeError(`${t} option is required`);return r}function E8(e){let t=D8(e);if(!O2.includes(D8(t)))throw RangeError(`invalid calendar identifier ${t}`);switch(t){case`ethiopic-amete-alem`:return`ethioaa`;case`islamicc`:return`islamic-civil`}return t}function D8(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t+=r>=65&&r<=90?String.fromCharCode(r+32):String.fromCharCode(r)}return t}function O8(e){throw TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${e===`PlainMonthDay`?`Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))`:`Temporal.${e}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var k8=RegExp(`^${o2.source}$`),A8=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?$`);function j8(e,t,n,r=e(t),i=e(n)){let a=t,o=n,s=r,c=i;for(;o-a>1;){let t=Math.trunc((a+o)/2),n=e(t);n===s?(a=t,s=n):n===c&&(o=t,c=n)}return o}function M8(e){return[...e]}function N8(e,t){if(e!==`gregory`&&e!==`iso8601`)return;let n=F8[e],r=t.year,{dayOfWeek:i,dayOfYear:a,daysInYear:o}=n.isoToDate(t,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),s=n.getFirstDayOfWeek(),c=n.getMinimalDaysInFirstWeek(),l=(i+7-s)%7,u=(i-a+7001-s)%7,d=Math.floor((a-1+u)/7);if(7-u>=c&&++d,d==0)d=function(e,t,n,r){let i=(r-e-n+1)%7;i<0&&(i+=7);let a=Math.floor((n+i-1)/7);return 7-i>=t&&++a,a}(s,c,a+n.isoToDate(n.dateAdd(t,{years:-1},`constrain`),{daysInYear:!0}).daysInYear,i),r--;else if(a>=o-5){let e=(l+o-a)%7;e<0&&(e+=7),6-e>=c&&a+7-l>o&&(d=1,r++)}return{week:d,year:r}}function P8(e,t,n,r,i){if(t!==i.year){if(e*(t-i.year)>0)return!0}else if(n!==i.month){if(e*(n-i.month)>0)return!0}else if(r!==i.day&&e*(r-i.day)>0)return!0;return!1}var F8={};function I8(e){if(!e.startsWith(`M`))throw RangeError(`Invalid month code: ${e}. Month codes must start with M.`);let t=+e.slice(1);if(Number.isNaN(t))throw RangeError(`Invalid month code: ${e}`);return t}function L8(e,t=!1){return`M${`${e}`.padStart(2,`0`)}${t?`L`:``}`}function R8(e,t=void 0,n=12){let{month:r,monthCode:i}=e;if(i===void 0){if(r===void 0)throw TypeError(`Either month or monthCode are required`);t===`reject`&&v6(r,1,n),t===`constrain`&&(r=g6(r,1,n)),i=L8(r)}else{let e=I8(i);if(i!==L8(e))throw RangeError(`Invalid month code: ${i}`);if(r!==void 0&&r!==e)throw RangeError(`monthCode ${i} and month ${r} must match if both are present`);if(r=e,r<1||r>n)throw RangeError(`Invalid monthCode: ${i}`)}return{...e,month:r,monthCode:i}}F8.iso8601={resolveFields(e,t){if((t===`date`||t===`year-month`)&&e.year===void 0)throw TypeError(`year is required`);if((t===`date`||t===`month-day`)&&e.day===void 0)throw TypeError(`day is required`);Object.assign(e,R8(e))},dateToISO:(e,t)=>g4(e.year,e.month,e.day,t),monthDayToISOReferenceDate(e,t){let{month:n,day:r}=g4(e.year??1972,e.month,e.day,t);return{month:n,day:r,year:1972}},extraFields:()=>[],fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];t.add(r),r===`month`?t.add(`monthCode`):r===`monthCode`&&t.add(`month`)}return M8(t)},dateAdd(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a){let{year:o,month:s,day:c}=e;return o+=t,s+=n,{year:o,month:s}=u6(o,s),{year:o,month:s,day:c}=g4(o,s,c,a),c+=i+7*r,d6(o,s,c)},dateUntil(e,t,n){let r=-p8(e,t);if(r===0)return{years:0,months:0,weeks:0,days:0};let i,a=0,o=0;if(n===`year`||n===`month`){let s=t.year-e.year;for(s!==0&&(s-=r);!P8(r,e.year+s,e.month,e.day,t);)a=s,s+=r;let c=r;for(i=u6(e.year+a,e.month+c);!P8(r,i.year,i.month,e.day,t);)o=c,c+=r,i=u6(i.year,i.month+r);n===`month`&&(o+=12*a,a=0)}i=u6(e.year+a,e.month+o);let s=_6(i.year,i.month,e.day),c=0,l=N6(t.year,t.month-1,t.day)-N6(s.year,s.month-1,s.day);return n===`week`&&(c=Math.trunc(l/7),l%=7),{years:a,months:o,weeks:c,days:l}},isoToDate({year:e,month:t,day:n},r){let i={era:void 0,eraYear:void 0,year:e,month:t,day:n,daysInWeek:7,monthsInYear:12};if(r.monthCode&&(i.monthCode=L8(t)),r.dayOfWeek){let r=t+(t<3?10:-2),a=e-+(t<3),o=Math.floor(a/100),s=a-100*o,c=(n+Math.floor(2.6*r-.2)+(s+Math.floor(s/4))+(Math.floor(o/4)-2*o))%7;i.dayOfWeek=c+(c<=0?7:0)}if(r.dayOfYear){let r=n;for(let n=t-1;n>0;n--)r+=o6(e,n);i.dayOfYear=r}return r.weekOfYear&&(i.weekOfYear=N8(`iso8601`,{year:e,month:t,day:n})),r.daysInMonth&&(i.daysInMonth=o6(e,t)),(r.daysInYear||r.inLeapYear)&&(i.inLeapYear=a6(e),i.daysInYear=i.inLeapYear?366:365),i},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};var z8=class e{constructor(t){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,t!==void 0){let n=0;for(let r of t.map.entries()){if(++n>e.MAX_CACHE_ENTRIES)break;this.map.set(...r)}}}get(e){let t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report()}report(){}setObject(t){if(e.objectMap.get(t))throw RangeError(`object already cached`);e.objectMap.set(t,this),this.report()}static getCacheForObject(t){let n=e.objectMap.get(t);return n||(n=new e,e.objectMap.set(t,n)),n}};function B8({isoYear:e,isoMonth:t,isoDay:n}){return`${M3(e)}-${N3(t)}-${N3(n)}T00:00Z`}function V8(e,t){return{years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}z8.objectMap=new WeakMap,z8.MAX_CACHE_ENTRIES=1e3;var H8=class{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:`numeric`,month:`numeric`,year:`numeric`,era:`short`,timeZone:`UTC`})),this.formatter}getCalendarParts(e){let t=this.getFormatter(),n=new Date(e);if(e===`-271821-04-19T00:00Z`){let e=t.resolvedOptions();t=new Intl.DateTimeFormat(e.locale,{...e,timeZone:`Etc/GMT+1`}),n=new Date(`-271821-04-20T00:00Z`)}try{return t.formatToParts(n)}catch{throw RangeError(`Invalid ISO date: ${e}`)}}isoToCalendarDate(e,t){let{year:n,month:r,day:i}=e,a=JSON.stringify({func:`isoToCalendarDate`,isoYear:n,isoMonth:r,isoDay:i,id:this.id}),o=t.get(a);if(o)return o;let s=B8({isoYear:n,isoMonth:r,isoDay:i}),c=this.getCalendarParts(s),l={};for(let e=0;e<c.length;e++){let{type:t,value:n}=c[e];if(t!==`year`&&t!==`relatedYear`||(this.hasEra?l.eraYear=+n:l.year=+n),t===`month`){let e=/^([0-9]*)(.*?)$/.exec(n);if(!e||e.length!=3||!e[1]&&!e[2])throw RangeError(`Unexpected month: ${n}`);if(l.month=e[1]?+e[1]:1,l.month<1)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(l.month>13)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(l.monthExtra=e[2])}t===`day`&&(l.day=+n),this.hasEra&&t===`era`&&n!=null&&n!==``&&(l.era=n.split(` (`)[0].normalize(`NFD`).replace(/[^-0-9 \p{L}]/gu,``).replace(/ /g,`-`).toLowerCase())}if(this.hasEra&&l.eraYear===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let e=this.eras.find((e=>l.era===e.genericName));e&&(l.era=e.code)}if(this.reviseIntlEra){let{era:t,eraYear:n}=this.reviseIntlEra(l,e);l.era=t,l.eraYear=n}this.checkIcuBugs&&this.checkIcuBugs(e);let u=this.adjustCalendarDate(l,t,`constrain`,!0);if(u.year===void 0)throw RangeError(`Missing year converting ${JSON.stringify(e)}`);if(u.month===void 0)throw RangeError(`Missing month converting ${JSON.stringify(e)}`);if(u.day===void 0)throw RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(a,u),[`constrain`,`reject`].forEach((n=>{let r=JSON.stringify({func:`calendarToIsoDate`,year:u.year,month:u.month,day:u.day,overflow:n,id:this.id});t.set(r,e)})),u}validateCalendarDate(e){let{month:t,year:n,day:r,eraYear:i,monthCode:a,monthExtra:o}=e;if(o!==void 0)throw RangeError("Unexpected `monthExtra` value");if(n===void 0&&i===void 0)throw TypeError(`year or eraYear is required`);if(t===void 0&&a===void 0)throw TypeError(`month or monthCode is required`);if(r===void 0)throw RangeError(`Missing day`);if(a!==void 0){if(typeof a!=`string`)throw RangeError(`monthCode must be a string, not `+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw RangeError(`Invalid monthCode: ${a}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw TypeError(`properties era and eraYear must be provided together`)}adjustCalendarDate(e,t=void 0,n=`constrain`,r=!1){if(this.calendarType===`lunisolar`)throw RangeError(`Override required for lunisolar calendars`);let i=e;this.validateCalendarDate(i);let a=this.monthsInYear(i,t),{month:o,monthCode:s}=i;return{month:o,monthCode:s}=R8(i,n,a),{...i,month:o,monthCode:s}}regulateMonthDayNaive(e,t,n){let r=this.monthsInYear(e,n),{month:i,day:a}=e;return t===`reject`?(v6(i,1,r),v6(a,1,this.maximumMonthLength(e))):(i=g6(i,1,r),a=g6(a,1,this.maximumMonthLength({...e,month:i}))),{...e,month:i,day:a}}calendarToIsoDate(e,t=`constrain`,n){let r=e,i=this.adjustCalendarDate(e,n,t,!1);i=this.regulateMonthDayNaive(i,t,n);let{year:a,month:o,day:s}=i,c=JSON.stringify({func:`calendarToIsoDate`,year:a,month:o,day:s,overflow:t,id:this.id}),l,u=n.get(c);if(u||r.year!==void 0&&r.month!==void 0&&r.day!==void 0&&(r.year!==i.year||r.month!==i.month||r.day!==i.day)&&(l=JSON.stringify({func:`calendarToIsoDate`,year:r.year,month:r.month,day:r.day,overflow:t,id:this.id}),u=n.get(l),u))return u;let d=this.estimateIsoDate({year:a,month:o,day:s}),f=e=>{let r=this.addDaysIso(d,e);if(i.day>this.minimumMonthLength(i)){let e=this.isoToCalendarDate(r,n);for(;e.month!==o||e.year!==a;){if(t===`reject`)throw RangeError(`day ${s} does not exist in month ${o} of year ${a}`);r=this.addDaysIso(r,-1),e=this.isoToCalendarDate(r,n)}}return r},p=0,m=this.isoToCalendarDate(d,n),h=V8(i,m);if(h.years!==0||h.months!==0||h.days!==0){let e=365*h.years+30*h.months+h.days;d=this.addDaysIso(d,e),m=this.isoToCalendarDate(d,n),h=V8(i,m),h.years===0&&h.months===0?d=f(h.days):p=this.compareCalendarDates(i,m)}let g=8;for(;p;){d=this.addDaysIso(d,p*g);let e=m;m=this.isoToCalendarDate(d,n);let a=p;if(p=this.compareCalendarDates(i,m),p){if(h=V8(i,m),h.years===0&&h.months===0)d=f(h.days),p=0;else if(a&&p!==a){if(g>1)g/=2;else{if(t===`reject`)throw RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...r})}`);this.compareCalendarDates(m,e)>0&&(d=this.addDaysIso(d,-1)),p=0}}}}if(n.set(c,d),l&&n.set(l,d),i.year===void 0||i.month===void 0||i.day===void 0||i.monthCode===void 0||this.hasEra&&(i.era===void 0||i.eraYear===void 0))throw RangeError(`Unexpected missing property`);return d}compareCalendarDates(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:S8(e.day-t.day):S8(e.month-t.month):S8(e.year-t.year)}regulateDate(e,t=`constrain`,n){let r=this.calendarToIsoDate(e,t,n);return this.isoToCalendarDate(r,n)}addDaysIso(e,t){return d6(e.year,e.month,e.day+t)}addDaysCalendar(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.addDaysIso(r,t);return this.isoToCalendarDate(i,n)}addMonthsCalendar(e,t,n,r){let i=e,{day:a}=i;for(let e=0,n=Math.abs(t);e<n;e++){let{month:e}=i,n=i,o=t<0?-Math.max(a,this.daysInPreviousMonth(i,r)):this.daysInMonth(i,r),s=this.calendarToIsoDate(i,`constrain`,r),c=this.addDaysIso(s,o);if(i=this.isoToCalendarDate(c,r),t>0){let t=this.monthsInYear(n,r);for(;i.month-1!=e%t;)c=this.addDaysIso(c,-1),i=this.isoToCalendarDate(c,r)}i.day!==a&&(i=this.regulateDate({...i,day:a},`constrain`,r))}if(n===`reject`&&i.day!==a)throw RangeError(`Day ${a} does not exist in resulting calendar month`);return i}addCalendar(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a,o){let{year:s,day:c,monthCode:l}=e,u=this.adjustCalendarDate({year:s+t,monthCode:l,day:c},o),d=this.addMonthsCalendar(u,n,a,o),f=i+7*r;return this.addDaysCalendar(d,f,o)}untilCalendar(e,t,n,r){let i=0,a=0,o=0,s=0;switch(n){case`day`:i=this.calendarDaysUntil(e,t,r);break;case`week`:{let n=this.calendarDaysUntil(e,t,r);i=n%7,a=(n-i)/7;break}case`month`:case`year`:{let a=this.compareCalendarDates(t,e);if(!a)return{years:0,months:0,weeks:0,days:0};let c=t.year-e.year,l=t.day-e.day;if(n===`year`&&c){let n=0;t.monthCode>e.monthCode&&(n=1),t.monthCode<e.monthCode&&(n=-1),n||=Math.sign(l),s=n*a<0?c-a:c}let u,d=s?this.addCalendar(e,{years:s},`constrain`,r):e;do o+=a,u=d,d=this.addMonthsCalendar(u,a,`constrain`,r),d.day!==e.day&&(d=this.regulateDate({...d,day:e.day},`constrain`,r));while(this.compareCalendarDates(t,d)*a>=0);o-=a,i=this.calendarDaysUntil(u,t,r);break}}return{years:s,months:o,weeks:a,days:i}}daysInMonth(e,t){let{day:n}=e,r=this.maximumMonthLength(e),i=this.minimumMonthLength(e);if(i===r)return i;let a=n<=r-i?r:i,o=this.calendarToIsoDate(e,`constrain`,t),s=this.addDaysIso(o,a),c=this.isoToCalendarDate(s,t),l=this.addDaysIso(s,-c.day);return this.isoToCalendarDate(l,t).day}daysInPreviousMonth(e,t){let{day:n,month:r,year:i}=e,a={year:r>1?i:i-1,month:r,day:1},o=r>1?r-1:this.monthsInYear(a,t);a={...a,month:o};let s=this.minimumMonthLength(a),c=this.maximumMonthLength(a);if(s===c)return c;let l=this.calendarToIsoDate(e,`constrain`,t),u=this.addDaysIso(l,-n);return this.isoToCalendarDate(u,t).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:`M01`,day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.calendarToIsoDate(t,`constrain`,n);return N6(i.year,i.month-1,i.day)-N6(r.year,r.month-1,r.day)}monthDaySearchStartYear(e,t){return 1972}monthDayFromFields(e,t,n){let r,i,a,o,s,{era:c,eraYear:l,year:u,month:d,monthCode:f,day:p}=e;if(d!==void 0&&u===void 0&&(!this.hasEra||c===void 0||l===void 0))throw TypeError(`when month is present, year (or era and eraYear) are required`);(f===void 0||u!==void 0||this.hasEra&&l!==void 0)&&({monthCode:f,day:p}=this.isoToCalendarDate(this.calendarToIsoDate(e,t,n),n));let m={year:this.monthDaySearchStartYear(f,p),month:12,day:31},h=this.isoToCalendarDate(m,n),g=h.monthCode>f||h.monthCode===f&&h.day>=p?h.year:h.year-1;for(let e=0;e<20;e++){let c=this.adjustCalendarDate({day:p,monthCode:f,year:g-e},n),l=this.calendarToIsoDate(c,`constrain`,n),u=this.isoToCalendarDate(l,n);if({year:r,month:i,day:a}=l,u.monthCode===f&&u.day===p)return{month:i,day:a,year:r};if(t===`constrain`){let e=this.maxLengthOfMonthCodeInAnyYear(u.monthCode);if(u.monthCode===f&&u.day===e&&p>e)return{month:i,day:a,year:r};(o===void 0||u.monthCode===o.monthCode&&u.day>o.day)&&(o=u,s=l)}}if(t===`constrain`&&s!==void 0)return s;throw RangeError(`No recent ${this.id} year with monthCode ${f} and day ${p}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}},U8=class extends H8{constructor(){super(...arguments),this.id=`hebrew`,this.calendarType=`lunisolar`,this.months={Tishri:{leap:1,regular:1,monthCode:`M01`,days:30},Heshvan:{leap:2,regular:2,monthCode:`M02`,days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:`M03`,days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:`M04`,days:29},Shevat:{leap:5,regular:5,monthCode:`M05`,days:30},Adar:{leap:void 0,regular:6,monthCode:`M06`,days:29},"Adar I":{leap:6,regular:void 0,monthCode:`M05L`,days:30},"Adar II":{leap:7,regular:void 0,monthCode:`M06`,days:29},Nisan:{leap:8,regular:7,monthCode:`M07`,days:30},Iyar:{leap:9,regular:8,monthCode:`M08`,days:29},Sivan:{leap:10,regular:9,monthCode:`M09`,days:30},Tamuz:{leap:11,regular:10,monthCode:`M10`,days:29},Av:{leap:12,regular:11,monthCode:`M11`,days:30},Elul:{leap:13,regular:12,monthCode:`M12`,days:29}}}inLeapYear(e){let{year:t}=e;return(7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,`min`)}maximumMonthLength(e){return this.minMaxMonthLength(e,`max`)}minMaxMonthLength(e,t){let{month:n,year:r}=e,i=this.getMonthCode(r,n),a=Object.entries(this.months).find((e=>e[1].monthCode===i));if(a===void 0)throw RangeError(`unmatched Hebrew month: ${n}`);let o=a[1].days;return typeof o==`number`?o:o[t]}maxLengthOfMonthCodeInAnyYear(e){return[`M04`,`M06`,`M08`,`M10`,`M12`].includes(e)?29:30}estimateIsoDate(e){let{year:t}=e;return{year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?t===6?L8(5,!0):L8(t<6?t:t-1):L8(t)}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthCode:o,day:s,monthExtra:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(c){let e=this.months[c];if(!e)throw RangeError(`Unrecognized month from formatToParts: ${c}`);a=this.inLeapYear({year:i})?e.leap:e.regular}return o=this.getMonthCode(i,a),{year:i,month:a,day:s,monthCode:o}}if(this.validateCalendarDate(e),a===void 0){if(o.endsWith(`L`)){if(o!==`M05L`)throw RangeError(`Hebrew leap month must have monthCode M05L, not ${o}`);if(a=6,!this.inLeapYear({year:i})){if(n===`reject`)throw RangeError(`Hebrew monthCode M05L is invalid in year ${i} which is not a leap year`);a=6,o=`M06`}}else{a=I8(o),this.inLeapYear({year:i})&&a>=6&&a++;let e=this.monthsInYear({year:i});if(a<1||a>e)throw RangeError(`Invalid monthCode: ${o}`)}}else if(n===`reject`?(v6(a,1,this.monthsInYear({year:i})),v6(s,1,this.maximumMonthLength({year:i,month:a}))):(a=g6(a,1,this.monthsInYear({year:i})),s=g6(s,1,this.maximumMonthLength({year:i,month:a}))),o===void 0)o=this.getMonthCode(i,a);else if(this.getMonthCode(i,a)!==o)throw RangeError(`monthCode ${o} doesn't correspond to month ${a} in Hebrew year ${i}`);return{...e,day:s,month:a,monthCode:o,year:i}}},W8=class extends H8{constructor(){super(...arguments),this.calendarType=`lunar`,this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear(e,t){let n={year:e.year,month:1,monthCode:`M01`,day:1},r={year:e.year+1,month:1,monthCode:`M01`,day:1};return this.calendarDaysUntil(n,r,t)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:Math.floor(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},G8=class extends W8{constructor(){super(...arguments),this.id=`islamic`}},K8=class extends W8{constructor(){super(...arguments),this.id=`islamic-umalqura`}},q8=class extends W8{constructor(){super(...arguments),this.id=`islamic-tbla`}},J8=class extends W8{constructor(){super(...arguments),this.id=`islamic-civil`}},Y8=class extends W8{constructor(){super(...arguments),this.id=`islamic-rgsa`}},X8=class extends W8{constructor(){super(...arguments),this.id=`islamicc`}},Z8=class extends H8{constructor(){super(...arguments),this.id=`persian`,this.calendarType=`solar`}inLeapYear(e,t){return this.daysInMonth({year:e.year,month:12,day:1},t)===30}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===12?29:t<=6?31:30}maximumMonthLength(e){let{month:t}=e;return t===12?30:t<=6?31:30}maxLengthOfMonthCodeInAnyYear(e){return I8(e)<=6?31:30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:t+621,month:1,day:1}}},Q8=class extends H8{constructor(){super(...arguments),this.id=`indian`,this.calendarType=`solar`,this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date(`0000-01-01T00:00Z`).toLocaleDateString(`en-US-u-ca-indian`,{timeZone:`UTC`})!==`10/11/-79 Saka`}inLeapYear(e){return $8(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}maxLengthOfMonthCodeInAnyYear(e){let t=I8(e),n=this.months[t];return n=n.leap??n,n.length}getMonthInfo(e){let{month:t}=e,n=this.months[t];if(n===void 0)throw RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let t=this.adjustCalendarDate(e),n=this.getMonthInfo(t);return d6(t.year+78+ +!!n.nextYear,n.month,n.day+t.day-1)}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function $8(e){return e%4==0&&(e%100!=0||e%400==0)}var e5=class extends H8{constructor(e,t){super(),this.calendarType=`solar`,this.id=e,this.isoEpoch=t}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return $8(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][I8(e)-1]}estimateIsoDate(e){let t=this.adjustCalendarDate(e);return g4(t.year+this.isoEpoch.year,t.month+this.isoEpoch.month,t.day+this.isoEpoch.day,`constrain`)}},t5=class extends H8{constructor(e,t){super(),this.hasEra=!0,this.calendarType=`solar`,this.id=e;let{eras:n,anchorEra:r}=function(e){let t,n=e;if(n.length===0)throw RangeError(`Invalid era data: eras are required`);if(n.length===1&&n[0].reverseOf)throw RangeError(`Invalid era data: anchor era cannot count years backwards`);if(n.length===1&&!n[0].code)throw RangeError(`Invalid era data: at least one named era is required`);if(n.filter((e=>e.reverseOf!=null)).length>1)throw RangeError(`Invalid era data: only one era can count years backwards`);n.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw RangeError(`Invalid era data: cannot have multiple anchor eras`);t=e,e.anchorEpoch={year:+!e.hasYearZero}}else if(!e.code)throw RangeError(`If era name is blank, it must be the anchor era`)})),n=n.filter((e=>e.code)),n.forEach((e=>{let{reverseOf:t}=e;if(t){let r=n.find((e=>e.code===t));if(r===void 0)throw RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=r,e.anchorEpoch=r.anchorEpoch,e.isoEpoch=r.isoEpoch}e.anchorEpoch.month===void 0&&(e.anchorEpoch.month=1),e.anchorEpoch.day===void 0&&(e.anchorEpoch.day=1)})),n.sort(((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return-1;if(!e.isoEpoch||!t.isoEpoch)throw RangeError(`Invalid era data: missing ISO epoch`);return t.isoEpoch.year-e.isoEpoch.year}));let r=n[n.length-1].reverseOf;if(r&&r!==n[n.length-2])throw RangeError(`Invalid era data: invalid reverse-sign era`);return n.forEach(((e,t)=>{e.genericName=`era`+(n.length-1-t)})),{eras:n,anchorEra:t||n[0]}}(t);this.anchorEra=r,this.eras=n}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return $8(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][I8(e)-1]}completeEraYear(e){let t=(t,n,r)=>{let i=e[t];if(i!=null&&i!=n&&!(r||[]).includes(i)){let e=r?.[0];throw RangeError(`Input ${t} ${i} doesn't match calculated value ${e?`${n} (also called ${e})`:n}`)}},n=t=>{let n,r={...e,year:t},i=this.eras.find(((e,i)=>{if(i===this.eras.length-1){if(e.reverseOf){if(t>0)throw RangeError(`Signed year ${t} is invalid for era ${e.code}`);return n=e.anchorEpoch.year-t,!0}return n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0}return this.compareCalendarDates(r,e.anchorEpoch)>=0&&(n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0)}));if(!i)throw RangeError(`Year ${t} was not matched by any era`);return{eraYear:n,era:i.code,eraNames:i.names}},{year:r,eraYear:i,era:a}=e;if(r!=null){let e=n(r);({eraYear:i,era:a}=e),t(`era`,a,e?.eraNames),t(`eraYear`,i)}else{if(i==null)throw RangeError(`Either year or eraYear and era are required`);{if(a===void 0)throw RangeError(`era and eraYear must be provided together`);let e=this.eras.find((({code:e,names:t=[]})=>e===a||t.includes(a)));if(!e)throw RangeError(`Era ${a} (ISO year ${i}) was not matched by any era`);r=e.reverseOf?e.anchorEpoch.year-i:i+e.anchorEpoch.year-+!e.hasYearZero,t(`year`,r),{eraYear:i,era:a}=n(r)}}return{...e,year:r,eraYear:i,era:a}}adjustCalendarDate(e,t,n=`constrain`){let r=e,{month:i,monthCode:a}=r;return i===void 0&&(r={...r,month:I8(a)}),this.validateCalendarDate(r),r=this.completeEraYear(r),super.adjustCalendarDate(r,t,n)}estimateIsoDate(e){let{year:t,month:n,day:r}=this.adjustCalendarDate(e),{anchorEra:i}=this;return g4(t+i.isoEpoch.year-+!i.hasYearZero,n,r,`constrain`)}},n5=class extends t5{constructor(e,t){super(e,t)}isoToCalendarDate(e){let{year:t,month:n,day:r}=e,i=L8(n),a=t-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:a,month:n,monthCode:i,day:r})}},r5={inLeapYear(e){let{year:t}=e;return(t+1)%4==0},monthsInYear:()=>13,minimumMonthLength(e){let{month:t}=e;return t===13?this.inLeapYear(e)?6:5:30},maximumMonthLength(e){return this.minimumMonthLength(e)},maxLengthOfMonthCodeInAnyYear:e=>e===`M13`?6:30},i5=class extends e5{constructor(e,t){super(e,t),this.inLeapYear=r5.inLeapYear,this.monthsInYear=r5.monthsInYear,this.minimumMonthLength=r5.minimumMonthLength,this.maximumMonthLength=r5.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=r5.maxLengthOfMonthCodeInAnyYear}},a5=class extends t5{constructor(e,t){super(e,t),this.inLeapYear=r5.inLeapYear,this.monthsInYear=r5.monthsInYear,this.minimumMonthLength=r5.minimumMonthLength,this.maximumMonthLength=r5.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=r5.maxLengthOfMonthCodeInAnyYear}},o5=class extends i5{constructor(){super(`ethioaa`,{year:-5492,month:7,day:17})}},s5=class extends a5{constructor(){super(`coptic`,[{code:`coptic`,isoEpoch:{year:284,month:8,day:29}},{code:`coptic-inverse`,reverseOf:`coptic`}])}},c5=class extends a5{constructor(){super(`ethiopic`,[{code:`ethioaa`,names:[`ethiopic-amete-alem`,`mundi`],isoEpoch:{year:-5492,month:7,day:17}},{code:`ethiopic`,names:[`incar`],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},l5=class extends n5{constructor(){super(`roc`,[{code:`roc`,names:[`minguo`],isoEpoch:{year:1912,month:1,day:1}},{code:`roc-inverse`,names:[`before-roc`],reverseOf:`roc`}])}},u5=class extends e5{constructor(){super(`buddhist`,{year:-543,month:1,day:1})}},d5=class extends n5{constructor(){super(`gregory`,[{code:`gregory`,names:[`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`gregory-inverse`,names:[`be`,`bce`],reverseOf:`gregory`}])}reviseIntlEra(e){let{era:t,eraYear:n}=e;return t===`b`&&(t=`gregory-inverse`),t===`a`&&(t=`gregory`),{era:t,eraYear:n}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}},f5=class extends n5{constructor(){super(`japanese`,[{code:`reiwa`,isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:`heisei`,isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:`showa`,isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:`taisho`,isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:`meiji`,isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:`japanese`,names:[`japanese`,`gregory`,`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`japanese-inverse`,names:[`japanese-inverse`,`gregory-inverse`,`bc`,`bce`],reverseOf:`japanese`}]),this.erasBeginMidYear=!0}reviseIntlEra(e,t){let{era:n,eraYear:r}=e,{year:i}=t;return this.eras.find((e=>e.code===n))?{era:n,eraYear:r}:i<1?{era:`japanese-inverse`,eraYear:1-i}:{era:`japanese`,eraYear:i}}},p5=class extends H8{constructor(){super(...arguments),this.calendarType=`lunisolar`}inLeapYear(e,t){let n=this.getMonthList(e.year,t);return Object.entries(n).length===13}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(e){return[`M01L`,`M09L`,`M10L`,`M11L`,`M12L`].includes(e)?29:30}monthDaySearchStartYear(e,t){let n={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[e]??[1972,1972];return t<30?n[0]:n[1]}getMonthList(e,t){if(e===void 0)throw TypeError(`Missing year`);let n=JSON.stringify({func:`getMonthList`,calendarYear:e,id:this.id}),r=t.get(n);if(r)return r;let i=this.getFormatter(),a=(e,t)=>{let n=B8({isoYear:e,isoMonth:2,isoDay:1}),r=new Date(n);r.setUTCDate(t+1);let a=i.formatToParts(r),o=a.find((e=>e.type===`month`)).value,s=+a.find((e=>e.type===`day`)).value,c=a.find((e=>e.type===`relatedYear`)),l;if(c===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+c.value,{calendarMonthString:o,calendarDay:s,calendarYearToVerify:l}},o=17,{calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o);s!==`1`&&(o+=29,{calendarMonthString:s,calendarDay:c}=a(e,o)),o-=c-5;let u={},d,f,p=1,m=!1;do({calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o)),d&&(u[f].daysInMonth=d+30-c),l===e?(u[s]={monthIndex:p++},o+=30):m=!0,d=c,f=s;while(!m);return u[f].daysInMonth=d+30-c,t.set(n,u),u}estimateIsoDate(e){let{year:t,month:n}=e;return{year:t,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthExtra:o,day:s,monthCode:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(o&&o!==`bis`)throw RangeError(`Unexpected leap month suffix: ${o}`);let e=L8(a,o!==void 0),n=`${a}${o||``}`,r=this.getMonthList(i,t)[n];if(r===void 0)throw RangeError(`Unmatched month ${n} in Chinese year ${i}`);return a=r.monthIndex,{year:i,month:a,day:s,monthCode:e}}if(this.validateCalendarDate(e),a===void 0){let e=this.getMonthList(i,t),r=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));r[0]===`0`&&(r=r.slice(1));let o=e[r];if(a=o&&o.monthIndex,a===void 0&&c.endsWith(`L`)&&c!=`M13L`&&n===`constrain`){let t=+c.replace(/^M0?|L$/g,``);o=e[t],o&&(a=o.monthIndex,c=L8(t))}if(a===void 0)throw RangeError(`Unmatched month ${c} in Chinese year ${i}`)}else if(c===void 0){let e=this.getMonthList(i,t),r=Object.entries(e),o=r.length;n===`reject`?(v6(a,1,o),v6(s,1,this.maximumMonthLength())):(a=g6(a,1,o),s=g6(s,1,this.maximumMonthLength()));let l=r.find((e=>e[1].monthIndex===a));if(l===void 0)throw RangeError(`Invalid month ${a} in Chinese year ${i}`);c=L8(+l[0].replace(`bis`,``),l[0].indexOf(`bis`)!==-1)}else{let e=this.getMonthList(i,t),n=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));n[0]===`0`&&(n=n.slice(1));let r=e[n];if(!r)throw RangeError(`Unmatched monthCode ${c} in Chinese year ${i}`);if(a!==r.monthIndex)throw RangeError(`monthCode ${c} doesn't correspond to month ${a} in Chinese year ${i}`)}return{...e,year:i,month:a,monthCode:c,day:s}}},m5=class extends p5{constructor(){super(...arguments),this.id=`chinese`}},h5=class extends p5{constructor(){super(...arguments),this.id=`dangi`}},g5=class{constructor(e){this.helper=e}extraFields(e){return this.helper.hasEra&&e.includes(`year`)?[`era`,`eraYear`]:[]}resolveFields(e){if(this.helper.calendarType!==`lunisolar`){let t=new z8;R8(e,void 0,this.helper.monthsInYear({year:e.year??1972},t))}}dateToISO(e,t){let n=new z8,r=this.helper.calendarToIsoDate(e,t,n);return n.setObject(r),r}monthDayToISOReferenceDate(e,t){let n=new z8,r=this.helper.monthDayFromFields(e,t,n);return n.setObject(r),r}fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];switch(t.add(r),r){case`era`:t.add(`eraYear`),t.add(`year`);break;case`eraYear`:t.add(`era`),t.add(`year`);break;case`year`:t.add(`era`),t.add(`eraYear`);break;case`month`:t.add(`monthCode`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`monthCode`:t.add(`month`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`day`:this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`))}}return M8(t)}dateAdd(e,{years:t,months:n,weeks:r,days:i},a){let o=z8.getCacheForObject(e),s=this.helper.isoToCalendarDate(e,o),c=this.helper.addCalendar(s,{years:t,months:n,weeks:r,days:i},a,o),l=this.helper.calendarToIsoDate(c,`constrain`,o);return z8.getCacheForObject(l)||new z8(o).setObject(l),l}dateUntil(e,t,n){let r=z8.getCacheForObject(e),i=z8.getCacheForObject(t),a=this.helper.isoToCalendarDate(e,r),o=this.helper.isoToCalendarDate(t,i);return this.helper.untilCalendar(a,o,n,r)}isoToDate(e,t){let n=z8.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,n);if(t.dayOfWeek&&(r.dayOfWeek=F8.iso8601.isoToDate(e,{dayOfWeek:!0}).dayOfWeek),t.dayOfYear){let e=this.helper.startOfCalendarYear(r);r.dayOfYear=this.helper.calendarDaysUntil(e,r,n)+1}if(t.weekOfYear&&(r.weekOfYear=N8(this.helper.id,e)),r.daysInWeek=7,t.daysInMonth&&(r.daysInMonth=this.helper.daysInMonth(r,n)),t.daysInYear){let e=this.helper.startOfCalendarYear(r),t=this.helper.addCalendar(e,{years:1},`constrain`,n);r.daysInYear=this.helper.calendarDaysUntil(e,t,n)}return t.monthsInYear&&(r.monthsInYear=this.helper.monthsInYear(r,n)),t.inLeapYear&&(r.inLeapYear=this.helper.inLeapYear(r,n)),r}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}};for(let e of[U8,Z8,c5,o5,s5,m5,h5,l5,Q8,u5,d5,f5,G8,K8,q8,J8,Y8,X8]){let t=new e;F8[t.id]=new g5(t)}K0(`calendarImpl`,(function(e){return F8[e]}));var _5=Intl.DateTimeFormat;function v5(e,t){let n=Q(e,t);return typeof n==`function`&&(n=new _5(Q(e,F0),n(Q(e,I0))),function(e,t,n){let r=z0(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t]===void 0)throw TypeError(`tried to reset ${t} which was not set`);r[t]=n}(e,t,n)),n}function y5(e){return H0(e,j0)}var b5=class{constructor(e=void 0,t=void 0){(function(e,t,n){let r=n!==void 0,i;if(r){let e=[`localeMatcher`,`calendar`,`numberingSystem`,`hour12`,`hourCycle`,`timeZone`,`weekday`,`era`,`year`,`month`,`day`,`dayPeriod`,`hour`,`minute`,`second`,`fractionalSecondDigits`,`timeZoneName`,`formatMatcher`,`dateStyle`,`timeStyle`];i=function(e){if(e==null)throw TypeError(`Expected object not ${e}`);return Object(e)}(n);let t=Object.create(null);for(let n=0;n<e.length;n++){let r=e[n];Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}i=t}else i=Object.create(null);let a=new _5(t,i),o=a.resolvedOptions();if(V0(e),r){let t=Object.assign(Object.create(null),o);for(let e in t)Object.prototype.hasOwnProperty.call(i,e)||delete t[e];t.hour12=i.hour12,t.hourCycle=i.hourCycle,U0(e,I0,t)}else U0(e,I0,i);U0(e,F0,o.locale),U0(e,j0,a),U0(e,M0,o.timeZone),U0(e,P0,o.calendar),U0(e,T0,j5),U0(e,E0,k5),U0(e,D0,A5),U0(e,O0,O5),U0(e,k0,M5),U0(e,A0,N5);let s=r?i.timeZone:void 0;if(s===void 0)U0(e,N0,o.timeZone);else{let t=M2(s);if(t.startsWith(`−`))throw RangeError(`Unicode minus (U+2212) is not supported in time zone offsets`);U0(e,N0,C3(t))}})(this,e,t)}get format(){$(this,y5);let e=C5.bind(this);return Object.defineProperties(e,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:``,enumerable:!1,writable:!1,configurable:!0}}),e}formatRange(e,t){return $(this,y5),T5.call(this,e,t)}formatToParts(e,...t){return $(this,y5),w5.call(this,e,...t)}formatRangeToParts(e,t){return $(this,y5),E5.call(this,e,t)}resolvedOptions(){return $(this,y5),S5.call(this)}};`formatToParts`in _5.prototype||delete b5.prototype.formatToParts,`formatRangeToParts`in _5.prototype||delete b5.prototype.formatRangeToParts;var x5=function(e=void 0,t=void 0){return new b5(e,t)};function S5(){let e=Q(this,j0).resolvedOptions();return e.timeZone=Q(this,N0),e}function C5(e,...t){let n,r,i=B5(e,this);return i.formatter?(n=i.formatter,r=[_8(i.epochNs,`floor`)]):(n=Q(this,j0),r=[e,...t]),n.format(...r)}function w5(e,...t){let n,r,i=B5(e,this);return i.formatter?(n=i.formatter,r=[_8(i.epochNs,`floor`)]):(n=Q(this,j0),r=[e,...t]),n.formatToParts(...r)}function T5(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=R5(e),r=R5(t),i,a=[n,r];if(L5(n)!==L5(r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);if(L5(n)){if(!z5(n,r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);let{epochNs:e,formatter:t}=B5(n,this),{epochNs:o,formatter:s}=B5(r,this);t&&(i=t,a=[_8(e,`floor`),_8(o,`floor`)])}return i||=Q(this,j0),i.formatRange(...a)}function E5(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=R5(e),r=R5(t),i,a=[n,r];if(L5(n)!==L5(r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);if(L5(n)){if(!z5(n,r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);let{epochNs:e,formatter:t}=B5(n,this),{epochNs:o,formatter:s}=B5(r,this);t&&(i=t,a=[_8(e,`floor`),_8(o,`floor`)])}return i||=Q(this,j0),i.formatRangeToParts(...a)}function D5(e={},t={}){let n=Object.assign({},e),r=[`year`,`month`,`day`,`hour`,`minute`,`second`,`weekday`,`dayPeriod`,`timeZoneName`,`dateStyle`,`timeStyle`];for(let e=0;e<r.length;e++){let i=r[e];n[i]=i in t?t[i]:n[i],!1!==n[i]&&n[i]!==void 0||delete n[i]}return n}function O5(e){let t=D5(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(t.timeStyle!==`long`&&t.timeStyle!==`full`||(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})),!F5(t)){if(I5(e))throw TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(e)}]`);Object.assign(t,{hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function k5(e){let t={short:{year:`2-digit`,month:`numeric`},medium:{year:`numeric`,month:`short`},long:{year:`numeric`,month:`long`},full:{year:`numeric`,month:`long`}},n=D5(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`year`in n||`month`in n||`era`in n)){if(I5(e))throw TypeError(`cannot format PlainYearMonth with options [${Object.keys(e)}]`);Object.assign(n,{year:`numeric`,month:`numeric`})}return n}function A5(e){let t={short:{month:`numeric`,day:`numeric`},medium:{month:`short`,day:`numeric`},long:{month:`long`,day:`numeric`},full:{month:`long`,day:`numeric`}},n=D5(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`month`in n)&&!(`day`in n)){if(I5(e))throw TypeError(`cannot format PlainMonthDay with options [${Object.keys(e)}]`);Object.assign(n,{month:`numeric`,day:`numeric`})}return n}function j5(e){let t=D5(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!P5(t)){if(I5(e))throw TypeError(`cannot format PlainDate with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`})}return t}function M5(e){let t=D5(e,{timeZoneName:!1});if((t.timeStyle===`long`||t.timeStyle===`full`)&&(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}),t.dateStyle)&&(Object.assign(t,{short:{year:`numeric`,month:`numeric`,day:`numeric`},medium:{year:`numeric`,month:`short`,day:`numeric`},long:{year:`numeric`,month:`long`,day:`numeric`},full:{year:`numeric`,month:`long`,day:`numeric`,weekday:`long`}}[t.dateStyle]),delete t.dateStyle),!F5(t)&&!P5(t)){if(I5(e))throw TypeError(`cannot format PlainDateTime with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function N5(e){let t=e;return F5(t)||P5(t)||(t=Object.assign({},t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})),t}function P5(e){return`year`in e||`month`in e||`day`in e||`weekday`in e||`dateStyle`in e||`era`in e}function F5(e){return`hour`in e||`minute`in e||`second`in e||`timeStyle`in e||`dayPeriod`in e||`fractionalSecondDigits`in e}function I5(e){return P5(e)||F5(e)||`dateStyle`in e||`timeStyle`in e||`timeZoneName`in e}function L5(e){return $2(e)||e4(e)||t4(e)||i4(e)||n4(e)||r4(e)||Z2(e)}function R5(e){return L5(e)?e:j2(e)}function z5(e,t){return!(!L5(e)||!L5(t)||e4(e)&&!e4(t)||$2(e)&&!$2(t)||t4(e)&&!t4(t)||i4(e)&&!i4(t)||n4(e)&&!n4(t)||r4(e)&&!r4(t)||Z2(e)&&!Z2(t))}function B5(e,t){if(e4(e)){let n={isoDate:{year:1970,month:1,day:1},time:Q(e,u0)};return{epochNs:O3(Q(t,M0),n,`compatible`),formatter:v5(t,O0)}}if(n4(e)){let n=Q(e,Z),r=Q(t,P0);if(n!==r)throw RangeError(`cannot format PlainYearMonth with calendar ${n} in locale with calendar ${r}`);let i=b4(Q(e,c0),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:O3(Q(t,M0),i,`compatible`),formatter:v5(t,E0)}}if(r4(e)){let n=Q(e,Z),r=Q(t,P0);if(n!==r)throw RangeError(`cannot format PlainMonthDay with calendar ${n} in locale with calendar ${r}`);let i=b4(Q(e,c0),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:O3(Q(t,M0),i,`compatible`),formatter:v5(t,D0)}}if($2(e)){let n=Q(e,Z),r=Q(t,P0);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDate with calendar ${n} in locale with calendar ${r}`);let i=b4(Q(e,c0),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:O3(Q(t,M0),i,`compatible`),formatter:v5(t,T0)}}if(t4(e)){let n=Q(e,Z),r=Q(t,P0);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDateTime with calendar ${n} in locale with calendar ${r}`);let i=Q(e,l0);return{epochNs:O3(Q(t,M0),i,`compatible`),formatter:v5(t,k0)}}if(i4(e))throw TypeError(`Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.`);return Z2(e)?{epochNs:Q(e,s0),formatter:v5(t,A0)}:{}}function V5(e){let t=Object.create(null);return t.years=Q(e,h0),t.months=Q(e,g0),t.weeks=Q(e,_0),t.days=Q(e,v0),t.hours=Q(e,y0),t.minutes=Q(e,b0),t.seconds=Q(e,x0),t.milliseconds=Q(e,S0),t.microseconds=Q(e,C0),t.nanoseconds=Q(e,w0),t}b5.prototype.constructor=x5,Object.defineProperty(x5,"prototype",{value:b5.prototype,writable:!1,enumerable:!1,configurable:!1}),x5.supportedLocalesOf=_5.supportedLocalesOf,G0(x5,`Intl.DateTimeFormat`);var{format:H5,formatToParts:U5}=Intl.DurationFormat?.prototype??Object.create(null);function W5(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=V5(G4(e));return H5.call(this,t)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=W5,Intl.DurationFormat.prototype.formatToParts=function(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=V5(G4(e));return U5.call(this,t)}),Object.freeze({__proto__:null,DateTimeFormat:x5,ModifiedIntlDurationFormatPrototypeFormat:W5});var G5=class{constructor(e){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);l3(this,y8(e))}get epochMilliseconds(){return $(this,Z2),_8(Q(this,s0),`floor`)}get epochNanoseconds(){return $(this,Z2),g8(X.default.BigInt(Q(this,s0)))}add(e){return $(this,Z2),t8(`add`,this,e)}subtract(e){return $(this,Z2),t8(`subtract`,this,e)}until(e,t=void 0){return $(this,Z2),G6(`until`,this,e,t)}since(e,t=void 0){return $(this,Z2),G6(`since`,this,e,t)}round(e){if($(this,Z2),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w8(`smallestUnit`,e):C8(e),n=E4(t),r=C4(t,`halfExpand`),i=j4(t,`smallestUnit`,`time`,A4);return D4(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0),u3(c8(Q(this,s0),n,i,r))}equals(e){$(this,Z2);let t=K4(e),n=Q(this,s0),r=Q(t,s0);return X.default.equal(X.default.BigInt(n),X.default.BigInt(r))}toString(e=void 0){$(this,Z2);let t=C8(e),n=O4(t),r=C4(t,`trunc`),i=j4(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let a=t.timeZone;a!==void 0&&(a=C3(a));let{precision:o,unit:s,increment:c}=k4(i,n);return I3(u3(c8(Q(this,s0),c,s,r)),a,o)}toJSON(){return $(this,Z2),I3(this,void 0,`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,Z2),new x5(e,t).format(this)}valueOf(){O8(`Instant`)}toZonedDateTimeISO(e){$(this,Z2);let t=C3(e);return f3(Q(this,s0),t,`iso8601`)}static fromEpochMilliseconds(e){return u3(v8(j2(e)))}static fromEpochNanoseconds(e){return u3(y8(e))}static from(e){return K4(e)}static compare(e,t){let n=K4(e),r=K4(t),i=Q(n,s0),a=Q(r,s0);return X.default.lessThan(i,a)?-1:+!!X.default.greaterThan(i,a)}};G0(G5,`Temporal.Instant`);var K5=class{constructor(e,t,n,r=`iso8601`){let i=N2(e),a=N2(t),o=N2(n),s=E8(r===void 0?`iso8601`:L2(r));y6(i,a,o),$4(this,{year:i,month:a,day:o},s)}get calendarId(){return $(this,$2),Q(this,Z)}get era(){return q5(this,`era`)}get eraYear(){return q5(this,`eraYear`)}get year(){return q5(this,`year`)}get month(){return q5(this,`month`)}get monthCode(){return q5(this,`monthCode`)}get day(){return q5(this,`day`)}get dayOfWeek(){return q5(this,`dayOfWeek`)}get dayOfYear(){return q5(this,`dayOfYear`)}get weekOfYear(){return q5(this,`weekOfYear`)?.week}get yearOfWeek(){return q5(this,`weekOfYear`)?.year}get daysInWeek(){return q5(this,`daysInWeek`)}get daysInMonth(){return q5(this,`daysInMonth`)}get daysInYear(){return q5(this,`daysInYear`)}get monthsInYear(){return q5(this,`monthsInYear`)}get inLeapYear(){return q5(this,`inLeapYear`)}with(e,t=void 0){if($(this,$2),!A2(e))throw TypeError(`invalid argument`);a4(e);let n=Q(this,Z),r=z4(n,Q(this,c0));return r=m3(n,r,B4(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),e3(b3(n,r,x4(C8(t))),n)}withCalendar(e){$(this,$2);let t=_3(e);return e3(Q(this,c0),t)}add(e,t=void 0){return $(this,$2),n8(`add`,this,e,t)}subtract(e,t=void 0){return $(this,$2),n8(`subtract`,this,e,t)}until(e,t=void 0){return $(this,$2),K6(`until`,this,e,t)}since(e,t=void 0){return $(this,$2),K6(`since`,this,e,t)}equals(e){$(this,$2);let t=H4(e);return p8(Q(this,c0),Q(t,c0))===0&&y3(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,$2),R3(this,T4(C8(e)))}toJSON(){return $(this,$2),R3(this)}toLocaleString(e=void 0,t=void 0){return $(this,$2),new x5(e,t).format(this)}valueOf(){O8(`PlainDate`)}toPlainDateTime(e=void 0){$(this,$2);let t=Y4(e);return n3(b4(Q(this,c0),t),Q(this,Z))}toZonedDateTime(e){let t,n;if($(this,$2),A2(e)){let r=e.timeZone;r===void 0?t=C3(e):(t=C3(r),n=e.plainTime)}else t=C3(e);let r=Q(this,c0),i;return n===void 0?i=j3(t,r):(n=J4(n),i=O3(t,b4(r,Q(n,u0)),`compatible`)),f3(i,t,Q(this,Z))}toPlainYearMonth(){$(this,$2);let e=Q(this,Z);return c3(x3(e,z4(e,Q(this,c0)),`constrain`),e)}toPlainMonthDay(){$(this,$2);let e=Q(this,Z);return i3(S3(e,z4(e,Q(this,c0)),`constrain`),e)}static from(e,t=void 0){return H4(e,t)}static compare(e,t){let n=H4(e),r=H4(t);return p8(Q(n,c0),Q(r,c0))}};function q5(e,t){$(e,$2);let n=Q(e,c0);return R4(e).isoToDate(n,{[t]:!0})[t]}G0(K5,`Temporal.PlainDate`);var J5=class{constructor(e,t,n,r=0,i=0,a=0,o=0,s=0,c=0,l=`iso8601`){let u=N2(e),d=N2(t),f=N2(n),p=r===void 0?0:N2(r),m=i===void 0?0:N2(i),h=a===void 0?0:N2(a),g=o===void 0?0:N2(o),_=s===void 0?0:N2(s),v=c===void 0?0:N2(c),y=E8(l===void 0?`iso8601`:L2(l));S6(u,d,f,p,m,h,g,_,v),t3(this,{isoDate:{year:u,month:d,day:f},time:{hour:p,minute:m,second:h,millisecond:g,microsecond:_,nanosecond:v}},y)}get calendarId(){return $(this,t4),Q(this,Z)}get year(){return Y5(this,`year`)}get month(){return Y5(this,`month`)}get monthCode(){return Y5(this,`monthCode`)}get day(){return Y5(this,`day`)}get hour(){return X5(this,`hour`)}get minute(){return X5(this,`minute`)}get second(){return X5(this,`second`)}get millisecond(){return X5(this,`millisecond`)}get microsecond(){return X5(this,`microsecond`)}get nanosecond(){return X5(this,`nanosecond`)}get era(){return Y5(this,`era`)}get eraYear(){return Y5(this,`eraYear`)}get dayOfWeek(){return Y5(this,`dayOfWeek`)}get dayOfYear(){return Y5(this,`dayOfYear`)}get weekOfYear(){return Y5(this,`weekOfYear`)?.week}get yearOfWeek(){return Y5(this,`weekOfYear`)?.year}get daysInWeek(){return Y5(this,`daysInWeek`)}get daysInYear(){return Y5(this,`daysInYear`)}get daysInMonth(){return Y5(this,`daysInMonth`)}get monthsInYear(){return Y5(this,`monthsInYear`)}get inLeapYear(){return Y5(this,`inLeapYear`)}with(e,t=void 0){if($(this,t4),!A2(e))throw TypeError(`invalid argument`);a4(e);let n=Q(this,Z),r=Q(this,l0),i={...z4(n,r.isoDate),...r.time};return i=m3(n,i,B4(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],`partial`)),n3(U4(n,i,x4(C8(t))),n)}withPlainTime(e=void 0){$(this,t4);let t=Y4(e);return n3(b4(Q(this,l0).isoDate,t),Q(this,Z))}withCalendar(e){$(this,t4);let t=_3(e);return n3(Q(this,l0),t)}add(e,t=void 0){return $(this,t4),r8(`add`,this,e,t)}subtract(e,t=void 0){return $(this,t4),r8(`subtract`,this,e,t)}until(e,t=void 0){return $(this,t4),q6(`until`,this,e,t)}since(e,t=void 0){return $(this,t4),q6(`since`,this,e,t)}round(e){if($(this,t4),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w8(`smallestUnit`,e):C8(e),n=E4(t),r=C4(t,`halfExpand`),i=j4(t,`smallestUnit`,`time`,A4,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];D4(n,a,a===1);let o=Q(this,l0);return n3(n===1&&i===`nanosecond`?o:l8(o,n,i,r),Q(this,Z))}equals(e){$(this,t4);let t=W4(e);return h8(Q(this,l0),Q(t,l0))===0&&y3(Q(this,Z),Q(t,Z))}toString(e=void 0){$(this,t4);let t=C8(e),n=T4(t),r=O4(t),i=C4(t,`trunc`),a=j4(t,`smallestUnit`,`time`,void 0);if(a===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:o,unit:s,increment:c}=k4(a,r),l=l8(Q(this,l0),c,s,i);return C6(l),B3(l,Q(this,Z),o,n)}toJSON(){return $(this,t4),B3(Q(this,l0),Q(this,Z),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,t4),new x5(e,t).format(this)}valueOf(){O8(`PlainDateTime`)}toZonedDateTime(e,t=void 0){$(this,t4);let n=C3(e),r=S4(C8(t));return f3(O3(n,Q(this,l0),r),n,Q(this,Z))}toPlainDate(){return $(this,t4),e3(Q(this,l0).isoDate,Q(this,Z))}toPlainTime(){return $(this,t4),o3(Q(this,l0).time)}static from(e,t=void 0){return W4(e,t)}static compare(e,t){let n=W4(e),r=W4(t);return h8(Q(n,l0),Q(r,l0))}};function Y5(e,t){$(e,t4);let n=Q(e,l0).isoDate;return R4(e).isoToDate(n,{[t]:!0})[t]}function X5(e,t){return $(e,t4),Q(e,l0).time[t]}G0(J5,`Temporal.PlainDateTime`);var Z5=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){let u=e===void 0?0:F2(e),d=t===void 0?0:F2(t),f=n===void 0?0:F2(n),p=r===void 0?0:F2(r),m=i===void 0?0:F2(i),h=a===void 0?0:F2(a),g=o===void 0?0:F2(o),_=s===void 0?0:F2(s),v=c===void 0?0:F2(c),y=l===void 0?0:F2(l);D6(u,d,f,p,m,h,g,_,v,y),V0(this),U0(this,h0,u),U0(this,g0,d),U0(this,_0,f),U0(this,v0,p),U0(this,y0,m),U0(this,b0,h),U0(this,x0,g),U0(this,S0,_),U0(this,C0,v),U0(this,w0,y)}get years(){return $(this,Q2),Q(this,h0)}get months(){return $(this,Q2),Q(this,g0)}get weeks(){return $(this,Q2),Q(this,_0)}get days(){return $(this,Q2),Q(this,v0)}get hours(){return $(this,Q2),Q(this,y0)}get minutes(){return $(this,Q2),Q(this,b0)}get seconds(){return $(this,Q2),Q(this,x0)}get milliseconds(){return $(this,Q2),Q(this,S0)}get microseconds(){return $(this,Q2),Q(this,C0)}get nanoseconds(){return $(this,Q2),Q(this,w0)}get sign(){return $(this,Q2),s6(this)}get blank(){return $(this,Q2),s6(this)===0}with(t){$(this,Q2);let{years:n=Q(this,h0),months:r=Q(this,g0),weeks:i=Q(this,_0),days:a=Q(this,v0),hours:o=Q(this,y0),minutes:s=Q(this,b0),seconds:c=Q(this,x0),milliseconds:l=Q(this,S0),microseconds:u=Q(this,C0),nanoseconds:d=Q(this,w0)}=v4(t);return new e(n,r,i,a,o,s,c,l,u,d)}negated(){return $(this,Q2),h6(this)}abs(){return $(this,Q2),new e(Math.abs(Q(this,h0)),Math.abs(Q(this,g0)),Math.abs(Q(this,_0)),Math.abs(Q(this,v0)),Math.abs(Q(this,y0)),Math.abs(Q(this,b0)),Math.abs(Q(this,x0)),Math.abs(Q(this,S0)),Math.abs(Q(this,C0)),Math.abs(Q(this,w0)))}add(e){return $(this,Q2),e8(`add`,this,e)}subtract(e){return $(this,Q2),e8(`subtract`,this,e)}round(e){if($(this,Q2),e===void 0)throw TypeError(`options parameter is required`);let t=N4(this),n=typeof e==`string`?w8(`smallestUnit`,e):C8(e),r=j4(n,`largestUnit`,`datetime`,void 0,[`auto`]),{plainRelativeTo:i,zonedRelativeTo:a}=M4(n),o=E4(n),s=C4(n,`halfExpand`),c=j4(n,`smallestUnit`,`datetime`,void 0),l=!0;c||=(l=!1,`nanosecond`);let u=P4(t,c),d=!0;if(r||=(d=!1,u),r===`auto`&&(r=u),!l&&!d)throw RangeError(`at least one of smallestUnit or largestUnit is required`);if(P4(r,c)!==r)throw RangeError(`largestUnit ${r} cannot be smaller than smallestUnit ${c}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];if(f!==void 0&&D4(o,f,!1),o>1&&I4(c)===`date`&&r!==c)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);if(a){let e=O6(this),t=Q(a,m0),n=Q(a,Z),i=Q(a,s0);return e=U6(i,$6(i,t,n,e),t,n,r,o,c,s),I4(r)===`date`&&(r=`hour`),j6(e,r)}if(i){let e=k6(this),t=Z6({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),n=Q(i,c0),a=Q(i,Z),l=h3(a,n,y4(e.date,t.deltaDays),`constrain`);return e=H6(b4(n,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),b4(l,t),a,r,o,c,s),j6(e,r)}if(F4(t))throw RangeError(`a starting point is required for ${t}s balancing`);if(F4(r))throw RangeError(`a starting point is required for ${r}s balancing`);let p=k6(this);if(c===`day`){let{quotient:e,remainder:t}=p.time.divmod(_2),n=p.date.days+e+f8(t,`day`);n=s8(n,o,s),p=M6({years:0,months:0,weeks:0,days:n},Q0.ZERO)}else p=M6({years:0,months:0,weeks:0,days:0},d8(p.time,o,c,s));return j6(p,r)}total(e){if($(this,Q2),e===void 0)throw TypeError(`options argument is required`);let t=typeof e==`string`?w8(`unit`,e):C8(e),{plainRelativeTo:n,zonedRelativeTo:r}=M4(t),i=j4(t,`unit`,`datetime`,A4);if(r){let e=O6(this),t=Q(r,m0),n=Q(r,Z),a=Q(r,s0);return function(e,t,n,r,i){return I4(i)===`time`?f8(Q0.fromEpochNsDiff(t,e),i):V6(R6(e,t,n,r,i),t,D3(n,e),n,r,i)}(a,$6(a,t,n,e),t,n,i)}if(n){let e=k6(this),t=Z6({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),r=Q(n,c0),a=Q(n,Z),o=h3(a,r,y4(e.date,t.deltaDays),`constrain`);return function(e,t,n,r){if(h8(e,t)==0)return 0;C6(e),C6(t);let i=L6(e,t,n,r);return r===`nanosecond`?X.default.toNumber(i.time.totalNs):V6(i,e6(t),e,null,n,r)}(b4(r,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),b4(o,t),a,i)}let a=N4(this);if(F4(a))throw RangeError(`a starting point is required for ${a}s total`);if(F4(i))throw RangeError(`a starting point is required for ${i}s total`);return f8(k6(this).time,i)}toString(e=void 0){$(this,Q2);let t=C8(e),n=O4(t),r=C4(t,`trunc`),i=j4(t,`smallestUnit`,`time`,void 0);if(i===`hour`||i===`minute`)throw RangeError(`smallestUnit must be a time unit other than "hours" or "minutes"`);let{precision:a,unit:o,increment:s}=k4(i,n);if(o===`nanosecond`&&s===1)return L3(this,a);let c=N4(this),l=O6(this),u=d8(l.time,s,o,r);return l=M6(l.date,u),L3(j6(l,P4(c,`second`)),a)}toJSON(){return $(this,Q2),L3(this,`auto`)}toLocaleString(e=void 0,t=void 0){if($(this,Q2),typeof Intl.DurationFormat==`function`){let n=new Intl.DurationFormat(e,t);return W5.call(n,this)}return console.warn(`Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.`),L3(this,`auto`)}valueOf(){O8(`Duration`)}static from(e){return G4(e)}static compare(e,t,n=void 0){let r=G4(e),i=G4(t),{plainRelativeTo:a,zonedRelativeTo:o}=M4(C8(n));if(Q(r,h0)===Q(i,h0)&&Q(r,g0)===Q(i,g0)&&Q(r,_0)===Q(i,_0)&&Q(r,v0)===Q(i,v0)&&Q(r,y0)===Q(i,y0)&&Q(r,b0)===Q(i,b0)&&Q(r,x0)===Q(i,x0)&&Q(r,S0)===Q(i,S0)&&Q(r,C0)===Q(i,C0)&&Q(r,w0)===Q(i,w0))return 0;let s=N4(r),c=N4(i),l=O6(r),u=O6(i);if(o&&(I4(s)===`date`||I4(c)===`date`)){let e=Q(o,m0),t=Q(o,Z),n=Q(o,s0),r=$6(n,e,t,l),i=$6(n,e,t,u);return S8(X.default.toNumber(X.default.subtract(r,i)))}let d=l.date.days,f=u.date.days;if(F4(s)||F4(c)){if(!a)throw RangeError(`A starting point is required for years, months, or weeks comparison`);d=m6(l.date,a),f=m6(u.date,a)}let p=l.time.add24HourDays(d),m=u.time.add24HourDays(f);return p.cmp(m)}};G0(Z5,`Temporal.Duration`);var Q5=class{constructor(e,t,n=`iso8601`,r=1972){let i=N2(e),a=N2(t),o=E8(n===void 0?`iso8601`:L2(n)),s=N2(r);y6(s,i,a),r3(this,{year:s,month:i,day:a},o)}get monthCode(){return $5(this,`monthCode`)}get day(){return $5(this,`day`)}get calendarId(){return $(this,r4),Q(this,Z)}with(e,t=void 0){if($(this,r4),!A2(e))throw TypeError(`invalid argument`);a4(e);let n=Q(this,Z),r=z4(n,Q(this,c0),`month-day`);return r=m3(n,r,B4(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),i3(S3(n,r,x4(C8(t))),n)}equals(e){$(this,r4);let t=q4(e);return p8(Q(this,c0),Q(t,c0))===0&&y3(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,r4),V3(this,T4(C8(e)))}toJSON(){return $(this,r4),V3(this)}toLocaleString(e=void 0,t=void 0){return $(this,r4),new x5(e,t).format(this)}valueOf(){O8(`PlainMonthDay`)}toPlainDate(e){if($(this,r4),!A2(e))throw TypeError(`argument should be an object`);let t=Q(this,Z);return e3(b3(t,m3(t,z4(t,Q(this,c0),`month-day`),B4(t,e,[`year`],[],[])),`constrain`),t)}static from(e,t=void 0){return q4(e,t)}};function $5(e,t){$(e,r4);let n=Q(e,c0);return R4(e).isoToDate(n,{[t]:!0})[t]}function e7(e){return D3(e,b8())}G0(Q5,`Temporal.PlainMonthDay`);var t7={instant:()=>u3(b8()),plainDateTimeISO:(e=x8())=>n3(e7(C3(e)),`iso8601`),plainDateISO:(e=x8())=>e3(e7(C3(e)).isoDate,`iso8601`),plainTimeISO:(e=x8())=>o3(e7(C3(e)).time),timeZoneId:()=>x8(),zonedDateTimeISO:(e=x8())=>{let t=C3(e);return f3(b8(),t,`iso8601`)},[Symbol.toStringTag]:`Temporal.Now`};Object.defineProperty(t7,Symbol.toStringTag,{value:`Temporal.Now`,writable:!1,enumerable:!1,configurable:!0});var n7=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0){let o=e===void 0?0:N2(e),s=t===void 0?0:N2(t),c=n===void 0?0:N2(n),l=r===void 0?0:N2(r),u=i===void 0?0:N2(i),d=a===void 0?0:N2(a);x6(o,s,c,l,u,d),a3(this,{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d})}get hour(){return $(this,e4),Q(this,u0).hour}get minute(){return $(this,e4),Q(this,u0).minute}get second(){return $(this,e4),Q(this,u0).second}get millisecond(){return $(this,e4),Q(this,u0).millisecond}get microsecond(){return $(this,e4),Q(this,u0).microsecond}get nanosecond(){return $(this,e4),Q(this,u0).nanosecond}with(t,n=void 0){if($(this,e4),!A2(t))throw TypeError(`invalid argument`);a4(t);let r=V4(t,`partial`),i=V4(this),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Object.assign(i,r),d=x4(C8(n));return{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=_4(a,o,s,c,l,u,d),new e(a,o,s,c,l,u)}add(e){return $(this,e4),i8(`add`,this,e)}subtract(e){return $(this,e4),i8(`subtract`,this,e)}until(e,t=void 0){return $(this,e4),J6(`until`,this,e,t)}since(e,t=void 0){return $(this,e4),J6(`since`,this,e,t)}round(e){if($(this,e4),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w8(`smallestUnit`,e):C8(e),n=E4(t),r=C4(t,`halfExpand`),i=j4(t,`smallestUnit`,`time`,A4);return D4(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1),o3(u8(Q(this,u0),n,i,r))}equals(e){$(this,e4);let t=J4(e);return m8(Q(this,u0),Q(t,u0))===0}toString(e=void 0){$(this,e4);let t=C8(e),n=O4(t),r=C4(t,`trunc`),i=j4(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:a,unit:o,increment:s}=k4(i,n);return z3(u8(Q(this,u0),s,o,r),a)}toJSON(){return $(this,e4),z3(Q(this,u0),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,e4),new x5(e,t).format(this)}valueOf(){O8(`PlainTime`)}static from(e,t=void 0){return J4(e,t)}static compare(e,t){let n=J4(e),r=J4(t);return m8(Q(n,u0),Q(r,u0))}};G0(n7,`Temporal.PlainTime`);var r7=class{constructor(e,t,n=`iso8601`,r=1){let i=N2(e),a=N2(t),o=E8(n===void 0?`iso8601`:L2(n)),s=N2(r);y6(i,a,s),s3(this,{year:i,month:a,day:s},o)}get year(){return i7(this,`year`)}get month(){return i7(this,`month`)}get monthCode(){return i7(this,`monthCode`)}get calendarId(){return $(this,n4),Q(this,Z)}get era(){return i7(this,`era`)}get eraYear(){return i7(this,`eraYear`)}get daysInMonth(){return i7(this,`daysInMonth`)}get daysInYear(){return i7(this,`daysInYear`)}get monthsInYear(){return i7(this,`monthsInYear`)}get inLeapYear(){return i7(this,`inLeapYear`)}with(e,t=void 0){if($(this,n4),!A2(e))throw TypeError(`invalid argument`);a4(e);let n=Q(this,Z),r=z4(n,Q(this,c0),`year-month`);return r=m3(n,r,B4(n,e,[`year`,`month`,`monthCode`],[],`partial`)),c3(x3(n,r,x4(C8(t))),n)}add(e,t=void 0){return $(this,n4),a8(`add`,this,e,t)}subtract(e,t=void 0){return $(this,n4),a8(`subtract`,this,e,t)}until(e,t=void 0){return $(this,n4),Y6(`until`,this,e,t)}since(e,t=void 0){return $(this,n4),Y6(`since`,this,e,t)}equals(e){$(this,n4);let t=X4(e);return p8(Q(this,c0),Q(t,c0))===0&&y3(Q(this,Z),Q(t,Z))}toString(e=void 0){return $(this,n4),H3(this,T4(C8(e)))}toJSON(){return $(this,n4),H3(this)}toLocaleString(e=void 0,t=void 0){return $(this,n4),new x5(e,t).format(this)}valueOf(){O8(`PlainYearMonth`)}toPlainDate(e){if($(this,n4),!A2(e))throw TypeError(`argument should be an object`);let t=Q(this,Z);return e3(b3(t,m3(t,z4(t,Q(this,c0),`year-month`),B4(t,e,[`day`],[],[])),`constrain`),t)}static from(e,t=void 0){return X4(e,t)}static compare(e,t){let n=X4(e),r=X4(t);return p8(Q(n,c0),Q(r,c0))}};function i7(e,t){$(e,n4);let n=Q(e,c0);return R4(e).isoToDate(n,{[t]:!0})[t]}G0(r7,`Temporal.PlainYearMonth`);var a7=x5.prototype.resolvedOptions,o7=class{constructor(e,t,n=`iso8601`){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);let r=y8(e),i=L2(t),{tzName:a,offsetMinutes:o}=h4(i);if(o===void 0){let e=J3(a);if(!e)throw RangeError(`unknown time zone ${a}`);i=e.identifier}else i=Z3(o);d3(this,r,i,E8(n===void 0?`iso8601`:L2(n)))}get calendarId(){return $(this,i4),Q(this,Z)}get timeZoneId(){return $(this,i4),Q(this,m0)}get year(){return c7(this,`year`)}get month(){return c7(this,`month`)}get monthCode(){return c7(this,`monthCode`)}get day(){return c7(this,`day`)}get hour(){return l7(this,`hour`)}get minute(){return l7(this,`minute`)}get second(){return l7(this,`second`)}get millisecond(){return l7(this,`millisecond`)}get microsecond(){return l7(this,`microsecond`)}get nanosecond(){return l7(this,`nanosecond`)}get era(){return c7(this,`era`)}get eraYear(){return c7(this,`eraYear`)}get epochMilliseconds(){return $(this,i4),_8(Q(this,s0),`floor`)}get epochNanoseconds(){return $(this,i4),g8(Q(this,s0))}get dayOfWeek(){return c7(this,`dayOfWeek`)}get dayOfYear(){return c7(this,`dayOfYear`)}get weekOfYear(){return c7(this,`weekOfYear`)?.week}get yearOfWeek(){return c7(this,`weekOfYear`)?.year}get hoursInDay(){$(this,i4);let e=Q(this,m0),t=s7(this).isoDate,n=d6(t.year,t.month,t.day+1),r=j3(e,t),i=j3(e,n);return f8(Q0.fromEpochNsDiff(i,r),`hour`)}get daysInWeek(){return c7(this,`daysInWeek`)}get daysInMonth(){return c7(this,`daysInMonth`)}get daysInYear(){return c7(this,`daysInYear`)}get monthsInYear(){return c7(this,`monthsInYear`)}get inLeapYear(){return c7(this,`inLeapYear`)}get offset(){return $(this,i4),E3(T3(Q(this,m0),Q(this,s0)))}get offsetNanoseconds(){return $(this,i4),T3(Q(this,m0),Q(this,s0))}with(e,t=void 0){if($(this,i4),!A2(e))throw TypeError(`invalid zoned-date-time-like`);a4(e);let n=Q(this,Z),r=Q(this,m0),i=T3(r,Q(this,s0)),a=s7(this),o={...z4(n,a.isoDate),...a.time,offset:E3(i)};o=m3(n,o,B4(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`],`partial`));let s=C8(t),c=S4(s),l=w4(s,`prefer`),u=U4(n,o,x4(s)),d=G3(o.offset);return f3(Z4(u.isoDate,u.time,`option`,d,r,c,l,!1),r,n)}withPlainTime(e=void 0){$(this,i4);let t=Q(this,m0),n=Q(this,Z),r=s7(this).isoDate,i;return i=e===void 0?j3(t,r):O3(t,b4(r,Q(J4(e),u0)),`compatible`),f3(i,t,n)}withTimeZone(e){$(this,i4);let t=C3(e);return f3(Q(this,s0),t,Q(this,Z))}withCalendar(e){$(this,i4);let t=_3(e);return f3(Q(this,s0),Q(this,m0),t)}add(e,t=void 0){return $(this,i4),o8(`add`,this,e,t)}subtract(e,t=void 0){return $(this,i4),o8(`subtract`,this,e,t)}until(e,t=void 0){return $(this,i4),X6(`until`,this,e,t)}since(e,t=void 0){return $(this,i4),X6(`since`,this,e,t)}round(e){if($(this,i4),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?w8(`smallestUnit`,e):C8(e),n=E4(t),r=C4(t,`halfExpand`),i=j4(t,`smallestUnit`,`time`,A4,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];if(D4(n,a,a===1),i===`nanosecond`&&n===1)return f3(Q(this,s0),Q(this,m0),Q(this,Z));let o=Q(this,m0),s=Q(this,s0),c=s7(this),l;if(i===`day`){let e=c.isoDate,t=d6(e.year,e.month,e.day+1),n=j3(o,e),i=j3(o,t),a=X.default.subtract(i,n);l=Q0.fromEpochNsDiff(s,n).round(a,r).addToEpochNs(n)}else{let e=l8(c,n,i,r),t=T3(o,s);l=Z4(e.isoDate,e.time,`option`,t,o,`compatible`,`prefer`,!1)}return f3(l,o,Q(this,Z))}equals(e){$(this,i4);let t=Q4(e),n=Q(this,s0),r=Q(t,s0);return!!X.default.equal(X.default.BigInt(n),X.default.BigInt(r))&&!!w3(Q(this,m0),Q(t,m0))&&y3(Q(this,Z),Q(t,Z))}toString(e=void 0){$(this,i4);let t=C8(e),n=T4(t),r=O4(t),i=function(e){return T8(e,`offset`,[`auto`,`never`],`auto`)}(t),a=C4(t,`trunc`),o=j4(t,`smallestUnit`,`time`,void 0);if(o===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let s=function(e){return T8(e,`timeZoneName`,[`auto`,`never`,`critical`],`auto`)}(t),{precision:c,unit:l,increment:u}=k4(o,r);return U3(this,c,n,s,i,{unit:l,increment:u,roundingMode:a})}toLocaleString(e=void 0,t=void 0){$(this,i4);let n=C8(t),r=Object.create(null);if(function(e,t,n,r){if(t==null)return;let i=Reflect.ownKeys(t);for(let r=0;r<i.length;r++){let a=i[r];!n.some((e=>Object.is(e,a)))&&Object.prototype.propertyIsEnumerable.call(t,a)&&(e[a]=t[a])}}(r,n,[`timeZone`]),n.timeZone!==void 0)throw TypeError(`ZonedDateTime toLocaleString does not accept a timeZone option`);if(r.year===void 0&&r.month===void 0&&r.day===void 0&&r.era===void 0&&r.weekday===void 0&&r.dateStyle===void 0&&r.hour===void 0&&r.minute===void 0&&r.second===void 0&&r.fractionalSecondDigits===void 0&&r.timeStyle===void 0&&r.dayPeriod===void 0&&r.timeZoneName===void 0&&(r.timeZoneName=`short`),r.timeZone=Q(this,m0),W3(r.timeZone))throw RangeError(`toLocaleString does not currently support offset time zones`);let i=new x5(e,r),a=a7.call(i).calendar,o=Q(this,Z);if(o!==`iso8601`&&a!==`iso8601`&&!y3(a,o))throw RangeError(`cannot format ZonedDateTime with calendar ${o} in locale with calendar ${a}`);return i.format(u3(Q(this,s0)))}toJSON(){return $(this,i4),U3(this,`auto`)}valueOf(){O8(`ZonedDateTime`)}startOfDay(){$(this,i4);let e=Q(this,m0);return f3(j3(e,s7(this).isoDate),e,Q(this,Z))}getTimeZoneTransition(e){$(this,i4);let t=Q(this,m0);if(e===void 0)throw TypeError(`options parameter is required`);let n=T8(typeof e==`string`?w8(`direction`,e):C8(e),`direction`,[`next`,`previous`],A4);if(n===void 0)throw TypeError(`direction option is required`);if(W3(t)||t===`UTC`)return null;let r=Q(this,s0),i=n===`next`?n6(t,r):r6(t,r);return i===null?null:f3(i,t,Q(this,Z))}toInstant(){return $(this,i4),u3(Q(this,s0))}toPlainDate(){return $(this,i4),e3(s7(this).isoDate,Q(this,Z))}toPlainTime(){return $(this,i4),o3(s7(this).time)}toPlainDateTime(){return $(this,i4),n3(s7(this),Q(this,Z))}static from(e,t=void 0){return Q4(e,t)}static compare(e,t){let n=Q4(e),r=Q4(t),i=Q(n,s0),a=Q(r,s0);return X.default.lessThan(X.default.BigInt(i),X.default.BigInt(a))?-1:+!!X.default.greaterThan(X.default.BigInt(i),X.default.BigInt(a))}};function s7(e){return D3(Q(e,m0),Q(e,s0))}function c7(e,t){$(e,i4);let n=s7(e).isoDate;return R4(e).isoToDate(n,{[t]:!0})[t]}function l7(e,t){return $(e,i4),s7(e).time[t]}G0(o7,`Temporal.ZonedDateTime`);var u7=Object.freeze({__proto__:null,Duration:Z5,Instant:G5,Now:t7,PlainDate:K5,PlainDateTime:J5,PlainMonthDay:Q5,PlainTime:n7,PlainYearMonth:r7,ZonedDateTime:o7});(class{toTemporalInstant(){return u3(v8(Date.prototype.valueOf.call(this)))}}).prototype.toTemporalInstant;var d7=[G5,K5,J5,Z5,Q5,n7,r7,o7];for(let e of d7){let t=Object.getOwnPropertyDescriptor(e,`prototype`);(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t))}function f7(e,t){let n=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r=e=>{let t=n.find(t=>t.type===e);if(!t)throw Error(`This timezone isn't recognised. Enter a timezone name like Europe/Tirane.`);return t.value};return`${r(`year`)}-${r(`month`)}-${r(`day`)}T${r(`hour`)}:${r(`minute`)}`}function p7(e,t){return f7(new Date(e),t)}function m7(e,t){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e))throw Error(`Pick a date and time for the one-off run.`);let n=u7.PlainDateTime.from(e,{overflow:`reject`}),r=n.toZonedDateTime(t,{disambiguation:`compatible`});if(!n.equals(r.toPlainDateTime()))throw Error(`That time is skipped in this timezone (a clock change). Choose another time.`);return r.toInstant().toString({smallestUnit:`millisecond`})}function h7(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}var g7=[[1,`Mon`],[2,`Tue`],[3,`Wed`],[4,`Thu`],[5,`Fri`],[6,`Sat`],[0,`Sun`]];function _7({templates:e,pending:t,onCreated:n,onError:r,editing:i,onCancel:a,error:o,onBusy:s}){let{api:c}=B(),[l,u]=(0,m.useState)(i?.name??``),[d,f]=(0,m.useState)(i?.templateId??``),[p,g]=(0,m.useState)(i?.cadence.kind??`daily`),[_,v]=(0,m.useState)(i?.cadence.kind===`once`?p7(i.cadence.at,i.timezone):``),[y,b]=(0,m.useState)(i&&i.cadence.kind!==`once`?i.cadence.time:`09:00`),[x,S]=(0,m.useState)(i?.cadence.kind===`weekly`?i.cadence.days:[1,3,5]),[C,w]=(0,m.useState)(()=>i?.timezone??(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`)),[T,E]=(0,m.useState)(i?.missedPolicy??`skip`),[D,O]=(0,m.useState)(i?.spendLimitCents?.toString()??``),[k,ee]=(0,m.useState)(()=>(i?.items??[]).map(e=>e.title).join(`
|
|
168
|
+
`)),[A,j]=(0,m.useState)(i?.topicKeyword??null),[M,N]=(0,m.useState)(i?.values??{}),[P,F]=(0,m.useState)(!1),[te,ne]=(0,m.useState)(!1),re=(0,m.useRef)(!1),ie=(0,m.useRef)(null),ae=i&&!e.some(e=>e.id===i.templateId)?[...e,{id:i.templateId,version:i.templateVersion,name:`Saved template`}]:e.map(e=>i?.templateId===e.id?{...e,version:i.templateVersion}:e),oe=ae.find(e=>e.id===d),se=I({queryKey:[`project-template`,d],enabled:d!==``,queryFn:async()=>{let e=await h$(c,d);if(!e.ok)throw Error(e.message);return e.value}}),ce=se.data?.document.form,le=ce===void 0?[]:[...new Set([...KF(ce.title).names,...Object.keys(ce.values)])],ue=A!==null&&le.includes(A)?A:le.find(e=>ce?.title.includes(`{{${e}}}`))??le[0]??null,de=v7(k);async function fe(e){if(e.preventDefault(),!(re.current||t)){if(!oe&&!ie.current){r(`Choose a template before saving the schedule.`);return}if(de.length>500){r(`Keep the list to 500 topics or fewer.`);return}if(de.some(e=>e.length>200)){r(`Each topic can be at most 200 characters.`);return}if(p===`weekly`&&x.length===0){r(`Choose at least one weekday for a weekly schedule.`);return}re.current=!0,F(!0),s(!0);try{if(!ie.current){if(!oe)throw Error(`Choose a template before saving the schedule.`);let e=C.trim();if(!x1(e))throw Error(`Enter a timezone name like Europe/Tirane or America/New_York.`);let t=p===`once`?{kind:p,at:m7(_,e)}:p===`weekly`?{kind:p,time:y,days:x}:{kind:p,time:y},n=D.trim()===``?null:Number(D);if(n!==null&&(!Number.isInteger(n)||n<0))throw Error(`Enter the spend limit as a whole number of cents, 0 or more (500 is $5.00), or leave it empty.`);let r={id:i?.id??crypto.randomUUID(),name:l.trim(),templateId:oe.id,templateVersion:i?.templateId===d?i.templateVersion:oe.version,cadence:t,timezone:e,missedPolicy:T,overlapPolicy:`skip`,spendLimitCents:n,items:de.map(e=>({title:e,values:i?.items.find(t=>t.title===e)?.values??{}})),topicKeyword:ue,values:Object.fromEntries(le.filter(e=>e!==ue).map(e=>[e,M[e]??ce?.values[e]??``]))};ie.current=i?{...r,baseVersion:i.version,mutationId:crypto.randomUUID()}:r}let e=ie.current,{id:t,...a}=e,o=`mutationId`in a?await z1(c,t,a):await R1(c,e);if(!o.ok){ie.current=null,ne(!1),r(o.reason===`conflict`?`${o.message} Your inputs are kept here. To load the latest saved version, cancel editing and press Edit again.`:o.message);return}ie.current=null,ne(!1),u(``),ee(``),n()}catch(e){ne(ie.current!==null),r(e instanceof Error?e.message:`The schedule wasn't saved. Try again.`)}finally{re.current=!1,F(!1),s(ie.current!==null)}}}return(0,h.jsxs)(`section`,{"aria-label":i?`Edit schedule`:`New schedule`,children:[o?(0,h.jsx)(`p`,{role:`alert`,className:`mb-3 text-small text-red`,children:o}):null,(0,h.jsxs)(`form`,{onSubmit:e=>void fe(e),children:[(0,h.jsxs)(`fieldset`,{disabled:P||te||t,className:`grid gap-4 sm:grid-cols-2`,children:[(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-name`,children:[(0,h.jsx)(`span`,{children:`Name`}),(0,h.jsx)(KP,{id:`schedule-name`,required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Monday morning stories`})]}),(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-template`,children:[(0,h.jsx)(`span`,{children:`Template`}),(0,h.jsxs)(`select`,{id:`schedule-template`,required:!0,value:d,onChange:e=>f(e.target.value),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-2 text-small`,disabled:ae.length===0,children:[(0,h.jsx)(`option`,{value:``,children:`Choose a template`}),ae.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version]},e.id))]})]}),(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-cadence`,children:[(0,h.jsx)(`span`,{children:`Cadence`}),(0,h.jsxs)(`select`,{id:`schedule-cadence`,value:p,onChange:e=>g(e.target.value===`once`?`once`:e.target.value===`weekly`?`weekly`:`daily`),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-2 text-small`,children:[(0,h.jsx)(`option`,{value:`daily`,children:`Every day`}),(0,h.jsx)(`option`,{value:`weekly`,children:`Selected weekdays`}),(0,h.jsx)(`option`,{value:`once`,children:`One time`})]})]}),p===`once`?(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-once`,children:[(0,h.jsx)(`span`,{children:`Run at`}),(0,h.jsx)(KP,{id:`schedule-once`,required:!0,type:`datetime-local`,value:_,onChange:e=>v(e.target.value)})]}):(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-time`,children:[(0,h.jsx)(`span`,{children:`Local time`}),(0,h.jsx)(KP,{id:`schedule-time`,required:!0,type:`time`,value:y,onChange:e=>b(e.target.value)})]}),p===`weekly`?(0,h.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,h.jsx)(`legend`,{children:`Weekdays`}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g7.map(([e,t])=>(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-1 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),onChange:t=>S(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e))}),t]},e))})]}):(0,h.jsx)(`div`,{}),(0,h.jsxs)(`div`,{className:`space-y-1`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:`schedule-timezone`,children:`Timezone`}),(0,h.jsx)(DI,{label:`Timezone`,children:(0,h.jsx)(`p`,{children:p===`once`?`IANA zone; the one-off instant is calculated here. Repeated clock times use the earlier occurrence; nonexistent spring-forward times are refused.`:`IANA zone; next run is calculated here. Repeated clock times use the earlier occurrence; nonexistent spring-forward times move forward by the gap.`})})]}),(0,h.jsx)(KP,{id:`schedule-timezone`,value:C,onChange:e=>w(e.target.value),placeholder:`Europe/Tirane`})]}),(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-missed`,children:[(0,h.jsx)(`span`,{children:`Missed run`}),(0,h.jsxs)(`select`,{id:`schedule-missed`,value:T,onChange:e=>E(e.target.value===`run-once`?`run-once`:`skip`),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-2 text-small`,children:[(0,h.jsx)(`option`,{value:`skip`,children:`Skip if Slopify was closed`}),(0,h.jsx)(`option`,{value:`run-once`,children:`Run once when Slopify reopens`})]})]}),(0,h.jsxs)(`label`,{className:`space-y-1`,htmlFor:`schedule-spend`,children:[(0,h.jsx)(`span`,{children:`Spend ceiling (cents, optional)`}),(0,h.jsx)(KP,{id:`schedule-spend`,inputMode:`numeric`,value:D,onChange:e=>O(e.target.value),placeholder:`1000`})]}),(0,h.jsx)(y7,{topics:k,onTopics:ee,queue:de,keywords:le,keyword:ue,onKeyword:j,values:Object.fromEntries(le.map(e=>[e,M[e]??ce?.values[e]??``])),onValue:(e,t)=>N(n=>({...n,[e]:t})),title:ce?.title,loading:d!==``&&se.isPending})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-[-16px] -mx-4 mt-4 flex gap-2 border-t border-line bg-panel px-4 py-3`,children:[(0,h.jsx)(V,{type:`submit`,variant:`primary`,disabled:t||P||ae.length===0&&!te,children:P?`Saving…`:te?`Retry save`:i?`Save changes`:`Save schedule`}),(0,h.jsx)(V,{type:`button`,disabled:P||te,onClick:a,children:i?`Cancel editing`:`Cancel`})]})]})]})}function v7(e){return e.split(`
|
|
169
|
+
`).map(e=>e.trim()).filter(e=>e!==``)}function y7({topics:e,onTopics:t,queue:n,keywords:r,keyword:i,onKeyword:a,values:o,onValue:s,title:c,loading:l}){let u=`min-h-8 w-full rounded-control border border-line2 bg-panel2 px-[10px] py-[5px] text-small`,d=n[0],f=c===void 0?void 0:JF(c,{...o,...i!==null&&d!==void 0?{[i]:d}:{}}),p=i!==null&&c?.includes(`{{${i}}}`)===!0;return(0,h.jsxs)(`fieldset`,{className:`space-y-3 sm:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`flex items-center gap-1`,children:[`Topics (optional)`,(0,h.jsx)(DI,{label:`Topics`,children:(0,h.jsx)(`p`,{children:`One topic per line. Each run starts one project with the first topic and removes it from the list; the schedule completes when the list is empty. With no topics, every run uses the template as saved.`})})]}),(0,h.jsxs)(`label`,{className:`block space-y-1`,htmlFor:`schedule-topics`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:n.length===0?`One per line`:`${String(n.length)} ${n.length===1?`topic`:`topics`} · next: ${d??``}`}),(0,h.jsx)(`textarea`,{id:`schedule-topics`,rows:6,className:u,value:e,onChange:e=>t(e.target.value),placeholder:`Owlbears
|
|
170
|
+
Gelatinous Cubes
|
|
171
|
+
Mimics`})]}),l?(0,h.jsx)(`p`,{className:`text-small text-ink3`,children:`Reading the template's keywords…`}):r.length===0?(0,h.jsxs)(`p`,{className:`text-small text-ink3`,children:[`This template has no keywords such as `,`{{Topic}}`,`, so each topic becomes the project's title.`]}):(0,h.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,h.jsxs)(`label`,{className:`block space-y-1`,htmlFor:`schedule-topic-keyword`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`Each topic fills`}),(0,h.jsx)(`select`,{id:`schedule-topic-keyword`,value:i??``,onChange:e=>a(e.target.value),className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-2 text-small`,children:r.map(e=>(0,h.jsx)(`option`,{value:e,children:`{{${e}}}`},e))})]}),r.filter(e=>e!==i).map(e=>(0,h.jsxs)(`label`,{className:`block space-y-1`,children:[(0,h.jsxs)(`span`,{className:`text-small text-ink2`,children:[e,` (every run)`]}),(0,h.jsx)(`input`,{maxLength:1e4,"aria-label":`${e} for every run`,className:u,value:o[e]??``,onChange:t=>s(e,t.target.value)})]},e))]}),f!==void 0&&d!==void 0?(0,h.jsxs)(`p`,{className:`text-small text-ink2`,children:[`Next project: `,(0,h.jsx)(`span`,{className:`font-semibold text-ink`,children:f}),p?null:(0,h.jsxs)(`span`,{className:`block text-ink3`,children:[`The template's project title does not use `,`{{${i??`keyword`}}}`,`, so every project gets this title. Edit the template's title to include it.`]})]}):null]})}function b7(){let{api:e}=B(),t=_(),n=I(I1(e)),r=I(m$(e)),[i,a]=(0,m.useState)(null),o=ml(),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(!1),p=(0,m.useRef)(!1),g=n.data?.filter(e=>e.deletedAt===null)??[],v=n.data?.filter(e=>e.deletedAt!==null)??[],y=rt({onError:e=>a(e.message),onSettled:async()=>{p.current=!1,await t.invalidateQueries({queryKey:F1})},mutationFn:async e=>e(),onSuccess:async e=>{if(!e.ok){a(e.message);return}a(null)}}),b=e=>{p.current||(p.current=!0,a(null),y.mutate(e))},x=l||s!==null,S=()=>{c(null),u(!1),a(null)},C=i?{tone:`error`,text:i}:n.error?{tone:`error`,text:n.error.message}:r.error?{tone:`error`,text:r.error.message}:void 0;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EF,{action:(0,h.jsxs)(V,{type:`button`,onClick:()=>{c(null),u(!0),a(null)},disabled:x||r.data?.length===0,children:[(0,h.jsx)(Ts,{"aria-hidden":`true`,className:`size-[14px]`}),`New schedule`]}),children:(0,h.jsxs)(`p`,{className:`flex items-center gap-1 text-small text-ink2`,children:[r.data?.length===0?(0,h.jsxs)(h.Fragment,{children:[`Save a template in`,` `,(0,h.jsx)(oa,{className:`underline`,to:`/templates`,children:`Templates`}),` `,`before creating a schedule.`]}):`Runs a saved template on this machine at a local time.`,(0,h.jsx)(DI,{label:`Schedules`,children:(0,h.jsx)(`p`,{children:`Each schedule keeps a durable history and creates fresh projects, so changing a template never rewrites an old run. Schedules use the selected template version and never include uploaded media.`})})]})}),(0,h.jsx)(EP,{tone:x?`info`:C?.tone??`info`,className:`mb-2`,children:x?void 0:C?.text}),n.data&&g.length===0?(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-6 text-ink2`,children:v.length===0?`No schedules yet. Your first one can be a one-off run or a recurring series.`:`No active schedules. Create one or review deleted history below.`})}):null,g.length>0?(0,h.jsx)(`section`,{className:`overflow-hidden rounded-panel border border-line bg-panel`,"aria-label":`Saved schedules`,children:g.map(e=>(0,h.jsx)(x7,{schedule:e,pending:y.isPending||d||x,onAction:b,error:i,onEdit:()=>{u(!1),c(e),a(null)}},e.id))}):null,v.length>0?(0,h.jsxs)(`details`,{className:`mt-4`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-small font-semibold text-ink2`,children:[`Deleted schedules · `,v.length]}),(0,h.jsx)(`p`,{className:`mt-2 text-small text-ink2`,children:`Deleted schedules cannot run again. Their occurrence history remains available here.`}),(0,h.jsx)(`section`,{className:`mt-2 overflow-hidden rounded-panel border border-line bg-panel`,"aria-label":`Deleted schedules`,children:v.map(e=>(0,h.jsx)(x7,{schedule:e,pending:!1,onAction:b,error:null,onEdit:()=>void 0},e.id))})]}):null,(0,h.jsx)(dI,{open:x,title:s?`Edit schedule`:`New schedule`,onClose:()=>{d||S()},children:(0,h.jsx)(_7,{onBusy:f,editing:s,onCancel:S,templates:r.data??[],pending:y.isPending,error:i,onCreated:()=>{o(s?`Schedule updated.`:`Schedule saved. It will run automatically while Slopify is open.`,`success`),S(),t.invalidateQueries({queryKey:F1})},onError:e=>{a(e),t.invalidateQueries({queryKey:F1})}},s?.id??`new`)})]})}function x7({schedule:e,pending:t,onAction:n,onEdit:r,error:i}){let{api:a}=B(),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(null),u=I({queryKey:[`schedule`,e.id],queryFn:async()=>{let t=await L1(a,e.id);if(!t.ok)throw Error(t.message);return t.value},enabled:o,refetchInterval:3e4}),d=e.cadence.kind===`once`?`One time`:e.cadence.kind===`daily`?`Daily at ${e.cadence.time}`:`Weekly at ${e.cadence.time}`,f=e.deletedAt===null,p=f&&(e.status===`active`||e.status===`paused`),g=!f||e.status===`canceled`?`canceled`:e.status===`paused`?`paused`:e.status===`completed`?`done`:`running`;return(0,h.jsxs)(`article`,{className:`border-b border-line px-4 py-[10px] last:border-b-0`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,h.jsx)(jl,{state:g,className:`animate-none`}),(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`h2`,{className:`break-words font-semibold`,children:e.name}),(0,h.jsxs)(`p`,{className:`text-small text-ink2`,children:[d,` · `,e.timezone,` ·`,` `,e.items.length===0?`Template as saved`:`${String(e.items.length)} ${e.items.length===1?`topic`:`topics`} left`,` `,`·`,` `,e.deletedAt===null?e.nextRunAt===null?`No future run`:`Next: ${h7(e.nextRunAt,e.timezone)}`:`Deleted: ${h7(e.deletedAt,e.timezone)}`]})]}),(0,h.jsx)(`span`,{className:`engraved w-[76px] text-ink2 capitalize`,children:e.status}),(0,h.jsx)(DI,{label:`${e.name} policy`,children:(0,h.jsxs)(`p`,{children:[`Missed runs: `,e.missedPolicy===`skip`?`skip`:`run once on reopening`,`. Overlap: skip. Spend ceiling:`,` `,e.spendLimitCents===null?`not set`:`${e.spendLimitCents} cents`,`.`]})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f?(0,h.jsx)(V,{type:`button`,disabled:t||!p,onClick:r,children:`Edit`}):null,(0,h.jsxs)(V,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),"aria-expanded":o,children:[o?(0,h.jsx)(gs,{"aria-hidden":`true`,className:`size-4`}):(0,h.jsx)(ms,{"aria-hidden":`true`,className:`size-4`}),`History`]}),f?(0,h.jsxs)(gF,{children:[(0,h.jsx)(_F,{asChild:!0,children:(0,h.jsx)(V,{type:`button`,variant:`ghost`,"aria-label":`More for ${e.name}`,className:`size-8 p-0`,children:(0,h.jsx)(bs,{"aria-hidden":`true`,className:`size-4`})})}),(0,h.jsxs)(vF,{children:[e.status===`paused`?(0,h.jsx)(yF,{disabled:t||!f,onSelect:()=>n(()=>B1(a,e.id,`resume`,e.version)),children:`Resume`}):(0,h.jsx)(yF,{disabled:t||!f||e.status!==`active`,onSelect:()=>n(()=>B1(a,e.id,`pause`,e.version)),children:`Pause`}),(0,h.jsx)(yF,{disabled:t||!p,onSelect:()=>l(`cancel`),children:`Cancel`}),(0,h.jsx)(yF,{disabled:t||!f||e.status!==`canceled`&&e.status!==`completed`,onSelect:()=>l(`delete`),children:`Delete`})]})]}):null]})]}),(0,h.jsx)(wP,{open:c!==null,title:c===`delete`?`Delete schedule?`:`Cancel schedule?`,consequence:(c===`delete`?`Removes this schedule from the active list. Its run history is kept.`:`Stops future scheduled runs. Existing projects and run history are kept.`)+(i?` ${i}`:``),verb:c===`delete`?`Delete schedule`:`Cancel schedule`,dismiss:`Keep schedule`,pending:t,onCancel:()=>{t||l(null)},onConfirm:()=>{let t=c;t&&n(async()=>{let n=t===`delete`?await V1(a,e.id,e.version):await B1(a,e.id,`cancel`,e.version);return n.ok&&l(null),n})}}),o?(0,h.jsx)(`div`,{className:`mt-3 border-t border-line pt-3 pl-6`,children:u.isPending?(0,h.jsx)(`p`,{className:`text-small text-ink3`,children:`Loading history…`}):u.error?(0,h.jsx)(`p`,{className:`text-small text-red`,children:u.error.message}):u.data?.runs.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink3`,children:`No runs yet.`}):(0,h.jsx)(`ul`,{className:`space-y-2`,children:u.data?.runs.map(t=>(0,h.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-2 text-small`,children:[(0,h.jsxs)(`span`,{className:`capitalize`,children:[t.status,` · `,h7(t.scheduledFor,e.timezone)]}),t.error?(0,h.jsx)(`span`,{className:`text-ink3`,children:t.error}):t.projectIds.length>0?(0,h.jsx)(`span`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-ink3`,children:t.projectIds.map((e,t)=>(0,h.jsxs)(oa,{className:`underline hover:text-ink`,to:`/projects/$projectId`,params:{projectId:e},children:[`Project `,t+1]},e))}):(0,h.jsx)(`span`,{className:`text-ink3`,children:`No projects`})]},t.id))})}):null]})}function S7(){let{api:e}=B(),t=_(),n=ml(),r=I({queryKey:[`catalogue`],queryFn:async()=>$a(await e.fetch(`${e.origin}/api/providers/catalogue`)),refetchInterval:3e4}),i=rt({mutationFn:async()=>$a(await e.fetch(`${e.origin}/api/providers/catalogue/refresh`,{method:`POST`})),onSuccess:e=>{n(`Catalogue updated.`,`success`),t.setQueryData([`catalogue`],e),t.invalidateQueries({queryKey:[`provider-models`]})}});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(WQ,{title:`Models`,info:`The catalogue lists supported text, image and speech models, their prices and request limits. Local YAML edits load automatically; model pickers refresh every 30 seconds. Refresh replaces your local file with the published catalogue and saves the previous file alongside it.`,children:(0,h.jsx)(V,{disabled:i.isPending||!r.data?.path,onClick:()=>i.mutate(),children:i.isPending?`Refreshing…`:`Refresh published catalogue`})}),(0,h.jsxs)(MP,{children:[(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:`Catalogue file`}),(0,h.jsx)(`span`,{className:`min-w-0 break-all font-mono text-small text-ink2`,children:r.data?.path??`Not available`})]}),(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:`Verified`}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:r.data?.updatedAt??`date unavailable`})]})]}),r.data?.warning||r.error||i.error?(0,h.jsx)(`p`,{role:`alert`,className:`mt-2 text-body text-red`,children:i.error?.message??r.error?.message??r.data?.warning}):null]})}var C7=`grid grid-cols-1 items-center gap-x-4 gap-y-2 border-t border-line px-4 py-[10px] first:border-t-0 md:grid-cols-[170px_150px_minmax(0,1fr)_auto]`;function w7({provider:e,readiness:t}){let{api:n}=B(),r=_(),i=(0,m.useId)(),a=(0,m.useId)(),o=(0,m.useId)(),s=(0,m.useId)(),c=(0,m.useId)(),[l,u]=(0,m.useState)(void 0),[d,f]=(0,m.useState)(!1),p=e.cliPath?.configured??null,g=e.cliPath?.managedOnHost===!0,v=e.id===`claude-code`?`claude`:e.id===`codex-image`?`codex`:e.id,y=e.cliPath?.command??v,b=l??p??``,x=tN(t),S=rt({mutationFn:t=>Mo(n,e.id,t),onMutate:()=>f(!1),onSuccess:async e=>{r.setQueryData(H.providers,t=>t?{...t,providers:t.providers.map(t=>t.id===e.id?e:t)}:void 0),u(void 0),f(!0),await r.invalidateQueries({queryKey:H.providers})}});(0,m.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>f(!1),OP);return()=>clearTimeout(e)},[d]);let[C,w]=(0,m.useState)(!1),T=(0,m.useId)();return(0,h.jsxs)(`div`,{"data-ready":x,className:`border-t border-line first:border-t-0`,children:[(0,h.jsxs)(`div`,{className:z(C7,`border-t-0`),children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{id:i,className:z(`font-semibold`,x?`text-ink`:`text-ink3`),children:e.displayName}),(0,h.jsxs)(DI,{label:`${e.displayName} sign-in`,children:[g?(0,h.jsx)(`p`,{children:`Runs on your host using its existing CLI login. Rerun the Docker launcher after changing CLI installations.`}):null,(0,h.jsxs)(`p`,{children:[`Sign in through `,e.displayName,` itself before generating; Slopify uses that login.`,e.id===`codex-image`?` Executable path and login are shared with Codex text generation.`:null]})]})]}),(0,h.jsxs)(`p`,{className:`flex min-w-0 items-center gap-2 text-small text-ink2`,"aria-live":`polite`,children:[(0,h.jsx)(jl,{state:x?`done`:`pending`}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:T7(t,p)})]}),(0,h.jsxs)(`p`,{className:`min-w-0 truncate text-label text-ink3`,title:y,children:[(0,h.jsx)(`span`,{className:`sr-only`,children:`Command: `}),(0,h.jsx)(`code`,{children:y})]}),(0,h.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2`,children:[g?(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:`Managed on host`}):(0,h.jsx)(V,{variant:`ghost`,"aria-expanded":C,"aria-controls":T,onClick:()=>w(e=>!e),children:C?`Close path`:`Change path`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:d?(0,h.jsx)(AP,{}):null})]})]}),g||!C?null:(0,h.jsxs)(`form`,{id:T,className:`border-t border-line bg-bg/40 px-4 py-3`,onSubmit:e=>{e.preventDefault(),S.isPending||S.mutate(b)},children:[(0,h.jsx)(JP,{htmlFor:a,id:o,className:`mb-[5px]`,children:`Executable path`}),(0,h.jsxs)(`div`,{className:`flex max-w-[640px] items-center gap-2`,children:[(0,h.jsx)(KP,{id:a,autoComplete:`off`,spellCheck:!1,maxLength:4096,"aria-labelledby":`${i} ${o}`,"aria-invalid":S.error!==null,"aria-describedby":`${s}${S.error?` ${c}`:``}`,placeholder:v,value:b,disabled:S.isPending,onChange:e=>{u(e.target.value),f(!1),S.reset()}}),(0,h.jsx)(V,{type:`submit`,"aria-label":`Save ${e.displayName} path`,disabled:S.isPending,children:S.isPending?`Checking…`:`Save path`})]}),(0,h.jsxs)(`p`,{id:s,className:`mt-1 text-label text-ink3`,children:[`Leave blank to find `,(0,h.jsx)(`code`,{children:v}),` on PATH. Use an absolute path without quotes or arguments.`]}),S.error?(0,h.jsx)(`p`,{id:c,role:`alert`,className:`mt-1 text-label text-red`,children:S.error.message}):null]})]})}function T7(e,t){return e.issue===void 0?e.installed?e.version===void 0?`Installed`:`Installed, version ${e.version}`:t===null?`Not found on PATH`:`Not found at saved path`:e.issue}var E7=[`llm`,`tts`,`image`],D7={llm:`Text`,tts:`Speech`,image:`Images`},O7=`••••••••••••`,k7=`engraved px-1 pb-2 text-ink3`;function A7(){let{api:e}=B(),t=I(Tb(e));if(t.error!==null)return(0,h.jsx)(MP,{children:(0,h.jsx)(NP,{children:(0,h.jsx)(`p`,{className:`text-body text-red`,children:t.error.message})})});if(t.data===void 0)return(0,h.jsx)(M7,{});let n=t.data.providers,r=n.every(e=>e.readiness.kind!==`keyed`||!e.readiness.hasKey);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[r?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Paste a key to make its provider selectable on Play.`}):null,E7.map(e=>(0,h.jsxs)(`section`,{"data-tour":`keys-${e}`,"aria-labelledby":`keys-${e}-title`,children:[(0,h.jsx)(`h2`,{id:`keys-${e}-title`,className:k7,children:D7[e]}),(0,h.jsx)(MP,{children:n.filter(t=>t.family===e).map(e=>e.readiness.kind===`cli`?(0,h.jsx)(w7,{provider:e,readiness:e.readiness},e.id):(0,h.jsx)(j7,{provider:e,hasKey:e.readiness.hasKey},e.id))})]},e))]})}function j7({provider:e,hasKey:t}){let{api:n}=B(),r=_(),i=(0,m.useId)(),a=(0,m.useId)(),o=(0,m.useId)(),s=(0,m.useId)(),c=(0,m.useId)(),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),[v,y]=(0,m.useState)(void 0),[b,x]=(0,m.useState)(!1),S=async()=>{f(!0),y(void 0);try{await jo(n,e.id,l),u(``),g(!0),await r.invalidateQueries({queryKey:H.providers})}catch(e){y(e instanceof Error?e.message:String(e))}finally{f(!1)}},C=rt({mutationFn:()=>No(n,e.id),onSuccess:async()=>{x(!1),y(void 0),await r.invalidateQueries({queryKey:H.providers})},onError:e=>{x(!1),y(e.message)}});(0,m.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{g(!1)},OP);return()=>{clearTimeout(e)}},[p]);let w=[t?s:void 0,v===void 0?void 0:c].filter(e=>e!==void 0).join(` `);return(0,h.jsxs)(`div`,{"data-ready":t,className:C7,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{id:o,className:`font-semibold`,children:e.displayName}),e.id===`inworld`?(0,h.jsx)(DI,{label:`Inworld keys`,children:(0,h.jsx)(`p`,{children:`Paste the Base64 credentials from Inworld Settings → API Keys.`})}):null]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(jl,{state:t?`done`:`pending`}),(0,h.jsx)(`span`,{className:z(`engraved`,t?`text-done`:`text-ink3`),children:t?`Key saved`:`No key`})]}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(JP,{htmlFor:i,id:a,className:`sr-only`,children:`API key`}),(0,h.jsx)(KP,{id:i,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-labelledby":`${o} ${a}`,"aria-invalid":v!==void 0,"aria-describedby":w===``?void 0:w,placeholder:t?O7:`Paste API key`,value:l,onChange:e=>{u(e.target.value)}}),t?(0,h.jsx)(`span`,{id:s,className:`sr-only`,children:`A key is stored for this provider.`}):null,v===void 0?null:(0,h.jsx)(`p`,{id:c,className:`mt-1 text-label text-red`,children:v})]}),(0,h.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(V,{"aria-label":`Save ${e.displayName} key`,disabled:l.trim()===``||d,onClick:()=>{S()},children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:p?(0,h.jsx)(AP,{}):null}),(0,h.jsx)(V,{variant:`ghost`,"aria-label":`Remove ${e.displayName} key`,disabled:!t,onClick:()=>{x(!0)},children:`Remove`})]}),(0,h.jsx)(wP,{open:b,title:`Remove the ${e.displayName} key?`,consequence:`Projects that used this provider cannot retry until a key is saved.`,verb:`Remove`,pending:C.isPending,onConfirm:()=>{C.mutate()},onCancel:()=>{x(!1)}})]})}function M7(){return(0,h.jsx)(`div`,{className:`flex flex-col gap-6`,role:`status`,"aria-label":`Loading providers`,children:[[`llm`,4],[`tts`,5],[`image`,5]].map(([e,t])=>(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`mb-2 block h-3 w-16 rounded-control bg-panel2`}),(0,h.jsx)(MP,{children:Array.from({length:t},(t,n)=>`${e}-${n}`).map(e=>(0,h.jsxs)(NP,{className:`py-[10px]`,children:[(0,h.jsx)(`span`,{className:`h-4 w-28 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-8 flex-1 rounded-control bg-panel2`})]},e))})]},e))})}var N7=fy,P7=fee;function F7({className:e,children:t,...n}){return(0,h.jsxs)(my,{"data-slot":`select-trigger`,className:z(`flex h-8 w-full items-center justify-between gap-2 rounded-control border border-line2`,`bg-panel2 px-[10px] text-left text-small text-ink data-[placeholder]:text-ink3`,e),...n,children:[t,(0,h.jsx)(hy,{asChild:!0,children:(0,h.jsx)(ms,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-ink2`})})]})}function I7({className:e,children:t,position:n=`popper`,...r}){return(0,h.jsx)(vy,{children:(0,h.jsx)(by,{"data-slot":`select-content`,position:n,sideOffset:4,className:z(`z-50 min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-panel`,`border border-line bg-panel p-1 shadow-[0_8px_24px_var(--color-shadow)]`,e),...r,children:(0,h.jsx)(My,{children:t})})})}function L7({className:e,children:t,...n}){return(0,h.jsxs)(Iy,{"data-slot":`select-item`,className:z(`relative flex cursor-default items-center rounded-control py-[5px] pr-8 pl-[10px]`,`text-small text-ink outline-hidden select-none`,`focus:bg-panel2 data-highlighted:bg-panel2`,e),...n,children:[(0,h.jsx)(Ry,{children:t}),(0,h.jsx)(By,{className:`absolute right-[10px] flex items-center`,children:(0,h.jsx)(ps,{"aria-hidden":`true`,className:`size-[14px] text-done`})})]})}var R7=`px-4 align-top`;function z7(){let{api:e}=B(),t=_(),n=I(Eb(e)),r=I(Tb(e)),[i,a]=(0,m.useState)(void 0),o=rt({mutationFn:t=>Ho(e,t),onSettled:async()=>{a(void 0),await t.invalidateQueries({queryKey:H.voices})}}),s=(r.data?.providers??[]).filter(e=>e.family===`tts`);if(n.error!==null)return(0,h.jsx)(MP,{children:(0,h.jsx)(NP,{children:(0,h.jsx)(`p`,{className:`text-body text-red`,children:n.error.message})})});let c=n.data?.voices;return(0,h.jsxs)(MP,{"data-tour":`voices`,children:[(0,h.jsxs)(`table`,{className:`w-full table-fixed border-collapse text-small`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,h.jsx)(`th`,{className:z(R7,`engraved w-[26%] py-3 text-left text-ink3`),children:`Name`}),(0,h.jsx)(`th`,{className:z(R7,`engraved w-[26%] py-3 text-left text-ink3`),children:`Provider`}),(0,h.jsx)(`th`,{className:z(R7,`engraved py-3 text-left text-ink3`),children:`Voice ID`}),(0,h.jsx)(`th`,{className:z(R7,`w-[104px] py-3`),children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Remove`})})]})}),(0,h.jsx)(`tbody`,{children:c===void 0?(0,h.jsx)(`tr`,{className:`border-b border-line`,children:(0,h.jsx)(`td`,{colSpan:4,className:z(R7,`py-4`),children:(0,h.jsx)(`span`,{className:`block h-4 w-64 rounded-control bg-panel2`})})}):c.length===0?(0,h.jsx)(`tr`,{className:`border-b border-line`,children:(0,h.jsx)(`td`,{colSpan:4,className:z(R7,`py-4 text-ink2`),children:`Add a voice ID from your text-to-speech provider. Audio needs one to narrate.`})}):c.map(e=>(0,h.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,h.jsx)(`td`,{className:z(R7,`py-3 font-semibold`),children:e.name}),(0,h.jsx)(`td`,{className:z(R7,`py-3 text-ink2`),children:H7(s,e.provider)}),(0,h.jsx)(`td`,{className:z(R7,`py-3 text-ink2 tabular-nums`),children:e.voiceId}),(0,h.jsx)(`td`,{className:z(R7,`py-3 text-right`),children:(0,h.jsx)(V,{className:`bg-transparent`,"aria-label":`Remove ${e.name}`,onClick:()=>{a(e)},children:`Remove`})})]},e.id))}),(0,h.jsx)(`tfoot`,{children:(0,h.jsx)(B7,{tts:s})})]}),o.error===null?null:(0,h.jsx)(`p`,{className:`border-t border-line px-4 py-3 text-label text-red`,children:o.error.message}),(0,h.jsx)(wP,{open:i!==void 0,title:i===void 0?``:`Remove ${i.name}?`,consequence:`Projects that used this voice keep the audio they made with it.`,verb:`Remove`,pending:o.isPending,onConfirm:()=>{i!==void 0&&o.mutate(i.id)},onCancel:()=>{a(void 0)}})]})}function B7({tts:e}){let{api:t}=B(),n=_(),r=(0,m.useId)(),i=(0,m.useId)(),a=(0,m.useId)(),o=(0,m.useId)(),s=(0,m.useId)(),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(``),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(void 0),y=f??e[0]?.id,b=rt({mutationFn:e=>Vo(t,e),onSuccess:async e=>{if(!e.ok){v(e.refusal);return}l(``),d(``),v(void 0),await n.invalidateQueries({queryKey:H.voices})}}),x=(e,t)=>{t(),g?.field===e&&v(void 0)},S=e=>g?.field===e?g.message:void 0;return(0,h.jsxs)(`tr`,{children:[(0,h.jsxs)(`td`,{className:z(R7,`py-[14px]`),children:[(0,h.jsx)(JP,{htmlFor:r,className:`mb-[5px]`,children:`Voice name`}),(0,h.jsx)(KP,{id:r,value:c,"aria-invalid":S(`name`)!==void 0,onChange:e=>{let t=e.target.value;x(`name`,()=>{l(t)})}}),(0,h.jsx)(V7,{id:`${s}-name`,message:S(`name`)})]}),(0,h.jsxs)(`td`,{className:z(R7,`py-[14px]`),children:[(0,h.jsx)(JP,{id:a,className:`mb-[5px]`,children:`Provider`}),(0,h.jsxs)(N7,{value:y??``,onValueChange:t=>{let n=e.find(e=>e.id===t);n!==void 0&&x(`provider`,()=>{p(n.id)})},children:[(0,h.jsx)(F7,{id:i,"aria-labelledby":`${a} ${i}`,children:(0,h.jsx)(P7,{placeholder:`Pick a provider`})}),(0,h.jsx)(I7,{children:e.map(e=>(0,h.jsx)(L7,{value:e.id,children:e.displayName},e.id))})]}),(0,h.jsx)(V7,{id:`${s}-provider`,message:S(`provider`)})]}),(0,h.jsxs)(`td`,{className:z(R7,`py-[14px]`),children:[(0,h.jsx)(JP,{htmlFor:o,className:`mb-[5px]`,children:`Voice ID`}),(0,h.jsx)(KP,{id:o,className:`tabular-nums`,value:u,"aria-invalid":S(`voiceId`)!==void 0,"aria-describedby":S(`voiceId`)===void 0?void 0:`${s}-voiceId`,onChange:e=>{let t=e.target.value;x(`voiceId`,()=>{d(t)})}}),(0,h.jsx)(V7,{id:`${s}-voiceId`,message:S(`voiceId`)}),y===`inworld`?(0,h.jsx)(`p`,{className:`mt-1 text-label text-ink3`,children:`Use an Inworld voice ID, such as Dennis, or one from your workspace.`}):null,b.error===null?null:(0,h.jsx)(`p`,{className:`mt-1 text-label text-red`,children:b.error.message})]}),(0,h.jsx)(`td`,{className:z(R7,`py-[14px] text-right`),children:(0,h.jsx)(V,{className:`mt-[22px]`,disabled:y===void 0||g!==void 0||b.isPending,onClick:()=>{y!==void 0&&b.mutate({provider:y,name:c,voiceId:u})},children:`Add voice`})})]})}function V7({id:e,message:t}){return t===void 0?null:(0,h.jsx)(`p`,{id:e,className:`mt-1 text-label text-red`,children:t})}function H7(e,t){return e.find(e=>e.id===t)?.displayName??t}var U7=[`settings`,`notifications`],W7=`The test notification couldn't be shown: this browser only allows notifications from installed apps. Set a Notification URL below instead.`;function G7(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(WQ,{title:`Notifications`,info:`Slopify tells you when a run finishes, fails, or stops to wait for your review or Resume. Browser notifications work while any Slopify tab is open. A Notification URL works with no tab open: Slopify POSTs a short plain-text message (the project title and what happened, never your keys) to it. For your phone, install the ntfy app, subscribe to a topic with a long random name, and paste https://ntfy.sh/that-topic here. Any address that accepts a POST works too.`}),(0,h.jsxs)(MP,{children:[(0,h.jsx)(K7,{}),(0,h.jsx)(q7,{})]})]})}function K7(){let e=(0,m.useId)(),t=(0,m.useSyncExternalStore)(NM,jM,()=>!1),[n,r]=(0,m.useState)(AM),[i,a]=(0,m.useState)(void 0),[o,s]=(0,m.useState)(!1),c=ml(),l=t&&n===`granted`;async function u(e){if(a(void 0),!e){MM(!1);return}s(!0);try{let e=await IM();r(e);let t=FM(e);e===`granted`?(MM(!0),jM()||a(`Browser notifications couldn't be turned on because this browser blocks site storage for Slopify. Allow site data for this address in your browser's settings, then turn Browser notifications on again.`)):a(t??`Browser notifications weren't turned on because the permission prompt was dismissed. Turn Browser notifications on again and choose Allow.`)}finally{s(!1)}}return(0,h.jsxs)(`div`,{className:`grid items-center gap-[14px] border-b border-line px-4 py-[14px] sm:grid-cols-[240px_1fr]`,children:[(0,h.jsx)(`span`,{id:e,className:`font-semibold`,children:`Browser notifications`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[10px]`,children:[(0,h.jsxs)(MF,{type:`single`,value:l?`on`:`off`,"aria-labelledby":e,disabled:o,onValueChange:e=>{(e===`on`||e===`off`)&&u(e===`on`)},children:[(0,h.jsx)(NF,{value:`off`,children:`Off`}),(0,h.jsx)(NF,{value:`on`,children:`On`})]}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:!l,onClick:()=>{a(void 0);try{RM({projectId:`test`,text:UM},()=>{}),c(`Test notification sent to this browser.`,`success`)}catch{a(W7)}},children:`Send test notification`}),i===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`basis-full text-label text-red`,children:i})]})]})}function q7(){let{api:e}=B(),t=_(),n=ml(),r=(0,m.useId)(),i=(0,m.useId)(),a=I({queryKey:U7,queryFn:()=>Io(e)}),[o,s]=(0,m.useState)(void 0),c=o??a.data?.url??``,l=GM(c),u=rt({mutationFn:t=>Ro(e,t),onSuccess:e=>{t.setQueryData(U7,e),s(void 0),n(e.url===null?`Notification URL removed.`:`Notification URL saved.`,`success`)}}),d=rt({mutationFn:t=>zo(e,t),onSuccess:()=>{n(`Test notification sent. Check the app or page behind your Notification URL.`,`success`)}}),f=l??u.error?.message??d.error?.message,p=u.isPending||d.isPending||a.data===void 0;return(0,h.jsxs)(`div`,{className:`grid items-center gap-[14px] px-4 py-[14px] sm:grid-cols-[240px_1fr]`,children:[(0,h.jsx)(`label`,{htmlFor:r,className:`font-semibold`,children:`Notification URL`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[10px]`,children:[(0,h.jsx)(KP,{id:r,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://ntfy.sh/your-topic`,className:`min-w-[220px] flex-1`,value:c,disabled:a.data===void 0,"aria-invalid":l!==void 0,"aria-describedby":f===void 0?void 0:i,onChange:e=>{u.reset(),d.reset(),s(e.target.value)}}),(0,h.jsx)(V,{type:`button`,disabled:p||l!==void 0||o===void 0,onClick:()=>u.mutate(c),children:`Save`}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:p||l!==void 0||c.trim()===``,onClick:()=>d.mutate(c),children:`Send test notification`}),a.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`basis-full text-label text-red`,children:[`The saved Notification URL couldn't be read: `,a.error.message]}),f===void 0?null:(0,h.jsx)(`p`,{id:i,role:`alert`,className:`basis-full text-label text-red`,children:f})]})]})}var J7=[`backups`],Y7=1,X7=30;function Z7(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function Q7(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=Y7&&Number(t)<=X7?void 0:`Keep between ${Y7} and ${X7} backups.`}function $7(e){return{enabled:e.config.enabled,time:e.config.time,keep:String(e.config.keep),folder:e.config.folder??``}}function e9(){let{api:e}=B(),t=_(),n=ml(),r=I({queryKey:J7,queryFn:()=>go(e),refetchInterval:e=>e.state.data?.running===!0&&2e3}),[i,a]=(0,m.useState)(void 0),[o,s]=(0,m.useState)(!1),c=(0,m.useId)(),l=(0,m.useId)(),u=(0,m.useId)(),d=(0,m.useId)(),f=(0,m.useId)(),p=rt({mutationFn:t=>_o(e,t),onSuccess:e=>{t.setQueryData(J7,e),a(void 0),s(!0)}}),g=rt({mutationFn:()=>vo(e),onSuccess:e=>{t.setQueryData(J7,e),n(`Backup started. Its result shows here when it finishes.`,`success`)}});(0,m.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>s(!1),OP);return()=>clearTimeout(e)},[o]);let v=r.data,y=i??(v===void 0?void 0:$7(v)),b=y===void 0?void 0:Q7(y.keep),x=e=>{y!==void 0&&a({...y,...e})};return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(WQ,{title:`Backups`,info:`Once a day Slopify writes the same file Export everything downloads (every project with its files, your library, templates, schedules, settings and usage; never provider keys) into the backup folder, and deletes its own oldest backups beyond the number you keep. Nothing else in the folder is touched. A backup waits while projects are being made, because their files are still being written. If Slopify was off at the backup time, it backs up a couple of minutes after it starts again.`,children:(0,h.jsx)(V,{type:`button`,disabled:v===void 0||v.running||g.isPending,onClick:()=>g.mutate(),children:`Back up now`})}),(0,h.jsxs)(MP,{className:`mb-4`,children:[(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1 text-small`,children:[(0,h.jsx)(`span`,{role:`status`,className:`text-ink2`,children:v===void 0?(0,h.jsx)(`span`,{className:`inline-block h-4 w-48 rounded-control bg-panel2`}):r9(v)}),(0,h.jsx)(`span`,{className:`text-ink2`,children:v===void 0?null:i9(v)})]}),v?.status.detail?(0,h.jsx)(NP,{className:v.status.lastResult===`failed`?`text-small text-red`:`text-small text-ink2`,children:v.status.detail}):null,g.error?(0,h.jsx)(NP,{className:`text-small text-red`,children:(0,h.jsx)(`span`,{role:`alert`,children:g.error.message})}):null]}),r.error?(0,h.jsx)(MP,{children:(0,h.jsx)(NP,{className:`text-small text-red`,children:r.error.message})}):(0,h.jsxs)(MP,{children:[(0,h.jsx)(t9,{label:`Back up automatically`,labelId:c,children:(0,h.jsxs)(MF,{type:`single`,value:y?.enabled===!0?`on`:`off`,"aria-labelledby":c,disabled:y===void 0,onValueChange:e=>{(e===`on`||e===`off`)&&x({enabled:e===`on`})},children:[(0,h.jsx)(NF,{value:`off`,children:`Off`}),(0,h.jsx)(NF,{value:`on`,children:`On`})]})}),(0,h.jsxs)(t9,{label:`Time of day`,htmlFor:l,children:[(0,h.jsx)(KP,{id:l,type:`time`,className:`w-[120px] tabular-nums`,value:y?.time??`03:00`,disabled:y===void 0,onChange:e=>x({time:e.target.value})}),(0,h.jsxs)(`span`,{className:`text-small text-ink2`,children:[Z7(),` time`]})]}),(0,h.jsxs)(t9,{label:`Keep last`,htmlFor:u,children:[(0,h.jsx)(KP,{id:u,type:`number`,inputMode:`numeric`,min:Y7,max:X7,step:1,className:`w-[72px] tabular-nums`,value:y?.keep??`5`,disabled:y===void 0,"aria-invalid":b!==void 0,"aria-describedby":b===void 0?void 0:d,onChange:e=>x({keep:e.target.value})}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`backups`}),b===void 0?null:(0,h.jsx)(`p`,{id:d,className:`basis-full text-label text-red`,children:b})]}),(0,h.jsxs)(t9,{label:`Folder`,htmlFor:f,children:[(0,h.jsx)(KP,{id:f,className:`min-w-0 flex-1`,value:y?.folder??``,placeholder:v?.defaultFolder??``,disabled:y===void 0,onChange:e=>x({folder:e.target.value})}),v===void 0?null:(0,h.jsx)(`p`,{className:`basis-full text-label text-ink2`,children:a9(v)})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[10px] px-4 py-[14px]`,children:[(0,h.jsx)(V,{disabled:y===void 0||b!==void 0||p.isPending,onClick:()=>{y!==void 0&&(s(!1),p.mutate({enabled:y.enabled,time:y.time,timeZone:Z7(),keep:Number(y.keep.trim()),folder:y.folder.trim()===``?null:y.folder.trim()}))},children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:o?(0,h.jsx)(AP,{}):null}),p.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`basis-full text-label text-red`,children:p.error.message})]})]})]})}function t9({label:e,htmlFor:t,labelId:n,children:r}){return(0,h.jsxs)(`div`,{className:`grid items-center gap-[14px] border-b border-line px-4 py-[14px] sm:grid-cols-[240px_1fr]`,children:[t===void 0?(0,h.jsx)(`span`,{id:n,className:`font-semibold`,children:e}):(0,h.jsx)(`label`,{htmlFor:t,className:`font-semibold`,children:e}),(0,h.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[10px]`,children:r})]})}function n9(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function r9(e){if(e.running)return`Backing up now…`;let{status:t}=e,n=t.lastSuccessAt===null?`No backup yet.`:`Last backup ${n9(t.lastSuccessAt)}${t.lastSuccessBytes===null?``:`, ${o9(t.lastSuccessBytes)}`}.`;return t.lastResult===`failed`&&t.lastAttemptAt!==null?`${n} The backup at ${n9(t.lastAttemptAt)} failed.`:t.lastResult===`waiting`?`${n} Waiting for projects to finish.`:n}function i9(e){return e.config.enabled?e.overdue?`Next: shortly.`:e.nextRunAt===null?``:`Next: ${n9(e.nextRunAt)}.`:`Automatic backups are off.`}function a9(e){let t=`${e.files.length} backup${e.files.length===1?``:`s`} here (${o9(e.files.reduce((e,t)=>e+t.bytes,0))}).`;return e.hostFolder===null?`Inside Slopify's Docker volume, not on your computer. Leave Folder empty to save backups in your projects folder on your computer. ${t}`:`${e.config.folder===null?`Empty uses the default: `:`On your computer: `}${e.hostFolder}. ${t}`}function o9(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=t[0]??`KB`;for(let e of t)if(n/=1024,r=e,n<1024||e===t.at(-1))break;return`${n>=10?n.toFixed(0):n.toFixed(1).replace(/\.0$/,``)} ${r}`}function s9({counters:e}){return(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-2 overflow-hidden rounded-panel border border-line bg-panel md:grid-cols-5`,children:e.map(e=>(0,h.jsxs)(`div`,{className:`-ml-px flex flex-col-reverse gap-2 border-l border-line p-[18px]`,children:[(0,h.jsx)(`dt`,{className:`engraved text-ink3`,children:e.label}),(0,h.jsx)(`dd`,{className:`m-0 text-counter font-bold tabular-nums tracking-[-0.01em]`,children:e.value})]},e.label))})}function c9({cells:e}){return(0,h.jsx)(`div`,{className:`grid grid-cols-2 overflow-hidden rounded-panel border border-line bg-panel md:grid-cols-5`,children:Array.from({length:e},(e,t)=>t).map(e=>(0,h.jsxs)(`div`,{className:`-ml-px flex flex-col gap-2 border-l border-line p-[18px]`,children:[(0,h.jsx)(`span`,{className:`h-8 w-20 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-panel2`})]},e))})}function l9(){let{api:e}=B(),t=I(wb(e));return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.error===null?null:(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-[14px] text-body text-red`,children:t.error.message})}),t.data===void 0?t.error===null?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c9,{cells:5}),(0,h.jsx)(v9,{})]}):null:(0,h.jsx)(u9,{usage:t.data})]})}function u9({usage:e}){let t=Object.values(e.counters).every(e=>e===0);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s9,{counters:_9(e)}),t?(0,h.jsx)(`p`,{className:`-mt-3 text-body text-ink2`,children:`Numbers appear after your first run.`}):null,(0,h.jsxs)(`div`,{className:`overflow-hidden rounded-panel border border-line bg-panel`,children:[(0,h.jsxs)(`table`,{"aria-label":`Tokens by stage`,className:`w-full table-fixed border-collapse`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,h.jsx)(d9,{className:`w-[24%]`,children:`Tokens by stage`}),(0,h.jsx)(d9,{className:`w-[38%]`,children:`Provider · model`}),(0,h.jsx)(d9,{className:`w-[19%] text-right`,children:`Tokens in`}),(0,h.jsx)(d9,{className:`w-[19%] text-right`,children:`Tokens out`})]})}),(0,h.jsx)(`tbody`,{children:e.byStage.map(e=>(0,h.jsxs)(`tr`,{className:`border-b border-line last:border-b-0`,children:[(0,h.jsx)(f9,{className:`truncate font-semibold`,children:nN[e.stage]}),(0,h.jsx)(f9,{className:`truncate text-ink2`,children:p9(e)}),(0,h.jsx)(f9,{className:`text-right tabular-nums`,children:m9.format(e.tokensIn)}),(0,h.jsx)(f9,{className:`text-right tabular-nums`,children:m9.format(e.tokensOut)})]},`${e.stage}/${e.provider}/${e.model??``}`))})]}),e.byStage.length===0?(0,h.jsx)(`p`,{className:`px-4 py-5 text-small text-ink3`,children:`No stages have run yet.`}):null]}),(0,h.jsx)(`p`,{className:`engraved text-ink3`,children:`Machine ID ${e.machineId??`not made yet`} · Slopify ${e.appVersion}`})]})}function d9({children:e,className:t}){return(0,h.jsx)(`th`,{className:`engraved px-4 py-3 text-left text-ink3 ${t}`,children:e})}function f9({children:e,className:t}){return(0,h.jsx)(`td`,{className:`px-4 py-3 align-top text-small ${t}`,children:e})}function p9(e){return e.model===null?e.provider:`${e.provider} · ${e.model}`}var m9=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),h9=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),g9=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function _9(e){let t=e.counters;return[{label:`Videos made`,value:m9.format(t.videosMade)},{label:`Hours of audio`,value:h9.format(t.audioSeconds/3600)},{label:`Images made`,value:m9.format(t.imagesMade)},{label:`Tokens used`,value:t.tokensUsed<1e6?m9.format(t.tokensUsed):g9.format(t.tokensUsed)},{label:`Projects`,value:m9.format(t.projects)}]}function v9(){return(0,h.jsx)(MP,{children:[0,1,2,3].map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-[14px] border-b border-line px-4 py-3 last:border-b-0`,children:[(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-3 w-56 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`ml-auto h-3 w-20 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-3 w-20 rounded-control bg-panel2`})]},e))})}var y9=[`storage-usage`],b9=[y9,H.projects,[`project`],H.usage,H.documentThemes,F1,[`play-drafts`],H.settings,H.providers,H.voices,H.prompts,H.entries,H.staging,l$,Nj,[`provider-models`]];async function x9(e){await Promise.all(b9.map(t=>e.invalidateQueries({queryKey:t})))}var S9=30,C9=[{value:`system`,label:`System`},{value:`dark`,label:`Dark`},{value:`light`,label:`Light`}];function w9(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=0&&Number(t)<=S9?void 0:`The silence gap is a whole number of seconds between 0 and ${String(S9)}.`}var T9=[{id:`providers`,label:`Providers`},{id:`voices`,label:`Voices`},{id:`models`,label:`Models`},{id:`playback`,label:`Playback & appearance`},{id:`notifications`,label:`Notifications`},{id:`storage`,label:`Backup & storage`},{id:`backups`,label:`Backups`},{id:`usage`,label:`Usage`}];function E9(e){return T9.find(t=>t.id===e)?.id??`providers`}function D9({section:e=`providers`,onSection:t=()=>{}}){let{api:n}=B(),r=T9.find(t=>t.id===e)??T9[0];return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(zP,{title:`Settings`,actions:(0,h.jsx)(V,{asChild:!0,variant:`ghost`,children:(0,h.jsx)(`a`,{href:`${n.origin}/api/diagnostics`,download:`slopify-diagnostics.json`,children:`Download diagnostics`})})}),(0,h.jsxs)(`div`,{className:`grid min-w-0 gap-6 md:grid-cols-[200px_minmax(0,1fr)]`,children:[(0,h.jsx)(`nav`,{"aria-label":`Settings sections`,className:`min-w-0`,children:(0,h.jsx)(`ul`,{className:`flex gap-1 overflow-x-auto border-b border-line pb-2 [scrollbar-width:none] md:flex-col md:border-b-0 md:pb-0`,children:T9.map(n=>(0,h.jsx)(`li`,{className:`shrink-0`,children:(0,h.jsx)(`button`,{type:`button`,"aria-current":n.id===e?`page`:void 0,onClick:()=>t(n.id),className:z(`flex min-h-9 w-full items-center rounded-control px-3 text-left whitespace-nowrap`,n.id===e?`bg-panel2 font-semibold text-ink shadow-[inset_2px_0_0_var(--color-lamp-run)]`:`text-ink2 hover:bg-panel2 hover:text-ink`),children:n.label})},n.id))})}),(0,h.jsxs)(`section`,{"aria-label":r.label,className:`min-w-0`,children:[e===`providers`?(0,h.jsx)(WQ,{title:`Providers`,info:`Provider readiness is checked again before each run. Keys stay on this machine and go only to the provider they belong to.`}):null,e===`providers`?(0,h.jsx)(A7,{}):null,e===`voices`?(0,h.jsx)(WQ,{title:`Voices`,info:`A wrong voice ID is discovered when the audio stage uses it.`}):null,e===`voices`?(0,h.jsx)(z7,{}):null,e===`models`?(0,h.jsx)(S7,{}):null,e===`playback`?(0,h.jsx)(WQ,{title:`Playback & appearance`}):null,e===`playback`?(0,h.jsx)(N9,{}):null,e===`notifications`?(0,h.jsx)(G7,{}):null,e===`storage`?(0,h.jsx)(k9,{}):null,e===`backups`?(0,h.jsx)(e9,{}):null,e===`usage`?(0,h.jsx)(WQ,{title:`Usage`,info:`This machine only. The same counters, anonymised, feed slopify.stream.`}):null,e===`usage`?(0,h.jsx)(l9,{}):null]})]})]})}var O9=`The backup wasn't imported. Check it is a file made with Export everything (.tar) or Export backup (.zip), then try again.`;function k9(){let{api:e}=B(),t=_(),n=I({queryKey:y9,queryFn:()=>Co(e),staleTime:3e4}),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)({phase:`idle`}),[s,c]=(0,m.useState)({phase:`idle`}),[l,u]=(0,m.useState)(null),d=ml(),[f,p]=(0,m.useState)(null);async function g(){p(null),o({phase:`preparing`});try{let t=await ho(e);if(!t.ready){o({phase:`idle`}),p(t.detail??`The backup can't be made right now. Try again in a moment.`);return}o({phase:`downloading`,bytes:t.bytes??0,projects:t.projects??0});let n=document.createElement(`a`);n.href=`${e.origin}/api/storage/export`,n.download=``,document.body.append(n),n.click(),n.remove()}catch(e){o({phase:`idle`}),p(e instanceof Error?e.message:`The backup couldn't be prepared. Try again in a moment.`)}}async function v(n){let r=n.name.toLowerCase().endsWith(`.zip`)||n.type===`application/zip`;if(n.size===0||r&&n.size>104857600){p(r?`This file is empty or larger than 100 MB. Choose a .zip made with Export backup, or a .tar made with Export everything.`:`This file is empty. Choose the .tar made with Export everything.`);return}i(!0),p(null),u(null),c({phase:`uploading`,sent:0,total:n.size});try{let i=await e.upload(`${e.origin}/api/storage/import`,n,r?`application/zip`:`application/x-tar`,(e,t)=>{c(e>=t?{phase:`importing`}:{phase:`uploading`,sent:e,total:t})}),a=await i.json();if(!i.ok)throw Error(a.detail??O9);a.projects===void 0?d(`Imported ${a.templates??0} template(s), ${a.fonts??0} uploaded font(s), and ${a.stagedFiles??0} staged file(s).${a.fontFallbacks?` ${a.fontFallbacks} missing legacy font reference(s) now use the default font.`:``}`,`success`):(u(a),d(`Backup imported.`,`success`)),await x9(t)}catch(e){p(e instanceof Error?e.message:O9)}finally{c({phase:`idle`}),i(!1)}}async function y(){i(!0),p(null);try{let n=await e.fetch(`${e.origin}/api/storage/cleanup`,{method:`POST`}),r=await n.json();if(!n.ok)throw Error(`Clean orphan files didn't finish. Try again in a moment.`);d(`Removed ${r.orphanFiles??0} orphan project file(s) and ${r.stagedFiles??0} stale staged file(s).`,`success`),await t.invalidateQueries({queryKey:y9})}catch(e){p(e instanceof Error?e.message:`Clean orphan files didn't finish. Try again in a moment.`)}finally{i(!1)}}let b=r||a.phase===`preparing`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(WQ,{title:`Backup & storage`,info:`Export everything saves every project with its files and history, your prompts, intros and outros, document themes, templates, schedules, Play drafts, uploaded fonts, settings and usage history in one .tar file. Importing adds to this install and never replaces anything: projects already here are skipped, items whose name is taken arrive as “(imported)”, and schedules arrive paused. Projects that are being made must finish or be paused before exporting.`,children:[(0,h.jsx)(V,{type:`button`,disabled:b,onClick:()=>void g(),children:`Export everything`}),(0,h.jsxs)(`label`,{className:`inline-flex h-8 cursor-pointer items-center rounded-control border border-line2 bg-panel2 px-3 text-body hover:border-ink3`,children:[`Import a backup`,(0,h.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`.tar,application/x-tar,.zip,application/zip`,disabled:b,onChange:e=>{let t=e.target.files?.[0];t&&v(t),e.target.value=``}})]}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:b,onClick:()=>void y(),children:`Clean orphan files`})]}),(0,h.jsxs)(MP,{className:`mb-4`,children:[(0,h.jsx)(NP,{className:`text-small text-ink2`,children:`Provider keys are never included in a backup. After importing, enter them again in Settings → Providers.`}),a.phase===`preparing`?(0,h.jsx)(NP,{className:`text-small`,children:(0,h.jsx)(`span`,{role:`status`,children:`Preparing the backup…`})}):null,a.phase===`downloading`?(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1 text-small`,children:[(0,h.jsxs)(`span`,{role:`status`,children:[`Downloading `,M9(a.bytes),` (`,a.projects,` project`,a.projects===1?``:`s`,`). Your browser's downloads show its progress; keep Slopify running until it finishes.`]}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>o({phase:`idle`}),children:`Dismiss`})]}):null,s.phase===`uploading`?(0,h.jsxs)(NP,{className:`text-small`,children:[(0,h.jsxs)(`span`,{role:`status`,className:`tabular-nums`,children:[`Uploading the backup: `,M9(s.sent),` of `,M9(s.total)]}),(0,h.jsx)(PP,{current:s.sent,total:s.total})]}):null,s.phase===`importing`?(0,h.jsx)(NP,{className:`text-small`,children:(0,h.jsx)(`span`,{role:`status`,children:`Checking and importing the backup… large projects can take a minute.`})}):null]}),l?(0,h.jsx)(j9,{result:l,onDismiss:()=>u(null)}):null,(0,h.jsx)(MP,{children:n.data?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1 text-small text-ink2`,children:[(0,h.jsxs)(`span`,{className:`font-semibold text-ink`,children:[M9(n.data.data),` stored`]}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[M9(n.data.projects),` project files · `,M9(n.data.staging),` `,`staged files`]})]}),n.data.byProject.length>0?(0,h.jsx)(`ul`,{"aria-label":`Storage by project`,children:n.data.byProject.slice(0,5).map(e=>(0,h.jsxs)(`li`,{className:`flex justify-between gap-4 border-b border-line px-4 py-2 text-small text-ink2 last:border-b-0`,children:[(0,h.jsx)(`span`,{className:`truncate`,children:e.title}),(0,h.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:M9(e.bytes)})]},e.id))}):null]}):n.error?(0,h.jsx)(NP,{className:`text-small text-ink2`,children:`Storage usage is unavailable.`}):(0,h.jsx)(NP,{children:(0,h.jsx)(`span`,{className:`h-4 w-48 rounded-control bg-panel2`})})}),f?(0,h.jsx)(`p`,{role:`alert`,className:`mt-2 text-small text-red`,children:f}):null]})}function A9(e,t){let n=[t.added>0?`${t.added} added`:null,t.renamed>0?`${t.renamed} added as “(imported)” because the name was taken`:null,t.skipped>0?`${t.skipped} already here`:null].filter(e=>e!==null);return n.length===0?null:`${e}: ${n.join(`, `)}.`}function j9({result:e,onDismiss:t}){let n=[e.projects.imported.length>0?`Projects: ${e.projects.imported.length} added (${M9(e.files.bytes)} of files).`:`Projects: none added.`,A9(`Prompts`,e.prompts),A9(`Intros and outros`,e.entries),A9(`Document themes`,e.documentThemes),A9(`Templates`,e.templates),A9(`Schedules`,e.schedules),e.schedules.paused>0?`${e.schedules.paused} schedule(s) arrived paused so two installs never run them both; resume them on the Schedules screen.`:null,A9(`Voices`,e.voices),A9(`Play drafts`,e.drafts),e.settings.added+e.settings.kept>0?`Settings: ${e.settings.added} filled in${e.settings.kept>0?`, ${e.settings.kept} kept as this install has them`:``}.`:null,e.fonts>0?`Uploaded fonts: ${e.fonts} added.`:null,e.usage.alreadyImported?`Usage: this backup's history was already added before, so it wasn't counted twice.`:`Usage: ${e.usage.events} recorded event(s) added to the totals.`,`Provider keys are not in backups: enter them in Settings → Providers.`].filter(e=>e!==null);return(0,h.jsxs)(MP,{className:`mb-4`,children:[(0,h.jsxs)(NP,{className:`flex-wrap justify-between gap-y-1`,children:[(0,h.jsxs)(`span`,{className:`font-semibold`,children:[`Imported the backup from `,e.backup.createdAt.slice(0,10)]}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,onClick:t,children:`Dismiss`})]}),(0,h.jsxs)(`ul`,{"aria-label":`Import result`,className:`px-4 py-2 text-small text-ink2`,children:[n.map(e=>(0,h.jsx)(`li`,{className:`py-0.5`,children:e},e)),e.projects.skipped.map(e=>(0,h.jsxs)(`li`,{className:`py-0.5`,children:[`Skipped “`,e.title,`”: `,e.reason]},e.id))]})]})}function M9(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=t[0]??`KB`;for(let e of t)if(n/=1024,r=e,n<1024||e===t.at(-1))break;return`${n>=10?n.toFixed(0):n.toFixed(1).replace(/\.0$/,``)} ${r}`}function N9(){let{api:e}=B(),t=_(),n=I(Ab(e)),r=(0,m.useId)(),i=(0,m.useId)(),a=(0,m.useId)(),[o,s]=(0,m.useState)(void 0),[c,l]=(0,m.useState)(!1),u=rt({mutationFn:t=>Fo(e,t),onMutate:e=>{let n=t.getQueryData(H.settings);return t.setQueryData(H.settings,e),{previous:n}},onError:(e,n,r)=>{r?.previous!==void 0&&t.setQueryData(H.settings,r.previous)},onSuccess:e=>{t.setQueryData(H.settings,e)}});if((0,m.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>{l(!1)},OP);return()=>{clearTimeout(e)}},[c]),n.error!==null)return(0,h.jsx)(MP,{children:(0,h.jsx)(NP,{children:(0,h.jsx)(`p`,{className:`text-body text-red`,children:n.error.message})})});if(n.data===void 0)return(0,h.jsx)(MP,{children:(0,h.jsxs)(NP,{children:[(0,h.jsx)(`span`,{className:`h-4 w-48 rounded-control bg-panel2`}),(0,h.jsx)(`span`,{className:`h-8 w-[72px] rounded-control bg-panel2`})]})});let d=n.data,f=o??String(d.silenceGapSeconds),p=w9(f);return(0,h.jsxs)(MP,{children:[(0,h.jsxs)(`div`,{className:`grid sm:grid-cols-[240px_1fr] items-center gap-[14px] border-b border-line px-4 py-[14px]`,children:[(0,h.jsx)(`label`,{htmlFor:r,className:`font-semibold`,children:`Silence between segments`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-[10px]`,children:[(0,h.jsx)(KP,{id:r,type:`number`,inputMode:`numeric`,min:0,max:S9,step:1,className:`w-[72px] tabular-nums`,value:f,"aria-invalid":p!==void 0,"aria-describedby":p===void 0?void 0:i,onChange:e=>{s(e.target.value)}}),(0,h.jsx)(`span`,{className:`text-small text-ink2`,children:`seconds`}),(0,h.jsx)(V,{className:`ml-[6px]`,disabled:p!==void 0||u.isPending,onClick:()=>{l(!1),u.mutate({silenceGapSeconds:Number(f.trim()),appearance:d.appearance},{onSuccess:()=>{s(void 0),l(!0)}})},children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:c?(0,h.jsx)(AP,{}):null}),p===void 0?null:(0,h.jsx)(`p`,{id:i,className:`basis-full text-label text-red`,children:p}),u.error===null?null:(0,h.jsx)(`p`,{className:`basis-full text-label text-red`,children:u.error.message})]})]}),(0,h.jsxs)(`div`,{className:`grid items-center gap-[14px] px-4 py-[14px] sm:grid-cols-[240px_1fr]`,children:[(0,h.jsx)(`span`,{id:a,className:`font-semibold`,children:`Appearance`}),(0,h.jsx)(MF,{type:`single`,value:d.appearance,"aria-labelledby":a,className:`justify-self-start`,onValueChange:e=>{let t=C9.find(t=>t.value===e);t!==void 0&&u.mutate({silenceGapSeconds:d.silenceGapSeconds,appearance:t.value})},children:C9.map(e=>(0,h.jsx)(NF,{value:e.value,children:e.label},e.value))})]})]})}function P9({onApplied:e,beforeApply:t,getGeneration:n,blocked:r=!1}){let{api:i}=B(),a=_(),o=I(m$(i)),s=I({queryKey:[`play-drafts`],queryFn:async()=>{let e=await Cj(i);if(!e.ok)throw Error(e.message);return e.value.drafts}}),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(``),[f,p]=(0,m.useState)(!1),[g,v]=(0,m.useState)(null),y=ml(),[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(null),w=(0,m.useRef)(!1),T=(0,m.useRef)(null),E=(0,m.useRef)(new Map),D=(0,m.useRef)(!0);(0,m.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);async function O(e){if(!w.current){w.current=!0,p(!0),v(null);try{await e()}catch(e){v(e instanceof Error?e.message:`That didn't finish. Try again.`)}finally{w.current=!1,p(!1)}}}async function k(){let e=await Tj(i,c);if(!e.ok)throw Error(e.message);let t=JSON.stringify([c,e.value.draft.version,u.trim()]);T.current?.key!==t&&(T.current={key:t,id:crypto.randomUUID()});let n=await g$(i,{id:T.current.id,name:u.trim(),document:e.value.draft.document});if(!n.ok)throw T.current=null,Error(n.message);T.current=null,d(``),x(!1),y(`Template saved.`,`success`),await a.invalidateQueries({queryKey:l$})}async function ee(o){let s=n?.();if(r||t&&!await t())throw Error(`Save or discard the draft open in Play first, then apply the template again.`);if(!D.current||s!==void 0&&s!==n?.())return;let c=`${o.id}:${o.version}`,l=E.current.get(c);l||(l=crypto.randomUUID(),E.current.set(c,l));let u=await y$(i,o,l);if(!u.ok)throw E.current.delete(c),Error(u.message);if(!(!D.current||s!==void 0&&s!==n?.())&&(await a.invalidateQueries({queryKey:[`play-drafts`]}),!(!D.current||s!==void 0&&s!==n?.()))){if(await e(u.value.draft.id,()=>D.current)!==!1)E.current.delete(c);else throw Error(`The template's draft was created but didn't open. Press Apply to Play again to open it.`)}}async function A(){if(!S)return;let e=S.id,t=await v$(i,S);if(!t.ok)throw Error(t.message);C(null),await a.cancelQueries({queryKey:l$}),a.setQueryData(l$,t=>t?.filter(t=>t.id!==e)),y(`Template deleted.`,`success`),await a.invalidateQueries({queryKey:l$})}let j=g&&!S?{tone:`error`,text:g}:r?{tone:`warning`,text:`A run is still starting in Play. Wait for it to finish (or press Check Start result there), then apply a template.`}:o.error?{tone:`error`,text:o.error.message}:o.isPending?{tone:`info`,text:`Loading templates…`}:void 0;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EF,{action:(0,h.jsxs)(V,{type:`button`,onClick:()=>x(!0),"aria-expanded":b,children:[(0,h.jsx)(Ts,{"aria-hidden":`true`,className:`size-[14px]`}),`Save a setup`]}),children:(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`Reuse a Play setup and its checkpoint choices. Apply creates a fresh draft to review.`})}),(0,h.jsxs)(`div`,{className:`mb-2 flex min-h-8 items-center gap-3`,children:[(0,h.jsx)(EP,{tone:j?.tone??`info`,children:j?.text}),o.error?(0,h.jsx)(V,{type:`button`,onClick:()=>void o.refetch(),children:`Reload templates`}):null,(0,h.jsx)(V,{type:`button`,variant:`ghost`,disabled:f||o.isFetching,onClick:()=>void o.refetch(),children:`Refresh templates`})]}),o.data?.length===0?(0,h.jsx)(MP,{children:(0,h.jsx)(`p`,{className:`px-4 py-6 text-ink2`,children:`No templates yet. Use Save a setup to keep a Play draft for reuse.`})}):null,o.data?.length?(0,h.jsx)(`ul`,{className:`overflow-hidden rounded-panel border border-line bg-panel`,"aria-label":`Project templates`,children:o.data.map(e=>(0,h.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line px-4 py-[10px] last:border-b-0`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-3`,children:[(0,h.jsx)(`h2`,{className:`break-words font-semibold`,children:e.name}),(0,h.jsxs)(`p`,{className:`text-small text-ink3`,children:[`Version `,e.version,` · Updated`,` `,(0,h.jsx)(`time`,{dateTime:e.updatedAt,children:e.updatedAt.slice(0,10)})]})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(V,{type:`button`,"aria-label":`Apply ${e.name}`,disabled:f||r,onClick:()=>void O(()=>ee(e)),children:`Apply to Play`}),(0,h.jsx)(V,{type:`button`,variant:`ghost`,"aria-label":`Delete ${e.name}`,disabled:f,onClick:()=>{C(e),v(null)},children:`Delete`})]})]},e.id))}):null,(0,h.jsxs)(dI,{open:b,title:`Save a setup`,width:`narrow`,onClose:()=>x(!1),footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(EP,{tone:g?`error`:`info`,children:g??(f?`Saving…`:void 0)}),(0,h.jsx)(V,{type:`submit`,form:`save-template-form`,variant:`primary`,disabled:f||!c||!u.trim(),children:`Save template`})]}),children:[(0,h.jsxs)(`p`,{className:`mb-4 text-small text-ink2`,children:[`Choose a saved Play draft, or`,` `,(0,h.jsx)(oa,{to:`/play`,className:`underline`,children:`open Play`}),` `,`to prepare one.`]}),(0,h.jsxs)(`form`,{id:`save-template-form`,"aria-label":`Save a setup`,className:`space-y-4`,onSubmit:e=>{e.preventDefault(),c&&u.trim()&&O(k)},children:[(0,h.jsxs)(`label`,{className:`block space-y-1`,children:[(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:`Saved Play draft`}),(0,h.jsxs)(`select`,{className:`h-8 w-full rounded-control border border-line2 bg-panel2 px-2`,value:c,required:!0,disabled:f,onChange:e=>l(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a draft`}),s.data?.filter(e=>e.readable).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.title||`Untitled draft`},e.id))]})]}),s.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-small text-ink2`,children:`Loading saved drafts…`}):null,s.data?.length===0?(0,h.jsx)(`p`,{className:`text-small text-ink2`,children:`No saved drafts yet.`}):null,s.error?(0,h.jsxs)(`p`,{role:`alert`,className:`text-small text-red`,children:[s.error.message,` `,(0,h.jsx)(V,{type:`button`,onClick:()=>void s.refetch(),children:`Reload drafts`})]}):null,(0,h.jsxs)(`label`,{className:`block space-y-1`,htmlFor:`template-name`,children:[(0,h.jsx)(`span`,{className:`engraved text-ink3`,children:`Template name`}),(0,h.jsx)(KP,{id:`template-name`,value:u,required:!0,maxLength:120,disabled:f,onChange:e=>d(e.target.value)})]})]})]}),(0,h.jsx)(wP,{open:S!==null,title:`Delete ${S?.name??`template`}?`,consequence:g??`Existing projects and drafts keep their setup.`,verb:`Delete template`,pending:f,onConfirm:()=>void O(A),onCancel:()=>{f||C(null)}})]})}var F9=ua({component:fP}),I9=ca({getParentRoute:()=>F9,path:`/`,component:r1}),L9=ca({getParentRoute:()=>F9,path:`play`,component:fR}),R9=ca({getParentRoute:()=>F9,id:`_library`,component:TF}),z9=ca({getParentRoute:()=>F9,path:`library`,beforeLoad:()=>{throw Fn({to:`/prompts`,search:{kind:`article`}})}}),Oee=ca({getParentRoute:()=>R9,path:`templates`,component:Aee}),kee=ca({getParentRoute:()=>R9,path:`schedules`,component:b7});function Aee(){let e=yM(),t=Wi();return(0,h.jsx)(P9,{getGeneration:e.generation,blocked:e.review.starting||e.review.uncertain||e.review.created!==null,beforeApply:e.flush,onApplied:async(n,r)=>!r()||!await e.open(n,r)||!r()?!1:(await t({to:`/play`}),r())})}var B9=ca({getParentRoute:()=>F9,path:`projects/$projectId`,component:Pee}),V9=ca({getParentRoute:()=>R9,path:`prompts`,validateSearch:e=>({kind:CP(e.kind)}),component:Fee}),H9=ca({getParentRoute:()=>F9,path:`prompts/new`,validateSearch:e=>{let t=CP(e.kind);return typeof e.from==`string`?{kind:t,from:e.from}:{kind:t}},component:Iee}),U9=ca({getParentRoute:()=>F9,path:`prompts/$promptId`,component:Lee}),W9=ca({getParentRoute:()=>R9,path:`entries`,validateSearch:e=>({category:bP(e.category)}),component:Ree}),G9=ca({getParentRoute:()=>F9,path:`entries/new`,validateSearch:e=>{let t=bP(e.category);return typeof e.from==`string`?{category:t,from:e.from}:{category:t}},component:zee}),K9=ca({getParentRoute:()=>F9,path:`entries/$entryId`,component:Bee}),jee=ca({getParentRoute:()=>R9,path:`document-themes`,component:kF}),q9=ca({getParentRoute:()=>F9,path:`document-themes/new`,validateSearch:e=>typeof e.from==`string`?{from:e.from}:{},component:Vee}),J9=ca({getParentRoute:()=>F9,path:`document-themes/$themeId`,component:Hee}),Y9=ca({getParentRoute:()=>F9,path:`settings`,validateSearch:e=>e.section===void 0?{}:{section:E9(e.section)},component:Nee}),Mee=ca({getParentRoute:()=>F9,path:`usage`,beforeLoad:()=>{throw Fn({to:`/settings`,search:{section:`usage`}})}});function Nee(){let{section:e}=Y9.useSearch(),t=Wi();return(0,h.jsx)(D9,{section:e??`providers`,onSection:e=>{t({to:`/settings`,search:{section:e},replace:!0})}})}function Pee(){let{projectId:e}=B9.useParams();return(0,h.jsx)(X$,{projectId:e},e)}function Fee(){let{kind:e}=V9.useSearch(),t=Wi();return(0,h.jsx)(h1,{kind:e,onKind:e=>{t({to:`/prompts`,search:{kind:e},replace:!0})}})}function Iee(){let{kind:e,from:t}=H9.useSearch(),n=X9();return(0,h.jsx)(l1,{promptId:void 0,kind:e,from:t,onLeave:n},`${e}:${t??`new`}`)}function Lee(){let{promptId:e}=U9.useParams(),t=X9();return(0,h.jsx)(l1,{promptId:e,kind:`article`,from:void 0,onLeave:t},e)}function X9(){let e=Wi();return t=>{e({to:`/prompts`,search:{kind:t}})}}function Ree(){let{category:e}=W9.useSearch(),t=Wi();return(0,h.jsx)(IF,{category:e,onCategory:e=>{t({to:`/entries`,search:{category:e},replace:!0})}})}function zee(){let{category:e,from:t}=G9.useSearch(),n=Q9();return(0,h.jsx)(lI,{entryId:void 0,category:e,from:t,onLeave:n})}function Bee(){let{entryId:e}=K9.useParams(),t=Q9();return(0,h.jsx)(lI,{entryId:e,category:`intro`,from:void 0,onLeave:t})}function Vee(){let{from:e}=q9.useSearch(),t=Z9();return(0,h.jsx)(uF,{themeId:void 0,from:e,onLeave:t})}function Hee(){let{themeId:e}=J9.useParams(),t=Z9();return(0,h.jsx)(uF,{themeId:e,from:void 0,onLeave:t})}function Z9(){let e=Wi();return()=>{e({to:`/document-themes`})}}function Q9(){let e=Wi();return t=>{e({to:`/entries`,search:{category:t}})}}var Uee=F9.addChildren({projectsRoute:I9,playRoute:L9,libraryRoute:R9.addChildren({promptsRoute:V9,entriesRoute:W9,templatesRoute:Oee,documentThemesRoute:jee,schedulesRoute:kee}),libraryIndexRoute:z9,projectRoute:B9,newPromptRoute:H9,promptRoute:U9,newEntryRoute:G9,entryRoute:K9,newDocumentThemeRoute:q9,documentThemeRoute:J9,settingsRoute:Y9,usageRoute:Mee});function Wee(){return Da({routeTree:Uee})}function Gee(){let e,t,n=new Set;return{observe:r=>{if(e===void 0){e=r;return}if(r!==e&&r!==t){t=r;for(let e of n)e()}},staleAt:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function Kee(e,t){return async(n,r)=>{let i=await e(n,r),a=i.headers.get(`X-Slopify-Version`);return a!==null&&t.observe(a),i}}function qee(e){let t=Gee(),n={api:fo(window.location.origin,Kee(window.fetch.bind(window),t),mo(e=>{let n=e.headers.get(`X-Slopify-Version`);n!==null&&t.observe(n)})),openEvents:e=>new EventSource(e),version:t};(0,Qa.createRoot)(e).render((0,h.jsx)(m.StrictMode,{children:(0,h.jsx)(v,{client:new Ue,children:(0,h.jsx)(_l,{deps:n,children:(0,h.jsx)(Aa,{router:Wee()})})})}))}var $9=document.getElementById(`root`);if($9===null)throw Error(`index.html carries no #root element for the app to mount on`);qee($9);export{UP as t};
|