papilot 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +52 -121
  2. package/README.zh-CN.md +51 -120
  3. package/bin/doctor.mjs +7 -5
  4. package/dist/assets/{_virtual_papilot-licenses-D7ro6ecN.js → _virtual_papilot-licenses-CMfCtEYQ.js} +1 -1
  5. package/dist/assets/index-BlLyIqT9.js +265 -0
  6. package/dist/assets/index-DVZtyZvu.css +1 -0
  7. package/dist/assets/{math-V9uUaUzA.js → math-Bu3xEyrC.js} +1 -1
  8. package/dist/assets/{pdf-view-Bnb2uIBE.js → pdf-view-PbkCuTZ-.js} +1 -1
  9. package/dist/index.html +2 -2
  10. package/examples/papilot-paper/preview/main.pdf +0 -0
  11. package/examples/papilot-paper/preview/main.synctex.gz +0 -0
  12. package/package.json +9 -3
  13. package/src/server/acp.ts +35 -2
  14. package/src/server/agents.ts +1 -1
  15. package/src/server/app.ts +3 -3
  16. package/src/server/desktop-demo.ts +38 -0
  17. package/src/server/manuscript.ts +18 -0
  18. package/src/server/reconcile.ts +20 -0
  19. package/src/server/review.ts +3 -2
  20. package/src/server/start.ts +19 -4
  21. package/src/server/updates.ts +7 -1
  22. package/src/server/workspace.ts +54 -13
  23. package/src/shared.ts +17 -9
  24. package/vendor/latex-review/dist/web/assets/{index-7VKAte5x.js → index-CXdnUjct.js} +2 -2
  25. package/vendor/latex-review/dist/web/index.html +1 -1
  26. package/vendor/latex-review/src/core/current-commit.ts +104 -0
  27. package/vendor/latex-review/src/core/delivery.ts +62 -16
  28. package/vendor/latex-review/src/core/git.ts +2 -1
  29. package/vendor/latex-review/src/core/publish.ts +7 -1
  30. package/vendor/latex-review/src/core/reconcile.ts +101 -0
  31. package/vendor/latex-review/src/core/review.ts +5 -2
  32. package/vendor/latex-review/src/core/store.ts +1 -0
  33. package/vendor/latex-review/src/core/tasks.ts +1 -1
  34. package/vendor/latex-review/src/server.ts +12 -1
  35. package/vendor/latex-review/src/types.ts +5 -2
  36. package/vendor/latex-review/src/web/review.tsx +7 -5
  37. package/vendor/latex-review/src/web/zh-CN.ts +4 -2
  38. package/dist/assets/index-Cc-awdNn.css +0 -1
  39. package/dist/assets/index-D_VX51no.js +0 -265
@@ -1,265 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/math-V9uUaUzA.js","assets/math-DEcVZfaU.css"])))=>i.map(i=>d[i]);
2
- 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,t.exports),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=[`yellow`,`green`,`purple`,`orange`,`red`],d=e=>e===`blue`?`yellow`:e,f=e=>e===`blue`||u.includes(e);function p(e){if(e===void 0)return{};if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Use valid instructions for each color group.`);let t={};for(let[n,r]of Object.entries(e)){if(!f(n)||typeof r!=`string`||r.length>4e3)throw Error(`Use valid instructions for each color group (up to 4000 characters).`);let e=d(n);if(t[e]&&t[e]!==r.trim())throw Error(`Use one instruction for each color group.`);r.trim()&&(t[e]=r.trim())}return t}var m=(e,t)=>u.filter(n=>!t[n]?.trim()&&e.some(e=>e.group&&d(e.group)===n&&!e.comment.trim())),h={yellow:`#eab308`,blue:`#eab308`,green:`#16a34a`,purple:`#a855f7`,orange:`#ea860c`,red:`#e05260`},g={yellow:`Yellow`,blue:`Yellow`,green:`Green`,purple:`Purple`,orange:`Orange`,red:`Red`};function _(e){return u.flatMap(t=>{let n=e.flatMap((e,n)=>e.group&&d(e.group)===t?[{note:e,index:n}]:[]);return n.length?[{group:t,entries:n}]:[]})}var v=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.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(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,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(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 F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function I(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ee=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function L(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ee)}catch(e){ee(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function te(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else L(te.bind(null,e))}var ne={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ne,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=te,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.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 D(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)E.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 D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:I}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=L,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),y=o(((e,t)=>{t.exports=v()})),b=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})),x=o(((e,t)=>{t.exports=b()})),S=y(),C=x(),w={info:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,C.jsx)(`path`,{d:`M12 11v6m0-10h.01`})]}),code:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`m8 7-5 5 5 5m8-10 5 5-5 5M14 4l-4 16`})}),github:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`M9 19c-4.3 1.3-4.3-2.1-6-2.5m12 5v-3.9a3.4 3.4 0 0 0-.9-2.7c3-.3 6.2-1.5 6.2-6.8a5.3 5.3 0 0 0-1.4-3.7 4.9 4.9 0 0 0-.1-3.6s-1.1-.3-3.8 1.4a13.2 13.2 0 0 0-7 0C5.3.5 4.2.8 4.2.8A4.9 4.9 0 0 0 4.1 4.4a5.3 5.3 0 0 0-1.4 3.7c0 5.3 3.2 6.5 6.2 6.8a3.4 3.4 0 0 0-.9 2.7v3.9`})}),keyboard:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`}),(0,C.jsx)(`path`,{d:`M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 12h.01M10 12h.01M14 12h.01M18 12h.01M7 16h10`})]}),sun:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,C.jsx)(`path`,{d:`M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5`})]}),moon:(0,C.jsx)(`path`,{d:`M20.9 13A9 9 0 0 1 11 3.1 9 9 0 1 0 20.9 13Z`}),plus:(0,C.jsx)(`path`,{d:`M12 5v14M5 12h14`}),attachment:(0,C.jsx)(`path`,{d:`m21 11-8 8a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.8-2.8l8-8`}),archive:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`4`,rx:`1`}),(0,C.jsx)(`path`,{d:`M5 7v13h14V7M10 11h4`})]}),restore:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`M3 10a9 9 0 1 1 2 9M3 4v6h6M12 7v5l3 2`})}),bolt:(0,C.jsx)(`path`,{d:`m13 2-9 12h7l-1 8 10-12h-7Z`}),compose:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,C.jsx)(`path`,{d:`M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z`})]}),sidebar:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2.5`}),(0,C.jsx)(`path`,{d:`M9 3v18`})]}),panelCollapse:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2.5`}),(0,C.jsx)(`path`,{d:`M15 3v18m-8-12 3 3-3 3`})]}),panelExpand:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2.5`}),(0,C.jsx)(`path`,{d:`M15 3v18m-5-12-3 3 3 3`})]}),menu:(0,C.jsx)(`path`,{d:`M4 7h16M4 12h16M4 17h16`}),arrowUp:(0,C.jsx)(`path`,{d:`M12 19V5m-7 7 7-7 7 7`}),arrowDown:(0,C.jsx)(`path`,{d:`M12 5v14m7-7-7 7-7-7`}),arrowRight:(0,C.jsx)(`path`,{d:`M5 12h14m-6-6 6 6-6 6`}),arrowRightSolid:(0,C.jsx)(`path`,{d:`M13 5.5a.75.75 0 0 1 1.28-.53l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5A.75.75 0 0 1 13 18.5V14H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h9Z`,fill:`currentColor`,stroke:`none`}),stop:(0,C.jsx)(`rect`,{x:`7`,y:`7`,width:`10`,height:`10`,rx:`2`,fill:`currentColor`,stroke:`none`}),updown:(0,C.jsx)(`path`,{d:`m7 15 5 5 5-5M7 9l5-5 5 5`}),check:(0,C.jsx)(`path`,{d:`M20 6 9 17l-5-5`}),close:(0,C.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`}),more:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.4`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.4`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.4`,fill:`currentColor`,stroke:`none`})]}),external:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M15 3h6v6M10 14 21 3`}),(0,C.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})]}),paper:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}),(0,C.jsx)(`path`,{d:`M14 2v5h5M16 13H8M16 17H8M10 9H8`})]}),compile:(0,C.jsx)(`path`,{d:`M6 3.5 21 12 6 20.5Z`,fill:`currentColor`,stroke:`none`}),pdf:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M4 9V4a2 2 0 0 1 2-2h9l5 5v2M14 2v5h6M4 20a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`}),(0,C.jsx)(`path`,{strokeWidth:`1.5`,d:`M2.5 18v-6h2a2 2 0 0 1 0 4h-2M9.5 12v6h1.5a3 3 0 0 0 0-6ZM17 18v-6h4m-4 3h3`})]}),chat:(0,C.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z`}),split:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2.5`}),(0,C.jsx)(`path`,{d:`M14 3v18`})]}),terminal:(0,C.jsx)(`path`,{d:`m4 17 6-6-6-6m8 14h8`}),diff:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}),(0,C.jsx)(`path`,{d:`M9 10h6m-3-3v6m-3 4h6`})]}),tool:(0,C.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9Z`}),log:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z`}),(0,C.jsx)(`path`,{d:`M14 3v5h5M9 13h6m-6 4h4`})]}),alert:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,C.jsx)(`path`,{d:`M12 8v4m0 4h.01`})]}),refresh:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7L21 8`}),(0,C.jsx)(`path`,{d:`M21 3v5h-5`})]}),trash:(0,C.jsx)(`path`,{d:`M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2m3 0-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6m5 5v6m4-6v6`}),pause:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`6`,y:`5`,width:`4`,height:`14`,rx:`1`}),(0,C.jsx)(`rect`,{x:`14`,y:`5`,width:`4`,height:`14`,rx:`1`})]}),search:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,C.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),region:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M5 3a2 2 0 0 0-2 2m16-2a2 2 0 0 1 2 2M5 21a2 2 0 0 1-2-2M9 3h1m4 0h1M9 21h2M3 9v1m18-1v2M3 14v1`}),(0,C.jsx)(`path`,{d:`M12.5 12.5 21 15.8l-3.6 1.3-1.3 3.6Z`})]}),list:(0,C.jsx)(`path`,{d:`M8 6h13M8 12h13M8 18h13M3.5 6h.01M3.5 12h.01M3.5 18h.01`}),chevronDown:(0,C.jsx)(`path`,{d:`m6 9 6 6 6-6`}),chevronUp:(0,C.jsx)(`path`,{d:`m18 15-6-6-6 6`}),chevronLeft:(0,C.jsx)(`path`,{d:`m15 18-6-6 6-6`}),chevronRight:(0,C.jsx)(`path`,{d:`m9 18 6-6-6-6`}),minus:(0,C.jsx)(`path`,{d:`M5 12h14`}),branch:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M6 3v12`}),(0,C.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,C.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,C.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),commit:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,C.jsx)(`path`,{d:`M3 12h6m6 0h6`})]}),notes:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z`}),(0,C.jsx)(`path`,{d:`M8 8h8M8 12h5`})]}),pencil:(0,C.jsx)(`path`,{d:`M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`}),pen:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M16.8 3.8a2.4 2.4 0 0 1 3.4 3.4L7 20.4 3 21l.6-4Z`}),(0,C.jsx)(`path`,{d:`m15.2 5.4 3.4 3.4M3.6 17 7 20.4`})]}),copy:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`9`,y:`9`,width:`12`,height:`12`,rx:`2`}),(0,C.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),bookmark:(0,C.jsx)(`path`,{d:`M19 21l-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z`}),bookmarkFilled:(0,C.jsx)(`path`,{d:`M19 21l-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z`,fill:`currentColor`}),plane:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`m22 2-7 20-4-9-9-4Z`}),(0,C.jsx)(`path`,{d:`M22 2 11 13`})]}),spark:(0,C.jsx)(`path`,{d:`M12 3c.4 3.9 2.1 5.6 6 6-3.9.4-5.6 2.1-6 6-.4-3.9-2.1-5.6-6-6 3.9-.4 5.6-2.1 6-6ZM19 15c.2 1.5.8 2.1 2.3 2.3-1.5.2-2.1.8-2.3 2.3-.2-1.5-.8-2.1-2.3-2.3 1.5-.2 2.1-.8 2.3-2.3Z`}),spellcheck:(0,C.jsx)(`path`,{d:`m3 14 4-10 4 10M4.5 10h5m3.5 7 3 3 6-7`}),compress:(0,C.jsx)(`path`,{d:`M4 5h16M4 19h16M2 12h7m-3-3 3 3-3 3m16-3h-7m3-3-3 3 3 3`}),sigma:(0,C.jsx)(`path`,{d:`M19 5V3H5l7 9-7 9h14v-2`}),checklist:(0,C.jsx)(`path`,{d:`M10 6h11M10 12h11M10 18h11M2 5l2 2 3-3M2 11l2 2 3-3M2 17l2 2 3-3`}),book:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`M12 5v16M3 3h4a5 5 0 0 1 5 2 5 5 0 0 1 5-2h4v16h-4a5 5 0 0 0-5 2 5 5 0 0 0-5-2H3Z`})}),chart:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`M3 3v18h18M7 16v-5m5 5V7m5 9V4`})}),globe:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,C.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,C.jsx)(`path`,{d:`M3 12h18`})]}),lightbulb:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`M9 18v-1a7 7 0 1 1 6 0v1M9 18h6m-6 3h6`})}),link:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`path`,{d:`m10 13 4-4M8 16l-1 1a4.2 4.2 0 0 1-6-6l4-4a4.2 4.2 0 0 1 6 0m2 10a4.2 4.2 0 0 0 6 0l4-4a4.2 4.2 0 0 0-6-6l-1 1`,transform:`translate(1 0) scale(.92)`})}),monitor:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`}),(0,C.jsx)(`path`,{d:`M8 21h8m-4-4v4`})]}),bell:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,C.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),key:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`7.5`,cy:`15.5`,r:`4.5`}),(0,C.jsx)(`path`,{d:`m10.7 12.3 9.8-9.8M17 6l3 3M14.5 8.5l2 2`})]}),people:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,C.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,C.jsx)(`path`,{d:`M16 4.6a3.5 3.5 0 0 1 0 6.8M18.5 14.2A6.5 6.5 0 0 1 21.5 20`})]}),signOut:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}),(0,C.jsx)(`path`,{d:`m16 17 5-5-5-5M21 12H9`})]}),settings:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})};function T({name:e,size:t=18}){return(0,C.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:w[e]||w.paper})}var E=new Map,D={getItem(e){if(E.has(e))return E.get(e);try{return localStorage.getItem(e)}catch{return null}},setItem(e,t){E.set(e,t);try{localStorage.setItem(e,t),E.delete(e)}catch{}},removeItem(e){E.set(e,``);try{localStorage.removeItem(e),E.delete(e)}catch{}}},O={"Review copy":`审阅副本`,"Suggestions stay in this task until you copy them to the manuscript":`建议保留在当前任务中,只有选中复制后才会出现在主论文上`,"Keep on manuscript":`保留到主论文`,"Kept on manuscript":`已保留到主论文`,"Ask for another review of this PDF version…":`对这个 PDF 版本补充审阅要求…`,"AI review":`AI 审阅`,"Read the paper and leave PDF comments without editing the manuscript":`只读论文并留下 PDF 批注,不修改原稿`,"AI suggestion":`AI 审阅建议`,"AI suggestion {n}":`AI 审阅建议 {n}`,"Close suggestion":`关闭建议`,"Previous suggestion":`上一条建议`,"Next suggestion":`下一条建议`,"Previous suggestion (←)":`上一条建议 (←)`,"Next suggestion (→)":`下一条建议 (→)`,"Unplaced suggestions":`位置待确认的建议`,"Remove suggestion {n} from task":`从任务中移除建议 {n}`,"PDF note {n}":`PDF 批注 {n}`,"Close note":`关闭批注`,"Note deleted.":`已删除批注。`,"Highlighted in {group}":`{group}高亮`,"Notes in this task":`已加入任务的批注`,"Remove note {n} from task":`从任务中移除批注 {n}`,"PDF note library":`PDF 批注列表`,"Close notes":`关闭批注列表`,"My notes":`我的批注`,"AI suggestions":`AI 审阅建议`,"Write a note…":`写下你的想法…`,"Quote in chat":`引用到对话`,"Remove from draft":`从草稿移除`,"Added to task: {n}":`已加入任务:{n} 条`,"Add all to task":`全部加入任务`,"Notes stay here unless you add them to a task.":`批注默认仅保存,加入任务后才会发给 agent。`,"Include suggestion {n} in this task":`将建议 {n} 加入任务`,"Show suggestion {n} on the page":`在页面上显示建议 {n}`,"Ignore suggestion {n}":`忽略建议 {n}`,Ignore:`忽略`,"Suggestion ignored.":`已忽略建议。`,"Suggestion {n}: {comment}":`建议 {n}:{comment}`,"View {n} review suggestion":`查看 {n} 条审阅建议`,"View {n} review suggestions":`查看 {n} 条审阅建议`,"Cursor SDK credentials were not detected.":`未检测到 Cursor SDK 凭据。`,"No GLM API key was found.":`未找到 GLM API key。`,"Claude Code or API credentials were not detected.":`未检测到 Claude Code 或 API 凭据。`,"{command} was not found by Papilot.":`Papilot 未找到 {command}。`,"Sign in on the Papilot host to continue.":`请先在运行 Papilot 的主机上登录。`,"The agent could not connect. Check its setup and try again.":`连接失败,请检查配置后重试。`,"Usage not reported":`未提供额度信息`,"Connect to view account, models, and usage.":`连接后可查看账号、模型和额度。`,"Sign in as the user running Papilot, then restart Papilot.":`请使用运行 Papilot 的用户登录,然后重启 Papilot。`,"Support more":`支持更多`,"Suggest an agent":`推荐一个智能体`,"Contribute an integration":`贡献适配`,Updates:`版本更新`,"Current version":`当前版本`,"Latest version":`最新版本`,"Update channel":`更新通道`,"Update available":`有可用更新`,"Up to date":`已是最新版本`,"Update now":`立即更新`,Stable:`稳定版`,"Dev (GitHub main)":`Dev(GitHub main)`,"Early updates from GitHub main. May be less stable.":`提前体验 GitHub main 的最新改动,稳定性可能较低。`,"Published releases, recommended for everyday use.":`正式发布的稳定版本,推荐日常使用。`,"Could not check for updates":`暂时无法检查更新`,"Check your connection and try again.":`请检查网络连接后重试。`,"Ready to check for updates":`随时获取最新版本`,"Reading update status…":`正在读取更新状态…`,"Check for updates":`检查更新`,"Checking for updates…":`正在检查更新…`,"Downloading and building the selected GitHub commit…":`正在下载并构建选定的 GitHub 提交…`,"You are using the latest version on this channel.":`你已在使用此通道的最新版本。`,"Check for updates to see the latest version.":`检查更新以查看最新版本。`,"Could not check for updates. Try again when connected.":`无法检查更新,请连接网络后重试。`,"The dev build needs at least 2 GB of free disk space. Free some space and retry.":`构建 Dev 版本至少需要 2 GB 可用磁盘空间,请释放空间后重试。`,"Save accepted changes":`保存已接受的改动`,"Back to summary":`返回提交区`,"Commit to task branch":`提交到 task 分支`,"Built-in":`内置`,Global:`全局`,"Search skills":`搜索技能`,"Refresh skills":`刷新技能`,"Skill scope":`技能范围`,"All skills":`全部技能`,"New skill":`新建技能`,Overridden:`已被覆盖`,All:`全部`,"Loading skills…":`正在加载技能…`,"Copy and edit":`复制并编辑`,"Skill ID":`技能 ID`,"Save to":`保存到`,"Choose an icon":`选择图标`,"Skill icon":`技能图标`,"Skill name":`技能名称`,Description:`简介`,Instructions:`指令`,Source:`源码`,Comments:`批注`,Branch:`分支`,Search:`搜索`,"Give your skill a name":`给技能起个名字`,"What does this skill help with?":`这个技能可以帮你做什么?`,"Describe what the agent should do, what to preserve, and how to present the result.":`说明智能体要做什么、需要保留哪些内容,以及如何呈现结果。`,Sparkles:`星光`,Pen:`笔`,Spelling:`拼写`,Math:`公式`,Checklist:`清单`,Book:`书籍`,Code:`代码`,Chart:`图表`,Globe:`地球`,Idea:`灵感`,Link:`链接`,"Use lowercase letters, numbers and hyphens. This is also the / command name.":`使用小写字母、数字和连字符,也作为 / 指令的名称。`,"Copy this built-in skill to customize it for all papers or this paper.":`复制这个内置技能,即可为所有论文或当前论文自定义。`,"Skill content (Markdown)":`技能内容(Markdown)`,"Skill content view":`技能内容视图`,Edit:`编辑`,Preview:`预览`,"A skill with the same ID takes priority here: this paper, then global, then built-in.":`此处有同 ID 的技能优先生效:当前论文优先于全局,全局优先于内置。`,"Delete skill":`删除技能`,Saved:`已保存`,"Unsaved changes":`尚未保存`,"Select a skill or create your own.":`选择一个技能,或创建自己的技能。`,"Reusable instructions for your revisions. Choose a skill from the / menu when starting a task.":`将常用的修改要求保存为技能,开始任务时从 / 菜单中选择。`,"Discard unsaved skill changes?":`放弃尚未保存的技能修改?`,"Delete this skill? Only its Markdown file is removed; supporting files stay in place.":`删除这个技能?只删除其 Markdown 文件,附属文件会保留。`,"Keep editing":`继续编辑`,"Discard changes":`放弃修改`,"This skill changed on disk. Reload it before saving.":`这个技能已在磁盘上被修改,请先复制保留当前编辑,再刷新后保存。`,"This skill changed on disk. Reload it before deleting.":`这个技能已在磁盘上被修改,请刷新后再删除。`,"A skill with this ID already exists in this location.":`此范围内已有相同 ID 的技能,请使用另一个 ID。`,"This skill no longer exists. Refresh the list.":`这个技能已不存在,请刷新列表。`,"This skill was removed on disk. Reload the list before saving.":`这个技能已从磁盘上删除,请先刷新列表。`,"The skill must contain instructions.":`请填写技能的指令正文。`,"Skill content must contain 1–20,000 characters.":`技能内容需为 1 至 20,000 个字符。`,"Apply to working directory":`应用到工作目录`,"Applying…":`正在应用…`,"Applied to working directory":`已应用到工作目录`,"Committed {hash} to {branch}":`已提交 {hash} 到 {branch}`,Attachments:`附件`,"Choose attachments":`选择附件`,"Add files or skills":`添加文件或技能`,"Add files…":`添加文件…`,"Drop files to attach":`松开以添加附件`,"Uploading…":`正在上传…`,"Upload failed. Please retry.":`上传失败,请重试。`,"Retry uploading {name}":`重新上传 {name}`,"Remove attachment {name}":`移除附件 {name}`,"Open attachment {name}":`打开附件 {name}`,"Attach up to 10 files per message.":`每条消息最多添加 10 个附件。`,"The file “{name}” is empty.":`文件“{name}”为空。`,"Files must be 25 MB or smaller.":`单个文件不能超过 25 MB。`,"Images must be 5 MB or smaller.":`单张图片不能超过 5 MB。`,"Attachments must total 100 MB or less.":`附件总大小不能超过 100 MB。`,"Antigravity opens images through its file tools. For direct image input, choose Codex or Claude.":`Antigravity 通过文件工具读取图片。需要直接传入图片时,请选择 Codex 或 Claude。`,"LaTeX engine":`LaTeX 编译引擎`,"Could not read the selected file.":`无法读取所选文件。`,"Choose up to 5,000 files, totaling less than 64 MB.":`最多选择 5,000 个文件,总大小需小于 64 MB。`,"Drop one LaTeX ZIP file.":`请拖入一个 LaTeX ZIP 文件。`,"Install TeX Live or MacTeX with latexmk on the computer running Papilot, then retry.":`请在运行 Papilot 的电脑上安装包含 latexmk 的 TeX Live 或 MacTeX,然后重试。`,"This paper may need XeLaTeX. Change the engine below and retry.":`这篇论文可能需要 XeLaTeX。请修改下方编译引擎后重试。`,"A package, font or source file may be missing. Check the details below, restore the missing file or ask for help.":`可能缺少宏包、字体或源文件。请查看下方详情,补齐文件或请求协助。`,"Check the main file and engine, or ask the assistant to fix compilation. You can also edit the saved files and retry.":`请检查主文件和编译引擎,或请助手协助修复。也可以修改已保存的文件后重试。`,"Bring your LaTeX files. Papilot prepares version history and checks compilation.":`导入 LaTeX 文件,Papilot 会准备版本历史并尝试编译。`,"Drop a LaTeX ZIP here":`将 LaTeX ZIP 拖到这里`,"Up to 64 MB · Folders and ZIPs are copied into Papilot":`最大 64 MB · 文件夹和 ZIP 会复制到 Papilot 中`,"Choose folder":`选择文件夹`,"Choose ZIP":`选择 ZIP`,"Use a folder on this computer":`使用本机文件夹`,"Use the original files on the computer running Papilot.":`直接使用运行 Papilot 的电脑上的原始文件。`,"Folder path":`文件夹路径`,"Read folder":`读取文件夹`,"Reading paper files…":`正在读取论文文件…`,"Import progress":`导入进度`,"Files received":`已接收文件`,"Version history":`版本历史`,"PDF compilation":`编译 PDF`,"Saved folder":`保存位置`,"Main TeX file":`TeX 主文件`,"Choose a main file":`请选择主文件`,"No TeX files found. Choose a folder or ZIP containing the LaTeX source.":`未找到 TeX 文件。请选择包含 LaTeX 源文件的文件夹或 ZIP。`,"Several TeX files were found. Check the selected main document before continuing.":`找到多个 TeX 文件,请确认主文件后继续。`,"The assistant is fixing compilation…":`助手正在修复编译问题…`,"Preparing version history and compiling the PDF…":`正在准备版本历史并编译 PDF…`,"Your paper compiled successfully. It is ready for editing.":`论文已成功编译,可以开始修改。`,"The paper needs a little help":`论文需要一些修复`,"Compilation details":`编译详情`,"Repair summary":`修复说明`,"Repairs are saved as uncommitted changes. Review them in the paper’s file changes.":`修复会保留为未提交的修改,可在论文的文件变更中查看。`,"Help fix compilation":`协助修复编译`,"Prepare and compile":`准备并编译`,"Retry compilation":`重新编译`,"Open paper":`打开论文`,"Add and fix later":`先添加,稍后修复`,"Connect an assistant in Settings to help repair this paper.":`请在设置中连接助手,以协助修复这篇论文。`,"Choose different files":`重新选择文件`,"Continue later":`稍后继续`,"Edit {name}":`编辑 {name}`,"Edit paper":`编辑论文`,"Remove paper":`移除论文`,"Remove paper?":`移除论文?`,"Remove from Papilot":`从 Papilot 移除`,"Paper name":`论文名称`,"Removing…":`正在移除…`,"Remove this paper and its tasks, conversations and notes from Papilot?":`从 Papilot 移除这篇论文及其任务、对话和批注记录?`,"Files on disk, Git history and task worktrees will stay in place.":`硬盘上的文件、Git 历史和任务工作树都会保留。`,"Updating…":`正在更新…`,"Update ready":`更新已就绪`,"Restarting…":`正在重启…`,"Update failed":`更新失败`,"New version":`有新版本`,"Papilot {version}":`Papilot {version}`,"Update Papilot":`更新 Papilot`,Later:`稍后`,"Retry update":`重试更新`,"Update to {version}":`更新到 {version}`,"Could not start the update. Please retry.":`未能启动更新,请重试。`,"Downloading and checking the new version…":`正在下载并检查新版本…`,"The update is ready. Waiting for tasks and PDF builds to finish before restarting.":`更新已就绪,将在任务和 PDF 编译完成后重启。`,"Restarting Papilot. This page will reconnect automatically; your drafts are kept.":`正在重启 Papilot,页面将自动重连,草稿会保留。`,"The update did not finish. Your current version is still available. You can retry here.":`更新未完成,当前版本仍然可用。你可以在这里重试。`,"Install the new version and restart automatically when tasks are idle. Your papers, tasks and settings stay in place.":`安装新版本,并在任务空闲时自动重启。论文、任务和设置都会保留。`,"Papilot cannot find npm on this computer. Updates are unavailable until npm is installed.":`Papilot 未能在这台电脑上找到 npm,安装 npm 后即可更新。`,"Generate task title":`生成任务标题`,"Generating task title…":`正在生成任务标题…`,"Retry title generation":`重新生成任务标题`,"PDF annotations":`PDF 标注`,Yellow:`黄色`,Green:`绿色`,Purple:`紫色`,Orange:`橙色`,Red:`红色`,"Annotation groups":`批注组`,"Annotation group color":`批注组颜色`,"Individual notes":`单条批注`,Color:`颜色`,"Add to group":`加入批注组`,"Quoted text":`引用原文`,"Your note":`批注内容`,"{n} location":`{n} 处`,"{n} locations":`{n} 处`,"Add to {group}":`加入{group}组`,"Instructions for color groups":`各颜色组的修改要求`,"Send annotations":`发送标注`,"Send annotations to the agent":`发送标注给代理`,"What should change in this group?":`这组内容希望怎么处理?`,"What should change in each color group?":`各颜色组需要怎样修改?`,"Instructions for {group} notes":`{group}批注的处理要求`,"Add instructions to the selected color groups above.":`请在上方为选中的颜色组填写处理要求。`,"Reasoning effort":`推理强度`,"Model default":`模型默认`,"Request failed. Please try again.":`请求失败,请重试。`,"The connection is taking too long. Check your network and try again.":`连接时间过长。请检查网络后重试。`,"The request timed out and may still be processing. Check the task status before retrying.":`请求超时,可能仍在处理中。重试前请先检查任务状态。`,Ready:`就绪`,Queued:`排队中`,"Needs your reply":`等待你的回复`,"Preparing task results":`正在整理任务结果`,"Ready for review":`待审阅`,Paused:`已暂停`,"Needs attention":`需要处理`,"Check task status":`请检查任务状态`,"Deleting task":`正在删除任务`,"Review complete":`审阅完成`,Completed:`已完成`,Committed:`已提交`,"Committed and pushed":`已提交并推送`,"{agent} is working":`{agent} 正在处理`,now:`刚刚`,"{n}m":`{n} 分钟`,"{n}h":`{n} 小时`,"{n}d":`{n} 天`,"just now":`刚刚`,"{time} ago":`{time}前`,"Details (optional)":`补充说明(选填)`,"{agent} needs your input":`{agent} 需要你的回答`,"Approve this action":`批准此操作`,"Or type your own answer":`或输入你自己的回答`,"{agent} is requesting permission for this action.":`{agent} 请求执行此操作的权限。`,"Apply file changes":`应用文件修改`,Decline:`拒绝`,"Submitting…":`正在提交…`,"Reply to {agent}":`回复 {agent}`,"Allow this action":`允许此操作`,Copied:`已复制`,"Copy message":`复制消息`,Copy:`复制`,"You, {time}":`你,{time}`,"Note on the PDF":`PDF 上的批注`,"{n} notes on the PDF":`PDF 上的 {n} 条批注`,"Marked region":`标记的区域`,"{n} accepted":`{n} 处已接受`,"{n} rejected":`{n} 处已拒绝`,"{n} comment":`{n} 条评论`,"{n} comments":`{n} 条评论`,"{n} undone":`{n} 处已撤销`,"build error":`编译错误`,"You sent review feedback, {time}":`你发送了审阅反馈,{time}`,"Review feedback":`审阅反馈`,"Viewed the PDF: {places}":`查看了 PDF:{places}`,"Viewed the PDF":`查看了 PDF`,"viewed the PDF":`查看了 PDF`,"Build failed · sent to {agent}":`编译失败 · 已发给 {agent}`,"Papilot sent the build error to {agent}, {time}":`Papilot 已将编译错误发给 {agent},{time}`,"With review feedback":`附带审阅反馈`,"Run command":`运行命令`,"Edited {file}":`编辑了 {file}`,"Edited {n} files":`编辑了 {n} 个文件`,"Run tool":`使用工具`,Running:`运行中`,Declined:`已拒绝`,Failed:`失败`,"ran {n} command":`运行了 {n} 条命令`,"ran {n} commands":`运行了 {n} 条命令`,"edited {file}":`编辑了 {file}`,"edited {n} files":`编辑了 {n} 个文件`,"used {n} tool":`使用了 {n} 个工具`,"used {n} tools":`使用了 {n} 个工具`,", ":`,`,"{n} failed":`{n} 个失败`,"This task is being deleted":`此任务正在删除`,"Check task status before sending":`发送前请先检查任务状态`,"Sending feedback…":`正在发送反馈…`,"Sending…":`正在发送…`,"{n} review update will be sent with this message":`{n} 项审阅更新将随此消息发送`,"{n} review updates will be sent with this message":`{n} 项审阅更新将随此消息发送`,"{agent} is working · new instructions run next":`{agent} 正在工作 · 新指令已排队`,"Default model":`默认模型`,"{agent} conversation":`{agent} 对话`,Chat:`对话`,"the default model on this host ({model})":`此主机上的默认模型({model})`,"the default model on this host":`此主机上的默认模型`,"Loading conversation…":`正在加载对话…`,"Retry conversation":`重新加载对话`,"{agent} is working on this task":`{agent} 正在处理此任务`,"Task saved. Waiting for an available {agent} session.":`任务已保存。正在等待可用的 {agent} 会话。`,"{n} change to review":`{n} 处修改待审阅`,"{n} changes to review":`{n} 处修改待审阅`,"Open review":`打开审阅`,"This step needs attention":`此步骤需要处理`,"Latest messages":`最新消息`,"Instructions for {agent}":`给 {agent} 的指令`,"Queue instructions for the next turn…":`添加后续指令…`,"Ask a question or request changes…":`继续提问,或提出修改要求…`,"Pause task":`暂停任务`,"Pause {agent}":`暂停 {agent}`,"Send instructions":`发送指令`,"Send (Enter) · New line (Shift+Enter)":`发送(Enter)· 换行(Shift+Enter)`,"{n} review update not sent yet":`{n} 项审阅更新尚未发送`,"{n} review updates not sent yet":`{n} 项审阅更新尚未发送`,"Send your review decisions and comments to the agent":`把你的审阅决定和评论发送给智能体`,"Send feedback":`发送反馈`,"Open task: {title}":`打开任务:{title}`,"Archived task":`已归档任务`,"No linked task":`未关联任务`,Retry:`重试`,"Current worktree":`当前工作树`,Worktrees:`工作树`,Current:`当前`,"Commit graph":`提交关系图`,"Newest first":`最新在上`,"{n} conflicts":`{n} 个冲突`,"{n} staged":`{n} 个已暂存`,"{n} unstaged":`{n} 个未暂存`,"{n} untracked":`{n} 个未跟踪`,"Refresh worktrees and history":`刷新工作树和提交历史`,"Reading worktrees and history…":`正在读取工作树和提交历史…`,"Could not refresh the repository.":`无法刷新仓库状态。`,"Showing the last update.":`正在显示最近一次更新。`,"Bare repository":`裸仓库`,"Status unavailable":`状态不可用`,Locked:`已锁定`,"Missing worktree":`工作树路径已失效`,"No upstream branch":`未设置上游分支`,"{ahead} ahead · {behind} behind":`领先 {ahead} · 落后 {behind}`,"Changed files in {branch}":`{branch} 中改动的文件`,"Could not read this worktree.":`无法读取此工作树。`,"No other worktrees in this repository.":`此仓库没有其他工作树。`,"No commits yet":`尚无提交`,"Branches and worktrees at each commit. Select a worktree to highlight its HEAD.":`查看每次提交上的分支和工作树。选择工作树可高亮其 HEAD。`,"This worktree’s HEAD is outside the displayed history.":`此工作树的 HEAD 不在当前显示的历史范围内。`,"Showing the latest {n} commits. Older history is not shown.":`显示最近 {n} 次提交,更早的历史未展示。`,"{n} commit":`{n} 次提交`,"{n} commits":`{n} 次提交`,detached:`游离`,"{n} changed":`{n} 处改动`,clean:`无改动`,Modified:`已修改`,Added:`已添加`,Deleted:`已删除`,Renamed:`已重命名`,Conflict:`冲突`,Untracked:`未跟踪`,"Type changed":`类型已改变`,"No textual changes.":`没有文本改动。`,"The diff is too long to show in full.":`差异太长,无法完整显示。`,"Git status":`Git 状态`,"Reading Git status…":`正在读取 Git 状态…`,"Committed {hash}.":`已提交 {hash}。`,"{n} new commit on {upstream}.":`{upstream} 上有 {n} 个新提交。`,"{n} new commits on {upstream}.":`{upstream} 上有 {n} 个新提交。`,"Up to date with the remote.":`已与远程保持同步。`,"Pulled the latest commits.":`已拉取最新提交。`,"Pushed to {upstream}.":`已推送到 {upstream}。`,"Pushed to the remote.":`已推送到远程。`,"detached HEAD":`游离 HEAD`,"Compared with {upstream}":`与 {upstream} 比较`,"up to date":`已同步`,"Pulling…":`正在拉取…`,Pull:`拉取`,"Pushing…":`正在推送…`,Push:`推送`,"Publish branch":`发布分支`,"Fetch from the remote":`从远程获取`,Tracking:`跟踪`,"Stage all changes":`暂存全部改动`,"Stage or unstage every change":`暂存或取消暂存全部改动`,"Uncommitted changes":`未提交的改动`,"Commit message":`提交信息`,"Committing…":`正在提交…`,"Commit 1 file":`提交 1 个文件`,"Commit staged changes in 1 file":`提交 1 个文件中暂存的改动`,"Commit staged changes in {n} files":`提交 {n} 个文件中暂存的改动`,"Commit all {n} files":`提交全部 {n} 个文件`,"Commit {chosen} of {n} files":`提交 {n} 个文件中的 {chosen} 个`,"Generate commit message":`生成提交信息`,"Write a commit message for the chosen files with {agent}":`让 {agent} 为选中的文件写提交信息`,"{agent} is writing a commit message…":`{agent} 正在写提交信息…`,"{n} build file":`{n} 个构建文件`,"{n} build files":`{n} 个构建文件`,"Untracked build output. Add to .gitignore adds:":`未跟踪的构建产物。加入 .gitignore 会添加:`,"Add to .gitignore":`加入 .gitignore`,"{n} file staged":`已暂存 {n} 个文件`,"{n} files staged":`已暂存 {n} 个文件`,"Commit what is staged":`提交已暂存的改动`,Show:`显示`,Changes:`改动`,"What changed since the last commit, to stage, revert and commit change by change":`上次提交以来的改动,可逐处暂存、还原并提交`,"Uncommitted changes in the PDF":`PDF 中未提交的改动`,"Commit…":`提交…`,"Commit to {branch}":`提交到 {branch}`,Commit:`提交`,"What this task accepted, in {n} file:":`此任务接受的改动,共 {n} 个文件:`,"What is staged, in {n} file:":`已暂存的改动,共 {n} 个文件:`,"What is staged, in {n} files:":`已暂存的改动,共 {n} 个文件:`,"What this task accepted, in {n} files:":`此任务接受的改动,共 {n} 个文件:`,"Commit and push":`提交并推送`,"Committing and pushing…":`正在提交并推送…`,"Committed {hash} and pushed.":`已提交 {hash} 并推送。`,Merge:`合并`,"Merging…":`正在合并…`,"{branch} and {upstream} have both changed. Merge brings in the remote commits.":`{branch} 和 {upstream} 都有新提交。合并会引入远端的提交。`,"Merged {upstream}.":`已合并 {upstream}。`,"The merge stopped at conflicts.":`合并遇到了冲突。`,"Merge in progress":`合并进行中`,"Merging: {n} file has conflicts":`合并中:{n} 个文件有冲突`,"Merging: {n} files have conflicts":`合并中:{n} 个文件有冲突`,"Merging: no conflicts left":`合并中:冲突已全部解决`,"Resolve with {agent}":`让 {agent} 解决`,"{agent} is resolving…":`{agent} 正在解决…`,"{agent} on the merge":`{agent} 对这次合并的说明`,"{n} file still has conflicts.":`还有 {n} 个文件有冲突。`,"{n} files still have conflicts.":`还有 {n} 个文件有冲突。`,"Conflicts resolved. Read the diffs, then commit the merge.":`冲突已解决。看过各文件的改动后,提交这次合并。`,"Commit merge":`提交合并`,"Abort merge":`放弃合并`,"Aborting…":`正在放弃…`,"The merge was abandoned.":`已放弃这次合并。`,"Added {n} pattern to .gitignore.":`已向 .gitignore 添加 {n} 条规则。`,"Added {n} patterns to .gitignore.":`已向 .gitignore 添加 {n} 条规则。`,"Stage {path}":`暂存 {path}`,Staged:`已暂存`,"Partly staged":`部分暂存`,"Not staged":`未暂存`,"Changes in {path}":`{path} 的改动`,"Loading the diff…":`正在加载差异…`,"No uncommitted changes":`没有未提交的改动`,"Select all notes for this task":`全选本轮批注`,"{selected} / {total} locations selected":`已选 {selected} / {total} 处`,"Collapse {group} notes":`收起{group}批注`,"Expand {group} notes":`展开{group}批注`,"Select all {group} notes for this task":`本轮选中全部{group}批注`,"Include note {n} in this task":`本轮发送批注 {n}`,"Clear selection":`取消全选`,"Add overall instructions (optional)":`补充整体修改要求(选填)`,"Address {n} PDF notes":`处理 {n} 条 PDF 批注`,"Page {n}":`第 {n} 页`,"PDF notes":`PDF 批注`,"Show note {n} on the page":`在页面上显示批注 {n}`,"Delete note {n}":`删除批注 {n}`,"Delete note":`删除批注`,"Position needs confirmation":`位置待确认`,"The position in the new PDF could not be confirmed. The original text and note are kept.":`无法确认这条批注在新 PDF 中的位置,原文和备注已保留。`,"Some note positions need confirmation. Their original text and comments are kept.":`部分批注的位置需要确认,原文和备注均已保留。`,"Send {n} note to the agent":`把 {n} 条批注发送给智能体`,"Send {n} notes to the agent":`把 {n} 条批注发送给智能体`,"PDF preview":`PDF 预览`,"The manuscript did not compile.":`稿件编译失败。`,"Opening the PDF…":`正在打开 PDF…`,"Compiling the PDF…":`正在编译 PDF…`,"Manuscript panels":`稿件面板`,Contents:`目录`,"PDF contents":`PDF 目录`,"This PDF has no bookmarks.":`此 PDF 没有书签。`,"Contents will appear when the PDF is ready.":`PDF 就绪后会显示目录。`,"You are offline. Your draft is kept in this browser.":`你已离线。草稿保存在此浏览器中。`,"Agent settings":`智能体设置`,"Add skill":`添加技能`,Fast:`快速`,"Fast mode":`快速模式`,"No notes yet":`暂无批注`,"Region note":`区域批注`,"Send {n} note":`发送 {n} 条批注`,"Send {n} notes":`发送 {n} 条批注`,"or select text to annotate":`或选中文字批注`,"Edit note":`编辑批注`,"Edit note {n}":`编辑批注 {n}`,"Edit note {n}: {comment}":`编辑批注 {n}:{comment}`,Save:`保存`,"Saving…":`正在保存…`,"Pending review":`待审阅`,Accepted:`已接受`,Rejected:`已拒绝`,"Revision requested":`需再修改`,"Partly reviewed":`部分已审阅`,"Retry linking changes":`重试关联修改`,"View changes for this note":`查看这条批注对应的修改`,"Change {n}":`修改 {n}`,"Awaiting changes":`等待修改`,"No linked change":`暂无对应修改`,"Show note {n}: {comment}":`查看批注 {n}:{comment}`,"Note {n}":`批注 {n}`,"No tasks yet":`暂无任务`,"No matching skills":`没有匹配的技能`,"LaTeX Git repository · Requires a commit and latexmk":`LaTeX Git 仓库 · 需有提交记录并安装 latexmk`,"{agent} is unavailable":`{agent} 不可用`,"Connection details":`连接详情`,"Faster responses; may use more of your limit.":`响应更快,可能消耗更多额度。`,"{agent} was not found on this computer. Install or set it up, then select Reconnect.":`本机未找到 {agent}。安装或配置后点“重新连接”。`,"Search models":`搜索模型`,Models:`模型`,Recent:`最近使用`,Default:`默认`,"No models match “{query}”":`没有匹配“{query}”的模型`,"Wait for the PDF to compile.":`请等待 PDF 编译完成。`,"Fit width":`适合宽度`,"Fit page":`适合页面`,"Note for the agent":`给智能体的批注`,"What should change here?":`这里应该怎么改?`,"Add note":`添加批注`,"Adding…":`正在添加…`,"PDF controls":`PDF 控件`,"Previous page":`上一页`,"Page number":`页码`,"Next page":`下一页`,"Zoom out":`缩小`,"Zoom out (⌘−)":`缩小(⌘−)`,Zoom:`缩放`,"Zoom in":`放大`,"Zoom in (⌘+)":`放大(⌘+)`,"Find in PDF":`在 PDF 中查找`,"Find (⌘F)":`查找(⌘F)`,"Mark region":`标记区域`,"Mark a figure or region":`标记图表或区域`,"Search the PDF":`搜索 PDF`,"No matches":`无匹配`,"{current} of {total}":`{current}/{total}`,"Previous match":`上一个匹配`,"Next match":`下一个匹配`,"Close search":`关闭搜索`,"PDF pages":`PDF 页面`,"The PDF could not be opened: {error}":`无法打开 PDF:{error}`,"Note {n}: {comment}":`批注 {n}:{comment}`,"{title} PDF change review":`{title} 的 PDF 修改审阅`,"The PDF review could not be loaded.":`无法加载 PDF 审阅。`,"The PDF review is taking longer than expected.":`PDF 审阅加载时间比预期长。`,"Loading PDF review…":`正在加载 PDF 审阅…`,"Reload review":`重新加载审阅`,"Review notes":`审阅批注`,"Review note: {comment}":`审阅批注:{comment}`,"Review PDF notes":`审阅 PDF 批注`,"Review notes ({n})":`审阅批注({n})`,"Close review notes":`关闭审阅批注`,"Delete review note {n}":`删除审阅批注 {n}`,"Marked on earlier changes.":`标记于之前的修改。`,"Check the task status before sending notes.":`发送批注前请先检查任务状态。`,"Full PDF":`完整 PDF`,"Open the full PDF":`打开完整 PDF`,"Generate PDF comparison":`生成 PDF 对比`,"Regenerate PDF comparison":`重新生成 PDF 对比`,"Open review in new tab":`在新标签页中打开审阅`,"Rename {name}":`重命名 {name}`,"Papers and tasks":`论文和任务`,"Hide task list":`隐藏任务列表`,"Paper: {name}":`论文:{name}`,"Add paper…":`添加论文…`,"Add paper":`添加论文`,Manuscript:`稿件`,"Git status of the manuscript":`稿件的 Git 状态`,"New task":`新任务`,Tasks:`任务`,"Task list":`任务列表`,"{n} change to decide":`{n} 处修改待定`,"{n} changes to decide":`{n} 处修改待定`,"Task actions for {title}":`{title} 的任务操作`,"Rename…":`重命名…`,"Check status":`检查状态`,"Retry deletion…":`重试删除…`,"Delete task…":`删除任务…`,Settings:`设置`,Connected:`已连接`,Reconnecting:`正在重新连接`,"{n} active task":`{n} 个活动任务`,"{n} active tasks":`{n} 个活动任务`,"Close task list":`关闭任务列表`,"Show task list":`显示任务列表`,"Recompile PDF":`重新编译 PDF`,"Open PDF":`打开 PDF`,"PDF compiled successfully.":`PDF 编译成功。`,"Compilation failed. Click to retry.":`编译失败,点击重试。`,"Compilation status unavailable.":`暂时无法确认编译状态。`,"Manuscript view":`稿件视图`,"Git, {n} changed":`Git,{n} 处改动`,"Retry deletion":`重试删除`,Pause:`暂停`,"View details":`查看详情`,"Workspace view":`工作区视图`,"Review, {n} to decide":`审阅,{n} 处待定`,Review:`审阅`,"Chat (reply needed)":`对话(需要回复)`,"PDF review only":`只看 PDF 审阅`,Split:`分栏`,"Review and chat side by side":`审阅和对话并排`,"Chat only":`只看对话`,"This conversation has no manuscript changes.":`本次对话没有稿件修改。`,"Connection lost. Showing the last update; your draft is kept.":`连接已断开。正在显示最近一次更新,你的草稿仍然保留。`,"Retry connection":`重新连接`,"Connecting to {agent}…":`正在连接 {agent}…`,"Connecting…":`正在连接…`,Reconnect:`重新连接`,"Resize chat panel":`调整对话面板宽度`,"Drag to resize · Double-click to reset":`拖动调整宽度 · 双击还原`,"PDF review":`PDF 审阅`,"Could not generate the PDF comparison.":`PDF 对比生成失败。`,"Retry build":`重新生成`,"Deletion is in progress":`正在删除`,"This task is reserved until its worktree cleanup is confirmed. Use Retry deletion if the connection was interrupted.":`在确认工作树清理完成之前,此任务会保留。如果连接中断,请使用“重试删除”。`,"Preparing task results…":`正在整理任务结果…`,"PDF comparison":`PDF 修改对比`,"No manuscript changes":`本次没有修改论文`,"This task did not change the manuscript. Read the answer in the chat.":`本次任务没有改动论文,请在对话中查看回复。`,"Only manuscript changes need a PDF comparison. Answers to questions are in the chat.":`只有论文改动需要对比,问答内容直接在对话中查看。`,"Checking for manuscript changes. A PDF comparison is generated only when needed.":`正在检查论文是否有改动,有改动时才会生成 PDF 对比。`,"If the task changes the manuscript, a PDF comparison will appear here. Otherwise, read the answer in the chat.":`如果任务修改了论文,这里会显示 PDF 对比;问答回复在对话中查看。`,"Reply in the chat to continue. A PDF comparison is needed only if the manuscript changes.":`请先在对话中回复,让任务继续。只有论文改动才需要 PDF 对比。`,"Confirm whether the task is still running before generating a PDF comparison.":`请先确认任务是否仍在运行,再生成 PDF 对比。`,"Opening your workspace":`正在打开工作区`,"Connecting to your papers and tasks…":`正在连接你的论文和任务…`,"What are we revising next?":`接下来要修改什么?`,"Describe the revision":`描述修改`,"Start task":`开始任务`,"Start task (Enter)":`开始任务(Enter)`,"Task added: {title}":`已添加任务:{title}`,"Add your first paper":`添加你的第一篇论文`,"Dismiss error":`关闭错误提示`,Close:`关闭`,"Add a paper":`添加论文`,"Repository path":`仓库路径`,"/Users/you/papers/my-paper":`/Users/you/papers/my-paper`,Cancel:`取消`,"Copied path":`已复制路径`,"Copy path: {path}":`复制路径:{path}`,"{agent} is waiting for your approval":`{agent} 正在等待你的批准`,"Review ready · {n} change to decide":`审阅已就绪 · {n} 处修改待定`,"Review ready · {n} changes to decide":`审阅已就绪 · {n} 处修改待定`,"{agent} finished":`{agent} 已完成`,"A task needs attention":`有任务需要处理`,"Notifications are on":`通知已开启`,"Papilot will tell you here when a task needs you.":`任务需要你时,Papilot 会在这里通知你。`,"LaTeX installation":`LaTeX 安装信息`,Distribution:`发行版`,Version:`版本`,"Installation location":`安装位置`,"Detect again":`重新识别`,"Detecting LaTeX installation…":`正在识别 LaTeX 安装…`,"Could not read the LaTeX installation. Try again.":`无法读取 LaTeX 安装信息,请重试。`,"No LaTeX installation was detected on this host.":`未在此主机上检测到 LaTeX 安装。`,Runtime:`运行环境`,Agents:`智能体`,"Set up this agent":`配置此智能体`,"Already set up?":`已经配置过了?`,"The last connection attempt found neither CURSOR_API_KEY nor a saved Cursor SDK login for the user running Papilot. Signing in to the Cursor desktop app or CLI does not configure this SDK.":`上次连接时,Papilot 未在运行服务的用户环境中找到 CURSOR_API_KEY 或 Cursor SDK 登录记录。Cursor 桌面应用或 CLI 的登录不适用于此 SDK。`,"Create a Cursor API key in the Cursor dashboard, or configure the Cursor SDK login on this host.":`在 Cursor 控制台创建 API key,或在此主机上配置 Cursor SDK 登录。`,"Provide CURSOR_API_KEY to the process or service that starts Papilot, then restart Papilot. The SDK is installed automatically when used.":`为启动 Papilot 的进程或服务设置 CURSOR_API_KEY,然后重启 Papilot。SDK 会在使用时自动安装。`,"An environment variable set in a new terminal does not reach an already running server. Restart Papilot with the credentials; Reconnect alone cannot change its environment.":`在新终端中设置的环境变量不会传给已运行的服务。需要携带凭据重启 Papilot;仅重新连接无法改变服务的环境。`,"The last connection attempt found neither ZHIPU_API_KEY nor ZAI_API_KEY in the Papilot server environment. A Claude login or a GLM website login does not supply these keys.":`上次连接时,Papilot 服务环境中没有 ZHIPU_API_KEY 或 ZAI_API_KEY。Claude 登录或 GLM 网站登录不会提供这两个密钥。`,"Create a GLM Coding Plan or API key with Zhipu or Z.ai.":`在智谱或 Z.ai 创建 GLM Coding Plan 或 API key。`,"Set ZHIPU_API_KEY for open.bigmodel.cn, or ZAI_API_KEY for api.z.ai, in the environment that starts Papilot. Then restart Papilot.":`在启动 Papilot 的环境中设置 ZHIPU_API_KEY(open.bigmodel.cn)或 ZAI_API_KEY(api.z.ai),然后重启 Papilot。`,"The last connection attempt found neither Claude Code nor supported API credentials in the Papilot server environment.":`上次连接时,Papilot 服务环境中既未找到 Claude Code,也未找到支持的 API 凭据。`,"The last connection attempt could not find a runnable {command} CLI in the Papilot server environment. It may still be installed in another location or for another user.":`上次连接时,Papilot 服务环境中未找到可运行的 {command} CLI。它可能已安装在其他位置或另一个用户下。`,"Run papilot codex login on the host. It installs a supported Codex CLI when needed.":`在主机上运行 papilot codex login。需要时,它会安装支持的 Codex CLI。`,"Install {command} on the host running Papilot, then complete its login or provider setup below.":`在运行 Papilot 的主机上安装 {command},然后按下方说明完成登录或模型服务商配置。`,"If it is already installed, set {variable} to its executable path in the environment that starts Papilot, then restart Papilot.":`如果已经安装,请在启动 Papilot 的环境中将 {variable} 设置为其可执行文件路径,然后重启 Papilot。`,"For the SDK instead, start Papilot with ANTHROPIC_API_KEY or a supported cloud provider configured. Restart Papilot after changing its environment.":`若使用 SDK,请配置 ANTHROPIC_API_KEY 或支持的云服务商后启动 Papilot。更改环境后需要重启 Papilot。`,"The browser and the Papilot server may run on different computers. Background services can also use a different PATH or user account from your terminal.":`浏览器与 Papilot 服务可能在不同的电脑上运行。后台服务的 PATH 和用户账号也可能与你的终端不同。`,"The latest configuration check found this agent. Reconnect to refresh its live status.":`最新的配置检查已找到此智能体。请重新连接以刷新实时状态。`,"Papilot reached this agent, but could not confirm a signed-in account on this host.":`Papilot 已连接到此智能体,但无法确认此主机上有已登录的账号。`,"Papilot could not establish a working connection to this agent. The latest connection error is shown below.":`Papilot 未能与此智能体建立可用的连接。下方是最近的连接错误。`,"If the live status still disagrees with the check, restart Papilot under the same user and environment where you configured the agent.":`如果实时状态仍与检查结果不一致,请用配置此智能体时的同一用户和环境重启 Papilot。`,"Check the connection error above and the agent’s login, provider, and network settings on this host. Restart Papilot after changing credentials or executable paths.":`请根据上方连接错误检查此主机上的登录、模型服务商和网络配置。更改凭据或可执行文件路径后,请重启 Papilot。`,"Could not reconnect. Check the server connection and try again.":`重新连接失败,请检查服务连接后重试。`,"Connect and sign in to load the model list.":`连接并登录后可加载模型列表。`,"This agent has not reported a model list. Its configured default can still be used.":`此智能体尚未返回模型列表,仍可使用其配置的默认模型。`,"Show fewer models":`收起模型`,"Show {n} more models":`展开其余 {n} 个模型`,"{agent} details":`{agent} 详情`,"View installation, account, and usage":`查看安装方式、账号和额度`,"Close agent details":`关闭智能体详情`,Account:`账号`,"Signed in":`已登录`,"Available models":`可用模型`,"Installation & setup":`安装与配置`,"Usage & limits":`用量与额度`,"Installation check":`安装检测`,"Environment variable":`环境变量`,"Set up on the host":`在主机上配置`,"Setup guide":`配置指南`,"No installation details were returned. Run the checks again to refresh.":`尚无安装检测结果,可重新检查以刷新。`,"Uses a compatible local Codex CLI. Papilot installs its own copy when needed.":`使用本机兼容的 Codex CLI;需要时,Papilot 会自动安装。`,"Uses Claude Code when installed, or the Claude Agent SDK with API credentials.":`优先使用已安装的 Claude Code,也可通过 API 凭据使用 Claude Agent SDK。`,"Uses the Cursor SDK with CURSOR_API_KEY. Papilot installs the SDK on first use.":`通过 CURSOR_API_KEY 使用 Cursor SDK,首次使用时由 Papilot 安装 SDK。`,"Uses the local Antigravity CLI and its saved Google login.":`使用本机 Antigravity CLI 及其保存的 Google 登录。`,"Uses Kimi Code CLI and its saved login through ACP.":`通过 ACP 连接 Kimi Code CLI,沿用其登录。`,"Uses Claude Code or the Claude Agent SDK with ZHIPU_API_KEY or ZAI_API_KEY.":`通过 ZHIPU_API_KEY 或 ZAI_API_KEY,使用 Claude Code 或 Claude Agent SDK。`,"Uses DeepSeek Harness and the providers configured in dsh.":`使用 DeepSeek Harness,以及在 dsh 中配置的模型服务商。`,"Uses Qwen Code and its saved login through ACP.":`通过 ACP 连接 Qwen Code,沿用其登录。`,"Uses OpenCode with the providers and models you have connected.":`使用 OpenCode 中已连接的模型服务商与模型。`,Changelog:`更新日志`,"See what changed in each release.":`了解每个版本的改进与修复。`,Contribute:`参与贡献`,"Help improve Papilot with code, docs, and ideas.":`通过代码、文档和建议,一起完善 Papilot。`,"Not found":`未找到`,"Not detected":`未检测到`,"Agent configuration":`智能体配置`,Unknown:`未知`,"Sign-in required":`需要登录`,Unavailable:`不可用`,"Checking…":`正在检查…`,"Check again":`重新检查`,"Could not complete the environment checks. Check the connection and try again.":`未能完成环境检查,请检查连接后重试。`,Passed:`通过`,Warning:`提醒`,"Suggested fix":`处理建议`,"Used for new tasks. Saved in this browser.":`用于新任务,保存在当前浏览器中。`,"Default reasoning effort":`默认推理强度`,"Available levels depend on the selected model.":`可选档位取决于所选模型。`,"This model uses its own reasoning settings.":`此模型使用自身的推理设置。`,"Review decisions":`审阅操作`,"Review navigation":`审阅导航`,"View & help":`视图与帮助`,"Enable shortcut: {action}":`启用快捷键:{action}`,General:`通用`,Personal:`个人偏好`,"Review preferences":`审阅偏好`,Workspace:`工作区`,Application:`应用`,"About Papilot":`关于 Papilot`,"Search settings":`搜索设置`,"Settings categories":`设置分类`,"No matching settings":`没有匹配的设置`,"Language for the Papilot interface.":`Papilot 界面的显示语言。`,"Opens in a new tab":`在新标签页中打开`,"A workspace for your papers.":`为论文而生的工作空间。`,"Read, annotate, and revise your papers with AI, all in one place.":`阅读、批注,与 AI 一起修改论文,在同一处完成。`,"GitHub repository":`GitHub 仓库`,"Feedback & issues":`问题与建议`,"Report a bug or suggest an improvement.":`反馈问题,或分享你的改进建议。`,"User guide":`使用指南`,"Get started and make Papilot your own.":`了解如何开始使用和配置 Papilot。`,"Licenses & acknowledgments":`许可证与致谢`,"Papilot license":`Papilot 许可证`,"Third-party licenses":`第三方许可证`,"Libraries, fonts, and the people behind them.":`使用的开源库、字体,以及背后的贡献者。`,"Made by Cui Chen and the Papilot contributors.":`由 Cui Chen 与 Papilot 贡献者共同构建。`,"Could not load the license notices.":`无法加载许可证信息。`,"Loading license notices…":`正在加载许可证…`,"{shown} of {total} components":`显示 {shown} / {total} 个组件`,"See license notice":`参见许可声明`,"Component source":`组件源码`,"License text is not included in this package. See the component source for its terms.":`此软件包未附带许可证正文,请前往组件源码查看许可条款。`,"No components match your search.":`没有找到匹配的组件。`,"Libraries and fonts used by Papilot and its review engine. Each component is covered by its own license.":`Papilot 及其审阅引擎使用的开源库和字体。各组件分别遵循其自身的许可证。`,"Search components or licenses…":`搜索组件或许可证…`,"Search components or licenses":`搜索组件或许可证`,"This browser cannot show notifications.":`此浏览器无法显示通知。`,"Browsers show notifications only on HTTPS or localhost. Open Papilot at a secure address to use them.":`浏览器只在 HTTPS 或 localhost 上显示通知。请通过安全地址打开 Papilot 后再使用。`,"Notifications are blocked for this site. Allow them in the browser’s site settings, then turn them on here.":`此网站的通知已被屏蔽。请先在浏览器的网站设置中允许通知,再回到这里开启。`,"Visual style":`视觉风格`,Mode:`模式`,Theme:`主题`,Accent:`强调色`,Background:`背景色`,Foreground:`文字色`,Paper:`纸张`,Slate:`岩灰`,Customized:`已自定义`,"Slate blue":`灰蓝`,Graphite:`墨灰`,Stone:`暖灰`,"Choose {color} color":`选择{color}`,"Use a hex color, like #2563EB.":`请输入十六进制颜色,例如 #2563EB。`,"Editing light mode colors. Changes are saved automatically.":`正在编辑浅色模式配色,修改会自动保存。`,"Editing dark mode colors. Changes are saved automatically.":`正在编辑深色模式配色,修改会自动保存。`,Advanced:`高级`,"PDF appearance":`PDF 外观`,"Choose how paper pages look in dark mode.":`选择深色模式下论文页面的显示方式。`,"Follow mode":`跟随模式`,"Always light":`始终浅色`,"Reset appearance":`重置外观`,Appearance:`外观`,Light:`浅色`,Dark:`深色`,System:`跟随系统`,Language:`语言`,"Browser default ({language})":`浏览器默认({language})`,Notifications:`通知`,"Show desktop notifications while Papilot is in the background.":`Papilot 在后台时,显示桌面通知。`,"Notify me about":`通知场景`,Off:`关闭`,"Input needed":`需要回复`,"Notify me when an agent asks me a question.":`智能体向我提问时通知我。`,"Approval requests":`等待批准`,"Notify me when an agent needs my approval to continue.":`智能体需要我的批准才能继续时通知我。`,"Review ready":`审阅就绪`,"Notify me when changes are ready for review.":`修改已准备好,可以开始审阅时通知我。`,"Task finished":`任务完成`,"Notify me when an agent finishes without changes to review.":`智能体已完成,且没有待审阅的修改时通知我。`,"Task errors":`任务出错`,"Notify me when a task fails or stops unexpectedly.":`任务失败或意外停止时通知我。`,"This browser could not enable notifications.":`此浏览器无法开启通知。`,"Check references online":`联网核对参考文献`,"Expand indirect changes":`默认展开间接影响`,"Expand changes elsewhere, such as contents and reference numbering. Off by default; edits with no visible change at their source, such as macro definitions, still show their effects.":`展开目录、引用编号等其他位置的连带变化。默认关闭;宏定义等在源码位置没有可见变化的修改,仍会显示其影响。`,"When a change adds or edits a bibliography entry, look up its title, authors, year and DOI in Crossref, DBLP and arXiv. Nothing else from your paper is sent.":`改动新增或修改参考文献条目时,用它的标题、作者、年份和 DOI 在 Crossref、DBLP 和 arXiv 中核对。论文的其他内容不会发出去。`,"Send a test notification":`发送测试通知`,"Sent. If nothing appeared, allow notifications for this browser in your system settings.":`已发送。如果没有看到通知,请在系统设置中允许此浏览器发送通知。`,"This browser could not show the notification.":`此浏览器无法显示这条通知。`,Polish:`润色`,Proofread:`校对`,Shorten:`精简`,"Check math":`检查数学`,Consistency:`统一表述`,"Fix LaTeX warnings":`修复 LaTeX 警告`,"Address reviewers":`回应审稿意见`,"Improve clarity and flow, keeping the meaning":`保留原意,让表达更清晰、行文更流畅`,"Fix typos, grammar and punctuation without rewording":`修正错别字、语法和标点,不改写原文`,"Cut length without losing content":`保留内容,精简篇幅`,"Find errors in notation, equations and proofs":`检查符号、公式和证明中的错误`,"Unify terms, notation, spelling and references":`统一术语、符号、拼写和引用`,"Resolve undefined references, overfull boxes and other build warnings":`修复未定义的引用、内容溢出等编译警告`,"Revise for reviewer comments and draft a point-by-point reply":`根据审稿意见修改论文,并起草逐条回复`,Skills:`技能`,"This paper":`本论文`,Yours:`你的`,"Skill: {name}":`技能:{name}`,"Remove the {name} skill":`移除技能 {name}`,"Pause this task before deleting it.":`删除前请先暂停此任务。`,"Wait for the PDF build to finish before deleting this task.":`请等 PDF 编译完成后再删除此任务。`,"Check task status before deleting this task.":`删除前请先检查任务状态。`,"Delete task?":`删除任务?`,"This permanently removes the task from Papilot, including its conversation, worktree, and PDF review files. Unaccepted edits and saved comments will be discarded, and review decisions can no longer be undone.":`这会从 Papilot 中永久删除此任务,包括它的对话、工作树和 PDF 审阅文件。未接受的修改和已保存的评论将被丢弃,审阅决定也无法再撤销。`,"Accepted changes in your manuscript stay in place. Other tasks are not affected.":`稿件中已接受的修改会保留,其他任务不受影响。`,"Deletion has already started. Retry to confirm the cleanup and remove the task.":`删除已经开始。重试以确认清理并移除任务。`,"Deleting…":`正在删除…`,"Delete task":`删除任务`,"Weekly limit":`每周额度`,"Daily limit":`每日额度`,"{n}-day limit":`{n} 天额度`,"{n}-hour limit":`{n} 小时额度`,"{n}-minute limit":`{n} 分钟额度`,"Usage limit":`用量额度`,"resets now":`即将重置`,"resets in {hours} h {minutes} min":`{hours} 小时 {minutes} 分钟后重置`,"resets in {minutes} min":`{minutes} 分钟后重置`,"resets {time}":`{time} 重置`,"{name} used":`{name}已用`,"{used}% used":`已用 {used}%`,"Limit reached":`已达上限`,"{agent} usage":`{agent} 用量`,"{agent} usage details":`{agent} 用量详情`,"Unlimited credits":`无限额度`,"{n} credits":`{n} 点额度`,"Credits available":`有可用额度`,"Sign in to continue.":`请先登录。`,"{name}, {time}":`{name},{time}`,"{name} sent review feedback, {time}":`{name} 发送了审阅反馈,{time}`,"from {name}":`来自 {name}`,Sharing:`共享`,"Sign out":`退出登录`,"No papers yet":`还没有论文`,"No papers have been shared with you yet. Papers appear here as soon as {name} shares them.":`还没有论文共享给你。{name} 共享后,论文会立即显示在这里。`,"People you invite sign in with a passkey at the public address and can do everything you can in the papers you share with them, including approving the commands agents run on this host and pushing with its Git credentials.":`受邀成员在公开地址上用通行密钥登录。在你共享给他们的论文里,他们能做你能做的一切,包括批准 agent 在此主机上运行的命令,以及用此主机的 Git 凭据推送。`,"Sharing is not sandboxed":`共享没有沙箱隔离`,"Invited people can access all files readable by Papilot, including credentials and unshared papers.":`受邀成员可访问 Papilot 有权限读取的所有文件,包括凭据和未共享论文。`,"Run Papilot and its agents in an isolated container such as Docker to limit access; mounted files remain accessible.":`请将 Papilot 及其 agent 运行在正确隔离的 Docker 等容器中以限制访问范围;挂载文件仍可访问。`,"Share your papers and manage the people you work with.":`共享论文,管理与你一起协作的成员。`,"Setup required":`待设置`,"Bring your collaborators in":`邀请伙伴,一起完善论文`,"Connect a public HTTPS address to invite people to your papers. They can sign in securely with a passkey.":`配置公开的 HTTPS 地址,即可邀请伙伴协作。他们可以使用通行密钥安全登录。`,"Set up sharing":`设置共享`,"Choose the papers to share, then send a personal invite link.":`选择要共享的论文,然后发送专属邀请链接。`,Name:`姓名`,Members:`成员列表`,"Access to all papers":`可访问所有论文`,"What can invited people do?":`受邀成员拥有哪些权限?`,"Invite someone":`邀请成员`,"Their name, as others will see it":`对方的名字,其他人会看到`,"Papers they can open":`可以打开的论文`,"Creating…":`正在创建…`,"Create invite link":`创建邀请链接`,"Loading people…":`正在加载成员…`,"{name} (you)":`{name}(你)`,Owner:`所有者`,"Invited, not joined yet":`已邀请,尚未加入`,"Last active {time}":`最近活动:{time}`,Joined:`已加入`,"Papers {name} can open":`{name} 可以打开的论文`,"Invite link for {name}":`{name} 的邀请链接`,"Open it on the device you want to sign in from. It works once, within 15 minutes.":`在要登录的设备上打开。链接只能使用一次,15 分钟内有效。`,"Send it to {name} yourself. It works once, within 7 days.":`请自行发给 {name}。链接只能使用一次,7 天内有效。`,"Passkey · {label}":`通行密钥 · {label}`,"Signed in · {label}":`已登录 · {label}`,"used {time}":`{time}使用过`,"added {time}":`{time}添加`,"Remove {device}":`移除 {device}`,Remove:`移除`,"Sign in from anywhere":`从任何地方登录`,"Invite link for a new device":`新设备的邀请链接`,"New invite link":`新的邀请链接`,"Sign out everywhere":`在所有设备上退出`,"Remove {name}":`移除 {name}`,"Remove…":`移除…`,"Signing in was cancelled. Try again when you are ready.":`登录已取消。准备好后再试一次。`,"Sign in to Papilot":`登录 Papilot`,"Use the passkey you created from your invite link.":`使用你通过邀请链接创建的通行密钥。`,"Waiting for your passkey…":`正在等待通行密钥…`,"Sign in with a passkey":`用通行密钥登录`,"This browser cannot use passkeys. Open this page in a current version of Safari, Chrome, Edge or Firefox.":`此浏览器不支持通行密钥。请用最新版的 Safari、Chrome、Edge 或 Firefox 打开此页。`,"No passkey on this device? Ask the person who invited you for a new invite link.":`这台设备上没有通行密钥?请邀请你的人发一个新的邀请链接。`,"This invite link is incomplete. Copy the whole link and open it again.":`邀请链接不完整。请复制完整链接后重新打开。`,"Creating the passkey was cancelled. The link still works; try again when you are ready.":`创建通行密钥已取消。链接仍然有效,准备好后再试一次。`,"Add a passkey":`添加通行密钥`,"Join Papilot":`加入 Papilot`,"Create a passkey to sign in to your Papilot from anywhere.":`创建通行密钥,以便从任何地方登录你的 Papilot。`,"Create a passkey on this device to sign in as {name}.":`在这台设备上创建通行密钥,以 {name} 的身份登录。`,"{inviter} invited you to work on {papers}. You will appear as {name}.":`{inviter} 邀请你参与 {papers}。你将显示为 {name}。`,"{inviter} invited you to Papilot. You will appear as {name}.":`{inviter} 邀请你加入 Papilot。你将显示为 {name}。`,"Create a passkey":`创建通行密钥`,"A passkey signs you in with Face ID, Touch ID, Windows Hello or your phone. Papilot never sees a password.":`通行密钥用面容 ID、触控 ID、Windows Hello 或手机为你登录,Papilot 不会接触任何密码。`,"Resize manuscript panel":`调整稿件右栏宽度`,"Collapse manuscript panel":`收起稿件右栏`,"Expand manuscript panel":`展开稿件右栏`,"Archived tasks":`已归档任务`,"Show current tasks":`显示未归档任务`,"Show archived tasks":`显示已归档任务`,"Search tasks":`搜索任务`,"Search tasks…":`搜索任务…`,"Search task titles and instructions":`搜索任务标题和初始指令`,"Clear task search":`清除任务搜索`,"Search archived tasks…":`搜索已归档任务…`,"Restore task":`恢复任务`,"Archive task":`归档任务`,"No matching tasks":`没有匹配的任务`,"No archived tasks":`暂无归档任务`,Undo:`撤销`,"Keyboard shortcuts":`键盘快捷键`,"Your review keyboard":`审阅快捷键一览`,"Click a highlighted key to customize it.":`点击高亮按键,即可修改快捷键。`,"Review shortcut keyboard":`审阅快捷键键盘示意图`,"Keyboard key {key}: {actions}":`键盘按键 {key}:{actions}`,"Hover over a highlighted key to see what it does.":`将鼠标移到高亮按键上,查看它的用途。`,"Choose a shortcut to edit:":`选择要修改的快捷键:`,"Customize shortcuts":`自定义快捷键`,"Accept change":`接受改动`,"Accept the current proposal. In Changes, stage or unstage it.":`接受当前建议;在“改动”视图中,暂存或取消暂存。`,"Reject change":`拒绝改动`,"Reject the current proposal. In Changes, revert it.":`拒绝当前建议;在“改动”视图中,还原这处改动。`,"Request a revision":`要求修改`,"Write feedback on the current proposed change.":`为当前建议填写修改意见。`,"Next change":`下一处改动`,"Move to the next visible change.":`跳到下一处可见的改动。`,"Previous change":`上一处改动`,"Move to the previous visible change.":`跳到上一处可见的改动。`,"Next undecided change":`下一处待审阅改动`,"Jump to the next change that still needs a decision.":`跳到下一处尚未处理的改动。`,"Show LaTeX source":`显示 LaTeX 源码`,"Show or hide the source for the current change.":`展开或收起当前改动的源码。`,"Undo review decision":`撤销审阅操作`,"Undo the last review decision or revert.":`撤销上一次审阅决定或还原操作。`,"Open these shortcut settings.":`打开此快捷键设置页。`,"Review shortcuts work while the PDF review is focused. They pause while you type or select text. Changes are saved in this browser.":`快捷键在 PDF 审阅区域聚焦时生效,输入或选中文字时暂停。设置保存在当前浏览器中。`,"Click a key to change it, then press the new shortcut. Escape cancels; Backspace clears it.":`点击按键后按下新的快捷键。Esc 取消,退格键清除。`,"Change shortcut: {action}":`修改快捷键:{action}`,"This key is reserved for the browser or text editing. Choose another shortcut.":`这个按键用于浏览器或文本编辑,请换一个快捷键。`,"Already used for {action}. Choose another shortcut.":`已用于“{action}”,请换一个快捷键。`,"Press a key…":`请按下按键…`,"Not assigned":`未设置`,"Restore default shortcuts":`恢复默认快捷键`,"Standard shortcuts":`常用快捷键`,"These keep the usual browser and text-editing behavior.":`这些按键保留浏览器和文本编辑的常规行为。`,"Copy selected PDF text":`复制选中的 PDF 文字`,"Undo typing, a deleted note, or the last review decision, depending on focus.":`根据焦点位置,撤销输入、恢复删除的批注或撤销上一次审阅操作。`,"Send the review comment being written.":`发送正在填写的审阅意见。`,"Close the current editor or cancel region selection.":`关闭当前编辑器或取消画框。`,"{differences} (record: {url}).":`{differences}(记录:{url})。`,"{field} is {bib} but {source} has {record}":`{field}写的是 {bib},{source} 里是 {record}`,"{field}: {bib} here, {record} in {source}":`{field}:这里是 {bib},{source} 里是 {record}`,"{key} ({place}): {problems}":`{key}({place}):{problems}`,"{n} checked by you":`{n} 个已人工确认`,"{n} could not be checked":`{n} 个未能核对`,"{n} differ":`{n} 个有出入`,"{n} entries":`{n} 个条目`,"{n} entry":`{n} 个条目`,"{n} not found":`{n} 个未找到`,"{n} verified":`{n} 个已核实`,"{cite} ({places}) has no entry with this key.":`{cite}({places})没有对应的条目。`,"{sources} could not be reached.":`无法访问 {sources}。`,"All entries":`全部条目`,"another entry has the same key.":`另一个条目用了同一个 key。`,"Another entry has the same key.":`另一个条目用了同一个 key。`,Authors:`作者`,"BibTeX cannot read it ({error}).":`BibTeX 读不了这个条目({error})。`,"BibTeX cannot read it: {error}":`BibTeX 读不了:{error}`,"Check {n} more online":`再联网核对 {n} 个`,"Check online":`联网核对`,"Checked by you":`已人工确认`,"Checking {n}…":`核对中,还剩 {n} 个…`,"Cited {n} time: {places}":`正文引用 {n} 处:{places}`,"Cited {n} times: {places}":`正文引用 {n} 处:{places}`,"Closest record":`最接近的记录`,"Could not check":`未能核对`,Differs:`有出入`,"I checked it myself":`我已人工确认`,"Include {key} in the task":`把 {key} 放进任务`,"it is not cited.":`正文没有引用它。`,"Look the entries up in Crossref, DBLP and arXiv. Only their titles, authors, years and identifiers are sent.":`在 Crossref、DBLP 和 arXiv 中查找这些条目。只发送标题、作者、年份和编号。`,"Missing: {files}":`缺少文件:{files}`,"No entry has this key.":`没有条目用这个 key。`,"No problems found.":`没有发现问题。`,"No problems in the files. Check online to compare the entries with their records.":`文件里没有发现问题。联网核对可以把条目和正式记录逐项对照。`,"No record in Crossref, DBLP or arXiv matches it.":`Crossref、DBLP 和 arXiv 中都没有对应记录。`,"Not checked":`未核对`,"Not cited in the paper.":`正文没有引用。`,"Nothing to check":`无从核对`,nothing:`没有`,"Online checks are off in Settings, so only problems found in the files are shown.":`设置里关闭了联网核对,这里只显示从文件中查出的问题。`,"Online checks are off in Settings.":`设置里关闭了联网核对。`,"possibly the same work as {keys} (same title).":`可能和 {keys} 是同一篇文献(标题相同)。`,Problems:`问题`,"Reading the bibliography…":`正在读取参考文献…`,Record:`记录`,"Same DOI as {keys}.":`和 {keys} 的 DOI 相同。`,"Same title as {keys}.":`和 {keys} 的标题相同。`,small:`小差别`,"the same work as {keys} (same DOI).":`和 {keys} 是同一篇文献(DOI 相同)。`,"This paper names no .bib file with {bibliography} or {addbibresource}.":`论文里没有用 {bibliography} 或 {addbibresource} 指定 .bib 文件。`,Title:`标题`,Verified:`已核实`,Year:`年份`,"You checked this entry yourself.":`你已人工确认过这个条目。`,"Paper tools":`论文工具`,Tools:`工具`,"Reference check":`引用检查`,"Citations, entries and their records":`引用、条目及其正式记录`,"Find out what happened with these bibliography problems and report back. Do not edit any file. For each, check whether the work exists and what its published record says (authors, title, year, venue, DOI), find where the entry or citation came from in the Git history of the .bib and .tex files, and say what you would suggest. Mark which findings you confirmed in a source and which are guesses.":`查清楚参考文献里这些问题是怎么回事,然后告诉我。不要修改任何文件。逐条确认:这篇文献是否存在,它的正式记录是什么(作者、标题、年份、出处、DOI);在 .bib 和 .tex 文件的 Git 历史里找出这个条目或引用是怎么来的;再说说你建议怎么处理。注明哪些结论在来源中核实过,哪些只是推测。`,"no record in Crossref, DBLP or arXiv matches it.":`Crossref、DBLP 和 arXiv 中都没有对应记录。`,"Ask an agent to look into {n} problem":`让 agent 调查 {n} 个问题`,"Ask an agent to look into {n} problems":`让 agent 调查 {n} 个问题`,"Opens a new task you can edit before sending. The agent reports what it finds and changes nothing.":`会打开一个新任务,发送前可以修改。agent 只汇报查到的情况,不改动文件。`,"Undefined reference":`未定义的引用`,"Undefined citation":`未定义的文献`,"Label defined more than once":`标签重复定义`,"Missing file":`缺少文件`,"Missing character":`缺少字符`,"Line too wide by {amount}pt":`行宽超出 {amount}pt`,Errors:`错误`,Warnings:`警告`,"{n} compilation error":`{n} 个编译错误`,"{n} compilation errors":`{n} 个编译错误`,"{n} compilation warning":`{n} 个编译警告`,"{n} compilation warnings":`{n} 个编译警告`,"Compilation log":`编译日志`,"p. {page}":`第 {page} 页`,"Compilation problems":`编译问题`,"Recompiling; this list will update.":`正在重新编译,列表稍后更新。`,"Loading…":`正在加载…`,"The first build is still running.":`首次编译仍在进行。`,"No problems in the last build.":`上次编译没有发现问题。`,"Typesetting and other remarks":`排版及其他提示`,"Raw log":`原始日志`,"Fix with an agent…":`交给代理修复…`,"The latest changes did not compile. This is the last PDF that did.":`最新的修改未能编译,当前显示的是上一次编译成功的 PDF。`,"Show problems":`查看问题`,"Reported {n} times":`出现 {n} 次`},k=[{id:`en`,name:`English`},{id:`zh-CN`,name:`简体中文`}],A=`papilot:language`,j={en:{},"zh-CN":O};function M(e=typeof window>`u`?[]:navigator.languages?.length?navigator.languages:[navigator.language]){for(let t of e){let e=t.toLowerCase();if(e.startsWith(`zh`))return`zh-CN`;if(e.startsWith(`en`))return`en`}return`en`}function N(){let e=D.getItem(A);return e===`en`||e===`zh-CN`?e:`system`}var P={choice:N(),language:`en`};P.language=P.choice===`system`?M():P.choice;var F=new Set;function I(e){let t=e===`system`?M():e;(e!==P.choice||t!==P.language)&&(P={choice:e,language:t},F.forEach(e=>e())),typeof document<`u`&&(document.documentElement.lang=t)}I(P.choice),typeof window<`u`&&(window.addEventListener(`languagechange`,()=>I(P.choice)),window.addEventListener(`storage`,e=>{(e.key===A||e.key===null)&&I(N())}));function ee(e){e===`system`?D.removeItem(A):D.setItem(A,e),I(e)}var L=()=>P.language,te=()=>P.language===`zh-CN`?`zh-CN`:`en-US`;function ne(){return(0,S.useSyncExternalStore)(e=>(F.add(e),()=>{F.delete(e)}),()=>P)}function R(e,t){let n=j[P.language][e]??e;return t?n.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e):n}function z(e,t,n,r){return R(e===1?t:n,{n:e,...r})}var re=e=>R(g[e]),ie=e=>e?{"--note-color":h[e],"--note-ink":d(e)===`yellow`?`#422f00`:`#fff`}:{};function ae({group:e}){return e?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`group-dot`,style:ie(e),"aria-hidden":`true`}),R(`Add to group`)]}):R(`Add note`)}function oe({value:e,onChange:t,disabled:n}){let r=(0,S.useId)(),i=(0,S.useRef)(null),a=(0,S.useRef)(null),[o,s]=(0,S.useState)(!1);(0,S.useEffect)(()=>{n&&a.current?.hidePopover()},[n]),(0,S.useEffect)(()=>{if(!o)return;let e=()=>a.current?.hidePopover(),t=t=>{t.target instanceof Node&&t.target.contains(i.current)&&e()};return window.addEventListener(`resize`,e),document.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,t,!0)}},[o]);function c(){return Array.from(a.current.querySelectorAll(`[role="menuitemradio"]`))}function l(){let e=a.current,t=i.current.getBoundingClientRect();e.showPopover(),e.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-e.offsetWidth-8))}px`,e.style.top=`${Math.max(8,Math.min(t.bottom+6,window.innerHeight-e.offsetHeight-8))}px`,(c().find(e=>e.getAttribute(`aria-checked`)===`true`)||c()[0])?.focus()}function f(e){a.current?.hidePopover(),i.current?.focus(),t(e)}return(0,C.jsxs)(`div`,{className:`group-picker`,style:ie(e||void 0),children:[(0,C.jsx)(`button`,{ref:i,type:`button`,className:`icon-button group-select`,"data-group":e||void 0,"aria-label":R(`Annotation group color`),title:R(`Annotation groups`),"aria-haspopup":`menu`,"aria-expanded":o,popoverTarget:r,disabled:n,onClick:e=>{e.preventDefault(),a.current?.matches(`:popover-open`)?a.current.hidePopover():l()},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),l())},children:(0,C.jsx)(`span`,{className:`group-highlight`,"aria-hidden":`true`,children:(0,C.jsx)(T,{name:`pen`,size:18})})}),(0,C.jsxs)(`div`,{ref:a,id:r,popover:`auto`,role:`menu`,"aria-label":R(`Annotation group color`),className:`group-palette`,onToggle:e=>s(e.nativeEvent.newState===`open`),onKeyDown:e=>{if(e.key===`Tab`)a.current?.hidePopover(),i.current?.focus();else if(e.stopPropagation(),e.key===`Escape`)e.preventDefault(),a.current?.hidePopover(),i.current?.focus();else if([`ArrowLeft`,`ArrowRight`,`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=c(),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+([`ArrowRight`,`ArrowDown`].includes(e.key)?1:-1)+t.length)%t.length]?.focus()}},children:[(0,C.jsx)(`div`,{className:`group-palette-label`,children:R(`Color`)}),(0,C.jsx)(`div`,{className:`group-swatches`,children:u.map(t=>(0,C.jsx)(`button`,{type:`button`,className:`group-swatch`,role:`menuitemradio`,"aria-label":re(t),"aria-checked":!!(e&&d(e)===t),style:ie(t),onClick:()=>f(t),children:(0,C.jsx)(`span`,{"aria-hidden":`true`})},t))}),(0,C.jsxs)(`button`,{type:`button`,className:`group-individual`,role:`menuitemradio`,"aria-checked":!e,onClick:()=>f(null),children:[(0,C.jsx)(T,{name:`notes`,size:16}),(0,C.jsx)(`span`,{children:R(`Individual notes`)}),!e&&(0,C.jsx)(T,{name:`check`,size:14})]})]})]})}function se({group:e,value:t,disabled:n,onChange:r}){let i=(0,S.useRef)(null),a=()=>{let e=i.current;e&&e.clientWidth&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight+e.offsetHeight-e.clientHeight,160)}px`)};return(0,S.useLayoutEffect)(a,[t]),(0,S.useEffect)(()=>{let e=i.current,t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,a())});return n.observe(e),()=>n.disconnect()},[]),(0,C.jsxs)(`div`,{className:`group-instruction-input`,children:[(0,C.jsx)(`textarea`,{ref:i,rows:1,maxLength:4e3,"aria-label":R(`Instructions for {group} notes`,{group:re(e)}),placeholder:R(`What should change in this group?`),value:t,disabled:n,onChange:e=>r(e.target.value)}),(0,C.jsx)(T,{name:`pencil`,size:13})]})}function ce({group:e,count:t,active:n,selection:r,children:i}){let[a,o]=(0,S.useState)(!0),s=(0,S.useId)(),c=(0,S.useId)(),l=r?r.count===t?!0:r.count?`mixed`:!1:void 0,u=r?R(`{selected} / {total} locations selected`,{selected:r.count,total:t}):z(t,`{n} location`,`{n} locations`);return(0,S.useEffect)(()=>{n&&o(!0)},[n]),(0,C.jsxs)(`div`,{className:`annotation-group`+(n?` active`:``),role:`group`,"aria-label":`${re(e)} · ${u}`,"data-selected":l,style:ie(e),children:[(0,C.jsxs)(`div`,{className:`group-header`,children:[r?(0,C.jsxs)(`button`,{type:`button`,className:`group-selection-toggle`,"aria-label":R(`Select all {group} notes for this task`,{group:re(e)}),"aria-describedby":s,"aria-pressed":l,disabled:r.disabled,onClick:r.toggle,children:[(0,C.jsx)(`span`,{className:`group-dot`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{id:s,children:u})]}):(0,C.jsxs)(`div`,{className:`group-heading`,children:[(0,C.jsx)(`span`,{className:`group-dot`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:u})]}),(0,C.jsx)(`button`,{type:`button`,className:`group-disclosure`,"aria-label":R(a?`Collapse {group} notes`:`Expand {group} notes`,{group:re(e)}),"aria-expanded":a,"aria-controls":c,onClick:()=>o(e=>!e),children:(0,C.jsx)(T,{name:`chevronDown`,size:12})})]}),(0,C.jsx)(`div`,{id:c,className:`group-locations`,hidden:!a,children:i})]})}var B=`papilot:selected-notes`;function V(){try{let e=JSON.parse(D.getItem(B)||`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>Array.isArray(e[1])&&e[1].every(e=>typeof e==`string`)))}catch{return{}}}function le(e,t){let[n,r]=(0,S.useState)(V);(0,S.useEffect)(()=>{Object.keys(n).length?D.setItem(B,JSON.stringify(n)):D.removeItem(B)},[n]);let i=new Set(n[e]||[]),a=e=>i.has(e);return{selected:t.filter(e=>a(e.id)),has:a,set(t,n){r(r=>{let i=new Set(r[e]||[]);for(let e of t)n?i.add(e):i.delete(e);let a={...r};return i.size?a[e]=[...i]:delete a[e],a})},reset(e){r(t=>{let n={...t};return delete n[e],n})}}}var ue=`papilot:group-instructions`;function de(){let e={};try{let t=JSON.parse(D.getItem(ue)||`{}`);if(!t||typeof t!=`object`||Array.isArray(t))return e;for(let[n,r]of Object.entries(t))try{e[n]=p(r)}catch{}}catch{}return e}function fe(e){let[t,n]=(0,S.useState)(de);return(0,S.useEffect)(()=>{Object.keys(t).length?D.setItem(ue,JSON.stringify(t)):D.removeItem(ue)},[t]),{get:n=>t[e]?.[d(n)]||``,set(t,r){n(n=>({...n,[e]:{...n[e],[d(t)]:r}}))},forNotes(n){return Object.fromEntries(_(n).flatMap(({group:n})=>t[e]?.[n]?.trim()?[[n,t[e][n].trim()]]:[]))},sent(e,t,r){n(n=>{let i={...n},a={...i[e]},o=new Set(t.map(e=>e.id));for(let{group:e}of _(t))r.some(t=>!o.has(t.id)&&t.group&&d(t.group)===e)||delete a[e];return Object.keys(a).length?i[e]=a:delete i[e],i})}}}function pe({text:e}){return(0,C.jsx)(`div`,{className:`note-quote`,children:(0,C.jsx)(`blockquote`,{className:`note-quote-text`,"aria-label":R(`Quoted text`),children:e||R(`Marked region`)})})}function H({children:e}){return(0,C.jsx)(`div`,{className:`note-body`,role:`group`,"aria-label":R(`Your note`),children:e})}var me=[`codex`,`claude`,`cursor`,`antigravity`,`kimi`,`glm`,`deepseek`,`qwen`,`opencode`],he={codex:`Codex`,claude:`Claude`,cursor:`Cursor`,antigravity:`Antigravity`,kimi:`Kimi`,glm:`GLM`,deepseek:`DeepSeek`,qwen:`Qwen`,opencode:`OpenCode`},ge=e=>me.includes(e);function _e(e){let t={errors:0,warnings:0,minor:0},n=new Set;for(let r of e){if(r.kind===`label`&&r.key){if(n.has(r.key))continue;n.add(r.key)}t[r.severity===`error`?`errors`:r.severity===`warning`?`warnings`:`minor`]++}return t}var ve=e=>e===`Continue this task using the decisions and comments from this review round. Preserve accepted changes and do not reintroduce rejected edits. Address any remaining revision requests; if no revision is needed, summarize the result.`||e===`Address the comments from this review round. Preserve accepted changes and do not reintroduce rejected edits.`;function ye(e){return e.split(/\n\n1\. \*\*Page \d+\*\* — /,1)[0].trimEnd()}var be=e=>e?.unsent??[`accepted`,`rejected`,`commented`].reduce((t,n)=>t+(e?.counts?.[n]||0),0),xe=class{key;storage;newId;text;sending=!1;sendingSource=null;revision=0;requestKeys;listeners=new Set;snapshot;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;changed(){this.snapshot={text:this.text,sending:this.sending,sendingSource:this.sendingSource};for(let e of this.listeners)e()}constructor(e,t,n){this.key=e,this.storage=t,this.newId=n,this.text=t.getItem(e)||``,this.requestKeys={draft:n(),feedback:n()},this.snapshot={text:this.text,sending:this.sending,sendingSource:this.sendingSource}}edit(e){this.text=e,this.revision++,this.requestKeys.draft=this.newId(),this.storage.setItem(this.key,e),this.changed()}async submit(e,t,n,r=[]){let i=e===`draft`?this.text:``;if(this.sending||e===`draft`&&!i.trim()&&!n&&!r.length)return!1;let a=this.key+`:request`;if(e===`draft`){let e=JSON.stringify([i.trim(),n||``,r]),t={};try{t=JSON.parse(this.storage.getItem(a)||`{}`)}catch{}this.requestKeys.draft=t?.signature===e&&t.id?t.id:this.newId(),this.storage.setItem(a,JSON.stringify({signature:e,id:this.requestKeys.draft}))}this.sending=!0,this.sendingSource=e,this.changed();let o=this.revision,s=this.requestKeys[e],c=this.storage.getItem(a);try{if(await t({text:i.trim(),requestKey:s,...e===`feedback`?{feedback:!0}:{},...n?{skill:n}:{},...e===`draft`&&r.length?{attachments:r}:{}}),e===`draft`&&this.storage.getItem(a)===c&&this.storage.removeItem(a),e===`draft`&&this.revision===o){let e=this.storage.getItem(this.key);e===i||e===null?(this.text=``,this.storage.removeItem(this.key)):this.text=e}return(e===`feedback`||this.revision===o)&&(this.requestKeys[e]=this.newId()),!0}finally{this.sending=!1,this.sendingSource=null,this.changed()}}};function Se(e){let t=(e.split(`
3
- `).find(e=>e.trim())||``).replace(/^[\s#>*+-]+/,``).replace(/\s+/g,` `).trim().replace(/\.$/,``);if(!t)return`Untitled task`;if(t.length<=80)return t;let n=t.slice(0,80),r=n.lastIndexOf(` `);return(r>40?n.slice(0,r):n).replace(/[\s,.;:]+$/,``)+`…`}function Ce(e,t){return e.key!==`Enter`||e.isComposing||e.keyCode===229?!1:e.metaKey||e.ctrlKey||!t&&!e.shiftKey&&!e.altKey}function we(e,t,n=280,r=!0){(0,S.useLayoutEffect)(()=>{if(!r)return;let i=e.current,a=i.closest(`.note-layer`),o=i.closest(`.pdf-container`),s=0,c=()=>{let e=a.getBoundingClientRect(),r=o.getBoundingClientRect(),s=Math.max(e.left,r.left)+8,c=Math.min(e.right,r.right)-8,l=Math.max(e.top,r.top)+8,u=Math.min(e.bottom,r.bottom)-8,d={left:e.left+t[0]*e.width,right:e.left+t[2]*e.width,top:e.top+t[1]*e.height,bottom:e.top+t[3]*e.height},f=c>s&&u>l&&d.bottom>=l&&d.top<=u&&d.right>=s&&d.left<=c;if(i.style.visibility=f?`visible`:`hidden`,!f)return;let p=Math.min(n,c-s);i.style.width=`${p}px`,i.style.maxHeight=`${u-l}px`;let m=i.getBoundingClientRect().height,h=c-d.right>=p+12,g=h?d.right+12:Math.max(s,Math.min(d.left,c-p)),_=u-d.bottom,v=d.top-l,y=h?d.top:_>=m+10||_>=v?d.bottom+10:d.top-m-10;i.style.left=`${g-e.left}px`,i.style.top=`${Math.max(l,Math.min(y,u-m))-e.top}px`},l=()=>{cancelAnimationFrame(s),s=requestAnimationFrame(c)},u=new ResizeObserver(l);return u.observe(a),u.observe(o),u.observe(i),o.addEventListener(`scroll`,l),window.addEventListener(`resize`,l),c(),()=>{u.disconnect(),cancelAnimationFrame(s),o.removeEventListener(`scroll`,l),window.removeEventListener(`resize`,l)}},[e,r,n,t[0],t[1],t[2],t[3]])}function Te({number:e,ai:t=!1,selected:n,disabled:r,destination:i,onClick:a}){let o=i?R(n?`Kept on manuscript`:`Keep on manuscript`):R(t?`Include suggestion {n} in this task`:`Include note {n} in this task`,{n:e});return(0,C.jsx)(`button`,{type:`button`,className:`icon-button pdf-note-attach`,"aria-label":o,"aria-pressed":i?void 0:n,title:i?o:R(n?`Remove from draft`:`Quote in chat`),disabled:r||!!(i&&n),onClick:a,children:(0,C.jsx)(T,{name:i?n?`bookmarkFilled`:`bookmark`:`arrowRightSolid`,size:i?16:18})})}function Ee({note:e,number:t,index:n,total:r,selected:i,busy:a,error:o,draft:s,onDraftChange:c,onToggle:l,onDismiss:u,onClose:d,onPrevious:f,onNext:p,onSave:m,onEditing:h,destination:g,inline:_=!1,header:v,children:y}){let b=(0,S.useRef)(null),x=(0,S.useRef)(!1),w=(0,S.useRef)(null),E=(0,S.useRef)(null),D=s!==null,O=!!e.aiReview;(0,S.useEffect)(()=>(h?.(D),()=>h?.(!1)),[D,h]);function k(){c(null),requestAnimationFrame(()=>w.current?.focus({preventScroll:!0}))}function A(){a||c(e.comment)}function j(e=!0){_?(c(null),e&&requestAnimationFrame(()=>w.current?.focus({preventScroll:!0}))):d?.(e)}async function M(t=`keep`,n=!0){if(a||x.current)return;let r=s?.trim();if(D&&!r)t===`close`&&j(n);else{if(D&&r!==e.comment){x.current=!0;try{if(!await m(r,t))return}finally{x.current=!1}}else t===`quote`&&l?.();t===`close`?(c(null),j(n)):D&&k()}}return(0,S.useEffect)(()=>{if(_&&!D)return;let e=b.current,t=t=>{t.button===0&&!t.composedPath().includes(e)&&M(`close`,!1)},n=t=>{if(_&&!e.contains(document.activeElement)||t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.keyCode===229)return;let n=t.target instanceof Element?t.target.closest(`dialog,[role="dialog"],[role="menu"],[role="listbox"]`):null;n&&n!==e||(t.preventDefault(),t.stopPropagation(),M(`close`,e.contains(document.activeElement)))};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,n,!0)}},[_,D,s,a,e.comment,d,m,l,c]),(0,S.useLayoutEffect)(()=>{let e=E.current;e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[D]),(0,S.useLayoutEffect)(()=>{let e=E.current;e&&(e.style.height=`0`,e.style.height=`${e.scrollHeight}px`)},[s]),we(b,e.rect,e.aiReview?330:280,!_),(0,S.useLayoutEffect)(()=>{_||E.current&&!E.current.disabled||b.current?.focus({preventScroll:!0})},[_,e.id]),(0,C.jsxs)(`section`,{ref:b,className:`pdf-note-card `+(O?`pdf-suggestion`:`pdf-personal-note`)+(_?` pdf-note-inline`:``),role:_?`group`:`dialog`,"aria-modal":_?void 0:!1,"aria-label":R(O?`AI suggestion {n}`:`PDF note {n}`,{n:t}),tabIndex:_?void 0:-1,children:[v,(0,C.jsxs)(`div`,{className:`pdf-note-content`,children:[(0,C.jsx)(`div`,{className:`pdf-suggestion-body`,children:D?(0,C.jsx)(`textarea`,{ref:E,className:`pdf-note-input`,"aria-label":R(`Edit note {n}`,{n:t}),placeholder:R(`Write a note…`),value:s,rows:1,maxLength:4e3,readOnly:a,onChange:e=>c(e.target.value),onKeyDown:e=>{Ce(e.nativeEvent,window.matchMedia(`(pointer: coarse)`).matches)&&(e.preventDefault(),M())}}):O?(0,C.jsx)(`p`,{children:e.comment}):(0,C.jsx)(`p`,{ref:w,className:`pdf-note-text note-edit-trigger`,role:`button`,tabIndex:a?-1:0,"aria-disabled":a,"aria-label":R(`Edit note {n}: {comment}`,{n:t,comment:e.comment}),title:R(`Edit note`),onClick:()=>{let e=window.getSelection();e&&!e.isCollapsed&&w.current?.contains(e.anchorNode)||A()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),A())},children:e.comment||(e.group?R(`Highlighted in {group}`,{group:re(e.group)}):``)})}),!_&&(0,C.jsx)(`button`,{type:`button`,className:`icon-button pdf-note-close`,"aria-label":R(O?`Close suggestion`:`Close note`),title:R(O?`Close suggestion`:`Close note`),disabled:a,onClick:()=>void M(`close`),children:a?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(T,{name:`close`,size:14})})]}),y,o&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:o}),(0,C.jsxs)(`div`,{className:`pdf-note-tools`,children:[e.aiReview&&!g&&(0,C.jsx)(`span`,{className:`pdf-note-origin`,title:R(`AI suggestion`),children:he[e.aiReview.agent]}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button pdf-note-delete`,"aria-label":R(O?`Ignore suggestion {n}`:`Delete note {n}`,{n:t}),title:R(O?`Ignore`:`Delete note`),disabled:a,onClick:u,children:(0,C.jsx)(T,{name:`trash`,size:14})}),(0,C.jsx)(`span`,{className:`pdf-note-tools-space`}),O&&r>1&&(0,C.jsxs)(`div`,{className:`pdf-suggestion-navigation`,children:[(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Previous suggestion`),title:R(`Previous suggestion (←)`),"aria-keyshortcuts":`ArrowLeft`,disabled:a||n<=0,onClick:f,children:(0,C.jsx)(T,{name:`chevronLeft`,size:14})}),(0,C.jsxs)(`span`,{"aria-label":R(`{current} of {total}`,{current:n+1,total:r}),children:[n+1,`/`,r]}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Next suggestion`),title:R(`Next suggestion (→)`),"aria-keyshortcuts":`ArrowRight`,disabled:a||n>=r-1,onClick:p,children:(0,C.jsx)(T,{name:`chevronRight`,size:14})})]}),(0,C.jsx)(Te,{number:t,ai:O,selected:i,disabled:a||D&&!s.trim(),destination:g,onClick:()=>{g&&!_&&b.current?.focus({preventScroll:!0}),M(`quote`)}})]})]})}var De=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&&j(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&&j(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,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(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}}}})),Oe=o(((e,t)=>{t.exports=De()})),ke=o((e=>{var t=y();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),Ae=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=ke()})),je=o((e=>{var t=Oe(),n=y(),r=Ae();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,b=null;function x(e,t,n){return e===n||e===t&&(v=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(v=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),L=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),ne=Symbol.for(`react.legacy_hidden`),R=Symbol.for(`react.memo_cache_sentinel`),z=Symbol.for(`react.view_transition`),re=Symbol.for(`react.recoverable`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case te:return`Activity`;case z:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case L:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function fe(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function H(e,t){de++,ue[de]=e.current,e.current=t}var me=fe(null),he=fe(null),ge=fe(null),_e=fe(null);function ve(e,t){switch(H(ge,t),H(he,e),H(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(me),H(me,e)}function ye(){pe(me),pe(he),pe(ge)}function be(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,H(_e,e)),t=me.current;var n=fp(t,e.type);t!==n&&(H(he,e),H(me,n))}function xe(e){he.current===e&&(pe(me),pe(he)),_e.current===e&&(pe(_e),ch._currentValue=le)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
4
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
5
- `+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
6
- `),l=s.split(`
7
- `);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=`
8
- `+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{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);case 30:return we(`ViewTransition`);default:return``}}function ke(e){try{var t=``,n=null;do t+=De(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
9
- Error generating stack: `+e.message+`
10
- `+e.stack}}var je=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,Pe=t.unstable_shouldYield,Fe=t.unstable_requestPaint,Ie=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,Re=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,Ve=t.unstable_LowPriority,He=t.unstable_IdlePriority,Ue=t.log,We=t.unstable_setDisableYieldValue,Ge=null,Ke=null;function qe(e){if(typeof Ue==`function`&&We(e),Ke&&typeof Ke.setStrictMode==`function`)try{Ke.setStrictMode(Ge,e)}catch{}}var Je=Math.clz32?Math.clz32:Ze,Ye=Math.log,Xe=Math.LN2;function Ze(e){return e>>>=0,e===0?32:31-(Ye(e)/Xe|0)|0}var Qe=256,$e=262144,et=4194304;function tt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nt(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=tt(n))):i=tt(o):i=tt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=tt(n))):i=tt(o)):i=tt(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 rt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function it(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Je(n),i=1<<r;t|=e[r],n&=~i}return t}function at(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 ot(){var e=et;return et<<=1,!(et&62914560)&&(et=4194304),e}function st(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lt(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-Je(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&&ut(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ut(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function dt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ft(e,t){var n=t&-t;return n=n&42?1:pt(n),(n&(e.suspendedLanes|t))===0?n:0}function pt(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 mt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ht(){var e=V.p;return e===0?(e=window.event,e===void 0?32:wh(e.type)):e}function gt(e,t){var n=V.p;try{return V.p=e,t()}finally{V.p=n}}var _t=Math.random().toString(36).slice(2),vt=`__reactFiber$`+_t,yt=`__reactProps$`+_t,bt=`__reactContainer$`+_t,xt=`__reactEvents$`+_t,St=`__reactListeners$`+_t,Ct=`__reactHandles$`+_t,wt=`__reactResources$`+_t,Tt=`__reactMarker$`+_t,Et=`__reactLoad$`+_t;function Dt(e){delete e[vt],delete e[yt],delete e[St],delete e[Ct]}function Ot(e){var t;if(t=e[vt])return t;for(var n=e.parentNode;n;){if(t=n[bt]||n[vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pm(e);e!==null;){if(n=e[vt])return n;e=pm(e)}return t}e=n,n=e.parentNode}return null}function kt(e){if(e=e[vt]||e[bt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function At(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function jt(e){var t=e[wt];return t||=e[wt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Mt(e){e[Tt]=!0}function Nt(e){e[Et]=void 0}var Pt=new Set,Ft={};function It(e,t){Lt(e,t),Lt(e+`Capture`,t)}function Lt(e,t){for(Ft[e]=t,e=0;e<t.length;e++)Pt.add(t[e])}var Rt=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]*$`),zt={},U={};function Bt(e){return je.call(U,e)?!0:je.call(zt,e)?!1:Rt.test(e)?U[e]=!0:(zt[e]=!0,!1)}var Vt=!1;function W(){var e=Vt;return Vt=!1,e}function Ht(e,t,n){if(Bt(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 Ut(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 Wt(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 Gt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function qt(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 Jt(e){if(!e._valueTracker){var t=Kt(e)?`checked`:`value`;e._valueTracker=qt(e,t,``+e[t])}}function Yt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Kt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Xt=/[\n"\\]/g;function Zt(e){return e.replace(Xt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Qt(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=``+Gt(t)):e.value!==``+Gt(t)&&(e.value=``+Gt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):en(e,Gt(n)):o===`number`&&e.value==t?en(e,Gt(e.value)):en(e,Gt(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=``+Gt(s):e.removeAttribute(`name`)}function $t(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)){Jt(e);return}n=n==null?``:``+Gt(n),t=t==null?n:``+Gt(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),Jt(e)}function en(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function tn(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=``+Gt(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 nn(e,t,n){t!=null&&(t=``+Gt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Gt(n)}function rn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ce(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Gt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Jt(e)}function an(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var on=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 sn(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||on.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function cn(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]=``,Vt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(sn(e,a,r),Vt=!0)}else for(var o in t)t.hasOwnProperty(o)&&sn(e,o,t[o])}function ln(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 un=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),dn=/^[\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 fn(e){return dn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function pn(){}var mn=null;function hn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gn=null,_n=null;function vn(e){var t=kt(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Qt(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="`+Zt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[yt]||null;if(!a)throw Error(i(90));Qt(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&&Yt(r)}break a;case`textarea`:nn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&tn(e,!!n.multiple,t,!1)}}}var yn=!1;function bn(e,t,n){if(yn)return e(t,n);yn=!0;try{return e(t)}finally{if(yn=!1,(gn!==null||_n!==null)&&(Rd(),gn&&(t=gn,e=_n,_n=gn=null,vn(t),e)))for(t=0;t<e.length;t++)vn(e[t])}}function xn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yt]||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 Sn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Cn=!1;if(Sn)try{var wn={};Object.defineProperty(wn,"passive",{get:function(){Cn=!0}}),window.addEventListener(`test`,wn,wn),window.removeEventListener(`test`,wn,wn)}catch{Cn=!1}var Tn=null,En=null,Dn=null;function On(){if(Dn)return Dn;var e,t=En,n=t.length,r,i=`value`in Tn?Tn.value:Tn.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 Dn=i.slice(e,1<r?1-r:void 0)}function kn(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 An(){return!0}function jn(){return!1}function Mn(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)?An:jn,this.isPropagationStopped=jn,this}return T(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=An)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=An)},persist:function(){},isPersistent:An}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pn=Mn(Nn),Fn=T({},Nn,{view:0,detail:0}),In=Mn(Fn),Ln,Rn,zn,Bn=T({},Fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zn,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!==zn&&(zn&&e.type===`mousemove`?(Ln=e.screenX-zn.screenX,Rn=e.screenY-zn.screenY):Rn=Ln=0,zn=e),Ln)},movementY:function(e){return`movementY`in e?e.movementY:Rn}}),Vn=Mn(Bn),Hn=Mn(T({},Bn,{dataTransfer:0})),Un=Mn(T({},Fn,{relatedTarget:0})),Wn=Mn(T({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0})),Gn=Mn(T({},Nn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Kn=Mn(T({},Nn,{data:0})),qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Jn={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`},Yn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Xn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yn[e])?!!t[e]:!1}function Zn(){return Xn}var Qn=Mn(T({},Fn,{key:function(e){if(e.key){var t=qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=kn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zn,charCode:function(e){return e.type===`keypress`?kn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?kn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),$n=Mn(T({},Bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),er=Mn(T({},Nn,{submitter:0})),tr=Mn(T({},Fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zn})),nr=Mn(T({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0})),rr=Mn(T({},Bn,{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})),ir=Mn(T({},Nn,{newState:0,oldState:0,source:0})),ar=[9,13,27,32],or=Sn&&`CompositionEvent`in window,sr=null;Sn&&`documentMode`in document&&(sr=document.documentMode);var cr=Sn&&`TextEvent`in window&&!sr,lr=Sn&&(!or||sr&&8<sr&&11>=sr),ur=` `,dr=!1;function fr(e,t){switch(e){case`keyup`:return ar.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function pr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var mr=!1;function hr(e,t){switch(e){case`compositionend`:return pr(t);case`keypress`:return t.which===32?(dr=!0,ur):null;case`textInput`:return e=t.data,e===ur&&dr?null:e;default:return null}}function gr(e,t){if(mr)return e===`compositionend`||!or&&fr(e,t)?(e=On(),Dn=En=Tn=null,mr=!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 lr&&t.locale!==`ko`?null:t.data;default:return null}}var _r={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 vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!_r[e.type]:t===`textarea`}function yr(e,t,n,r){gn?_n?_n.push(r):_n=[r]:gn=r,t=Jf(t,`onChange`),0<t.length&&(n=new Pn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var br=null,xr=null;function Sr(e){Vf(e,0)}function Cr(e){if(Yt(At(e)))return e}function wr(e,t){if(e===`change`)return t}var Tr=!1;if(Sn){var Er;if(Sn){var Dr=`oninput`in document;if(!Dr){var Or=document.createElement(`div`);Or.setAttribute(`oninput`,`return;`),Dr=typeof Or.oninput==`function`}Er=Dr}else Er=!1;Tr=Er&&(!document.documentMode||9<document.documentMode)}function kr(){br&&(br.detachEvent(`onpropertychange`,Ar),xr=br=null)}function Ar(e){if(e.propertyName===`value`&&Cr(xr)){var t=[];yr(t,xr,e,hn(e)),bn(Sr,t)}}function jr(e,t,n){e===`focusin`?(kr(),br=t,xr=n,br.attachEvent(`onpropertychange`,Ar)):e===`focusout`&&kr()}function Mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Cr(xr)}function Nr(e,t){if(e===`click`)return Cr(t)}function Pr(e,t){if(e===`input`||e===`change`)return Cr(t)}function Fr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ir=typeof Object.is==`function`?Object.is:Fr;function Lr(e,t){if(Ir(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(!je.call(t,i)||!Ir(e[i],t[i]))return!1}return!0}function Rr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function zr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Br(e,t){var n=zr(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=zr(n)}}function Vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rr(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=Rr(e.document)}return t}function Ur(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 Wr=Sn&&`documentMode`in document&&11>=document.documentMode,Gr=null,Kr=null,qr=null,Jr=!1;function Yr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Gr==null||Gr!==Rr(r)||(r=Gr,`selectionStart`in r&&Ur(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qr&&Lr(qr,r)||(qr=r,r=Jf(Kr,`onSelect`),0<r.length&&(t=new Pn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Gr)))}function Xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Zr={animationend:Xr(`Animation`,`AnimationEnd`),animationiteration:Xr(`Animation`,`AnimationIteration`),animationstart:Xr(`Animation`,`AnimationStart`),transitionrun:Xr(`Transition`,`TransitionRun`),transitionstart:Xr(`Transition`,`TransitionStart`),transitioncancel:Xr(`Transition`,`TransitionCancel`),transitionend:Xr(`Transition`,`TransitionEnd`)},Qr={},$r={};Sn&&($r=document.createElement(`div`).style,`AnimationEvent`in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),`TransitionEvent`in window||delete Zr.transitionend.transition);function ei(e){if(Qr[e])return Qr[e];if(!Zr[e])return e;var t=Zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $r)return Qr[e]=t[n];return e}var ti=ei(`animationend`),ni=ei(`animationiteration`),ri=ei(`animationstart`),ii=ei(`transitionrun`),ai=ei(`transitionstart`),oi=ei(`transitioncancel`),si=ei(`transitionend`),ci=new Map,li=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);li.push(`scrollEnd`);function ui(e,t){ci.set(e,t),It(t,[e])}var di=0;function fi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=yd.identifierPrefix;var n=di++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function pi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Dd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function mi(e,t){return e=pi(e),t=pi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var hi=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)},gi=[],G=0,_i=0;function vi(){for(var e=G,t=_i=G=0;t<e;){var n=gi[t];gi[t++]=null;var r=gi[t];gi[t++]=null;var i=gi[t];gi[t++]=null;var a=gi[t];if(gi[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&&xi(n,i,a)}}function K(e,t,n,r){gi[G++]=e,gi[G++]=t,gi[G++]=n,gi[G++]=r,_i|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function yi(e,t,n,r){return K(e,t,n,r),Si(e)}function bi(e,t){return K(e,null,null,t),Si(e)}function xi(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-Je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Si(e){if(50<Od)throw Od=0,kd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ci={};function wi(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 Ti(e,t,n,r){return new wi(e,t,n,r)}function Ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Di(e,t){var n=e.alternate;return n===null?(n=Ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Oi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ki(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ei(r)&&(s=1);else if(typeof r==`string`)s=Jm(e,n,me.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case te:return e=Ti(31,n,t,a),e.elementType=te,e.lanes=o,e;case k:return Ai(n.children,a,o,t);case A:s=8,a|=24;break;case j:return e=Ti(12,n,t,a|2),e.elementType=j,e.lanes=o,e;case F:return e=Ti(13,n,t,a),e.elementType=F,e.lanes=o,e;case I:return e=Ti(19,n,t,a),e.elementType=I,e.lanes=o,e;case ne:case z:return e=a|32,e=Ti(30,n,t,e),e.elementType=z,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case P:s=11;break a;case ee:s=14;break a;case L:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ai(e,t,n,r){return e=Ti(7,e,r,t),e.lanes=n,e}function ji(e,t,n){return e=Ti(6,e,null,t),e.lanes=n,e}function Mi(e){var t=Ti(18,null,null,0);return t.stateNode=e,t}function Ni(e,t,n){return t=Ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Pi=new WeakMap;function Fi(e,t){if(typeof e==`object`&&e){var n=Pi.get(e);return n===void 0?(t={value:e,source:t,stack:ke(t)},Pi.set(e,t),t):n}return{value:e,source:t,stack:ke(t)}}var Ii=[],Li=0,Ri=null,zi=0,Bi=[],Vi=0,Hi=null,Ui=1,Wi=``;function Gi(e,t){Ii[Li++]=zi,Ii[Li++]=Ri,Ri=e,zi=t}function Ki(e,t,n){Bi[Vi++]=Ui,Bi[Vi++]=Wi,Bi[Vi++]=Hi,Hi=e;var r=Ui;e=Wi;var i=32-Je(r)-1;r&=~(1<<i),n+=1;var a=32-Je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ui=1<<32-Je(t)+i|n<<i|r,Wi=a+e}else Ui=1<<a|n<<i|r,Wi=e}function qi(e){e.return!==null&&(Gi(e,1),Ki(e,1,0))}function Ji(e){for(;e===Ri;)Ri=Ii[--Li],Ii[Li]=null,zi=Ii[--Li],Ii[Li]=null;for(;e===Hi;)Hi=Bi[--Vi],Bi[Vi]=null,Wi=Bi[--Vi],Bi[Vi]=null,Ui=Bi[--Vi],Bi[Vi]=null}function Yi(e,t){Bi[Vi++]=Ui,Bi[Vi++]=Wi,Bi[Vi++]=Hi,Ui=t.id,Wi=t.overflow,Hi=e}var Xi=null,Zi=null,q=!1,Qi=null,$i=!1,ea=Error(i(519));function ta(e){throw sa(Fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ea}function na(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[vt]=e,t[yt]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<zf.length;n++)Q(zf[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),$t(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),rn(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||ep(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=pn),t=!0):t=!1,t||ta(e,!0)}function ra(e){for(Xi=e.return;Xi;)switch(Xi.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:Xi=Xi.return}}function ia(e){if(e!==Xi)return!1;if(!q)return ra(e),q=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||mp(e.type,e.memoizedProps)),n=!n),n&&Zi&&ta(e),ra(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Zi=fm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Zi=fm(e)}else t===27?(t=Zi,Cp(e.type)?(e=dm,dm=null,Zi=e):Zi=t):Zi=Xi?um(e.stateNode.nextSibling):null;return!0}function aa(){Zi=Xi=null,q=!1}function oa(){var e=Qi;return e!==null&&(dd===null?dd=e:dd.push.apply(dd,e),Qi=null),e}function sa(e){Qi===null?Qi=[e]:Qi.push(e)}var ca=fe(null),la=null,ua=null;function da(e,t,n){H(ca,t._currentValue),t._currentValue=n}function fa(e){e._currentValue=ca.current,pe(ca)}function pa(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 ma(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),pa(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),pa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),pa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ha(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;Ir(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===_e.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ch]:e.push(ch))}a=a.return}return e!==null&&ma(t,e,n,r),t.flags|=262144,e!==null}function ga(e){for(e=e.firstContext;e!==null;){if(!Ir(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function _a(e){la=e,ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function va(e){return ba(la,e)}function ya(e,t){return la===null&&_a(e),ba(e,t)}function ba(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ua===null){if(e===null)throw Error(i(308));ua=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ua=ua.next=t;return n}var xa=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()})}},Sa=t.unstable_scheduleCallback,Ca=t.unstable_NormalPriority,wa={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ta(){return{controller:new xa,data:new Map,refCount:0}}function Ea(e){e.refCount--,e.refCount===0&&Sa(Ca,function(){e.controller.abort()})}function Da(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Oa=null;function ka(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Aa=null,ja=0,Ma=0,Na=null;function Pa(e,t){if(Aa===null){var n=Aa=[];ja=0,Ma=Pf(),Na={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ja++,t.then(Fa,Fa),t}function Fa(){if(--ja===0&&(Oa=null,Aa!==null)){Na!==null&&(Na.status=`fulfilled`);var e=Aa;Aa=null,Ma=0,Na=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ia(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 La=B.S;B.S=function(e,t){if(md=Ie(),typeof t==`object`&&t&&typeof t.then==`function`&&Pa(e,t),Oa!==null)for(var n=bf;n!==null;)Da(n,Oa),n=n.next;if(n=e.types,n!==null){for(var r=bf;r!==null;)Da(r,n),r=r.next;if(Ma!==0){r=Oa,r===null&&(r=Oa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}La!==null&&La(e,t)};var Ra=fe(null);function za(){var e=Ra.current;return e===null?Yu.pooledCache:e}function Ba(e,t){t===null?H(Ra,Ra.current):H(Ra,t.pool)}function Va(){var e=za();return e===null?null:{parent:wa._currentValue,pool:e}}var Ha=Error(i(460)),Ua=Error(i(474)),Wa=Error(i(542)),Ga={then:function(){}};function Ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function qa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(pn,pn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Za(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(pn,pn);else{if(e=Yu,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,Za(e),e}throw Ya=t,Ha}}function Ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ya=e,Ha):e}}var Ya=null;function Xa(){if(Ya===null)throw Error(i(459));var e=Ya;return Ya=null,e}function Za(e){if(e===Ha||e===Wa)throw Error(i(483))}var Qa=null,$a=0;function eo(e){var t=$a;return $a+=1,Qa===null&&(Qa=[]),qa(Qa,e,t)}function to(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function J(e,t){throw t.$$typeof===E?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function no(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=Di(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ji(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===k?(e=d(e,t,n.props.children,r,n.key),to(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===L&&Ja(i)===t.type)?(t=a(t,n.props),to(t,n),t.return=e,t):(t=ki(n.type,n.key,n.props,null,e.mode,r),to(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=Ni(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=Ai(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=ji(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=ki(t.type,t.key,t.props,null,e.mode,n),to(n,t),n.return=e,n;case O:return t=Ni(t,e.mode,n),t.return=e,t;case L:return t=Ja(t),f(e,t,n)}if(ce(t)||ae(t))return t=Ai(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,eo(t),n);if(t.$$typeof===N)return f(e,ya(e,t),n);J(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 D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case L:return n=Ja(n),p(e,t,n,r)}if(ce(n)||ae(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,eo(n),r);if(n.$$typeof===N)return p(e,t,ya(e,n),r);J(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 D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case L:return r=Ja(r),m(e,t,n,r,i)}if(ce(r)||ae(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,eo(r),i);if(r.$$typeof===N)return m(e,t,n,ya(t,r),i);J(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),q&&Gi(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 q&&Gi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),q&&Gi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),q&&Gi(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 q&&Gi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),q&&Gi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),to(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===L&&Ja(l)===r.type){n(e,r.sibling),c=a(r,o.props),to(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=Ai(o.props.children,e.mode,c,o.key),to(c,o),c.return=e,e=c):(c=ki(o.type,o.key,o.props,null,e.mode,c),to(c,o),c.return=e,e=c)}return s(e);case O: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=Ni(o,e.mode,c),c.return=e,e=c}return s(e);case L:return o=Ja(o),_(e,r,o,c)}if(ce(o))return h(e,r,o,c);if(ae(o)){if(l=ae(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,eo(o),c);if(o.$$typeof===N)return _(e,r,ya(e,o),c);J(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=ji(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{$a=0;var i=_(e,t,n,r);return Qa=null,i}catch(t){if(t===Ha||t===Wa)throw t;var a=Ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Y=no(!0),ro=no(!1),io=!1;function ao(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oo(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 X(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ju&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Si(e),xi(e,null,n),t}return K(e,r,t,n),Si(e)}function co(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,dt(e,n)}}function lo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uo=!1;function fo(){if(uo){var e=Na;if(e!==null)throw e}}function po(e,t,n,r){uo=!1;var i=e.updateQueue;io=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Zu&f)===f:(r&f)===f){f!==0&&f===Ma&&(uo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:io=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ad|=o,e.lanes=o,e.memoizedState=d}}function mo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function ho(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)mo(n[e],t)}var go=fe(null),_o=fe(0);function vo(e,t){e=rd,H(_o,e),H(go,t),rd=e|t.baseLanes}function yo(){H(_o,rd),H(go,go.current)}function bo(){rd=_o.current,pe(go),pe(_o)}var xo=fe(null),So=null;function Co(e){var t=e.alternate;H(Oo,Oo.current&1),H(xo,e),So===null&&(t===null||go.current!==null||t.memoizedState!==null)&&(So=e)}function wo(e){H(Oo,Oo.current),H(xo,e),So===null&&(So=e)}function To(e){e.tag===22?(H(Oo,Oo.current),H(xo,e),So===null&&(So=e)):Eo()}function Eo(){H(Oo,Oo.current),H(xo,xo.current)}function Do(e){pe(xo),So===e&&(So=null),pe(Oo)}var Oo=fe(0);function ko(e,t){H(xo,xo.current),H(Oo,t)}function Ao(e){pe(Oo),pe(xo),So===e&&(So=null)}function jo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sm(n)||cm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mo=0,Z=null,No=null,Po=null,Fo=!1,Io=!1,Lo=!1,Ro=0,zo=0,Bo=null,Vo=0;function Ho(){throw Error(i(321))}function Uo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ir(e[n],t[n]))return!1;return!0}function Wo(e,t,n,r,i,a){return Mo=a,Z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?sc:cc,Lo=!1,a=n(r,i),Lo=!1,Io&&(a=Ko(t,n,r,i)),Go(e),a}function Go(e){B.H=oc;var t=No!==null&&No.next!==null;if(Mo=0,Po=No=Z=null,Fo=!1,zo=0,Bo=null,t)throw Error(i(300));e===null||Tc||(e=e.dependencies,e!==null&&ga(e)&&(Tc=!0))}function Ko(e,t,n,r){Z=e;var a=0;do{if(Io&&(Bo=null),zo=0,Io=!1,25<=a)throw Error(i(301));if(a+=1,Po=No=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}B.H=lc,o=t(n,r)}while(Io);return o}function qo(){var e=B.H,t=e.useState()[0];return t=typeof t.then==`function`?es(t):t,e=e.useState()[0],(No===null?null:No.memoizedState)!==e&&(Z.flags|=1024),t}function Jo(){var e=Ro!==0;return Ro=0,e}function Yo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Xo(e){if(Fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Fo=!1}Mo=0,Po=No=Z=null,Io=!1,zo=Ro=0,Bo=null}function Zo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Po===null?Z.memoizedState=Po=e:Po=Po.next=e,Po}function Qo(){if(No===null){var e=Z.alternate;e=e===null?null:e.memoizedState}else e=No.next;var t=Po===null?Z.memoizedState:Po.next;if(t!==null)Po=t,No=e;else{if(e===null)throw Z.alternate===null?Error(i(467)):Error(i(310));No=e,e={memoizedState:No.memoizedState,baseState:No.baseState,baseQueue:No.baseQueue,queue:No.queue,next:null},Po===null?Z.memoizedState=Po=e:Po=Po.next=e}return Po}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function es(e){var t=zo;return zo+=1,Bo===null&&(Bo=[]),e=qa(Bo,e,t),t=Z,(Po===null?t.memoizedState:Po.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?sc:cc),e}function ts(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return es(e);if(e.$$typeof===re)return;if(e.$$typeof===N)return va(e)}throw Error(i(438,String(e)))}function ns(e){var t=null,n=Z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Z.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=$o(),Z.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]=R;return t.index++,n}function rs(e,t){return typeof t==`function`?t(e):t}function is(e){return as(Qo(),No,e)}function as(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?(Mo&f)===f:(Zu&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===Ma&&(d=!0);else if((Mo&p)===p){u=u.next,p===Ma&&(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,Z.lanes|=p,ad|=p;f=u.action,Lo&&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,Z.lanes|=f,ad|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ir(o,e.memoizedState)&&(Tc=!0,d&&(n=Na,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 os(e){var t=Qo(),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);Ir(o,t.memoizedState)||(Tc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ss(e,t,n){var r=Z,a=Qo(),o=q;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ir((No||a).memoizedState,n);if(s&&(a.memoizedState=n,Tc=!0),a=a.queue,Ms(us.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Po!==null&&!!(Po.memoizedState.tag&1),Ds(e?9:8,{destroy:void 0},ls.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Yu===null)throw Error(i(349));o||Mo&127||cs(r,t,n)}return n}function cs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Z.updateQueue,t===null?(t=$o(),Z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ls(e,t,n,r){t.value=n,t.getSnapshot=r,ds(t)&&fs(e)}function us(e,t,n){return n(function(){ds(t)&&fs(e)})}function ds(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ir(e,n)}catch{return!0}}function fs(e){var t=bi(e,2);t!==null&&Nd(t,e,2)}function ps(e){var t=Zo();if(typeof e==`function`){var n=e;if(e=n(),Lo){qe(!0);try{n()}finally{qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:e},t}function ms(e,t,n,r){return e.baseState=n,as(e,No,typeof r==`function`?r:rs)}function hs(e,t,n,r,a){if(rc(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)}};B.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,gs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function gs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=B.T,o={};o.types=a===null?null:a.types,B.T=o;try{var s=n(i,r),c=B.S;c!==null&&c(o,s),_s(e,t,s)}catch(n){ys(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),B.T=a}}else try{a=n(i,r),_s(e,t,a)}catch(n){ys(e,t,n)}}function _s(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){vs(e,t,n)},function(n){return ys(e,t,n)}):vs(e,t,n)}function vs(e,t,n){t.status=`fulfilled`,t.value=n,bs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,gs(e,n)))}function ys(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,bs(t),t=t.next;while(t!==r)}e.action=null}function bs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function xs(e,t){return t}function Ss(e,t){if(q){var n=Yu.formState;if(n!==null){a:{var r=Z;if(q){if(Zi){b:{for(var i=Zi,a=$i;i.nodeType!==8;)if(!a||(i=um(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Zi=um(i.nextSibling),r=i.data===`F!`;break a}}ta(r)}r=!1}r&&(t=n[0])}}return n=Zo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:t},n.queue=r,n=ec.bind(null,Z,r),r.dispatch=n,r=ps(!1),a=nc.bind(null,Z,!1,r.queue),r=Zo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=hs.bind(null,Z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Cs(e){return ws(Qo(),No,e)}function ws(e,t,n){if(t=as(e,t,xs)[0],e=is(rs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=es(t)}catch(e){throw e===Ha?Wa:e}else r=t;t=Qo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Z.flags|=2048,Ds(9,{destroy:void 0},Ts.bind(null,i,n),null)),[r,a,e]}function Ts(e,t){e.action=t}function Es(e){var t=Qo(),n=No;if(n!==null)return ws(t,n,e);Qo(),t=t.memoizedState,n=Qo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ds(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Z.updateQueue,t===null&&(t=$o(),Z.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 Os(){return Qo().memoizedState}function ks(e,t,n,r){var i=Zo();Z.flags|=e,i.memoizedState=Ds(1|t,{destroy:void 0},n,r===void 0?null:r)}function As(e,t,n,r){var i=Qo();r=r===void 0?null:r;var a=i.memoizedState.inst;No!==null&&r!==null&&Uo(r,No.memoizedState.deps)?i.memoizedState=Ds(t,a,n,r):(Z.flags|=e,i.memoizedState=Ds(1|t,a,n,r))}function js(e,t){ks(8390656,8,e,t)}function Ms(e,t){As(2048,8,e,t)}function Ns(e){Z.flags|=4;var t=Z.updateQueue;if(t===null)t=$o(),Z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ps(e){var t=Qo().memoizedState;return Ns({ref:t,nextImpl:e}),function(){if(Ju&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Fs(e,t){return As(4,2,e,t)}function Is(e,t){return As(4,4,e,t)}function Ls(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 Rs(e,t,n){n=n==null?null:n.concat([e]),As(4,4,Ls.bind(null,t,e),n)}function zs(){}function Bs(e,t){var n=Qo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Uo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Vs(e,t){var n=Qo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Uo(t,r[1]))return r[0];if(r=e(),Lo){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[r,t],r}function Hs(e,t,n){return n===void 0||Mo&1073741824&&!(Zu&261930)?e.memoizedState=t:(e.memoizedState=n,e=jd(),Z.lanes|=e,ad|=e,n)}function Us(e,t,n,r){return Ir(n,t)?n:go.current===null?!(Mo&106)||Mo&1073741824&&!(Zu&261930)?(Tc=!0,e.memoizedState=n):(e=jd(),Z.lanes|=e,ad|=e,t):(e=Hs(e,n,r),Ir(e,t)||(Tc=!0),e)}function Ws(e,t,n,r,i){var a=V.p;V.p=a!==0&&8>a?a:8;var o=B.T,s={};s.types=o===null?null:o.types,B.T=s,nc(e,!1,t,n);try{var c=i(),l=B.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?tc(e,t,Ia(c,r),Ad(e)):tc(e,t,r,Ad(e))}catch(n){tc(e,t,{then:function(){},status:`rejected`,reason:n},Ad())}finally{V.p=a,o!==null&&s.types!==null&&(o.types=s.types),B.T=o}}function Gs(){}function Ks(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=qs(e).queue;Ws(e,a,t,le,n===null?Gs:function(){return Js(e),n(r)})}function qs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Js(e){var t=qs(e);t.next===null&&(t=e.alternate.memoizedState),tc(e,t.next.queue,{},Ad())}function Ys(){return va(ch)}function Xs(){return Qo().memoizedState}function Zs(){return Qo().memoizedState}function Qs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ad();e=X(n);var r=so(t,e,n);r!==null&&(Nd(r,t,n),co(r,t,n)),t={cache:Ta()},e.payload=t;return}t=t.return}}function $s(e,t,n){var r=Ad();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},rc(e)?ic(t,n):(n=yi(e,t,n,r),n!==null&&(Nd(n,e,r),ac(n,t,r)))}function ec(e,t,n){tc(e,t,n,Ad())}function tc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(rc(e))ic(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,Ir(s,o))return K(e,t,i,0),Yu===null&&vi(),!1}catch{}if(n=yi(e,t,i,r),n!==null)return Nd(n,e,r),ac(n,t,r),!0}return!1}function nc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},rc(e)){if(t)throw Error(i(479))}else t=yi(e,n,r,2),t!==null&&Nd(t,e,2)}function rc(e){var t=e.alternate;return e===Z||t!==null&&t===Z}function ic(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ac(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var oc={readContext:va,use:ts,useCallback:Ho,useContext:Ho,useEffect:Ho,useImperativeHandle:Ho,useLayoutEffect:Ho,useInsertionEffect:Ho,useMemo:Ho,useReducer:Ho,useRef:Ho,useState:Ho,useDebugValue:Ho,useDeferredValue:Ho,useTransition:Ho,useSyncExternalStore:Ho,useId:Ho,useHostTransitionStatus:Ho,useFormState:Ho,useActionState:Ho,useOptimistic:Ho,useMemoCache:Ho,useCacheRefresh:Ho,useEffectEvent:Ho},sc={readContext:va,use:ts,useCallback:function(e,t){return Zo().memoizedState=[e,t===void 0?null:t],e},useContext:va,useEffect:js,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ks(4194308,4,Ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ks(4194308,4,e,t)},useInsertionEffect:function(e,t){ks(4,2,e,t)},useMemo:function(e,t){var n=Zo();t=t===void 0?null:t;var r=e();if(Lo){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Zo();if(n!==void 0){var i=n(t);if(Lo){qe(!0);try{n(t)}finally{qe(!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=$s.bind(null,Z,e),[r.memoizedState,e]},useRef:function(e){var t=Zo();return e={current:e},t.memoizedState=e},useState:function(e){e=ps(e);var t=e.queue,n=ec.bind(null,Z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:zs,useDeferredValue:function(e,t){return Hs(Zo(),e,t)},useTransition:function(){var e=ps(!1);return e=Ws.bind(null,Z,e.queue,!0,!1),Zo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Z,a=Zo();if(q){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Yu===null)throw Error(i(349));Zu&127||cs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,js(us.bind(null,r,o,e),[e]),r.flags|=2048,Ds(9,{destroy:void 0},ls.bind(null,r,o,n,t),null),n},useId:function(){var e=Zo(),t=Yu.identifierPrefix;if(q){var n=Wi,r=Ui;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Ro++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Vo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ys,useFormState:Ss,useActionState:Ss,useOptimistic:function(e){var t=Zo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=nc.bind(null,Z,!0,n),n.dispatch=t,[e,t]},useMemoCache:ns,useCacheRefresh:function(){return Zo().memoizedState=Qs.bind(null,Z)},useEffectEvent:function(e){var t=Zo(),n={impl:e};return t.memoizedState=n,function(){if(Ju&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},cc={readContext:va,use:ts,useCallback:Bs,useContext:va,useEffect:Ms,useImperativeHandle:Rs,useInsertionEffect:Fs,useLayoutEffect:Is,useMemo:Vs,useReducer:is,useRef:Os,useState:function(){return is(rs)},useDebugValue:zs,useDeferredValue:function(e,t){return Us(Qo(),No.memoizedState,e,t)},useTransition:function(){var e=is(rs)[0],t=Qo().memoizedState;return[typeof e==`boolean`?e:es(e),t]},useSyncExternalStore:ss,useId:Xs,useHostTransitionStatus:Ys,useFormState:Cs,useActionState:Cs,useOptimistic:function(e,t){return ms(Qo(),No,e,t)},useMemoCache:ns,useCacheRefresh:Zs,useEffectEvent:Ps},lc={readContext:va,use:ts,useCallback:Bs,useContext:va,useEffect:Ms,useImperativeHandle:Rs,useInsertionEffect:Fs,useLayoutEffect:Is,useMemo:Vs,useReducer:os,useRef:Os,useState:function(){return os(rs)},useDebugValue:zs,useDeferredValue:function(e,t){var n=Qo();return No===null?Hs(n,e,t):Us(n,No.memoizedState,e,t)},useTransition:function(){var e=os(rs)[0],t=Qo().memoizedState;return[typeof e==`boolean`?e:es(e),t]},useSyncExternalStore:ss,useId:Xs,useHostTransitionStatus:Ys,useFormState:Es,useActionState:Es,useOptimistic:function(e,t){var n=Qo();return No===null?(n.baseState=e,[e,n.queue.dispatch]):ms(n,No,e,t)},useMemoCache:ns,useCacheRefresh:Zs,useEffectEvent:Ps};function uc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var dc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ad(),i=X(r);i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(Nd(t,e,r),co(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ad(),i=X(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(Nd(t,e,r),co(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ad(),r=X(n);r.tag=2,t!=null&&(r.callback=t),t=so(e,r,n),t!==null&&(Nd(t,e,n),co(t,e,n))}};function fc(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?!Lr(n,r)||!Lr(i,a):!0}function pc(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&&dc.enqueueReplaceState(t,t.state,null)}function mc(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=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function hc(e){hi(e)}function gc(e){console.error(e)}function _c(e){hi(e)}function vc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function yc(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 bc(e,t,n){return n=X(n),n.tag=3,n.payload={element:null},n.callback=function(){vc(e,t)},n}function xc(e){return e=X(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(){yc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){yc(t,n,r),typeof i!=`function`&&(_d===null?_d=new Set([this]):_d.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&&ha(t,n,a,!0),n=xo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return So===null?Gd():n.alternate===null&&id===0&&(id=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),mf(e,r,a)),!1;case 22:return n.flags|=65536,r===Ga?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)),mf(e,r,a)),!1}throw Error(i(435,n.tag))}return mf(e,r,a),Gd(),!1}if(q)return t=xo.current,t===null?(r!==ea&&(t=Error(i(423),{cause:r}),sa(Fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Fi(r,n),a=bc(e.stateNode,r,a),lo(e,a),id!==4&&(id=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ea&&(e=Error(i(422),{cause:r}),sa(Fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Fi(o,n),ud===null?ud=[o]:ud.push(o),id!==4&&(id=2),t===null)return!0;r=Fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=bc(n.stateNode,r,e),lo(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`&&(_d===null||!_d.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=xc(a),Sc(a,e,n,r),lo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var wc=Error(i(461)),Tc=!1;function Ec(e,t,n,r){t.child=e===null?ro(t,null,n,r):Y(t,e.child,n,r)}function Dc(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 _a(t),r=Wo(e,t,n,o,a,i),s=Jo(),e!==null&&!Tc?(Yo(e,t,i),tl(e,t,i)):(q&&s&&qi(t),t.flags|=1,Ec(e,t,r,i),t.child)}function Oc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,kc(e,t,a,r,i)):(e=ki(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!nl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Lr:n,n(o,r)&&e.ref===t.ref)return tl(e,t,i)}return t.flags|=1,e=Di(a,r),e.ref=t.ref,e.return=t,t.child=e}function kc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Lr(a,r)&&e.ref===t.ref){if(Tc=!1,t.pendingProps=r=a,nl(e,i))e.flags&131072&&(Tc=!0);else return t.lanes=e.lanes,tl(e,t,i)}}return Lc(e,t,n,r,i)}function Ac(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 Mc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ba(t,a===null?null:a.cachePool),a===null?yo():vo(t,a),To(t);else return r=t.lanes=536870912,Mc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ba(t,null),yo(),Eo()):(Ba(t,a.cachePool),vo(t,a),Eo(),t.memoizedState=null);return Ec(e,t,i,n),t.child}function jc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Mc(e,t,n,r,i){var a=za();return a=a===null?null:{parent:wa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ba(t,null),yo(),To(t),e!==null&&ha(e,t,r,!0),t.childLanes=i,null}function Nc(e,t){return t=Kc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Pc(e,t,n){return Y(t,e.child,null,n),e=Nc(t,t.pendingProps),e.flags|=2,Do(t),t.memoizedState=null,e}function Fc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(q){if(r.mode===`hidden`)return e=Nc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},jc(null,e);if(wo(t),(e=Zi)?(e=om(e,$i),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hi===null?null:{id:Ui,overflow:Wi},retryLane:536870912,hydrationErrors:null},n=Mi(e),n.return=t,t.child=n,Xi=t,Zi=null)):e=null,e===null)throw ta(t);return t.lanes=536870912,null}return Nc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(wo(t),a){if(t.flags&256)t.flags&=-257,t=Pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Tc||ha(e,t,n,!1),a=(n&e.childLanes)!==0,Tc||a){if(go.current===null){if(r=Yu,r!==null&&(s=ft(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,bi(e,s),Nd(r,e,s),wc;Gd()}t=Pc(e,t,n)}else e=o.treeContext,Zi=um(s.nextSibling),Xi=t,q=!0,Qi=null,$i=!1,e!==null&&Yi(t,e),t=Nc(t,r),t.flags|=134221824;return t}return e=Di(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ic(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 Lc(e,t,n,r,i){return _a(t),n=Wo(e,t,n,r,void 0,i),r=Jo(),e!==null&&!Tc?(Yo(e,t,i),tl(e,t,i)):(q&&r&&qi(t),t.flags|=1,Ec(e,t,n,i),t.child)}function Rc(e,t,n,r,i,a){return _a(t),t.updateQueue=null,n=Ko(t,r,n,i),Go(e),r=Jo(),e!==null&&!Tc?(Yo(e,t,a),tl(e,t,a)):(q&&r&&qi(t),t.flags|=1,Ec(e,t,n,a),t.child)}function zc(e,t,n,r,i){if(_a(t),t.stateNode===null){var a=Ci,o=n.contextType;typeof o==`object`&&o&&(a=va(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=dc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ao(t),o=n.contextType,a.context=typeof o==`object`&&o?va(o):Ci,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(uc(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&&dc.enqueueReplaceState(a,a.state,null),po(t,r,a,i),fo(),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=mc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ci,typeof u==`object`&&u&&(o=va(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)&&pc(t,a,r,o),io=!1;var f=t.memoizedState;a.state=f,po(t,r,a,i),fo(),l=t.memoizedState,s||f!==l||io?(typeof d==`function`&&(uc(t,n,d,r),l=t.memoizedState),(c=io||fc(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,oo(e,t),o=t.memoizedProps,u=mc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ci,typeof l==`object`&&l&&(c=va(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)&&pc(t,a,r,c),io=!1,f=t.memoizedState,a.state=f,po(t,r,a,i),fo();var p=t.memoizedState;o!==d||f!==p||io||e!==null&&e.dependencies!==null&&ga(e.dependencies)?(typeof s==`function`&&(uc(t,n,s,r),p=t.memoizedState),(u=io||fc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ga(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,Ic(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=Y(t,e.child,null,i),t.child=Y(t,null,n,i)):Ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=tl(e,t,i),e}function Bc(e,t,n,r){return aa(),t.flags|=256,Ec(e,t,n,r),t.child}var Vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hc(e){return{baseLanes:e,cachePool:Va()}}function Uc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=cd),e}function Wc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Oo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(q){if(i?Co(t):Eo(),(e=Zi)?(e=om(e,$i),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hi===null?null:{id:Ui,overflow:Wi},retryLane:536870912,hydrationErrors:null},n=Mi(e),n.return=t,t.child=n,Xi=t,Zi=null)):e=null,e===null)throw ta(t);return t.lanes=cm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Eo(),i=t.mode,a=Kc({mode:`hidden`,children:a},i),r=Ai(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Hc(n),r.childLanes=Uc(e,o,n),t.memoizedState=Vc,jc(null,r)):(Co(t),Gc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Jc(e,t,a,o,r,c,s,n)}return i?(Eo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Di(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ai(i,a,n,null),i.flags|=2):i=Di(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,jc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Hc(n):(a=i.cachePool,a===null?a=Va():(s=wa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Uc(e,o,n),t.memoizedState=Vc,jc(e.child,r)):(Co(t),n=e.child,e=n.sibling,n=Di(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Gc(e,t){return t=Kc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Kc(e,t){return e=Ti(22,e,null,t),e.lanes=0,e}function qc(e,t,n){return Y(t,e.child,null,n),e=Gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Co(t),t.flags&=-257,qc(e,t,c)):t.memoizedState===null?(Eo(),o=a.fallback,s=t.mode,a=Kc({mode:`visible`,children:a.children},s),o=Ai(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,Y(t,e.child,null,c),a=t.child,a.memoizedState=Hc(c),a.childLanes=Uc(e,r,c),t.memoizedState=Vc,jc(null,a)):(Eo(),t.child=e.child,t.flags|=128,null);if(Co(t),cm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,sa({value:a,source:null,stack:null})),qc(e,t,c)}if(Tc||ha(e,t,c,!1),r=(c&e.childLanes)!==0,Tc||r){if(go.current!==null)return qc(e,t,c);if(r=Yu,r!==null&&(a=ft(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,bi(e,a),Nd(r,e,a),wc;return sm(o)||Gd(),qc(e,t,c)}return sm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Zi=um(o.nextSibling),Xi=t,q=!0,Qi=null,$i=!1,e!==null&&Yi(t,e),t=Gc(t,a.children),t.flags|=134221824,t)}function Yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pa(e.return,t,n)}function Xc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&jo(n)===null&&(t=e),e=e.sibling}return t}function Zc(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 Qc(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function $c(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Oo.current;if(t.flags&128)return ko(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ko(t,o),i===`backwards`&&e!==null?(Qc(e),Ec(e,t,r,n),Qc(e)):Ec(e,t,r,n),r=q?zi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Yc(e,n,t);else if(e.tag===19)Yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Xc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,Qc(t)),Zc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&jo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Zc(t,!0,n,null,a,r);break;case`together`:Zc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Xc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Zc(t,!1,i,n,a,r)}return t.child}function el(e,t,n){var r=t.pendingProps;return da(t,t.type,r.value),Ec(e,t,r.children,n),t.child}function tl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ad|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ha(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=Di(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Di(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ga(e)))}function rl(e,t,n){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),da(t,wa,e.memoizedState.cache),aa();break;case 27:case 5:be(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Co(t),t.flags|=128,null;r=ha(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Wc(e,t,n):(Co(t),e=tl(e,t,n),e===null?null:e.sibling)}Co(t);break;case 19:if(t.flags&128)return $c(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ha(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return $c(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ko(t,Oo.current),r)break;return null;case 22:return t.lanes=0,Ac(e,t,n,t.pendingProps);case 24:da(t,wa,e.memoizedState.cache)}return tl(e,t,n)}function il(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Tc=!0;else{if(!nl(e,n)&&!(t.flags&128))return Tc=!1,rl(e,t,n);Tc=!!(e.flags&131072)}}else Tc=!1,q&&t.flags&1048576&&Ki(t,zi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ja(t.elementType),t.type=e,typeof e==`function`)Ei(e)?(r=mc(e,r),t.tag=1,t=zc(null,t,e,r,n)):(t.tag=0,t=Lc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===P){t.tag=11,t=Dc(null,t,e,r,n);break a}if(a===ee){t.tag=14,t=Oc(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=el(null,t,n);break a}}throw t=se(e)||e,Error(i(306,t,``))}}return t;case 0:return Lc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=mc(r,t.pendingProps),zc(e,t,r,a,n);case 3:a:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,oo(e,t),po(t,r,null,n);var s=t.memoizedState;if(r=s.cache,da(t,wa,r),r!==o.cache&&ma(t,[wa],n,!0),fo(),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=Bc(e,t,r,n);break a}if(r!==a){a=Fi(Error(i(424)),t),sa(a),t=Bc(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(Zi=um(e.firstChild),Xi=t,q=!0,Qi=null,$i=!0,n=ro(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(aa(),r===a){t=tl(e,t,n);break a}Ec(e,t,r,n)}t=t.child}return t;case 26:return Ic(e,t),e===null?(n=Pm(t.type,null,t.pendingProps,null))?t.memoizedState=n:q||(t.stateNode=pp(t.type,t.pendingProps,ge.current,t)):t.memoizedState=Pm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return be(t),e===null&&q&&(r=t.stateNode=gm(t.type,t.pendingProps,ge.current),Xi=t,$i=!0,a=Zi,Cp(t.type)?(dm=a,Zi=um(r.firstChild)):Zi=a),Ec(e,t,t.pendingProps.children,n),Ic(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&q&&((a=r=Zi)&&(r=im(r,t.type,t.pendingProps,$i),r===null?a=!1:(t.stateNode=r,Xi=t,Zi=um(r.firstChild),$i=!1,a=!0)),a||ta(t)),be(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,mp(a,o)?r=null:s!==null&&mp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Wo(e,t,qo,null,null,n),ch._currentValue=a),Ic(e,t),Ec(e,t,r,n),t.child;case 6:return e===null&&q&&((e=n=Zi)&&(n=am(n,t.pendingProps,$i),n===null?e=!1:(t.stateNode=n,Xi=t,Zi=null,e=!0)),e||ta(t)),null;case 13:return Wc(e,t,n);case 4:return ve(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Y(t,null,r,n):Ec(e,t,r,n),t.child;case 11:return Dc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Ic(e,t),Ec(e,t,r,n),t.child;case 8:return Ec(e,t,t.pendingProps.children,n),t.child;case 12:return Ec(e,t,t.pendingProps.children,n),t.child;case 10:return el(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,_a(t),a=va(a),r=r(a),t.flags|=1,Ec(e,t,r,n),t.child;case 14:return Oc(e,t,t.type,t.pendingProps,n);case 15:return kc(e,t,t.type,t.pendingProps,n);case 19:return $c(e,t,n);case 31:return Fc(e,t,n);case 22:return Ac(e,t,n,t.pendingProps);case 24:return _a(t),r=va(wa),e===null?(a=za(),a===null&&(a=Yu,o=Ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ao(t),da(t,wa,a)):((e.lanes&n)!==0&&(oo(e,t),po(t,null,null,n),fo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,da(t,wa,r),r!==a.cache&&ma(t,[wa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),da(t,wa,r))),Ec(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:q&&qi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Ic(e,t),Ec(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function al(e){e.flags|=4}function ol(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Ym(t,r):Ym(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Hd())e.flags|=8192;else throw Ya=Ga,Ua}}else e.flags&=-16777217}function sl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xm(t)){if(Hd())e.flags|=8192;else throw Ya=Ga,Ua}}function cl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ot(),e.lanes|=t,ld|=t)}function ll(e,t){if(!q)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ul(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function dl(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 ul(t),null;case 1:return ul(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),fa(wa),ye(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ia(t)?al(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,oa())),ul(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(al(t),o===null?(ul(t),ol(t,a,null,r,n)):(ul(t),sl(t,o))):o?o===e.memoizedState?(ul(t),t.flags&=-16777217):(al(t),ul(t),sl(t,o)):(e=e.memoizedProps,e!==r&&al(t),ul(t),ol(t,a,e,r,n)),null;case 27:if(xe(t),n=ge.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return ul(t),t.subtreeFlags&=-33554433,null}e=me.current,ia(t)?na(t,e):(e=gm(a,r,n),t.stateNode=e,al(t))}return ul(t),t.subtreeFlags&=-33554433,null;case 5:if(xe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return ul(t),t.subtreeFlags&=-33554433,null}if(o=me.current,ia(t))na(t,o);else{var s=up(ge.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[vt]=t,o[yt]=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(rp(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&&al(t)}}return ul(t),t.subtreeFlags&=-33554433,ol(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ge.current,ia(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Xi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||ta(t,!0)}else e=up(e).createTextNode(r),e[vt]=t,t.stateNode=e}return ul(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ia(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[vt]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),e=!1}else n=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Do(t),t):(Do(t),null);if(t.flags&128)throw Error(i(558))}return ul(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ia(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[vt]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),a=!1}else a=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Do(t),t):(Do(t),null)}return Do(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),cl(t,t.updateQueue),ul(t),null);case 4:return ye(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,ul(t),null;case 10:return fa(t.type),ul(t),null;case 19:if(Ao(t),r=t.memoizedState,r===null)return ul(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)ll(r,!1);else{if(id!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=jo(e),o!==null){for(t.flags|=128,ll(r,!1),e=o.updateQueue,t.updateQueue=e,cl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Oi(n,e),n=n.sibling;return ko(t,Oo.current&1|2),q&&Gi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>hd&&(t.flags|=128,a=!0,ll(r,!1),t.lanes=4194304)}}else{if(!a){if(e=jo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,cl(t,e),ll(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!q)return ul(t),null}else 2*Ie()-r.renderingStartTime>hd&&n!==536870912&&(t.flags|=128,a=!0,ll(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ie(),e.sibling=null,o=Oo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||q?ko(t,o):(n=o,H(xo,t),H(Oo,n),So===null&&(So=t)),q&&Gi(t,r.treeForkCount),e}return ul(t),null;case 22:case 23:return Do(t),bo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(ul(t),t.subtreeFlags&6&&(t.flags|=8192)):ul(t),n=t.updateQueue,n!==null&&cl(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&&pe(Ra),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fa(wa),ul(t),null;case 25:return null;case 30:return t.flags|=33554432,ul(t),null}throw Error(i(156,t.tag))}function fl(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 fa(wa),ye(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xe(t),null;case 31:if(t.memoizedState!==null){if(Do(t),t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Do(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ao(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ye(),null;case 10:return fa(t.type),null;case 22:case 23:return Do(t),bo(),e!==null&&pe(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(wa),null;case 25:return null;default:return null}}function pl(e,t){switch(Ji(t),t.tag){case 3:fa(wa),ye();break;case 26:case 27:case 5:xe(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&Do(t);break;case 13:Do(t);break;case 19:Ao(t);break;case 10:fa(t.type);break;case 22:case 23:Do(t),bo(),e!==null&&pe(Ra);break;case 24:fa(wa)}}function ml(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){pf(t,t.return,e)}}function hl(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){pf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){pf(t,t.return,e)}}function gl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ho(t,n)}catch(t){pf(e,e.return,t)}}}function _l(e,t,n){n.props=mc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){pf(e,t,n)}}function vl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=fi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Fp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Ip(e);f(e.child,!1,$p,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){pf(e,t,n)}}function yl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){pf(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){pf(e,t,n)}else n.current=null}}function bl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)tm(e.stateNode,t[n])}function xl(e){for(var t=e.return;t!==null&&(wl(t)&&tm(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Sl(e){for(var t=e.return;t!==null&&(wl(t)&&nm(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Cl(e){return e.tag===5||e.tag===3||e.tag===27}function wl(e){return e&&e.tag===7&&e.stateNode!==null}function Tl(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){pf(e,e.return,t)}}function El(e,t,n){try{var r=e.stateNode;ap(r,e.type,n,t),r[yt]=t}catch(t){pf(e,e.return,t)}}function Dl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cp(e.type)||e.tag===4}function Ol(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dl(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&&Cp(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 kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pn)),bl(e,r),Vt=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Cp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(kl(e,t,n,r),e=e.sibling;e!==null;)kl(e,t,n,r),e=e.sibling}function Al(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),bl(e,r),Vt=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Cp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Al(e,t,n,r),e=e.sibling;e!==null;)Al(e,t,n,r),e=e.sibling}function jl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);rp(t,r,n),t[vt]=e,t[yt]=n}catch(t){pf(e,e.return,t)}}var Ml=!1,Nl=null;function Pl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Ml=!0)}var Fl=null;function Il(){var e=Fl;return Fl=null,e}var Ll=0;function Rl(e,t,n,r,i){return Ll=0,zl(e.child,t,n,r,i)}function zl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=kp(o);r.push(s),s.view&&(a=!0)}else a||kp(o).view&&(a=!0);Ml=!0,Ep(o,Ll===0?t:t+`_`+Ll,n),Ll++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||zl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Bl(e,t){for(;e!==null;)e.tag===5?Dp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Bl(e.child,t),e=e.sibling}function Vl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Vl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=mi(t.default,t.share),t!==`none`&&(Rl(e,n,t,null,!1)||Bl(e.child,!1))}e=e.sibling}}function Hl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=fi(r,n),a=mi(r.default,n.paired?r.share:r.enter);a===`none`?Vl(e):Rl(e,i,a,null,!1)?(Vl(e),n.paired||t||Md(e,r.onEnter)):Bl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Hl(e,t),e=e.sibling;else Vl(e)}function Ul(e){if(Nl!==null&&Nl.size!==0){var t=Nl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=mi(n.default,n.share);if(a!==`none`&&(Rl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Md(e,n.onShare)):Bl(e.child,!1)),t.delete(r),t.size===0)break}}}Ul(e)}e=e.sibling}}}function Wl(e){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode),r=Nl===null?void 0:Nl.get(n),i=mi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Rl(e,n,i,null,!1)?r===void 0?Md(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Nl.delete(n),Md(e,t.onShare)):Bl(e.child,!1)),Nl!==null&&Ul(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Wl(e),e=e.sibling;else Nl!==null&&Ul(e)}function Gl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode);t=mi(t.default,t.update),e.flags&=-5,t!==`none`&&Rl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Gl(e);e=e.sibling}}function Kl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Bl(e.child,!1))}Kl(e)}e=e.sibling}}function ql(e){if(e.tag===30)e.stateNode.paired=null,Bl(e.child,!1),Kl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ql(e),e=e.sibling;else Kl(e)}function Jl(e){for(e=e.child;e!==null;)e.tag===30?Bl(e.child,!1):e.subtreeFlags&33554432&&Jl(e),e=e.sibling}function Yl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Ll<a.length){var l=a[Ll],u=kp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Ep(c,Ll===0?n:n+`_`+Ll,i),s&&e.flags&4||(Fl===null&&(Fl=[]),Fl.push(c,Ll===0?r:r+`_`+Ll,t.memoizedProps)),Ll++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Yl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Xl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=fi(n,r),a=mi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ap)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Ll=0,i=Yl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Md(e,n.onUpdate))}else e.subtreeFlags&33554432&&Xl(e,t);e=e.sibling}}var Zl=!1,Ql=!1,$l=!1,eu=!1,tu=typeof WeakSet==`function`?WeakSet:Set,nu=null,ru=!1,iu=!1,au=!1,ou=!1;function su(e,t,n){if(e=e.containerInfo,cp=_h,e=Hr(e),Ur(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(lp={focusedElem:e,selectionRange:r},_h=!1,n=(n&335544064)===n,nu=t,t=n?9270:1024;nu!==null;){if(e=nu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Wl(r[a]);if(e.alternate===null&&e.flags&2)n&&Pl(e),cu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Wl(r),cu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Pl(e),cu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,nu=r):(n&&Gl(e),cu(n))}}Nl=null}function cu(e){for(;nu!==null;){var t=nu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=mc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){pf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)rm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:rm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=fi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=mi(a.default,a.update),a!==`none`&&Rl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,nu=r;break}nu=t.return}}function lu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ku(e,n),r&4&&ml(5,n);break;case 1:if(ku(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){pf(n,n.return,e)}else{var i=mc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){pf(n,n.return,e)}}}r&64&&gl(n),r&512&&vl(n,n.return);break;case 3:if(ku(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{ho(e,t)}catch(e){pf(n,n.return,e)}}break;case 27:t===null&&r&4&&jl(n);case 26:case 5:ku(e,n),t===null&&r&4&&Tl(n),r&512&&vl(n,n.return);break;case 12:ku(e,n);break;case 31:ku(e,n),r&4&&vu(e,n);break;case 13:ku(e,n),r&4&&yu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=_f.bind(null,n),lm(e,n))));break;case 22:if(r=n.memoizedState!==null||Zl,!r){var a=t!==null&&t.memoizedState!==null||Ql;t=Zl,i=Ql,Zl=r,(Ql=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),ju(e,n,r)):ku(e,n),Zl=t,Ql=i}break;case 30:ku(e,n),r&512&&vl(n,n.return);break;case 7:r&512&&vl(n,n.return);default:ku(e,n)}}function uu(e,t){for(e=e.child;e!==null;)du(e,t),e=e.sibling}function du(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){pf(e,e.return,t)}fu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Vt=!0}catch(t){pf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Tp(s,!0):Tp(e.stateNode,!1)}catch(t){pf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&uu(e,t);break;default:uu(e,t)}}function fu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:du(n,r);break a;case 22:n.memoizedState===null&&fu(n,r);break a;default:fu(n,r)}}e=e.sibling}}function pu(e){var t=e.alternate;t!==null&&(e.alternate=null,pu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Dt(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 mu=null,hu=!1;function gu(e,t,n){for(n=n.child;n!==null;)_u(e,t,n),n=n.sibling}function _u(e,t,n){if(Ke&&typeof Ke.onCommitFiberUnmount==`function`)try{Ke.onCommitFiberUnmount(Ge,n)}catch{}switch(n.tag){case 26:Ql||yl(n,t),gu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Ql&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ql||yl(n,t),Sl(n);var r=mu,i=hu;Cp(n.type)&&(mu=n.stateNode,hu=!1),gu(e,t,n),_m(n.stateNode,n.type,n.memoizedProps),mu=r,hu=i;break;case 5:Ql||yl(n,t),Sl(n);case 6:if(n.tag===6&&Sl(n),r=mu,i=hu,mu=null,gu(e,t,n),mu=r,hu=i,mu!==null){if(hu)try{(mu.nodeType===9?mu.body:mu.nodeName===`HTML`?mu.ownerDocument.body:mu).removeChild(n.stateNode),Vt=!0}catch(e){pf(n,t,e)}else try{mu.removeChild(n.stateNode),Vt=!0}catch(e){pf(n,t,e)}}break;case 18:mu!==null&&(hu?(e=mu,wp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Uh(e)):wp(mu,n.stateNode));break;case 4:r=mu,i=hu,mu=n.stateNode.containerInfo,hu=!0,gu(e,t,n),mu=r,hu=i;break;case 0:case 11:case 14:case 15:hl(2,n,t),Ql||hl(4,n,t),gu(e,t,n);break;case 1:Ql||(yl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&_l(n,t,r)),gu(e,t,n);break;case 21:gu(e,t,n);break;case 22:Ql=(r=Ql)||n.memoizedState!==null,gu(e,t,n),Ql=r;break;case 30:yl(n,t),gu(e,t,n);break;case 7:Ql||yl(n,t),gu(e,t,n);break;default:gu(e,t,n)}}function vu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Uh(e)}catch(e){pf(t,t.return,e)}}}function yu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Uh(e)}catch(e){pf(t,t.return,e)}}function bu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tu),t;default:throw Error(i(435,e.tag))}}function xu(e,t){var n=bu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=vf.bind(null,e,t);t.then(r,r)}})}function Su(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Cp(l.type)){mu=l.stateNode,hu=!1;break a}break;case 5:mu=l.stateNode,hu=!1;break a;case 3:case 4:mu=l.stateNode.containerInfo,hu=!0;break a}l=l.return}if(mu===null)throw Error(i(160));_u(s,c,o),mu=null,hu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wu(t,e,n),t=t.sibling}var Cu=null;function wu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Su(t,e,n),Tu(e),a&4&&(hl(3,e,e.return),ml(3,e),hl(5,e,e.return));break;case 1:Su(t,e,n),Tu(e),a&512&&(Ql||r===null||yl(r,r.return)),a&64&&Zl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Cu,Su(t,e,n),Tu(e),a&512&&(Ql||r===null||yl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Zl)e.stateNode=pp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Tt]||r[vt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),rp(r,t,n),r[vt]=e,Mt(r),t=r;break a;case`link`:if(o=Km(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),rp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Km(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),rp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[vt]=e,Mt(r),t=r}e.stateNode=t}}else Zl||qm(o,e.type,e.stateNode)}else e.stateNode=Vm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&El(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||Ql||t.parentNode.removeChild(t)):a.count--,n===null?Zl||qm(o,e.type,e.stateNode):Vm(o,n,e.memoizedProps))}break;case 27:Su(t,e,n),Tu(e),a&512&&(Ql||r===null||yl(r,r.return)),r!==null&&a&4&&El(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=$l,$l=!1,Su(t,e,n),$l=o,Tu(e),a&512&&(Ql||r===null||yl(r,r.return)),e.flags&32){t=e.stateNode;try{an(t,``),Vt=!0}catch(t){pf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,El(e,t,r===null?t:r.memoizedProps)),a&1024&&(eu=!0);break;case 6:if(Su(t,e,n),Tu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Vt=!0}catch(t){pf(e,e.return,t)}}break;case 3:if(Vt=!1,Gm=null,o=Cu,Cu=xm(t.containerInfo),Su(t,e,n),Cu=o,Tu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Uh(t.containerInfo)}catch(t){pf(e,e.return,t)}eu&&(eu=!1,Eu(e)),Vt=!1;break;case 4:a=$l,$l=Zl,r=W(),o=Cu,Cu=xm(e.stateNode.containerInfo),Su(t,e,n),Tu(e),Cu=o,Vt&&iu&&(au=!0),Vt=r,$l=a;break;case 12:Su(t,e,n),Tu(e);break;case 31:Su(t,e,n),Tu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 13:Su(t,e,n),Tu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(pd=Ie()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Zl,l=Ql,u=$l;Zl=c||o,$l=u||o,Ql=l||s,Su(t,e,n),Ql=l,$l=u,Zl=c,Tu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||Zl||Ql||(t=s||Ql,n=Zl,r=Ql,Zl=o||Zl,Ql=t,Au(e,2),Zl=n,Ql=r),!o&&$l||uu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,xu(e,n))));break;case 19:Su(t,e,n),Tu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 30:a&512&&(Ql||r===null||yl(r,r.return)),a=W(),o=iu,s=(n&335544064)===n,c=e.memoizedProps,iu=s&&mi(c.default,c.update)!==`none`,Su(t,e,n),Tu(e),s&&r!==null&&Vt&&(e.flags|=4),iu=o,Vt=a;break;case 21:break;case 7:a&512&&(Ql||r===null||yl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Su(t,e,n),Tu(e)}}function Tu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Dl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(wl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Cl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Al(e,Ol(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(an(l,``),n.flags&=-33),Al(e,Ol(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;kl(e,Ol(e),u,s);break;default:throw Error(i(161))}}catch(t){pf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Eu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Eu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,_h=!0,t.reset(),_h=!1),e=e.sibling}}function Du(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ou(t,e),t=t.sibling;else Xl(t,!1)}function Ou(e,t){var n=e.alternate;if(n===null)Hl(e,!1);else switch(e.tag){case 3:if(ou=ru=!1,Il(),Du(t,e),!ru&&!au){if(e=Fl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Dp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),ou=!0}Fl=null;break;case 5:Du(t,e);break;case 4:r=ru,ru=!1,Du(t,e),ru&&(au=!0),ru=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Du(t,e):Hl(e,!1));break;case 30:r=ru,i=Il(),ru=!1,Du(t,e),ru&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=fi(a,o),o=fi(n.memoizedProps,o);var s=mi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Ll=0,t=Yl(e,n,t,o,s,a,!0),Ll!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Md(e,e.memoizedProps.onUpdate),Fl=i):i!==null&&(i.push.apply(i,Fl),Fl=i),ru=e.flags&32?!0:r;break;default:Du(t,e)}}function ku(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)lu(e,t.alternate,t),t=t.sibling}function Au(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:hl(4,n,n.return),Au(n,r);break;case 1:yl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&_l(n,n.return,i),Au(n,r);break;case 27:r&2&&_m(n.stateNode,n.type,n.memoizedProps);case 5:yl(n,n.return),n.tag!==5&&n.tag!==27||Sl(n),Au(n,r);break;case 6:Sl(n);break;case 26:yl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Ql||i.parentNode.removeChild(i),Au(n,r);break;case 22:n.memoizedState===null&&Au(n,r);break;case 30:yl(n,n.return),Au(n,r);break;case 7:yl(n,n.return);default:Au(n,r)}e=e.sibling}}function ju(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:ju(i,a,n),ml(4,a);break;case 1:if(ju(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){pf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)mo(l[i],c)}catch(e){pf(r,r.return,e)}}s&&o&64&&gl(a),vl(a,a.return);break;case 27:n&2&&jl(a);case 5:a.tag!==5&&a.tag!==27||xl(a),ju(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 6:xl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Zl||qm(xm(c.ownerDocument),a.type,c),ju(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 12:ju(i,a,n);break;case 31:ju(i,a,n),s&&o&4&&vu(i,a);break;case 13:ju(i,a,n),s&&o&4&&yu(i,a);break;case 22:a.memoizedState===null&&ju(i,a,n),vl(a,a.return);break;case 30:ju(i,a,n),vl(a,a.return);break;case 7:vl(a,a.return);default:ju(i,a,n)}t=t.sibling}}function Mu(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&&Ea(n))}function Nu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ea(e))}function Pu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Fu(e,t,n,r),t=t.sibling;else i&&Jl(t)}function Fu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ql(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Pu(e,t,n,r),a&2048&&ml(9,t);break;case 1:Pu(e,t,n,r);break;case 3:Pu(e,t,n,r),i&&ou&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ea(a)));break;case 12:if(a&2048){Pu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){pf(t,t.return,e)}}else Pu(e,t,n,r);break;case 31:Pu(e,t,n,r);break;case 13:Pu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ql(t),o._visibility&2?Pu(e,t,n,r):(o._visibility|=2,Iu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ql(s),o._visibility&2?Pu(e,t,n,r):Lu(e,t)),a&2048&&Mu(s,t);break;case 24:Pu(e,t,n,r),a&2048&&Nu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Bl(a.child,!0),Bl(t.child,!0))),Pu(e,t,n,r);break;default:Pu(e,t,n,r)}}function Iu(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:Iu(a,o,s,c,i),ml(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Iu(a,o,s,c,i)):u._visibility&2?Iu(a,o,s,c,i):Lu(a,o),i&&l&2048&&Mu(o.alternate,o);break;case 24:Iu(a,o,s,c,i),i&&l&2048&&Nu(o.alternate,o);break;default:Iu(a,o,s,c,i)}t=t.sibling}}function Lu(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:Lu(n,r),i&2048&&Mu(r.alternate,r);break;case 24:Lu(n,r),i&2048&&Nu(r.alternate,r);break;default:Lu(n,r)}t=t.sibling}}var Ru=8192;function zu(e,t,n){if(e.subtreeFlags&Ru)for(e=e.child;e!==null;)Bu(e,t,n),e=e.sibling}function Bu(e,t,n){switch(e.tag){case 26:zu(e,t,n),e.flags&Ru&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Qm(n,e)):$m(n,Cu,e.memoizedState,e.memoizedProps));break;case 5:zu(e,t,n),e.flags&Ru&&(e=e.stateNode,(t&335544128)===t&&Qm(n,e));break;case 3:case 4:var r=Cu;Cu=xm(e.stateNode.containerInfo),zu(e,t,n),Cu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ru,Ru=16777216,zu(e,t,n),Ru=r):zu(e,t,n));break;case 30:if((e.flags&Ru)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Nl===null&&(Nl=new Map),Nl.set(r,i)}zu(e,t,n);break;default:zu(e,t,n)}}function Vu(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 Hu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nu=r,Gu(r,e)}Vu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Uu(e),e=e.sibling}function Uu(e){switch(e.tag){case 0:case 11:case 15:Hu(e),e.flags&2048&&hl(9,e,e.return);break;case 3:Hu(e);break;case 12:Hu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Wu(e)):Hu(e);break;default:Hu(e)}}function Wu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nu=r,Gu(r,e)}Vu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:hl(8,t,t.return),Wu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Wu(t));break;default:Wu(t)}e=e.sibling}}function Gu(e,t){for(;nu!==null;){var n=nu;switch(n.tag){case 0:case 11:case 15:hl(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:Ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nu=r;else a:for(n=e;nu!==null;){r=nu;var i=r.sibling,a=r.return;if(pu(r),r===n){nu=null;break a}if(i!==null){i.return=a,nu=i;break a}nu=a}}}var Ku={getCacheForType:function(e){var t=va(wa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return va(wa).controller.signal}},qu=typeof WeakMap==`function`?WeakMap:Map,Ju=0,Yu=null,Xu=null,Zu=0,Qu=0,$u=null,ed=!1,td=!1,nd=!1,rd=0,id=0,ad=0,od=0,sd=0,cd=0,ld=0,ud=null,dd=null,fd=!1,pd=0,md=0,hd=1/0,gd=null,_d=null,vd=0,yd=null,bd=null,xd=0,Sd=0,Cd=null,wd=null,Td=null,Ed=null,Dd=null,Od=0,kd=null;function Ad(){return Ju&2&&Zu!==0?Zu&-Zu:B.T===null?ht():Pf()}function jd(){if(cd===0){if(!(Zu&536870912)||q){var e=$e;$e<<=1,!($e&3932160)&&($e=262144),cd=e}else cd=536870912}return e=xo.current,e!==null&&(e.flags|=32),cd}function Md(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Fp(fi(e.memoizedProps,n))),Ed===null&&(Ed=[]),Ed.push(t.bind(null,r))}}function Nd(e,t,n){(e===Yu&&(Qu===2||Qu===9)||e.cancelPendingCommit!==null)&&(Bd(e,0),Ld(e,Zu,cd,!1)),ct(e,n),Ju&2&&e===Yu||(e===Yu&&(!(Ju&2)&&(od|=n),id===4&&Ld(e,Zu,cd,!1)),Ef(e))}function Pd(e,t,n){if(Ju&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||rt(e,t),a=r?Jd(e,t):Kd(e,t,!0),o=r;do{if(a===0){td&&!r&&Ld(e,t,0,!1);break}if(n=e.current.alternate,o&&!Id(n))a=Kd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ud;var l=c.current.memoizedState.isDehydrated;if(l&&(Bd(c,s).flags|=256),s=Kd(c,s,!1),s!==2&&s!==6){if(nd&&!l){c.errorRecoveryDisabledLanes|=o,od|=o,a=4;break a}o=dd,dd=a,o!==null&&(dd===null?dd=o:dd.push.apply(dd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Bd(e,0),Ld(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Ld(r,t,cd,!ed);break a;case 2:dd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=pd+300-Ie(),10<a)){if(Ld(r,t,cd,!ed),nt(r,0,!0)!==0)break a;xd=t,r.timeoutHandle=_p(Fd.bind(null,r,n,dd,gd,fd,t,cd,od,ld,ed,o,`Throttled`,-0,0),a);break a}Fd(r,n,dd,gd,fd,t,cd,od,ld,ed,o,null,-0,0)}break}}while(1);Ef(e)}function Fd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pn},Nl=null,Bu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=rh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?pd-Ie():(a&4194048)===a?md-Ie():0,m=th(d,m),m!==null)?(xd=a,e.cancelPendingCommit=m(tf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Ld(e,a,o,!l)):tf(e,t,a,n,r,i,o,s,c,l,u,d)}function Id(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(!Ir(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 Ld(e,t,n,r){t=it(e,t),t&=~sd,t&=~od,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ut(e,n,t)}function Rd(){return Ju&6?!0:(Df(0,!1),!1)}function zd(){if(Xu!==null){if(Qu===0)var e=Xu.return;else e=Xu,ua=la=null,Xo(e),Qa=null,$a=0,e=Xu;for(;e!==null;)pl(e.alternate,e),e=e.return;Xu=null}}function Bd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,vp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),xd=0,zd(),Yu=e,Xu=n=Di(e.current,null),Zu=t,Qu=0,$u=null,ed=!1,td=rt(e,t),nd=!1,ld=cd=sd=od=ad=id=0,dd=ud=null,fd=!1,rd=it(e,t),vi(),n}function Vd(e,t){Z=null,B.H=oc,t===Ha||t===Wa?(t=Xa(),Qu=3):t===Ua?(t=Xa(),Qu=4):Qu=t===wc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,$u=t,Xu===null&&(id=1,vc(e,Fi(t,e.current)))}function Hd(){var e=xo.current;return e===null?!0:(Zu&4194048)===Zu?So===null:(Zu&62914560)===Zu||Zu&536870912?e===So:!1}function Ud(){var e=B.H;return B.H=oc,e===null?oc:e}function Wd(){var e=B.A;return B.A=Ku,e}function Gd(){id=4,ed||(Zu&4194048)!==Zu&&xo.current!==null||(td=!0),!(ad&134217727)&&!(od&134217727)||Yu===null||Ld(Yu,Zu,cd,!1)}function Kd(e,t,n){var r=Ju;Ju|=2;var i=Ud(),a=Wd();(Yu!==e||Zu!==t)&&(gd=null,Bd(e,t)),t=!1;var o=id;a:do try{if(Qu!==0&&Xu!==null){var s=Xu,c=$u;switch(Qu){case 8:zd(),o=6;break a;case 3:case 2:case 9:case 6:xo.current===null&&(t=!0);var l=Qu;if(Qu=0,$u=null,Qd(e,s,c,l),n&&td){o=0;break a}break;default:l=Qu,Qu=0,$u=null,Qd(e,s,c,l)}}qd(),o=id;break}catch(t){Vd(e,t)}while(1);return t&&e.shellSuspendCounter++,ua=la=null,Ju=r,B.H=i,B.A=a,Xu===null&&(Yu=null,Zu=0,vi()),o}function qd(){for(;Xu!==null;)Xd(Xu)}function Jd(e,t){var n=Ju;Ju|=2;var r=Ud(),a=Wd();Yu!==e||Zu!==t?(gd=null,hd=Ie()+500,Bd(e,t)):td=rt(e,t);a:do try{if(Qu!==0&&Xu!==null){t=Xu;var o=$u;b:switch(Qu){case 1:Qu=0,$u=null,Qd(e,t,o,1);break;case 2:case 9:if(Ka(o)){Qu=0,$u=null,Zd(t);break}t=function(){Qu!==2&&Qu!==9||Yu!==e||(Qu=7),Ef(e)},o.then(t,t);break a;case 3:Qu=7;break a;case 4:Qu=5;break a;case 7:Ka(o)?(Qu=0,$u=null,Zd(t)):(Qu=0,$u=null,Qd(e,t,o,7));break;case 5:var s=null;switch(Xu.tag){case 26:s=Xu.memoizedState;case 5:case 27:var c=Xu;if(s?Xm(s):c.stateNode.complete){Qu=0,$u=null;var l=c.sibling;if(l!==null)Xu=l;else{var u=c.return;u===null?Xu=null:(Xu=u,$d(u))}break b}}Qu=0,$u=null,Qd(e,t,o,5);break;case 6:Qu=0,$u=null,Qd(e,t,o,6);break;case 8:zd(),id=6;break a;default:throw Error(i(462))}}Yd();break}catch(t){Vd(e,t)}while(1);return ua=la=null,B.H=r,B.A=a,Ju=n,Xu===null?(Yu=null,Zu=0,vi(),id):0}function Yd(){for(;Xu!==null&&!Pe();)Xd(Xu)}function Xd(e){var t=il(e.alternate,e,rd);e.memoizedProps=e.pendingProps,t===null?$d(e):Xu=t}function Zd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Rc(n,t,t.pendingProps,t.type,void 0,Zu);break;case 11:t=Rc(n,t,t.pendingProps,t.type.render,t.ref,Zu);break;case 5:Xo(t);var r=t;r===Xi&&(q?(ra(r),r.tag===5&&r.stateNode!=null&&(Zi=r.stateNode)):(ra(r),q=!0));default:pl(n,t),t=Xu=Oi(t,rd),t=il(n,t,rd)}e.memoizedProps=e.pendingProps,t===null?$d(e):Xu=t}function Qd(e,t,n,r){ua=la=null,Xo(t),Qa=null,$a=0;var i=t.return;try{if(Cc(e,i,t,n,Zu)){id=1,vc(e,Fi(n,e.current)),Xu=null;return}}catch(t){if(i!==null)throw Xu=i,t;id=1,vc(e,Fi(n,e.current)),Xu=null;return}t.flags&32768?(q||r===1?e=!0:td||Zu&536870912?e=!1:(ed=e=!0,(r===2||r===9||r===3||r===6)&&(r=xo.current,r!==null&&r.tag===13&&(r.flags|=16384))),ef(t,e)):$d(t)}function $d(e){var t=e;do{if(t.flags&32768){ef(t,ed);return}e=t.return;var n=dl(t.alternate,t,rd);if(n!==null){Xu=n;return}if(t=t.sibling,t!==null){Xu=t;return}Xu=t=e}while(t!==null);id===0&&(id=5)}function ef(e,t){do{var n=fl(e.alternate,e);if(n!==null){n.flags&=32767,Xu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Xu=e;return}Xu=e=n}while(e!==null);id=6,Xu=null}function tf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do uf();while(vd!==0);if(Ju&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Yu&&(Xu=Yu=null,Zu=0),bd=t,yd=e,xd=n,Cd=a,wd=r,nf(e,t,n,s,c,l,f)}}function nf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Sd=s,s|=_i,lt(e,n,s,r,i,a),Ed=null,(n&335544064)===n?(Dd=ka(e),r=10262):(Dd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,yf(Be,function(){return df(),null})):(e.callbackNode=null,e.callbackPriority=0),Ml=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=B.T,B.T=null,i=V.p,V.p=2,a=Ju,Ju|=4;try{su(e,t,n)}finally{Ju=a,V.p=i,B.T=r}}vd=1,Ml?Td=Np(o,e.containerInfo,Dd,of,sf,af,cf,df,rf,null,null):(of(),sf(),cf())}function rf(e){if(vd!==0){var t=yd.onRecoverableError;t(e,{componentStack:null})}}function af(){vd===3&&(vd=0,Ou(bd,yd),vd=4)}function of(){if(vd===1){vd=0;var e=yd,t=bd,n=xd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=B.T,B.T=null;var i=V.p;V.p=2;var a=Ju;Ju|=4;try{iu=au=!1,wu(t,e,n),n=lp;var o=Hr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Vr(s.ownerDocument.documentElement,s)){if(c!==null&&Ur(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 _=Br(s,h),v=Br(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}}_h=!!cp,lp=cp=null}finally{Ju=a,V.p=i,B.T=r}}e.current=t,vd=2}}function sf(){if(vd===2){vd=0;var e=yd,t=bd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=B.T,B.T=null;var r=V.p;V.p=2;var i=Ju;Ju|=4;try{lu(e,t.alternate,t)}finally{Ju=i,V.p=r,B.T=n}}vd=3}}function cf(){if(vd===4||vd===3){vd=0;var e=Td;Td=null,Fe();var t=yd,n=bd,r=xd,i=wd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?vd=5:(vd=0,bd=yd=null,lf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(_d=null),mt(r),n=n.stateNode,Ke&&typeof Ke.onCommitFiberRoot==`function`)try{Ke.onCommitFiberRoot(Ge,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=B.T,a=V.p,V.p=2,B.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{B.T=n,V.p=a}}if(i=Ed,o=Dd,Dd=null,i!==null&&(Ed=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);xd&3&&uf(),Ef(t),a=t.pendingLanes,r&261930&&a&42?t===kd?Od++:(Od=0,kd=t):(Od=0,kd=null),Df(0,!1)}}function lf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ea(t)))}function uf(){return Td!==null&&(Td.skipTransition(),Td=null),of(),sf(),cf(),df()}function df(){if(vd!==5)return!1;var e=yd,t=Sd;Sd=0;var n=mt(xd),r=B.T,a=V.p;try{V.p=32>n?32:n,B.T=null,n=Cd,Cd=null;var o=yd,s=xd;if(vd=0,bd=yd=null,xd=0,Ju&6)throw Error(i(331));var c=Ju;if(Ju|=4,Uu(o.current),Fu(o,o.current,s,n),Ju=c,Df(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot==`function`)try{Ke.onPostCommitFiberRoot(Ge,o)}catch{}return!0}finally{V.p=a,B.T=r,lf(e,t)}}function ff(e,t,n){t=Fi(n,t),t=bc(e.stateNode,t,2),e=so(e,t,2),e!==null&&(ct(e,2),Ef(e))}function pf(e,t,n){if(e.tag===3)ff(e,e,n);else for(;t!==null;){if(t.tag===3){ff(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(_d===null||!_d.has(r))){e=Fi(n,e),n=xc(2),r=so(t,n,2),r!==null&&(Sc(n,r,t,e),ct(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qu;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)||(nd=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Yu===e&&(Zu&n)===n&&(id===4||id===3&&(Zu&62914560)===Zu&&300>Ie()-pd?Ju&2?sd|=n:Bd(e,0):sd|=n,ld===Zu&&(ld=0)),Ef(e)}function gf(e,t){t===0&&(t=ot()),e=bi(e,t),e!==null&&(ct(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(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),gf(e,n)}function yf(e,t){return Me(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;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-Je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=Zu,a=nt(r,r===Yu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||rt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&gp()&&(e=Tf);for(var t=Ie(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}vd!==0&&vd!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=at(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Yu,n=Zu,n=nt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Qu===2||Qu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ne(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||rt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ne(r),mt(n)){case 2:case 8:n=ze;break;case 32:n=Be;break;case 268435456:n=He;break;default:n=Be}return r=jf.bind(null,e),n=Me(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ne(r),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,t){if(vd!==0&&vd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(uf()&&e.callbackNode!==n)return null;var r=Zu;return r=nt(e,e===Yu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Pd(e,r,t),Af(e,Ie()),e.callbackNode!=null&&e.callbackNode===n?jf.bind(null,e):null)}function Mf(e,t){if(uf())return null;Pd(e,t,!0)}function Nf(){xp(function(){Ju&6?Me(Re,Of):kf()})}function Pf(){if(Tf===0){var e=Ma;e===0&&(e=Qe,Qe<<=1,!(Qe&261888)&&(Qe=256)),Tf=e}return Tf}function Ff(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:fn(e)}function If(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ff((i[yt]||null).action),o=r.submitter;o&&(t=(t=o[yt]||null)?Ff(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Pn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Tf!==0){var e=new FormData(i,o);Ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Lf=0;Lf<li.length;Lf++){var Rf=li[Lf];ui(Rf.toLowerCase(),`on`+(Rf[0].toUpperCase()+Rf.slice(1)))}ui(ti,`onAnimationEnd`),ui(ni,`onAnimationIteration`),ui(ri,`onAnimationStart`),ui(`dblclick`,`onDoubleClick`),ui(`focusin`,`onFocus`),ui(`focusout`,`onBlur`),ui(ii,`onTransitionRun`),ui(ai,`onTransitionStart`),ui(oi,`onTransitionCancel`),ui(si,`onTransitionEnd`),Lt(`onMouseEnter`,[`mouseout`,`mouseover`]),Lt(`onMouseLeave`,[`mouseout`,`mouseover`]),Lt(`onPointerEnter`,[`pointerout`,`pointerover`]),Lt(`onPointerLeave`,[`pointerout`,`pointerover`]),It(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),It(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),It(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),It(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var zf=`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(` `),Bf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(zf));function Vf(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){hi(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){hi(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[xt];n===void 0&&(n=t[xt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Pt.forEach(function(t){t!==`selectionchange`&&(Bf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(wh(t)){case 2:var i=vh;break;case 8:i=yh;break;default:i=bh}n=i.bind(null,t,n,e),i=void 0,!Cn||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 Kf(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=Ot(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}bn(function(){var r=a,i=hn(n),s=[];a:{var c=ci.get(e);if(c!==void 0){var l=Pn,u=e;switch(e){case`keypress`:if(kn(n)===0)break a;case`keydown`:case`keyup`:l=Qn;break;case`focusin`:u=`focus`,l=Un;break;case`focusout`:u=`blur`,l=Un;break;case`beforeblur`:case`afterblur`:l=Un;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=Vn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Hn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=tr;break;case ti:case ni:case ri:l=Wn;break;case si:l=nr;break;case`scroll`:case`scrollend`:l=In;break;case`wheel`:l=rr;break;case`copy`:case`cut`:case`paste`:l=Gn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=$n;break;case`submit`:l=er;break;case`toggle`:case`beforetoggle`:l=ir}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=xn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==mn&&(u=n.relatedTarget||n.fromElement)&&(Ot(u)||u[bt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ot(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Vn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=$n,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:At(c),h=l==null?u:At(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Ot(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,Yf):null,c!==null&&Xf(s,u,c,d,!1),l!==null&&f!==null&&Xf(s,f,l,d,!0)))}a:{if(c=r?At(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=wr;else if(vr(c)){if(Tr)_=Pr;else{_=Mr;var v=jr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&ln(r.elementType)&&(_=wr):_=Nr;if(_&&=_(e,r)){yr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?At(r):window,e){case`focusin`:(vr(v)||v.contentEditable===`true`)&&(Gr=v,Kr=r,qr=null);break;case`focusout`:qr=Kr=Gr=null;break;case`mousedown`:Jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Jr=!1,Yr(s,n,i);break;case`selectionchange`:if(Wr)break;case`keydown`:case`keyup`:Yr(s,n,i)}var y;if(or)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else mr?fr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(lr&&n.locale!==`ko`&&(mr||b!==`onCompositionStart`?b===`onCompositionEnd`&&mr&&(y=On()):(Tn=i,En=`value`in Tn?Tn.value:Tn.textContent,mr=!0)),v=Jf(r,b),0<v.length&&(b=new Kn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=pr(n),y!==null&&(b.data=y)))),(y=cr?hr(e,n):gr(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new Kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),If(s,e,r,n,i)}Vf(s,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(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=xn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=xn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(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=xn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=xn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\r\n?/g,Qf=/\u0000|\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`
11
- `).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function tp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||an(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&an(e,``+r);else return;break;case`className`:Ut(e,`class`,r);break;case`tabIndex`:Ut(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ut(e,n,r);break;case`style`:cn(e,r,o);return;case`data`:if(t!==`object`){Ut(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=fn(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`&&tp(e,t,`name`,a.name,a,null),tp(e,t,`formEncType`,a.formEncType,a,null),tp(e,t,`formMethod`,a.formMethod,a,null),tp(e,t,`formTarget`,a.formTarget,a,null)):(tp(e,t,`encType`,a.encType,a,null),tp(e,t,`method`,a.method,a,null),tp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=fn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=pn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=fn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Ht(e,`popover`,r);break;case`xlinkActuate`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ht(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=un.get(n)||n,Ht(e,n,r);else return}Vt=!0}function np(e,t,n,r,a,o){switch(n){case`style`:cn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)an(e,r);else if(typeof r==`number`||typeof r==`bigint`)an(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=pn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[yt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Vt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ht(e,n,r)}return}Vt=!0}function rp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`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:tp(e,t,o,s,n,null)}}a&&tp(e,t,`srcSet`,n.srcSet,n,null),r&&tp(e,t,`src`,n.src,n,null);return;case`input`:Q(`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:tp(e,t,r,d,n,null)}}$t(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`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:tp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&tn(e,!!r,n,!0):tn(e,!!r,t,!1);return;case`textarea`:for(s in Q(`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:tp(e,t,s,c,n,null)}rn(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:tp(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<zf.length;r++)Q(zf[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`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:tp(e,t,u,r,n,null)}return;default:if(ln(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&np(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&tp(e,t,c,r,n,null))}var ip={};function ap(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)||tp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Vt=!0),o=m;break;case`name`:m!==f&&(Vt=!0),a=m;break;case`checked`:m!==f&&(Vt=!0),u=m;break;case`defaultChecked`:m!==f&&(Vt=!0),d=m;break;case`value`:m!==f&&(Vt=!0),s=m;break;case`defaultValue`:m!==f&&(Vt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&tp(e,t,p,m,r,f)}}Qt(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)||tp(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Vt=!0),p=o;break;case`defaultValue`:o!==l&&(Vt=!0),c=o;break;case`multiple`:o!==l&&(Vt=!0),s=o;default:o!==l&&tp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?tn(e,!!n,n?[]:``,!1):tn(e,!!n,t,!0)):tn(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:tp(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Vt=!0),p=a;break;case`defaultValue`:a!==o&&(Vt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&tp(e,t,s,a,r,o)}nn(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:tp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Vt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:tp(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)&&tp(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:tp(e,t,u,p,r,m)}return;default:if(ln(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&np(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||np(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&tp(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||tp(e,t,f,p,r,m)}function op(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function sp(){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&&op(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&&op(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 cp=null,lp=null;function up(e){return e.nodeType===9?e:e.ownerDocument}function dp(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 fp(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 pp(e,t,n,r){return n=up(n).createElement(e),n[vt]=r,n[yt]=t,rp(n,e,t),Mt(n),n}function mp(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 hp=null;function gp(){var e=window.event;return e&&e.type===`popstate`?e!==hp&&(hp=e,!0):(hp=null,!1)}var _p=typeof setTimeout==`function`?setTimeout:void 0,vp=typeof clearTimeout==`function`?clearTimeout:void 0,yp=typeof Promise==`function`?Promise:void 0,bp=typeof requestAnimationFrame==`function`?requestAnimationFrame:_p,xp=typeof queueMicrotask==`function`?queueMicrotask:yp===void 0?_p:function(e){return yp.resolve(null).then(e).catch(Sp)};function Sp(e){setTimeout(function(){throw e})}function Cp(e){return e===`head`}function wp(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),Uh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vm(e.ownerDocument.body)}n=i}while(n);Uh(t)}function Tp(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 Ep(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Dp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Op(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kp(e){return Op(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ap(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Op(t,n,e)}function jp(e){return e.documentElement.clientHeight}function Mp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Np(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Zm(f),u>eh){s.length=o;break}f=new Promise(Mp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Pp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Pp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Pp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Pp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fp(e){return{name:e,group:new Pp(`group`,e),imagePair:new Pp(`image-pair`,e),old:new Pp(`old`,e),new:new Pp(`new`,e)}}function Ip(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ip.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Vp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Lp,e,s,r)}this._eventListeners=a}};function Lp(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Ip.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Vp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=zp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Rp,e,n,i),r.splice(t,1),a!==null&&a()}};function Rp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Bp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Vp(e,t,n,r){if(e.length===0)return-1;r=Bp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Bp(a.optionsOrUseCapture)===r)return i}return-1}Ip.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Ip.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Hp,e,void 0,void 0)};function Hp(e,t){return e.tag!==6&&(e=_(e),mm(e,t))}Ip.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Up,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Hp(t[n],e);n--);};function Up(e,t){return t.push(e),!1}Ip.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=up(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Wp,e,void 0,void 0))};function Wp(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ip.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Ip.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Kp,e,void 0,void 0);for(var n=t=0;n<qp.length;n++){var r=qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):qp[t++]=r}qp.length=t}};function Kp(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var qp=[],Jp=!1;function Yp(e,t,n){qp.push({fragmentInstance:e,observer:t,instance:n}),Jp||(Jp=!0,hm(function(){Jp=!1;var e=qp;qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Ip.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Xp,e,void 0,void 0),e};function Xp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}Ip.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Ip.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Up,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zp(e,t,n,r,i){var a=Ot(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(f(t,!0,x,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(f(t,!0,S,a,r),a=v,b=v=null,t=a!==null)),t):!1}function Qp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ip.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Up,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),Qp(e,n);return}if(r=_(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=_(a),Qp(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function $p(e,t){return e=_(e),em(e,t),!1}function em(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<qp.length;i++){var a=qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(qp[r++]=a)}qp.length=r,n.observe(e)}),em(e,t))}function nm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Yp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rm(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`:rm(n),Dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function im(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[Tt])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=um(e.nextSibling),e===null)break}return null}function am(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=um(e.nextSibling),e===null))return null;return e}function om(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=um(e.nextSibling),e===null))return null;return e}function sm(e){return e.data===`$?`||e.data===`$~`}function cm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lm(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 um(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 dm=null;function fm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return um(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pm(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 mm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function hm(e){bp(function(){bp(function(t){return e(t)})})}function gm(e,t,n){switch(t=up(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 _m(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&tp(e,t,r,null,ip,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===pn&&(e.onclick=null),Dt(e)}function vm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Dt(e)}var ym=new Map,bm=new Set;function xm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Sm=V.d;V.d={f:Cm,r:wm,D:Dm,C:Om,L:km,m:Am,X:Mm,S:jm,M:Nm};function Cm(){var e=Sm.f(),t=Rd();return e||t}function wm(e){var t=kt(e);t!==null&&t.tag===5&&t.type===`form`?Js(t):Sm.r(e)}var Tm=typeof document>`u`?null:document;function Em(e,t,n){var r=Tm;if(r&&typeof t==`string`&&t){var i=Zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bm.has(i)||(bm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),rp(t,`link`,e),Mt(t),r.head.appendChild(t)))}}function Dm(e){Sm.D(e),Em(`dns-prefetch`,e,null)}function Om(e,t){Sm.C(e,t),Em(`preconnect`,e,t)}function km(e,t,n){Sm.L(e,t,n);var r=Tm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Zt(n.imageSizes)+`"]`)):i+=`[href="`+Zt(e)+`"]`;var a=i;switch(t){case`style`:a=Fm(e);break;case`script`:a=zm(e)}if(!(ym.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),ym.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Im(a))||t===`script`&&r.querySelector(Bm(a))))){var o=r.createElement(`link`);rp(o,`link`,e),t===`style`&&(o[Et]=!0,o.onload=o.onerror=function(){Nt(o)}),Mt(o),r.head.appendChild(o)}}}function Am(e,t){Sm.m(e,t);var n=Tm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Zt(r)+`"][href="`+Zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zm(e)}if(!ym.has(a)&&(e=T({rel:`modulepreload`,href:e},t),ym.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bm(a)))return}r=n.createElement(`link`),rp(r,`link`,e),Mt(r),n.head.appendChild(r)}}}function jm(e,t,n){Sm.S(e,t,n);var r=Tm;if(r&&e){var i=jt(r).hoistableStyles,a=Fm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Im(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=ym.get(a))&&Um(e,n);var c=o=r.createElement(`link`);Mt(c),rp(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,Hm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mm(e,t){Sm.X(e,t);var n=Tm;if(n&&e){var r=jt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Mt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t){Sm.M(e,t);var n=Tm;if(n&&e){var r=jt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Mt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t,n,r){var a=(a=ge.current)?xm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Fm(n.href),t=jt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Fm(n.href);var o=jt(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(Im(e)))?o._p||(s.instance=o,s.state.loading=5):(o=ym.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ym.set(e,o)),Rm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=zm(n),t=jt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Fm(e){return`href="`+Zt(e)+`"`}function Im(e){return`link[rel="stylesheet"][`+e+`]`}function Lm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Rm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Et]){r.loading=1;return}}else t=e.createElement(`link`),t[Et]=!0,t.onload=t.onerror=Nt.bind(null,t),rp(t,`link`,n),Mt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function zm(e){return`[src="`+Zt(e)+`"]`}function Bm(e){return`script[async]`+e}function Vm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Zt(n.href)+`"]`);if(r)return t.instance=r,Mt(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Mt(r),rp(r,`style`,a),Hm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Fm(n.href);var o=e.querySelector(Im(a));if(o)return t.state.loading|=4,t.instance=o,Mt(o),o;r=Lm(n),(a=ym.get(a))&&Um(r,a),o=(e.ownerDocument||e).createElement(`link`),Mt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),rp(o,`link`,r),t.state.loading|=4,Hm(o,n.precedence,e),t.instance=o;case`script`:return o=zm(n.src),(a=e.querySelector(Bm(o)))?(t.instance=a,Mt(a),a):(r=n,(a=ym.get(o))&&(r=T({},n),Wm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Mt(a),rp(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,Hm(r,n.precedence,e));return t.instance}function Hm(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 Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gm=null;function Km(e,t,n){if(Gm===null){var r=new Map,i=Gm=new Map;i.set(n,r)}else i=Gm,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[Tt]||a[vt]||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 qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jm(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 Ym(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Xm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Qm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Zm(t),e.suspenseyImages.push(t)),e=ih.bind(e),t.decode().then(e,e))}function $m(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=Fm(r.href),a=t.querySelector(Im(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Mt(a);return}a=t.ownerDocument||t,r=Lm(r),(i=ym.get(i))&&Um(r,i),a=a.createElement(`link`),Mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(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=rh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var eh=0;function th(e,t){return e.stylesheets&&e.count===0&&oh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&eh===0&&(eh=62500*sp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>eh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function nh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)oh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function rh(){this.count--,nh(this)}function ih(){this.imgCount--,nh(this)}var ah=null;function oh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ah=new Map,t.forEach(sh,e),ah=null,rh.call(e))}function sh(e,t){if(!(t.state.loading&4)){var n=ah.get(e);if(n)var r=n.get(null);else{n=new Map,ah.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=rh.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 ch={$$typeof:N,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function lh(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=st(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=st(0),this.hiddenUpdates=st(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function uh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new lh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ti(3,null,null,t),e.current=a,a.stateNode=e,t=Ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ao(a),e}function dh(e){return e?(e=Ci,e):Ci}function fh(e,t,n,r,i,a){i=dh(i),r.context===null?r.context=i:r.pendingContext=i,r=X(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=so(e,r,t),n!==null&&(Nd(n,e,t),co(n,e,t))}function ph(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mh(e,t){ph(e,t),(e=e.alternate)&&ph(e,t)}function hh(e){if(e.tag===13||e.tag===31){var t=bi(e,67108864);t!==null&&Nd(t,e,67108864),mh(e,67108864)}}function gh(e){if(e.tag===13||e.tag===31){var t=Ad();t=pt(t);var n=bi(e,t);n!==null&&Nd(n,e,t),mh(e,t)}}var _h=!0;function vh(e,t,n,r){var i=B.T;B.T=null;var a=V.p;try{V.p=2,bh(e,t,n,r)}finally{V.p=a,B.T=i}}function yh(e,t,n,r){var i=B.T;B.T=null;var a=V.p;try{V.p=8,bh(e,t,n,r)}finally{V.p=a,B.T=i}}function bh(e,t,n,r){if(_h){var i=xh(r);if(i===null)Kf(e,t,r,Sh,n),Nh(e,r);else if(Fh(i,e,t,n,r))r.stopPropagation();else if(Nh(e,r),t&4&&-1<Mh.indexOf(e)){for(;i!==null;){var a=kt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=tt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Je(o);s.entanglements[1]|=c,o&=~c}Ef(a),!(Ju&6)&&(hd=Ie()+500,Df(0,!1))}}break;case 31:case 13:s=bi(a,2),s!==null&&Nd(s,a,2),Rd(),mh(a,2)}if(a=xh(r),a===null&&Kf(e,t,r,Sh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function xh(e){return e=hn(e),Ch(e)}var Sh=null;function Ch(e){if(Sh=null,e=Ot(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 Sh=e,null}function wh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Le()){case Re:return 2;case ze:return 8;case Be:case Ve:return 32;case He:return 268435456;default:return 32}default:return 32}}var Th=!1,Eh=null,Dh=null,Oh=null,kh=new Map,Ah=new Map,jh=[],Mh=`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 Nh(e,t){switch(e){case`focusin`:case`focusout`:Eh=null;break;case`dragenter`:case`dragleave`:Dh=null;break;case`mouseover`:case`mouseout`:Oh=null;break;case`pointerover`:case`pointerout`:kh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ah.delete(t.pointerId)}}function Ph(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=kt(t),t!==null&&hh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Fh(e,t,n,r,i){switch(t){case`focusin`:return Eh=Ph(Eh,e,t,n,r,i),!0;case`dragenter`:return Dh=Ph(Dh,e,t,n,r,i),!0;case`mouseover`:return Oh=Ph(Oh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return kh.set(a,Ph(kh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ah.set(a,Ph(Ah.get(a)||null,e,t,n,r,i)),!0}return!1}function Ih(e){var t=Ot(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,gt(e.priority,function(){gh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,gt(e.priority,function(){gh(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 Lh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);mn=r,n.target.dispatchEvent(r),mn=null}else return t=kt(n),t!==null&&hh(t),e.blockedOn=n,!1;t.shift()}return!0}function Rh(e,t,n){Lh(e)&&n.delete(t)}function zh(){Th=!1,Eh!==null&&Lh(Eh)&&(Eh=null),Dh!==null&&Lh(Dh)&&(Dh=null),Oh!==null&&Lh(Oh)&&(Oh=null),kh.forEach(Rh),Ah.forEach(Rh)}function Bh(e,n){e.blockedOn===n&&(e.blockedOn=null,Th||(Th=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zh)))}var Vh=null;function Hh(e){Vh!==e&&(Vh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vh===e&&(Vh=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(Ch(r||n)===null)continue;break}var a=kt(n);a!==null&&(e.splice(t,3),t-=3,Ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Uh(e){function t(t){return Bh(t,e)}Eh!==null&&Bh(Eh,e),Dh!==null&&Bh(Dh,e),Oh!==null&&Bh(Oh,e),kh.forEach(t),Ah.forEach(t);for(var n=0;n<jh.length;n++){var r=jh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jh.length&&(n=jh[0],n.blockedOn===null);)Ih(n),n.blockedOn===null&&jh.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[yt]||null;if(typeof a==`function`)o||Hh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[yt]||null)s=o.formAction;else if(Ch(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hh(n)}}}function Wh(){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 Gh(e){this._internalRoot=e}Kh.prototype.render=Gh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;fh(n,Ad(),e,t,null,null)},Kh.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fh(e.current,2,null,e,null,null),Rd(),t[bt]=null}};function Kh(e){this._internalRoot=e}Kh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jh.length&&t!==0&&t<jh[n].priority;n++);jh.splice(n,0,e),n===0&&Ih(e)}};var $=n.version;if($!==`19.3.1`)throw Error(i(527,$,`19.3.1`));V.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:B,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Ge=Jh.inject(qh),Ke=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=hc,s=gc,c=_c;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=uh(e,1,!1,null,null,n,r,null,o,s,c,Wh),e[bt]=t.current,Wf(e),new Gh(t)}})),Me=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=je()})),Ne=Ae(),Pe=Me(),Fe=`Revise the manuscript according to these notes the author marked on the compiled PDF.`,Ie=` PDF text: "`,Le=` Marked region: a figure, equation or other non-text area`,Re=`
12
- Note: `;function ze(e){if(e.anchor)return e.anchor;let t=e.where.match(/^Round (\d+)\b/),n=[];for(let t of e.where.split(/ · |; /)){let e=t.match(/^(.+?)(?::| lines? )(\d+(?:[–-]\d+)?(?:,\s*\d+(?:[–-]\d+)?)*)$/);if(e)for(let t of e[2].split(/,\s*/)){let[r,i]=t.split(/[–-]/).map(Number);n.push({file:e[1],lines:[r,i??r]})}}return{sources:n,...t?{round:Number(t[1])}:{}}}function Be(e){if(!e.startsWith(Fe))return null;let t=[];for(let n of e.split(/\n\n(?=\d+\. )/).slice(1)){let e=n.match(/^\d+\. (.*)\n/);if(!e)return null;let r=n.slice(e[0].length);if(r.startsWith(" LaTeX source of the marked region:\n ```latex\n")){let e=r.match(/\n {3}```\n(?= {3}(?:PDF text: "|Marked region: ))/);if(!e)return null;r=r.slice(e.index+e[0].length)}let i=r.indexOf(Re);if(i<0)return null;let a=r.slice(0,i);if(a!==Le&&!(a.startsWith(Ie)&&a.endsWith(`"`)))return null;let o=e[1].endsWith(` · Color group: Blue`),s=o?`blue`:u.find(t=>e[1].endsWith(` · Color group: ${g[t]}`)),c=s?e[1].slice(0,-` · Color group: ${o?`Blue`:g[s]}`.length):e[1];t.push({...s?{group:s}:{},where:c,quote:a===Le?``:a.slice(14,-1),comment:r.slice(i+10).replace(/\n {3}/g,`
13
- `)})}return t.length?t:null}var Ve=/\.(aux|log|out|toc|lof|lot|lol|fls|fdb_latexmk|synctex(?:\.gz)?|bbl|blg|bcf|run\.xml|nav|snm|vrb|xdv|dvi|idx|ilg|ind|glo|gls|glg|ist|thm|loa)$/;function He(e){let t=e.slice(e.lastIndexOf(`/`)+1);if(t===`.DS_Store`)return`.DS_Store`;if(/(?:^|\/)_minted[^/]*\//.test(e))return`_minted*/`;let n=Ve.exec(t);return n?`*.${n[1]}`:null}function Ue({label:e,actions:t,children:n,className:r=`icon-button more-button`,menuClassName:i=``,align:a=`end`,disabled:o}){let s=(0,S.useId)(),c=(0,S.useRef)(null),l=(0,S.useRef)(null),[u,d]=(0,S.useState)(!1);(0,S.useEffect)(()=>{if(!u)return;let e=()=>l.current?.hidePopover(),t=t=>{t.target instanceof Node&&t.target.contains(c.current)&&!l.current?.contains(t.target)&&e()};return window.addEventListener(`resize`,e),document.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,t,!0)}},[u]);function f(){let e=l.current,t=c.current.getBoundingClientRect();if(a===`side`){let n=t.right+6,r=t.left-e.offsetWidth-6;e.style.left=`${n+e.offsetWidth<=window.innerWidth-8||r<8?Math.max(8,Math.min(n,window.innerWidth-e.offsetWidth-8)):r}px`,e.style.top=`${Math.max(8,Math.min(t.top-5,window.innerHeight-e.offsetHeight-8))}px`;return}a===`start`&&(e.style.minWidth=`${t.width}px`);let n=a===`start`?t.left:t.right-e.offsetWidth;e.style.left=`${Math.max(8,Math.min(n,window.innerWidth-e.offsetWidth-8))}px`;let r=t.bottom+6,i=t.top-e.offsetHeight-6;e.style.top=`${r+e.offsetHeight>window.innerHeight-8&&i>=8?i:Math.max(8,Math.min(r,window.innerHeight-e.offsetHeight-8))}px`}function p(){return Array.from(l.current.querySelectorAll(`[role^="menuitem"]:not(:disabled)`))}function m(){l.current?.hidePopover()}function h(e=!1){l.current?.showPopover(),f(),d(!0);let t=p();(e?t[t.length-1]:t.find(e=>e.getAttribute(`aria-checked`)===`true`)||t[0])?.focus()}let g=t.some(e=>e.checked!==void 0);return(0,C.jsxs)(`span`,{className:`menu-anchor`,children:[(0,C.jsx)(`button`,{ref:c,type:`button`,className:r,"aria-label":e,title:e,disabled:o,"aria-haspopup":`menu`,"aria-expanded":u,popoverTarget:s,onClick:e=>{e.preventDefault(),l.current?.matches(`:popover-open`)?m():h()},onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),h(e.key===`ArrowUp`)):a===`side`&&e.key===`ArrowRight`&&(e.preventDefault(),h())},children:n||(0,C.jsx)(T,{name:`more`,size:18})}),(0,C.jsx)(`div`,{ref:l,id:s,popover:`auto`,role:`menu`,"aria-label":e,className:`action-menu `+i,onToggle:e=>{let t=e.nativeEvent.newState===`open`;d(t)},onKeyDown:e=>{if(e.key===`Tab`)m(),c.current?.focus();else if(e.stopPropagation(),e.key===`Escape`||a===`side`&&e.key===`ArrowLeft`)e.preventDefault(),m(),c.current?.focus();else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=p(),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()}},children:t.map(e=>{let t=(0,C.jsxs)(C.Fragment,{children:[e.icon?(0,C.jsx)(T,{name:e.icon,size:16}):g&&(0,C.jsx)(`span`,{className:`menu-check`,children:e.checked&&(0,C.jsx)(T,{name:`check`,size:16})}),(0,C.jsxs)(`span`,{className:`menu-label`,children:[e.label,e.detail&&(0,C.jsx)(`small`,{className:`menu-detail`,"aria-hidden":`true`,children:e.detail})]}),e.hint&&(0,C.jsx)(`span`,{className:`menu-hint`,"aria-hidden":`true`,children:e.hint}),e.icon&&e.checked&&(0,C.jsx)(`span`,{className:`menu-check`,children:(0,C.jsx)(T,{name:`check`,size:16})})]}),n=e.href?(0,C.jsx)(`a`,{role:`menuitem`,title:e.title,href:e.href,target:`_blank`,rel:`noreferrer`,onClick:m,children:t},e.id||e.label):(0,C.jsx)(`button`,{type:`button`,title:e.title,role:e.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":e.checked,disabled:e.disabled,className:e.danger?`danger-text`:void 0,"data-indent":e.indent||void 0,style:e.indent?{paddingLeft:10+e.indent*14}:void 0,onClick:()=>{m(),c.current?.focus(),e.select?.()},children:t},e.id||e.label),r=e.edit?(0,C.jsxs)(`div`,{className:`menu-item-row`,children:[n,(0,C.jsx)(`button`,{type:`button`,role:`menuitem`,className:`icon-button paper-actions`,"aria-label":e.edit.label,title:e.edit.label,"aria-haspopup":`dialog`,onClick:()=>{m(),c.current?.focus(),e.edit?.select()},children:(0,C.jsx)(T,{name:`pencil`,size:15})})]},e.id||e.label):n;return e.divider?[(0,C.jsx)(`div`,{role:`separator`,className:`menu-separator`},e.label+`-divider`),r]:r})})]})}var We=[{id:`spark`,label:`Sparkles`},{id:`pen`,label:`Pen`},{id:`spellcheck`,label:`Spelling`},{id:`compress`,label:`Shorten`},{id:`sigma`,label:`Math`},{id:`checklist`,label:`Checklist`},{id:`notes`,label:`Comments`},{id:`book`,label:`Book`},{id:`search`,label:`Search`},{id:`code`,label:`Code`},{id:`tool`,label:`Tools`},{id:`chart`,label:`Chart`},{id:`globe`,label:`Globe`},{id:`lightbulb`,label:`Idea`},{id:`link`,label:`Link`},{id:`branch`,label:`Branch`}],Ge=e=>We.some(t=>t.id===e),Ke={polish:`spark`,proofread:`spellcheck`,shorten:`compress`,"check-math":`sigma`,consistency:`checklist`,"latex-warnings":`tool`,"reviewer-response":`notes`,"ai-review":`notes`},qe=e=>Ge(e.icon)?e.icon:Object.hasOwn(Ke,e.id)?Ke[e.id]:`spark`,Je=e=>!e.source||e.source===`builtin`?R(e.name):e.name,Ye=e=>e.source===`builtin`?R(e.description):e.description,Xe=e=>/^\/([\p{L}\p{M}\p{N}_-]*)$/u.exec(e)?.[1].toLowerCase()??null;function Ze(e,t){let n=e=>[e.id,e.name,Je(e)].map(e=>e.toLowerCase().replace(/\s+/g,`-`)),r=e.filter(e=>n(e).some(e=>e.startsWith(t))),i=e.filter(e=>!r.includes(e)&&(n(e).some(e=>e.includes(t))||[e.description,Ye(e)].some(e=>e.toLowerCase().includes(t))));return[...r,...i]}function Qe({id:e,skills:t,active:n,onPick:r,onActive:i}){return(0,C.jsx)(`div`,{className:`skill-menu`,role:`listbox`,id:e,"aria-label":R(`Skills`),children:t.length?t.map((t,a)=>(0,C.jsxs)(`div`,{role:`option`,id:`${e}-${a}`,title:Ye(t),"aria-selected":a===n,className:`skill-option`+(a===n?` active`:``),onPointerDown:e=>{e.preventDefault(),r(t)},onPointerEnter:()=>i(a),children:[(0,C.jsxs)(`span`,{className:`skill-name`,"data-skill-icon":qe(t),children:[(0,C.jsx)(T,{name:qe(t),size:14}),Je(t)]}),t.source!==`builtin`&&(0,C.jsx)(`span`,{className:`skill-source`,children:t.source===`paper`?R(`This paper`):R(`Yours`)})]},t.id)):(0,C.jsx)(`p`,{className:`skill-empty`,children:R(`No matching skills`)})})}function $e({skill:e,onRemove:t}){let n=Je(e);return(0,C.jsxs)(`span`,{className:`skill-chip`,"data-skill-icon":qe(e),title:R(`Skill: {name}`,{name:n}),children:[(0,C.jsx)(T,{name:qe(e),size:13}),n,t&&(0,C.jsx)(`button`,{type:`button`,"aria-label":R(`Remove the {name} skill`,{name:n}),onClick:t,children:(0,C.jsx)(T,{name:`close`,size:12})})]})}function et({skills:e,selected:t,onPick:n,disabled:r,onAttach:i}){return!e.length&&!i?null:(0,C.jsx)(Ue,{label:R(i?`Add files or skills`:`Add skill`),className:`icon-button composer-plus`,menuClassName:`skills-picker-menu`,align:`start`,disabled:r,actions:[...i?[{label:R(`Add files…`),icon:`attachment`,select:i}]:[],...e.map((e,r)=>({id:e.id,label:Je(e),title:Ye(e),icon:qe(e),divider:!!(i&&r===0),checked:t?.id===e.id,select:()=>n(t?.id===e.id?null:e)}))],children:(0,C.jsx)(T,{name:`plus`,size:19})})}var tt=class{key;storage;entries=[];error=``;requests=new Map;listeners=new Set;snapshot={entries:this.entries,files:[],blocked:!1,error:``};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;constructor(e,t){this.key=e,this.storage=t;try{let n=JSON.parse(t.getItem(e)||`[]`);Array.isArray(n)&&(this.entries=n.filter(e=>e&&typeof e.id==`string`&&typeof e.projectId==`string`&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.mime==`string`).slice(0,10).map(e=>({key:e.id,name:e.name,size:e.size,attachment:e,uploading:!1})))}catch{}this.changed()}changed(){let e=this.entries.flatMap(e=>e.attachment?[e.attachment]:[]);this.snapshot={entries:this.entries,files:e,blocked:this.entries.some(e=>e.uploading||!!e.error),error:this.error},e.length?this.storage.setItem(this.key,JSON.stringify(e)):this.storage.removeItem(this.key);for(let e of this.listeners)e()}async add(e,t){this.error=``;let n=[];for(let t of e){let e=this.entries.reduce((e,t)=>e+t.size,0);if(this.entries.length>=10){this.error=R(`Attach up to 10 files per message.`);break}if(!t.size){this.error=R(`The file “{name}” is empty.`,{name:t.name});continue}if(t.size>26214400){this.error=R(`Files must be 25 MB or smaller.`);continue}if([`image/png`,`image/jpeg`,`image/gif`,`image/webp`].includes(t.type)&&t.size>5242880){this.error=R(`Images must be 5 MB or smaller.`);continue}if(e+t.size>104857600){this.error=R(`Attachments must total 100 MB or less.`);continue}let r={key:crypto.randomUUID?.()||Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),name:t.name,size:t.size,file:t,uploading:!0};this.entries=[...this.entries,r],n.push(r)}this.changed(),await Promise.all(n.map(e=>this.upload(e.key,t)))}async upload(e,t){let n=this.entries.find(t=>t.key===e);if(!n?.file||this.requests.has(e))return;let r=new AbortController;this.requests.set(e,r),this.entries=this.entries.map(t=>t.key===e?{...t,uploading:!0,error:void 0}:t),this.changed();try{let i=await t(n.file,r.signal);this.entries=this.entries.map(t=>t.key===e?{key:e,name:i.name,size:i.size,attachment:i,uploading:!1}:t)}catch(t){this.entries=this.entries.map(n=>n.key===e?{...n,uploading:!1,error:t instanceof Error?t.message:R(`Upload failed. Please retry.`)}:n)}finally{this.requests.delete(e),this.changed()}}remove(e){this.requests.get(e)?.abort(),this.entries=this.entries.filter(t=>t.key!==e),this.error=``,this.changed()}clear(e){let t=new Set(e.map(e=>e.id));this.entries=this.entries.filter(e=>!e.attachment||!t.has(e.attachment.id)),this.error=``,this.changed()}dispose(){for(let e of this.requests.values())e.abort();this.entries=[],this.error=``,this.changed()}},nt=new Map;function rt(){for(let e of nt.values())e.dispose();nt.clear()}function it(e){let t=(0,S.useMemo)(()=>{let t=nt.get(e);return t||(t=new tt(e,D),nt.set(e,t)),t},[e]);return{draft:t,...(0,S.useSyncExternalStore)(t.subscribe,t.getSnapshot)}}var at=e=>`/api/projects/${encodeURIComponent(e.projectId)}/attachments/${encodeURIComponent(e.id)}`,ot=e=>e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`;function st({file:e}){return e?.mime.startsWith(`image/`)?(0,C.jsx)(`img`,{src:at(e),alt:``,loading:`lazy`}):(0,C.jsx)(T,{name:e?.mime===`application/pdf`?`pdf`:`paper`,size:20})}function ct({draft:e,upload:t,discard:n,disabled:r}){let{entries:i,error:a}=(0,S.useSyncExternalStore)(e.subscribe,e.getSnapshot);return(0,C.jsxs)(C.Fragment,{children:[i.length>0&&(0,C.jsx)(`ul`,{className:`composer-attachments`,"aria-label":R(`Attachments`),children:i.map(i=>(0,C.jsxs)(`li`,{className:`attachment`+(i.error?` attachment-failed`:``),children:[(0,C.jsx)(`span`,{className:`attachment-icon`,children:i.uploading?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(st,{file:i.attachment})}),(0,C.jsxs)(`span`,{className:`attachment-info`,children:[(0,C.jsx)(`span`,{className:`attachment-name`,title:i.name,children:i.name}),(0,C.jsx)(`small`,{title:i.error,role:i.uploading?`status`:i.error?`alert`:void 0,children:i.uploading?R(`Uploading…`):i.error||ot(i.size)})]}),i.error&&(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Retry uploading {name}`,{name:i.name}),disabled:r,onClick:()=>void e.upload(i.key,t),children:(0,C.jsx)(T,{name:`refresh`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Remove attachment {name}`,{name:i.name}),disabled:r,onClick:()=>{e.remove(i.key),i.attachment&&n(i.attachment)},children:(0,C.jsx)(T,{name:`close`,size:14})})]},i.key))}),a&&(0,C.jsx)(`p`,{className:`attachment-error`,role:`alert`,children:a})]})}function lt({files:e}){return e?.length?(0,C.jsx)(`ul`,{className:`message-attachments`,"aria-label":R(`Attachments`),children:e.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsxs)(`a`,{className:`attachment`,href:at(e),target:`_blank`,rel:`noreferrer`,title:R(`Open attachment {name}`,{name:e.name}),children:[(0,C.jsx)(`span`,{className:`attachment-icon`,children:(0,C.jsx)(st,{file:e})}),(0,C.jsxs)(`span`,{className:`attachment-info`,children:[(0,C.jsx)(`span`,{className:`attachment-name`,children:e.name}),(0,C.jsx)(`small`,{children:ot(e.size)})]}),(0,C.jsx)(T,{name:`external`,size:13})]})},e.id))}):null}var ut=e=>e.replace(/^Round\s+\d+(?:\s*·\s*|$)/i,``),dt=class{current=null;run(e,t,n){if(this.current?.key===e)return this.current.promise;this.cancel();let r=new AbortController,i=Promise.resolve().then(()=>t(r.signal)).then(e=>{r.signal.aborted||n(e)}).catch(e=>{if(!r.signal.aborted)throw e}).finally(()=>{this.current?.controller===r&&(this.current=null)});return this.current={key:e,controller:r,promise:i},i}cancel(){this.current?.controller.abort(),this.current=null}};function ft(e){return e===`h2`||e===`h3`}var pt=`.task-commit{width:100%;min-width:0;font:13px/1.5 var(--sans);color:var(--text);flex-direction:column;gap:6px;display:flex;container:task-commit/inline-size}.task-commit-compose{border:1px solid var(--line);background:var(--bg-subtle);border-radius:10px;min-width:0;transition:border-color .15s,background .15s}.task-commit-compose:focus-within{border-color:var(--line-hover);background:var(--bg)}.task-commit textarea{box-sizing:border-box;resize:none;width:100%;min-height:42px;max-height:132px;color:var(--text);font:14px/22px var(--sans);box-shadow:none;background:0 0;border:0;border-radius:10px;outline:none;margin:0;padding:11px 12px 5px;display:block}.task-commit textarea:focus{box-shadow:none;border:0;outline:none}.task-commit textarea::placeholder{color:var(--text-3)}.task-commit-toolbar{flex-wrap:wrap;align-items:center;gap:4px 8px;padding:6px 8px 8px 12px;display:flex}.task-commit .task-commit-branch{min-width:0;max-width:min(42%,260px);color:var(--text-3);font:11.5px/1.5 var(--mono,ui-monospace,monospace);align-items:center;gap:5px;display:inline-flex}.task-commit-branch svg{flex-shrink:0}.task-commit .task-commit-branch>span{text-overflow:ellipsis;white-space:nowrap;color:inherit;overflow:hidden}.task-commit-generate{width:28px;height:28px;color:var(--text-3);cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;margin-left:auto;padding:0;display:inline-flex}.task-commit-generate:hover{background:var(--bg-hover);color:var(--text)}.task-commit .task-commit-generate[aria-busy=true]{opacity:1}.task-commit-actions{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:4px;display:flex}.task-commit-actions button{min-height:30px;color:var(--text-2);font:500 12px/20px var(--sans);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:7px;justify-content:center;align-items:center;gap:7px;padding:4px 10px;transition:background .15s,color .15s;display:inline-flex}.task-commit-actions button:hover:not(:disabled){background:var(--bg-hover);color:var(--text)}.task-commit-actions .task-commit-primary{background:var(--primary);color:#fff;padding-inline:11px;font-size:13px}.task-commit-actions .task-commit-primary:hover:not(:disabled){background:var(--primary-hover);color:#fff}.task-commit button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.task-commit button:disabled{opacity:.45;cursor:default}.task-commit .task-commit-hint{color:var(--text-3);padding-inline:2px;font-size:11px}.task-commit-error{color:var(--red);overflow-wrap:anywhere;margin:0;padding-inline:2px;font-size:12px}.task-commit-spinner{box-sizing:border-box;border:1.5px solid var(--accent-line);border-top-color:var(--accent);border-radius:50%;flex-shrink:0;width:15px;height:15px;animation:.8s linear infinite task-commit-spin;display:inline-block}@keyframes task-commit-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.task-commit-spinner{animation:none}.task-commit-compose,.task-commit button{transition:none}}.review-complete:has(.task-commit){border-radius:12px;gap:3px 8px;padding:12px 14px}.review-complete:has(.task-commit)>strong{align-items:center;gap:7px;font-size:12px;font-weight:600;display:inline-flex}.review-complete:has(.task-commit)>strong:before{content:"";background:var(--green);border-radius:50%;flex-shrink:0;width:6px;height:6px}.review-complete:has(.task-commit)>span{color:var(--text-3);font-size:12px}.review-complete-actions:has(.task-commit){width:100%;margin:8px 0 0}.task-delivery:has(.task-commit){align-items:stretch}.review-complete-jump{top:calc(var(--papilot-review-bar-height,44px) + 8px);z-index:8;box-sizing:border-box;border:1px solid var(--line-strong);background:var(--bg);color:var(--text);box-shadow:var(--float);font:12px/1.4 var(--sans);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;padding:8px 10px 8px 12px;display:flex;position:fixed;left:14px;right:34px}.review-complete-jump>span{align-items:center;gap:6px;min-width:0;font-weight:500;display:flex}.review-complete-jump>span>svg{color:var(--green);flex:none}.review-complete-jump button{border:1px solid var(--line-strong);background:var(--bg);min-height:30px;color:var(--text);font:500 13px/1.4 var(--sans);cursor:pointer;border-radius:7px;flex:none;justify-content:center;align-items:center;gap:6px;padding:4px 11px;transition:background-color .15s,border-color .15s;display:inline-flex}.review-complete-jump button:hover{background:var(--bg-subtle);border-color:var(--line-hover)}.review-complete-jump button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@media (width<=520px){.review-complete-jump{gap:8px;padding:6px 8px;left:8px;right:24px}.review-complete-jump button{min-height:36px}}@container task-commit (width<=460px){.task-commit-toolbar:has(.task-commit-alternative) .task-commit-actions{flex-basis:100%;padding-top:2px}.task-commit-toolbar:has(.task-commit-alternative) .task-commit-branch{max-width:calc(100% - 44px)}}@media (width<=520px){.task-commit textarea{font-size:16px;line-height:24px}.task-commit-actions button{min-height:36px}.task-commit-generate{width:32px;height:32px}}`;function mt(e){let t=[];for(let n of[...e].sort((e,t)=>e[1]-t[1]||e[0]-t[0])){let e=t.find(e=>Math.abs((e[1]+e[3])/2-(n[1]+n[3])/2)<Math.min(e[3]-e[1],n[3]-n[1])/2&&n[0]<=e[2]+.02);e?(e[0]=Math.min(e[0],n[0]),e[1]=Math.min(e[1],n[1]),e[2]=Math.max(e[2],n[2]),e[3]=Math.max(e[3],n[3])):t.push([...n])}return t}function ht(e,t,n,r=1/0){let i=-1,a=r;return e.forEach((e,r)=>{if(!e)return;let[o,s,c,l]=e,u=4*Math.max(s-n,0,n-l)+Math.max(o-t,0,t-c);u<a&&(a=u,i=r)}),i}function gt(e,t){let n=e[t].line,r=t=>e[t]?.line===n&&!/\s/u.test(e[t].text),i=t,a=t;for(;r(i-1);)i--;for(;r(a+1);)a++;return[i,a]}function _t(e,t){let n=(e.ownerDocument??e).defaultView,r=()=>n.matchMedia(`(pointer: coarse)`).matches,i=e=>e instanceof n.Element?e:e?.parentElement,a=null,o=null,s=null;function c(e){let{units:n,line:r}=t.units(e),i=n.map((e,t)=>({text:e.textContent||``,line:r(e,t)}));return{units:n,words:i,boxes:n.map((e,t)=>{let n=e.getBoundingClientRect();return/\S/u.test(i[t].text)&&(n.width||n.height)?[n.left,n.top,n.right,n.bottom]:null})}}let l=()=>{a&&t.onSelect({target:a.target,units:a.units,from:a.from,to:a.to})},u=()=>{a=null,t.onClear()},d=e=>{if(clearTimeout(s?.timer),s=null,o=null,e.touches.length!==1||t.blocked()||!r())return;let n=i(e.target),{clientX:u,clientY:d}=e.touches[0],f=n?.closest(`.select-handle`);if(f&&a){Object.assign(a,c(a.target)),o=f.dataset.end;return}if(n?.closest(t.menu))return;let p=n?t.target(n):void 0;s={x:u,y:d,timer:setTimeout(()=>{if(s=null,p===void 0)return;let e=c(p),t=ht(e.boxes,u,d,40);if(t<0)return;let n=gt(e.words,t);a={target:p,...e,anchor:n,from:n[0],to:n[1]},o=`extend`,l()},450)}},f=e=>{let t=e.touches[0];if(!t||(s&&Math.hypot(t.clientX-s.x,t.clientY-s.y)>10&&(clearTimeout(s.timer),s=null),!o||!a))return;e.preventDefault();let n=ht(a.boxes,t.clientX,t.clientY);if(n<0)return;let[r,i]=gt(a.words,n);o===`extend`?(a.from=Math.min(a.anchor[0],r),a.to=Math.max(a.anchor[1],i)):o===`from`?a.from=Math.min(r,gt(a.words,a.to)[0]):a.to=Math.max(i,gt(a.words,a.from)[1]),l()},p=e=>{o?(o=null,e.cancelable&&e.preventDefault()):s&&(clearTimeout(s.timer),s=null,a&&!i(e.target)?.closest(t.menu)&&u())},m=()=>{clearTimeout(s?.timer),s=null,o=null},h=[[`touchstart`,d,{passive:!0}],[`touchmove`,f,{passive:!1}],[`touchend`,p,{passive:!1}],[`touchcancel`,m],[`contextmenu`,e=>{let n=i(e.target);r()&&n&&t.target(n)!==void 0&&e.preventDefault()}]];for(let[t,n,r]of h)e.addEventListener(t,n,r);return{active:()=>!!a,reset:()=>{a=null,o=null},stop:()=>{m(),a=null;for(let[t,n]of h)e.removeEventListener(t,n)}}}function vt(e,t){let n=(0,S.useRef)(e);n.current=e,(0,S.useEffect)(()=>{let e=[...new Set([document,...t?[t]:[]])],r=t=>{if(t.defaultPrevented||t.isComposing||t.repeat||t.altKey||t.shiftKey||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!==`z`)return;let r=t.target;r?.isContentEditable||r?.closest?.(`input, textarea, select, [role="textbox"]`)||e.some(e=>e.querySelector(`dialog[open], [aria-modal="true"]`))||n.current()&&(t.preventDefault(),t.stopImmediatePropagation())};return e.forEach(e=>e.addEventListener(`keydown`,r,!0)),()=>e.forEach(e=>e.removeEventListener(`keydown`,r,!0))},[t])}var yt=()=>crypto.randomUUID?.()||Array.from(crypto.getRandomValues(new Uint8Array(20)),e=>e.toString(16).padStart(2,`0`)).join(``),bt=e=>Math.max(0,Math.min(1,e)),xt=([e,t,n,r])=>({left:`${e*100}%`,top:`${t*100}%`,width:`${(n-e)*100}%`,height:`${(r-t)*100}%`}),St=e=>e?.nodeType===1?e:e?.parentElement;function Ct(e){try{let t=JSON.parse(D.getItem(e)||`null`);if(t&&Array.isArray(t.notes)&&typeof t.requestKey==`string`)return t}catch{}return{notes:[],requestKey:yt(),editing:null}}function wt(e,t,n,r){let i=e.strip.closest(`.change`),a=e.strip.closest(`.before`)?`Before`:e.strip.closest(`.after`)?`After`:`Unchanged text`,o=i?.querySelector(`.change-number`),s=i?.querySelector(`.change-where`),c=[`Round ${e.round}`,`PDF page ${e.strip.dataset.page||`?`}`,a,o?.dataset.change?`Change ${o.dataset.change}`:o?.textContent,s?.dataset.location||s?.getAttribute(`title`)||s?.textContent].filter(Boolean).join(` · `);return{strip:e.key,round:e.round,where:c,quote:n,rects:t,region:r}}function Tt(e,t){let n=e.strip.getBoundingClientRect(),r=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>[bt((e.left-n.left)/n.width),bt((e.top-n.top)/n.height),bt((e.right-n.left)/n.width),bt((e.bottom-n.top)/n.height)]),i=t.toString().replace(/\s+/g,` `).trim();return i&&r.length?wt(e,mt(r),i,!1):null}function Et({doc:e,layer:t,selection:n,group:r,onAdd:i}){let a=(0,S.useRef)(null);return(0,S.useLayoutEffect)(()=>{let r=()=>{let r=a.current;if(!r)return;let i=t.strip.getBoundingClientRect(),o=e.getElementById(`paper`)?.getBoundingClientRect()||e.body.getBoundingClientRect(),s=i.top+n.rects[0][1]*i.height,c=i.top+n.rects.at(-1)[3]*i.height,l=i.left+i.width*(Math.min(...n.rects.map(e=>e[0]))+Math.max(...n.rects.map(e=>e[2])))/2,u=r.offsetHeight,d=r.offsetWidth/2,f=s-u-22>=o.top+6;r.style.top=`${f?s-u-22:c+22}px`,r.style.left=`${Math.max(o.left+d+8,Math.min(o.right-d-8,l))}px`,r.style.visibility=c<o.top||s>o.bottom?`hidden`:``};r();let i=0,o=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(r)};return e.addEventListener(`scroll`,o,!0),e.defaultView?.addEventListener(`resize`,o),()=>{cancelAnimationFrame(i),e.removeEventListener(`scroll`,o,!0),e.defaultView?.removeEventListener(`resize`,o)}},[e,t,n]),(0,C.jsx)(`div`,{ref:a,className:`review-select-menu`,children:(0,C.jsx)(`button`,{type:`button`,"aria-label":r?R(`Add to {group}`,{group:re(r)}):R(`Add note`),onClick:i,children:(0,C.jsx)(ae,{group:r})})})}function Dt({doc:e,task:t,onSend:n}){let r=`papilot:review-notes:${t.id}`,[i,a]=(0,S.useState)(()=>Ct(r)),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),f=(0,S.useRef)(u);f.current=u;let p=(0,S.useRef)([]),[m,h]=(0,S.useState)(!1),[g,v]=(0,S.useState)(()=>!!i.editing?.comment.trim()),[y,b]=(0,S.useState)(!1),[x,w]=(0,S.useState)(``),[E,O]=(0,S.useState)(null),k=(0,S.useRef)(null),A=(0,S.useRef)({draft:i,region:m,busy:y,open:g});A.current={draft:i,region:m,busy:y,open:g};let j=g&&!!i.editing,M=(0,S.useRef)(!1),N=(0,S.useRef)(null);vt(()=>{if(e&&(f.current||A.current.open)&&p.current.length&&!A.current.busy&&!A.current.draft.editing){let e=p.current.pop(),t=A.current.draft;return F({...t,notes:t.notes.filter(t=>t.id!==e),requestKey:yt()}),!0}return!e||!A.current.open||!A.current.draft.deleted?.length?!1:(A.current.busy||A.current.draft.editing||A.current.region||le(),!0)},e),(0,S.useEffect)(()=>{if(!m||!e)return;let t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),h(!1),O(null),k.current=null)};return e.addEventListener(`keydown`,t,!0),document.addEventListener(`keydown`,t,!0),()=>{e.removeEventListener(`keydown`,t,!0),document.removeEventListener(`keydown`,t,!0)}},[e,m]);function P(t){h(t),v(!1),N.current?.reset(),l(null),e?.defaultView?.focus()}function F(e){A.current.draft=e,D.setItem(r,JSON.stringify(e)),a(e)}(0,S.useEffect)(()=>{if(!e)return;let n=new Map,r=()=>{let r=!1,i=Array.from(e.querySelectorAll(`.pdf-strip`));for(let[e,t]of n)i.includes(e)||(t.element.remove(),n.delete(e),r=!0);i.forEach((i,a)=>{let o=i.querySelector(`img`)?.getAttribute(`src`)||``,s=Number(o.match(/\/files\/[^/]+\/(\d+)\//)?.[1]||t.review?.round||0),c=`${s}:${a}`,l=n.get(i);if(l?.key===c)return;l?.element.remove();let u=e.createElement(`div`);u.className=`review-note-layer`,i.append(u),n.set(i,{strip:i,element:u,key:c,round:s}),r=!0}),r&&(s([...n.values()]),N.current?.reset(),l(null))};r();let i=new MutationObserver(r);i.observe(e.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`src`]});let a,o=()=>{if(A.current.open&&A.current.draft.editing||A.current.region||A.current.busy||N.current?.active())return;let t=e.getSelection();if(!t?.rangeCount||t.isCollapsed){l(null);return}let r=t.getRangeAt(0),i=St(r.startContainer)?.closest(`.pdf-strip`),a=i===St(r.endContainer)?.closest(`.pdf-strip`)&&i?n.get(i):null;if(!a||!St(r.startContainer)?.closest(`.pdf-text`)||!St(r.endContainer)?.closest(`.pdf-text`)){l(null);return}let o=Tt(a,r);return l(o),o},c=()=>{clearTimeout(a),a=setTimeout(o,100)};e.addEventListener(`selectionchange`,c);let u=!1,d=e=>{f.current&&e.pointerType!==`touch`&&e.target.closest(`.pdf-text`)&&setTimeout(()=>{if(u)return;let e=o();e&&f.current&&ee(e)},0)};return e.addEventListener(`pointerup`,d),N.current=_t(e,{target:e=>{let t=e.closest(`.pdf-text`)?.closest(`.pdf-strip`);return t?n.get(t):void 0},units:e=>({units:Array.from(e.strip.querySelectorAll(`.pdf-glyph`)),line:e=>e.parentElement}),blocked:()=>{let{draft:e,region:t,busy:n,open:r}=A.current;return!!(r&&e.editing)||t||n},menu:`.review-select-menu`,onSelect:({target:t,units:n,from:r,to:i})=>{let a=e.createRange();a.setStart(n[r],0),a.setEnd(n[i],n[i].childNodes.length);let o=Tt(t,a);if(!o)return;let s=t.strip.getBoundingClientRect(),c=(e,t)=>{let n=e.getBoundingClientRect();return[bt((n[t]-s.left)/s.width),bt((n.top-s.top)/s.height),bt((n.bottom-s.top)/s.height)]};l({...o,handles:{from:c(n[r],`left`),to:c(n[i],`right`)}})},onClear:()=>l(null)}),()=>{u=!0,clearTimeout(a),i.disconnect(),N.current?.stop(),N.current=null,e.removeEventListener(`selectionchange`,c),e.removeEventListener(`pointerup`,d);for(let e of n.values())e.element.remove()}},[e,t.review?.round]);function I(e){d(e),N.current?.reset(),l(null),!e&&A.current.draft.notes.some(e=>e.group)&&v(!0)}(0,S.useEffect)(()=>{let t=e=>{e.key===`Escape`&&f.current&&I(null)};return e?.addEventListener(`keydown`,t),document.addEventListener(`keydown`,t),()=>{e?.removeEventListener(`keydown`,t),document.removeEventListener(`keydown`,t)}},[e]);function ee(t){let n=f.current,r=A.current.draft;if(!n||A.current.busy)return;let i={...t,group:n,comment:``,id:yt()};p.current.push(i.id),F({...r,notes:[...r.notes,i],requestKey:yt()}),N.current?.reset(),l(null),e?.getSelection()?.removeAllRanges()}function L({handles:t,...n}){if(f.current){ee(n);return}let r=A.current.draft;F({...r,editing:{...n,comment:r.editing?.id?``:r.editing?.comment||``}}),N.current?.reset(),l(null),h(!1),v(!0),e?.getSelection()?.removeAllRanges()}function te(e){F({...A.current.draft,editing:{...e}}),w(``),N.current?.reset(),l(null)}function ne(){let t=A.current.draft,n=t.editing?.id;F({...t,editing:null}),t.notes.length||v(!1),n&&requestAnimationFrame(()=>e?.querySelector(`[data-note="${n}"] .note-comment`)?.focus())}function se(){let e=A.current.draft;e.editing&&!e.editing.comment.trim()&&F({...e,editing:null}),v(!1),h(!1)}function B(){let e=A.current.draft,t=e.editing;if(!t?.comment.trim()||y)return;let n={...t,comment:t.comment.trim(),id:t.id||yt()};F({...e,notes:t.id?e.notes.map(e=>e.id===n.id?n:e):[...e.notes,n],requestKey:yt()}),ne()}function V(e){p.current=[];let t=A.current.draft;F({...t,notes:t.notes.filter(t=>t.id!==e.id),deleted:[...t.deleted||[],{note:e,index:t.notes.indexOf(e)}],requestKey:yt()}),w(``)}function le(){let t=A.current.draft,n=[...t.deleted||[]],r=n.pop();if(!r)return;let i=[...t.notes];i.splice(r.index,0,r.note),F({...t,notes:i,deleted:n,requestKey:yt()}),w(``),requestAnimationFrame(()=>e?.querySelector(`[data-note="${r.note.id}"] .note-comment`)?.focus())}async function ue(){if(M.current||!i.notes.length||i.editing)return;M.current=!0,b(!0),w(``);let e=i;try{await n({requestKey:e.requestKey,text:e.instructions||``,notes:e.notes.map(e=>({...e.group?{group:e.group}:{},id:e.id,where:e.where+(e.region?` · Region in displayed strip: ${e.rects[0].map(e=>`${Math.round(e*100)}%`).join(`, `)}`:``),quote:e.quote,comment:e.comment,anchor:{...ze(e),round:e.round}}))});let t=Ct(r);t.requestKey===e.requestKey?F({notes:[],editing:null,requestKey:yt()}):a(t),v(!1),d(null),p.current=[]}catch(e){w(e instanceof Error?e.message:String(e))}finally{M.current=!1,b(!1)}}let de=t.status===`uncertain`||t.status===`deleting`,fe=i.notes.some(e=>e.group);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(oe,{value:u,onChange:I,disabled:y||j}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Mark region`),title:R(`Mark region`),"aria-pressed":m,disabled:!e||y||j,onClick:()=>P(!m),children:(0,C.jsx)(T,{name:`region`,size:16})}),e&&(0,Ne.createPortal)((0,C.jsx)(`style`,{children:`.review-note-layer{z-index:3;pointer-events:none;font-family:var(--sans);position:absolute;inset:0}.review-note-mark,.review-note-box{pointer-events:none;background:color-mix(in srgb,var(--accent) 20%,transparent);border-radius:2px;position:absolute}.review-note-box{border:1.5px solid var(--primary);background:color-mix(in srgb,var(--accent) 8%,transparent)}.review-region-capture{pointer-events:auto;cursor:crosshair;touch-action:none;position:absolute;inset:0}.review-note-tag,.review-add-note{pointer-events:auto;background:var(--primary);color:#fff;font:500 13px/1.4 var(--sans);cursor:pointer;border:0;border-radius:16px;padding:5px 10px;position:absolute;box-shadow:0 2px 8px #0002}.review-note-tag{min-width:24px;padding:3px 6px;left:8px}.review-add-note{white-space:nowrap;z-index:2;transform:translate(-50%,4px)}.review-notes-panel{z-index:20;box-sizing:border-box;border:1px solid var(--line);background:var(--bg);width:min(360px,100% - 32px);max-height:calc(100% - 80px);color:var(--text);box-shadow:var(--float);font:14px/1.5 var(--sans);border-radius:14px;padding:14px;position:fixed;bottom:16px;right:16px;overflow:auto}.review-notes-panel *{box-sizing:border-box}.review-notes-panel header,.review-notes-panel footer,.review-note-head{justify-content:space-between;align-items:center;gap:8px;display:flex}.review-notes-panel header{margin-bottom:10px}.review-notes-panel button{font:inherit;cursor:pointer;background:var(--bg-muted);color:var(--text-2);border:0;border-radius:7px;padding:5px 10px}.review-notes-panel button:disabled{opacity:.45;cursor:default}.review-notes-panel button:focus-visible,.review-add-note:focus-visible,.review-note-tag:focus-visible{outline:2px solid var(--primary);outline-offset:2px}.review-notes-panel button.primary{background:var(--primary);color:#fff;padding:7px 12px}.review-notes-panel footer{justify-content:flex-end;margin-top:10px}.review-notes-panel p{white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0}.review-notes-panel small{color:var(--text-2);overflow-wrap:anywhere}.review-notes-panel blockquote{border-left:2px solid var(--line);color:var(--text-2);max-height:110px;margin:8px 0;padding-left:10px;font-size:13px;overflow:auto}.review-notes-panel textarea{resize:vertical;border:1px solid var(--line-strong);width:100%;min-height:80px;font:14px/1.5 var(--sans);color:var(--text);background:var(--bg);border-radius:8px;padding:8px;display:block}.review-notes-panel textarea:focus{outline:2px solid var(--accent-line);border-color:var(--primary)}.review-notes-panel ol{margin:0;padding:0;list-style:none}.review-notes-panel li+li{border-top:1px solid var(--line);margin-top:12px;padding-top:12px}.review-notes-panel button.review-note-location{text-align:left;color:var(--text-2);overflow-wrap:anywhere;background:0 0;padding:0;font-size:12px}.review-notes-panel .review-notes-error{color:var(--red)}.review-notes-empty{text-align:center;color:var(--text-2);padding:8px 0}.review-note-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:14px;display:grid}.review-note-actions button{flex-direction:column;align-items:center;gap:7px;min-height:68px;padding:10px 6px;display:flex}@media (pointer:coarse){.pdf-strip,.pdf-strip .pdf-text,.pdf-strip .pdf-glyph{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}}.select-handle{background:var(--primary);pointer-events:auto;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;width:2px;margin-left:-1px;position:absolute}.select-handle:before{content:"";position:absolute;inset:-16px -15px}.select-handle:after{content:"";background:var(--primary);border-radius:50%;width:12px;height:12px;position:absolute;left:-5px}.select-handle[data-end=from]:after{top:-11px}.select-handle[data-end=to]:after{bottom:-11px}.review-select-menu{z-index:19;font-family:var(--sans);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:manipulation;position:fixed;transform:translate(-50%)}.review-select-menu button{background:var(--primary);color:#fff;height:40px;font:500 15px/1 var(--sans);white-space:nowrap;cursor:pointer;border:0;border-radius:20px;padding:0 18px;box-shadow:0 4px 16px #00000040}:root[data-papilot-phone] .review-notes-panel{left:0;right:0;top:var(--papilot-review-bar-height,48px);width:auto;max-height:calc(100% - var(--papilot-review-bar-height,48px) - var(--keyboard,0px));border-width:0 0 1px;border-radius:0 0 16px 16px;padding:12px 14px 14px;bottom:auto}:root[data-papilot-phone] body:has(.review-notes-panel) .change-head .dock{display:none}:root[data-papilot-phone] .review-notes-panel header{margin-bottom:6px}:root[data-papilot-phone] .review-notes-panel form small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}:root[data-papilot-phone] .review-notes-panel form blockquote{-webkit-line-clamp:2;-webkit-box-orient:vertical;max-height:none;margin:6px 0 8px;display:-webkit-box;overflow:hidden}:root[data-papilot-phone] .review-notes-panel textarea{resize:none;min-height:76px;font-size:16px}:root[data-papilot-phone] .review-notes-panel button{min-height:40px}:root[data-papilot-phone] .review-notes-panel footer button{padding:0 16px}.note-quote{border-left:2px solid var(--line-strong);background:var(--bg-muted);border-radius:0 4px 4px 0;margin:4px 0 0;padding:4px 8px}.note-quote .note-quote-text{font:13px/1.5 var(--sans);color:var(--text-2);white-space:pre-wrap;overflow-wrap:anywhere;border:0;max-height:8em;margin:0;padding:0;overflow:auto}.note-body{margin-top:4px;padding:0 2px}.note-comment.note-comment{width:100%;color:var(--text);font:14px/1.5 var(--sans);text-align:left;cursor:text;background:0 0;border:0;border-radius:4px;align-items:flex-start;gap:8px;padding:2px 0;display:flex}.note-comment span{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.note-comment svg{color:var(--text-3,var(--text-2));opacity:0;flex:none;margin-top:4px;transition:opacity .15s}.note-comment:hover svg,.note-comment:focus-visible svg{opacity:1}.note-comment:focus-visible{outline:2px solid var(--primary);outline-offset:3px}.note-comment:disabled{cursor:default}@media (pointer:coarse){.note-comment svg{opacity:.6}.note-comment.note-comment{min-height:40px}}.group-picker{flex:none;align-items:center;gap:2px;display:inline-flex}.group-highlight{justify-content:center;width:20px;height:22px;display:flex;position:relative}.group-highlight:after{content:"";background:var(--text-3);opacity:.4;border-radius:2px;height:2px;position:absolute;bottom:0;left:3px;right:3px}.group-select[data-group] .group-highlight:after{background:var(--note-color);opacity:1}.group-palette{border:1px solid var(--line);border-radius:var(--r-lg);background:var(--bg);max-width:calc(100vw - 16px);color:var(--text);box-shadow:var(--float);font:13px/1.5 var(--sans);margin:0;padding:8px;position:fixed;inset:auto}.group-palette-label{color:var(--text-3);padding:3px 6px 7px;font-size:12px}.group-swatches{gap:4px;padding:0 2px 4px;display:flex}.group-swatch{border-radius:var(--r);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:32px;height:32px;padding:6px;display:flex}.group-swatch>span{background:var(--note-color);border-radius:50%;flex:none;width:20px;height:20px}.group-swatch:hover{background:var(--bg-hover)}.group-swatch[aria-checked=true]>span{outline:1.5px solid var(--note-color);outline-offset:3px}.group-individual{border-radius:var(--r);width:100%;color:var(--text-2);font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;margin-top:9px;padding:7px 6px;display:flex;position:relative}.group-individual:before{content:"";border-top:1px solid var(--line);position:absolute;top:-5px;left:2px;right:2px}.group-individual>span{text-align:left;flex:1}.group-individual:hover{background:var(--bg-hover);color:var(--text)}.group-dot{background:var(--note-color);width:9px;height:9px;box-shadow:0 0 0 1px color-mix(in srgb,var(--note-color) 30%,transparent);border-radius:50%;flex:none;display:inline-block}.annotation-group{border:1px solid var(--line);border-left:2px solid var(--note-color);background:var(--bg);border-radius:10px;margin:3px 0}.annotation-group.active:not([data-selected]){border-color:var(--note-color)}.annotation-group[data-selected]{transition:background-color .15s,border-color .15s}.annotation-group[data-selected=true]{border-color:color-mix(in srgb,var(--note-color) 70%,var(--line));background:color-mix(in srgb,var(--note-color) 11%,var(--bg))}.annotation-group[data-selected=mixed]{border-color:color-mix(in srgb,var(--note-color) 55%,var(--line));background:color-mix(in srgb,var(--note-color) 4%,var(--bg));border-style:dashed}.annotation-group[data-selected=false]{border-color:var(--line);background:var(--bg)}.group-header{font:12px/1.5 var(--sans);color:var(--text-2);align-items:stretch;gap:2px;padding-right:4px;display:flex}.group-header strong{color:var(--text);margin-right:auto;font-weight:500}.group-disclosure{border-radius:6px;flex:none;justify-content:center;align-self:center;align-items:center;width:32px;height:32px;display:flex}.group-disclosure:hover{background:var(--bg-hover)}.group-disclosure[aria-expanded=true]>svg{transform:rotate(180deg)}.group-selection-toggle,.group-heading{text-align:left;min-width:0;min-height:36px;color:inherit;font:inherit;flex:1;align-items:center;gap:8px;padding:6px 10px;display:flex}.group-selection-toggle[aria-pressed=true]>strong{font-weight:600}.group-selection-toggle[aria-pressed=false]>strong{color:var(--text-3)}.group-selection-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:4px;border-radius:2px}.group-locations{max-height:240px;padding:0 10px 5px;overflow:auto}.group-instruction-input{margin:0 0 10px;position:relative}.group-instruction-input textarea{box-sizing:border-box;resize:none;border:1px solid var(--line-strong);background:var(--bg);width:100%;min-height:64px;max-height:160px;color:var(--text);font:14px/1.6 var(--sans);border-radius:10px;padding:11px 34px 11px 12px;transition:border-color .15s,box-shadow .15s;display:block;box-shadow:0 1px 2px #00000006}.group-instruction-input textarea:hover:not(:disabled){border-color:var(--line-hover)}.group-instruction-input textarea:focus{border-color:color-mix(in srgb,var(--note-color) 70%,var(--text-3));box-shadow:0 0 0 3px color-mix(in srgb,var(--note-color) 13%,transparent);outline:none}.group-instruction-input textarea::placeholder{color:var(--text-3)}.group-instruction-input>svg{color:var(--text-3);pointer-events:none;opacity:.7;transition:opacity .15s;position:absolute;top:15px;right:12px}.group-instruction-input:focus-within>svg{opacity:0}.group-instruction-sent{font:13px/1.5 var(--sans);white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text);margin:2px 0 8px}@media (pointer:coarse){.group-instruction-input textarea{font-size:16px}.group-disclosure{width:44px;height:44px}.group-selection-toggle{min-height:44px}}.group-location{border-top:1px solid var(--line);font:12px/1.5 var(--sans);align-items:center;gap:6px;padding:4px 0 1px;display:flex}.notes-panel .group-location{border:1px solid var(--line);border-radius:6px;margin:4px 0;padding:6px 8px}.notes-panel .annotation-group{flex:none}.notes-panel .group-locations{max-height:none;overflow:visible}.group-location-target{text-align:left;min-width:0;color:var(--text-2);cursor:default;background:0 0;border:0;flex:1}.group-location-target>span{color:var(--text-3);font-size:11px}.group-location blockquote{white-space:nowrap;text-overflow:ellipsis;color:var(--text);margin:1px 0 0;font-size:13px;overflow:hidden}.notes-panel .group-location blockquote{-webkit-line-clamp:3;white-space:normal;overflow-wrap:anywhere;-webkit-box-orient:vertical;display:-webkit-box}.group-locations .sent-notes{margin:0;padding:0}.group-locations .sent-notes>li{list-style:none}.notes-panel .annotation-group[data-selected]{border:1px solid var(--line);background:var(--bg-subtle);box-shadow:var(--shadow-xs);border-radius:14px;margin:5px 0}.notes-panel .annotation-group[data-selected=true]{border-color:color-mix(in srgb,var(--note-color) 25%,var(--line))}.notes-panel .group-header{color:var(--text-2);padding:4px 8px 4px 3px}.notes-panel .group-header strong,.notes-panel .group-selection-toggle[aria-pressed=true]>strong{color:var(--text-2);font-size:12px;font-weight:500}.notes-panel .group-header .group-dot{width:8px;height:8px;box-shadow:0 0 0 3px color-mix(in srgb,var(--note-color) 12%,transparent)}.notes-panel .group-disclosure{width:28px;height:28px;color:var(--text-3)}.notes-panel .group-locations{padding:0 12px 12px}.group-references{gap:6px;display:grid}.notes-panel .group-location.note-card{border:1px solid var(--line);background:var(--bg);border-radius:9px;align-items:flex-start;gap:8px;margin:0;padding:9px 8px}.notes-panel .group-location.note-card[data-selected=true]{border-color:color-mix(in srgb,var(--note-color) 65%,var(--line));background:color-mix(in srgb,var(--note-color) 16%,var(--bg))}.notes-panel .group-location.note-card:hover{border-color:var(--line-hover);background:var(--bg-hover)}.notes-panel .group-location.note-card[data-selected=true]:hover{border-color:var(--note-color);background:color-mix(in srgb,var(--note-color) 22%,var(--bg))}.notes-panel .group-location.note-card.active{box-shadow:inset 3px 0 0 var(--note-color)}.notes-panel .group-location .note-number{background:color-mix(in srgb,var(--text) 5%,transparent);min-width:20px;height:22px;color:var(--text-2);font-variant-numeric:tabular-nums;border-radius:5px;flex:none;padding:0 4px;font-size:11px}.notes-panel .group-location .note-number:hover:not(:disabled){background:var(--bg-active);color:var(--text)}.notes-panel .group-location-target blockquote{color:var(--text);-webkit-line-clamp:2;margin:0 0 3px;font-size:13px;line-height:1.5}.notes-panel .group-location-target>span{color:var(--text-2);overflow-wrap:anywhere;font-size:11px;line-height:1.5;display:block}.group-location-selected{background:var(--note-color);width:18px;height:18px;color:var(--note-ink);opacity:0;border-radius:50%;flex:none;justify-content:center;align-items:center;margin-top:2px;transition:opacity .15s;display:flex}.group-location[data-selected=true]>.group-location-selected{opacity:1}.notes-panel .group-location-remove{width:22px;height:22px;color:var(--text-3);opacity:0;transition:opacity .15s}.group-location:hover>.group-location-remove,.group-location:focus-within>.group-location-remove{opacity:1}@media (pointer:coarse){.notes-panel .group-disclosure{width:44px;height:44px}.notes-panel .group-location-remove{opacity:1;width:36px;height:36px}.notes-panel .group-location .note-number{min-width:32px;height:36px}.group-location-selected{margin-top:9px}}.note-mark[data-group]{background:color-mix(in srgb,var(--note-color) 26%,transparent)}.note-mark[data-group].active{background:color-mix(in srgb,var(--note-color) 42%,transparent)}.note-box[data-group]{border-color:var(--note-color);background:color-mix(in srgb,var(--note-color) 12%,transparent)}.note-tag[data-group]{background:var(--note-color);color:var(--note-ink)}.review-add-note,.review-select-menu>button{align-items:center;gap:6px;display:inline-flex}@media (width<=680px){.group-location>button{min-height:36px}.group-swatch{width:44px;height:44px}.group-individual{min-height:44px}}.review-note-mark[data-group]{background:color-mix(in srgb,var(--note-color) 26%,transparent)}.review-note-box[data-group]{border-color:var(--note-color);background:color-mix(in srgb,var(--note-color) 12%,transparent)}.review-note-tag[data-group]{background:var(--note-color);color:var(--note-ink)}`}),e.head),o.map(e=>(0,Ne.createPortal)((0,C.jsxs)(S.Fragment,{children:[i.notes.filter(t=>t.strip===e.key).map(e=>(0,C.jsxs)(S.Fragment,{children:[e.rects.map((t,n)=>(0,C.jsx)(`div`,{className:e.region?`review-note-box`:`review-note-mark`,"data-group":e.group,style:{...xt(t),...ie(e.group)}},n)),(0,C.jsx)(`button`,{className:`review-note-tag`,"data-group":e.group,style:{top:`${e.rects[0][1]*100}%`,...ie(e.group)},title:e.group?R(`Annotation groups`):e.comment,"aria-label":R(`Review note: {comment}`,{comment:e.group?re(e.group):e.comment}),onClick:()=>v(!0),children:i.notes.indexOf(e)+1})]},e.id)),j&&i.editing?.strip===e.key&&i.editing.rects.map((e,t)=>(0,C.jsx)(`div`,{className:i.editing.region?`review-note-box`:`review-note-mark`,style:xt(e)},t)),m&&(0,C.jsx)(`div`,{className:`review-region-capture`,onPointerDown:t=>{if(t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=e.strip.getBoundingClientRect(),r=bt((t.clientX-n.left)/n.width),i=bt((t.clientY-n.top)/n.height);k.current={layer:e,x:r,y:i},O({key:e.key,rect:[r,i,r,i]})},onPointerMove:e=>{let t=k.current;if(!t)return;let n=t.layer.strip.getBoundingClientRect(),r=bt((e.clientX-n.left)/n.width),i=bt((e.clientY-n.top)/n.height);O({key:t.layer.key,rect:[Math.min(t.x,r),Math.min(t.y,i),Math.max(t.x,r),Math.max(t.y,i)]})},onPointerUp:e=>{let t=k.current;if(k.current=null,O(null),!t)return;let n=t.layer.strip.getBoundingClientRect(),r=bt((e.clientX-n.left)/n.width),i=bt((e.clientY-n.top)/n.height),a=[Math.min(t.x,r),Math.min(t.y,i),Math.max(t.x,r),Math.max(t.y,i)];if((a[2]-a[0])*n.width<4||(a[3]-a[1])*n.height<4)return;let o=(t.layer.strip.querySelector(`.pdf-text`)?.textContent||``).replace(/\s+/g,` `).trim().slice(0,2e3);L(wt(t.layer,[a],o,!0))},onPointerCancel:()=>{k.current=null,O(null)}}),E?.key===e.key&&(0,C.jsx)(`div`,{className:`review-note-box`,style:xt(E.rect)}),c?.handles&&c.strip===e.key&&(0,C.jsxs)(C.Fragment,{children:[c.rects.map((e,t)=>(0,C.jsx)(`div`,{className:`review-note-mark`,style:xt(e)},t)),[`from`,`to`].map(e=>{let[t,n,r]=c.handles[e];return(0,C.jsx)(`span`,{className:`select-handle`,"data-end":e,style:{left:`${t*100}%`,top:`${n*100}%`,height:`${(r-n)*100}%`}},e)})]}),c?.strip===e.key&&!c.handles&&!j&&!y&&(0,C.jsx)(`button`,{className:`review-add-note`,"aria-label":u?R(`Add to {group}`,{group:re(u)}):R(`Add note`),style:{left:`${Math.min(80,c.rects.at(-1)[2]*100)}%`,top:`${c.rects.at(-1)[3]*100}%`},onPointerDown:e=>e.preventDefault(),onClick:()=>L(c),children:(0,C.jsx)(ae,{group:u})})]}),e.element,e.key)),e&&c?.handles&&!j&&!y&&(()=>{let t=o.find(e=>e.key===c.strip);return t?(0,Ne.createPortal)((0,C.jsx)(Et,{doc:e,layer:t,selection:c,group:u,onAdd:()=>L(c)}),e.body):null})(),e&&g&&!m&&(0,Ne.createPortal)((0,C.jsxs)(`aside`,{className:`review-notes-panel`,"aria-label":R(`Review PDF notes`),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&!y&&(i.editing?.id?ne():se())},children:[(0,C.jsxs)(`header`,{children:[(0,C.jsx)(`strong`,{children:fe?R(`PDF annotations`):i.notes.length?R(`Review notes ({n})`,{n:i.notes.length}):R(`Review notes`)}),(0,C.jsx)(`button`,{type:`button`,"aria-label":R(`Close review notes`),onClick:se,children:`×`})]}),i.editing?(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),B()},children:[(0,C.jsx)(`small`,{children:ut(i.editing.where)}),(0,C.jsx)(pe,{text:i.editing.quote}),(0,C.jsx)(H,{children:(0,C.jsx)(`textarea`,{autoFocus:!0,"aria-label":R(`Note for the agent`),rows:3,maxLength:4e3,placeholder:R(`What should change here?`),value:i.editing.comment,onChange:e=>F({...i,editing:{...i.editing,comment:e.target.value}}),onKeyDown:e=>{Ce(e.nativeEvent,window.matchMedia(`(pointer: coarse)`).matches)&&(e.preventDefault(),B())}})}),(0,C.jsxs)(`footer`,{children:[(0,C.jsx)(`button`,{type:`button`,onClick:ne,children:R(`Cancel`)}),(0,C.jsx)(`button`,{className:`primary`,disabled:!i.editing.comment.trim(),children:i.editing.id?R(`Save`):R(`Add note`)})]})]}):(0,C.jsxs)(C.Fragment,{children:[_(i.notes).map(({group:e,entries:t})=>(0,C.jsx)(ce,{group:e,count:t.length,children:t.map(({note:e,index:t})=>(0,C.jsxs)(`div`,{className:`group-location`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>{o.find(t=>t.key===e.strip)?.strip.scrollIntoView({block:`center`}),v(!1)},children:[(0,C.jsx)(`span`,{children:ut(e.where)}),(0,C.jsx)(`blockquote`,{children:e.quote||R(`Marked region`)})]}),(0,C.jsx)(`button`,{type:`button`,"aria-label":R(`Delete review note {n}`,{n:t+1}),disabled:y,onClick:()=>V(e),children:`×`})]},e.id))},e)),fe&&(0,C.jsx)(`textarea`,{"aria-label":R(`Instructions for color groups`),placeholder:R(`What should change in each color group?`),value:i.instructions||``,disabled:y,onChange:e=>F({...A.current.draft,instructions:e.target.value,requestKey:yt()})}),i.notes.length?(0,C.jsx)(`ol`,{children:i.notes.map((e,n)=>!e.group&&(0,C.jsxs)(`li`,{"data-note":e.id,children:[(0,C.jsxs)(`div`,{className:`review-note-head`,children:[(0,C.jsxs)(`button`,{className:`review-note-location`,onClick:()=>{o.find(t=>t.key===e.strip)?.strip.scrollIntoView({block:`center`}),v(!1)},children:[n+1,`. `,ut(e.where)]}),(0,C.jsx)(`button`,{type:`button`,"aria-label":R(`Delete review note {n}`,{n:n+1}),disabled:y,onClick:()=>V(e),children:`×`})]}),(0,C.jsx)(pe,{text:e.quote}),(0,C.jsx)(H,{children:(0,C.jsxs)(`button`,{type:`button`,className:`note-comment`,"aria-label":R(`Edit note {n}: {comment}`,{n:n+1,comment:e.comment}),title:R(`Edit note`),disabled:y,onClick:()=>te(e),children:[(0,C.jsx)(`span`,{children:e.comment}),(0,C.jsx)(T,{name:`pencil`,size:13})]})}),e.round!==t.review?.round&&(0,C.jsx)(`small`,{children:R(`Marked on earlier changes.`)})]},e.id))}):(0,C.jsxs)(`div`,{className:`review-notes-empty`,children:[(0,C.jsx)(`p`,{children:R(`No notes yet`)}),(0,C.jsx)(`div`,{className:`review-note-actions`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),children:[(0,C.jsx)(T,{name:`region`,size:16}),R(`Region note`)]})})]}),x&&(0,C.jsx)(`p`,{className:`review-notes-error`,role:`alert`,children:x}),de&&(0,C.jsx)(`p`,{children:R(`Check the task status before sending notes.`)}),i.notes.length>0&&(0,C.jsx)(`footer`,{children:(0,C.jsx)(`button`,{className:`primary`,"aria-label":y?R(`Sending…`):fe?R(`Send annotations to the agent`):z(i.notes.length,`Send {n} note to the agent`,`Send {n} notes to the agent`),disabled:y||de||fe&&!i.instructions?.trim()&&!i.notes.some(e=>e.comment.trim()),onClick:()=>void ue(),children:y?R(`Sending…`):fe?R(`Send annotations`):z(i.notes.length,`Send {n} note`,`Send {n} notes`)})})]})]}),e.body)]})}var Ot=`:root{--bg:#fff;--sidebar:#f9f9f9;--bg-subtle:#fafafa;--bg-muted:#f4f4f4;--bg-hover:#efefef;--bg-active:#e7e7e7;--canvas:#f3f3f3;--line:#e8e8e8;--line-strong:#d6d6d6;--text:#171717;--text-2:#525252;--text-3:#8a8a8a;--accent:#2563eb;--accent-hover:#1d4ed8;--accent-soft:#eff6ff;--accent-line:#bfdbfe;--primary:#2563eb;--primary-hover:#1d4ed8;--green:#15803d;--green-soft:#f0fdf4;--purple:#7c3aed;--purple-soft:#f5f3ff;--red:#dc2626;--red-soft:#fef2f2;--red-line:#fecaca;--amber-soft:#fffbeb;--amber-line:#fde68a;--amber-text:#92400e;--shadow-xs:0 1px 2px #0000000f;--shadow-sm:0 1px 2px #0000000d,0 3px 8px #0000000d;--float:0 2px 4px #0000000a,0 14px 36px #00000021;--ring:0 0 0 3px #2563eb2e;--line-hover:#c4c4c4;--danger:#dc2626;--danger-hover:#b91c1c;--scroll-thumb:#0000001f;--scroll-hover:#0003;--scroll-active:#00000057;--pdf-filter:none;--pdf-page:#fff;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:root[data-theme=dark]{--bg:#26272b;--sidebar:#202124;--bg-subtle:#2a2b2f;--bg-muted:#303135;--bg-hover:#37383c;--bg-active:#404145;--canvas:#1e1f22;--line:#38393e;--line-strong:#4b4c52;--line-hover:#63646b;--text:#ececee;--text-2:#c2c3c9;--text-3:#9c9da5;--accent:#8ab4ff;--accent-hover:#b2ceff;--accent-soft:#2b3651;--accent-line:#445c85;--primary:#2563eb;--primary-hover:#1d4ed8;--green:#7bd5a0;--green-soft:#243a2f;--purple:#bfa1ff;--purple-soft:#372d48;--red:#ff9696;--red-soft:#46292e;--red-line:#733b45;--amber-soft:#3e3424;--amber-line:#6d5631;--amber-text:#eac584;--shadow-xs:0 1px 2px #0003;--shadow-sm:0 1px 2px #0000002e,0 3px 8px #0003;--float:0 2px 4px #0003,0 14px 36px #0006;--ring:0 0 0 3px #8ab4ff38;--scroll-thumb:#ffffff29;--scroll-hover:#ffffff40;--scroll-active:#ffffff61;--pdf-filter:invert(.84) hue-rotate(180deg);--pdf-page:#292929;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}`,kt=`papilot:appearance`,At={preset:`papilot`,accent:`default`,colors:{light:{},dark:{}},pdf:`theme`},jt={papilot:{light:{background:`#ffffff`,foreground:`#171717`,accent:`#2563eb`},dark:{background:`#26272b`,foreground:`#ececee`,accent:`#2563eb`}},paper:{light:{background:`#faf9f6`,foreground:`#302e2b`,accent:`#74695c`},dark:{background:`#282724`,foreground:`#e8e6e1`,accent:`#74695c`}},slate:{light:{background:`#f6f7f8`,foreground:`#2c3035`,accent:`#526477`},dark:{background:`#24272b`,foreground:`#e5e7ea`,accent:`#526477`}}},Mt={blue:`#526477`,graphite:`#55565a`,stone:`#74695c`};function Nt(e){if(typeof e!=`string`)return;let t=e.trim().replace(/^#/,``);if(/^[\da-f]{6}$/i.test(t))return`#`+t.toLowerCase();if(/^[\da-f]{3}$/i.test(t))return`#`+[...t].map(e=>e+e).join(``).toLowerCase()}function Pt(e){try{let t=JSON.parse(e||`{}`),n=e=>({background:Nt(t?.colors?.[e]?.background),foreground:Nt(t?.colors?.[e]?.foreground)});return{preset:typeof t?.preset==`string`&&Object.hasOwn(jt,t.preset)?t.preset:`papilot`,accent:typeof t?.accent==`string`&&(t.accent==="default"||Object.hasOwn(Mt,t.accent))?t.accent:`default`,colors:{light:n(`light`),dark:n(`dark`)},pdf:t?.pdf===`light`?`light`:`theme`}}catch{return At}}function Ft(e,t,n){return`#`+[1,3,5].map(r=>Math.round(parseInt(e.slice(r,r+2),16)*(1-n)+parseInt(t.slice(r,r+2),16)*n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function It(e,t){let n=jt[e.preset][t];return{background:e.colors[t].background||n.background,foreground:e.colors[t].foreground||n.foreground,accent:e.accent==="default"?n.accent:Mt[e.accent]}}function Lt(e,t){let{background:n,foreground:r,accent:i}=It(e,t),a=t===`dark`,o=e.preset!==`papilot`||e.colors[t].background||e.colors[t].foreground,s=e.preset!==`papilot`||e.accent!=="default",c=a?{"--sidebar":`#202124`,"--bg-subtle":`#2a2b2f`,"--bg-muted":`#303135`,"--bg-hover":`#37383c`,"--bg-active":`#404145`,"--canvas":`#1e1f22`,"--line":`#38393e`,"--line-strong":`#4b4c52`,"--line-hover":`#63646b`,"--text-2":`#c2c3c9`,"--text-3":`#9c9da5`}:{"--sidebar":`#f9f9f9`,"--bg-subtle":`#fafafa`,"--bg-muted":`#f4f4f4`,"--bg-hover":`#efefef`,"--bg-active":`#e7e7e7`,"--canvas":`#f3f3f3`,"--line":`#e8e8e8`,"--line-strong":`#d6d6d6`,"--line-hover":`#c4c4c4`,"--text-2":`#525252`,"--text-3":`#8a8a8a`},l=s?a?Ft(i,`#ffffff`,.45):i:a?`#8ab4ff`:`#2563eb`;return{"--bg":n,"--text":r,...o?{"--sidebar":Ft(n,a?`#000000`:r,a?.16:.025),"--bg-subtle":Ft(n,r,.025),"--bg-muted":Ft(n,r,.055),"--bg-hover":Ft(n,r,.09),"--bg-active":Ft(n,r,.14),"--canvas":Ft(n,a?`#000000`:r,a?.24:.05),"--line":Ft(n,r,.12),"--line-strong":Ft(n,r,.22),"--line-hover":Ft(n,r,.32),"--text-2":Ft(n,r,.76),"--text-3":Ft(n,r,.58)}:c,"--accent":l,"--accent-hover":s?Ft(l,a?`#ffffff`:`#000000`,.18):a?`#b2ceff`:`#1d4ed8`,"--accent-soft":!o&&!s?a?`#2b3651`:`#eff6ff`:Ft(n,l,.11),"--accent-line":!o&&!s?a?`#445c85`:`#bfdbfe`:Ft(n,l,.3),"--primary":i,"--primary-hover":s?Ft(i,`#000000`,.18):`#1d4ed8`,"--ring":`0 0 0 3px ${l}33`,"--pdf-filter":a&&e.pdf===`theme`?`invert(.84) hue-rotate(180deg)`:`none`,"--pdf-page":a&&e.pdf===`theme`?`#292929`:`#ffffff`}}var Rt=Object.keys(Lt(At,`light`));function zt(e,t){t.dataset.theme=e.dataset.theme;for(let n of Rt){let r=e.style.getPropertyValue(n);r?t.style.setProperty(n,r):t.style.removeProperty(n)}}var U=(0,S.createContext)(null),Bt=()=>(0,S.useContext)(U);function Vt({task:e,items:t,read:n,openReview:r,openChat:i,children:a}){let[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)(0),v=(0,S.useRef)(0),y=(0,S.useRef)({read:n,openReview:r,openChat:i});y.current={read:n,openReview:r,openChat:i};let b=t.filter(e=>e.type===`user`&&(e.meta?.notes?.length||Be(e.text))).map(e=>e.id).join(`,`),x=e?.id,w=(0,S.useCallback)(()=>{if(!x||!b)return;let e=++v.current;d(!0),l(!1),y.current.read(x).then(t=>{if(!Array.isArray(t.notes))throw Error(`Invalid note results`);v.current===e&&s(t.notes)}).catch(()=>{v.current===e&&l(!0)}).finally(()=>{v.current===e&&d(!1)})},[x,b]),T=JSON.stringify(e?.review?.counts);(0,S.useEffect)(()=>(w(),()=>{++v.current}),[w,e?.review?.round,e?.status,e?.updatedAt,T]),(0,S.useEffect)(()=>{s([]),h(null),p(``),l(!1)},[x]);let E={notes:o,loading:u,error:c,selected:f,reveal:g,focus:m,reload:w,showNote:e=>{p(e),_(e=>e+1),y.current.openChat(),requestAnimationFrame(()=>{let t=[...document.querySelectorAll(`[data-note-result]`)].find(t=>t.dataset.noteResult===e);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})})},showChange(e,t){p(e),h(n=>({key:e,change:t,sequence:(n?.sequence||0)+1})),y.current.openReview()}};return(0,C.jsx)(U.Provider,{value:E,children:a})}var W=e=>({pending:R(`Pending review`),accepted:R(`Accepted`),rejected:R(`Rejected`),commented:R(`Revision requested`),mixed:R(`Partly reviewed`)})[e];function Ht({noteKey:e}){let t=Bt();if(!t)return null;let n=t.notes.find(t=>t.key===e);return t.error?e.endsWith(`:0`)?(0,C.jsxs)(`button`,{type:`button`,className:`note-result-retry`,onClick:t.reload,children:[(0,C.jsx)(T,{name:`refresh`,size:12}),R(`Retry linking changes`)]}):null:n?(0,C.jsx)(`div`,{className:`note-result-links`,children:n.changes.length?n.changes.map(n=>(0,C.jsxs)(`button`,{type:`button`,className:`note-result-link `+n.state,title:R(`View changes for this note`),onClick:()=>t.showChange(e,n),children:[(0,C.jsx)(T,{name:`diff`,size:13}),(0,C.jsx)(`span`,{children:R(`Change {n}`,{n:n.stop+1})}),(0,C.jsx)(`span`,{className:`note-result-decision`,children:W(n.state)}),(0,C.jsx)(T,{name:`arrowRight`,size:12})]},`${n.round}:${n.stop}`)):(0,C.jsx)(`span`,{className:`note-result-status`,children:n.state===`waiting`?R(`Awaiting changes`):R(`No linked change`)})}):t.loading?(0,C.jsx)(`span`,{className:`note-result-status`,children:(0,C.jsx)(`span`,{className:`spinner`})}):null}function Ut({doc:e,round:t}){let n=Bt(),r=(0,S.useRef)(n);r.current=n;let[i,a]=(0,S.useState)([]),o=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!e||!n)return;let r=new Map,i=()=>{let i=Number(e.documentElement.dataset.papilotRound)||t,o=[];for(let t of e.querySelectorAll(`.change[data-stop]`)){let a=Number(t.dataset.stop),s=n.notes.filter(e=>e.changes.some(e=>e.round===i&&e.stop===a)),c=t.querySelector(`.change-head`);if(!s.length||!c)continue;let l=r.get(t);l?l.parentElement!==c&&c.append(l):(l=e.createElement(`span`),l.className=`papilot-note-links`,c.append(l),r.set(t,l)),o.push({element:t,slot:l,notes:s,stop:a,round:i})}for(let[e,t]of r)o.some(t=>t.element===e)||(t.remove(),r.delete(e));a(e=>e.length===o.length&&e.every((e,t)=>e.slot===o[t].slot&&e.element===o[t].element&&e.round===o[t].round&&e.notes.length===o[t].notes.length&&e.notes.every((e,n)=>e===o[t].notes[n]))?e:o)};i();let o=new MutationObserver(i);return o.observe(e.body,{childList:!0,subtree:!0}),e.defaultView?.addEventListener(`papilot:round`,i),()=>{o.disconnect(),e.defaultView?.removeEventListener(`papilot:round`,i),r.forEach((e,t)=>{e.remove(),t.classList.remove(`papilot-linked-change`)})}},[e,n?.notes,t]),(0,S.useEffect)(()=>{let t=n?.focus;for(let e of i)e.element.classList.toggle(`papilot-linked-change`,!!(t&&t.change.round===e.round&&t.change.stop===e.stop));if(!e||!t||o.current?.doc===e&&o.current.sequence===t.sequence)return;let r=i.find(e=>e.round===t.change.round&&e.stop===t.change.stop);r&&(r.element.click(),r.element.scrollIntoView({block:`center`}),r.element.focus({preventScroll:!0}),o.current={doc:e,sequence:t.sequence})},[e,i,n?.focus]),!e||!n?null:(0,C.jsxs)(C.Fragment,{children:[(0,Ne.createPortal)((0,C.jsx)(`style`,{children:`
14
- .papilot-note-links{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;order:5}
15
- .papilot-note-links button{display:inline-flex;align-items:center;gap:4px;padding:3px 7px;border:1px solid var(--line);border-radius:6px;background:var(--bg-muted);color:var(--text-2);font:12px/1.5 var(--sans);cursor:pointer}
16
- .papilot-note-links button:hover,.papilot-note-links button:focus-visible{color:var(--primary);border-color:var(--primary)}
17
- .papilot-linked-change{outline:2px solid var(--primary);outline-offset:-2px}
18
- @media(max-width:680px){.papilot-note-links button{min-height:32px}}
19
- `}),e.head),i.map(e=>(0,Ne.createPortal)((0,C.jsx)(C.Fragment,{children:e.notes.map(e=>(0,C.jsxs)(`button`,{type:`button`,title:e.note.comment,"aria-label":R(`Show note {n}: {comment}`,{n:e.index+1,comment:e.note.comment}),onClick:t=>{t.stopPropagation(),r.current?.showNote(e.key)},children:[(0,C.jsx)(T,{name:`notes`,size:12}),R(`Note {n}`,{n:e.index+1})]},e.key))}),e.slot,`${e.round}:${e.stop}`))]})}var Wt=`latex-review:shortcuts`,Gt=`latex-review:shortcuts-changed`,Kt={accept:[`a`],reject:[`r`],comment:[`c`],next:[`j`,`ArrowRight`],previous:[`k`,`ArrowLeft`],pending:[`n`],source:[`s`],undo:[`u`],help:[`?`]},qt=Object.keys(Kt);function Jt(e){if(e.isComposing||[`Control`,`Meta`,`Alt`,`Shift`,`Dead`,`Unidentified`,`Process`].includes(e.key))return null;let t=e.key.length===1?e.key.toLowerCase():e.key;return[e.ctrlKey&&`Ctrl`,e.metaKey&&`Meta`,e.altKey&&`Alt`,e.shiftKey&&(/^[a-z]$/.test(t)||t.length>1)&&`Shift`,t].filter(Boolean).join(`+`)}function Yt(e){return/^(?:(?:Ctrl|Meta|Alt|Shift)\+)*(?:[a-z0-9?/,.;'\[\]`=\-]|Arrow(?:Left|Right|Up|Down))$/.test(e)}function Xt(e){return!Yt(e)||/^(?:Ctrl|Meta)\+(?:Shift\+)?[acflnpqrstuvwxz=\-]$/.test(e)||/^(?:Alt|Meta)\+Arrow(?:Left|Right)$/.test(e)}function Zt(e){let t=e&&typeof e==`object`?e:{};return Object.fromEntries(qt.map(e=>{let n=t[e];return[e,Array.isArray(n)&&n.length<=4&&n.every(e=>typeof e==`string`&&!Xt(e))?[...new Set(n)]:[...Kt[e]]]}))}function Qt(e){try{return Zt(JSON.parse(e||`{}`))}catch{return Zt({})}}function $t(e){return e.split(`+`).map(e=>({Meta:`⌘`,Ctrl:`Ctrl`,Alt:`Alt`,Shift:`Shift`,ArrowRight:`→`,ArrowLeft:`←`,ArrowUp:`↑`,ArrowDown:`↓`})[e]||e.toUpperCase()).join(`+`)}var en=`latex-review:shortcut-bindings`,tn=Qt(D.getItem(en)),nn=Qt(D.getItem(Wt)),rn=new Set;function an(e){nn=e,rn.forEach(e=>e())}typeof window<`u`&&window.addEventListener(`storage`,e=>{(e.key===en||e.key===null)&&(tn=Qt(D.getItem(en)),rn.forEach(e=>e())),(e.key===`latex-review:shortcuts`||e.key===null)&&an(Qt(D.getItem(Wt)))});function on(e){D.setItem(Wt,JSON.stringify(e)),an(e)}function sn(){return(0,S.useSyncExternalStore)(e=>(rn.add(e),()=>{rn.delete(e)}),()=>nn)}function cn(e){D.setItem(en,JSON.stringify(e)),tn=e,rn.forEach(e=>e())}function ln(){return(0,S.useSyncExternalStore)(e=>(rn.add(e),()=>{rn.delete(e)}),()=>tn)}function un(e,t){let n=(e,n,r)=>{if(e.defaultPrevented||!e.cancelable||e.ctrlKey||e.metaKey)return;let i=t.getElementById(`paper`),a=t.elementFromPoint(n,r);if(!i||!a||!i.contains(a)||a.closest(`select`))return;let o=t.defaultView,s=parseFloat(o.getComputedStyle(a).lineHeight)||16,c=e.deltaMode===1?s:e.deltaMode===2?i.clientWidth:1,l=e.deltaMode===1?s:e.deltaMode===2?i.clientHeight:1,u=e.shiftKey&&!e.deltaX?e.deltaY*c:e.deltaX*c,d=e.shiftKey&&!e.deltaX?0:e.deltaY*l;if(u||d){e.preventDefault(),i.scrollTo({top:i.scrollTop,left:i.scrollLeft,behavior:`instant`});for(let[e,t]of[[`x`,u],[`y`,d]])if(t)for(let n=a;n;n=n.parentElement){let r=o.getComputedStyle(n),a=e===`x`?r.overflowX:r.overflowY,s=e===`x`?n.scrollLeft:n.scrollTop,c=e===`x`?n.scrollWidth-n.clientWidth:n.scrollHeight-n.clientHeight;if(/^(auto|scroll)$/.test(a)&&c>0){if(t<0?s>0:s<c-1){n.scrollBy({[e===`x`?`left`:`top`]:t,behavior:`instant`});break}if([`contain`,`none`].includes(e===`x`?r.overscrollBehaviorX:r.overscrollBehaviorY))break}if(n===i)break}}},r=e=>n(e,e.clientX,e.clientY),i=t=>{if(e.ownerDocument.elementFromPoint(t.clientX,t.clientY)!==e)return;let r=e.getBoundingClientRect();n(t,(t.clientX-r.left)*e.clientWidth/r.width,(t.clientY-r.top)*e.clientHeight/r.height)};return t.addEventListener(`wheel`,r,{passive:!1}),e.ownerDocument.addEventListener(`wheel`,i,{passive:!1,capture:!0}),()=>{t.removeEventListener(`wheel`,r),e.ownerDocument.removeEventListener(`wheel`,i,!0)}}var dn=`latex-review:effects`,fn=`latex-review:effects-changed`,pn=D.getItem(dn)===`on`,mn=new Set;function hn(e){pn=e,mn.forEach(e=>e())}typeof window<`u`&&window.addEventListener(`storage`,e=>{(e.key===`latex-review:effects`||e.key===null)&&hn(D.getItem(dn)===`on`)});function gn(e){D.setItem(dn,e?`on`:`off`),hn(e)}function _n(){return(0,S.useSyncExternalStore)(e=>(mn.add(e),()=>{mn.delete(e)}),()=>pn)}var vn=(e,t,n)=>`/review/${e.projectId}/?task=${e.name}${t?`&round=${t}${n===void 0?`&history=1`:`&change=${n}`}`:``}${L()===`en`?``:`&lang=${L()}`}`,yn=e=>`/review/${e}/?changes=1${L()===`en`?``:`&lang=${L()}`}`;function bn(e,t,n,r){if(!e||e.getElementById(`papilot-embed-style`))return;e.documentElement.style.setProperty(`--papilot-tools`,`${t}px`),e.documentElement.style.setProperty(`--papilot-lead`,`${n}px`);let i=e.createElement(`style`);i.id=`papilot-embed-style`,i.textContent=Ot+`
20
- :root{--sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI","PingFang SC","Noto Sans SC",system-ui,sans-serif;--comment:var(--accent);--accept:var(--green);--reject:var(--red);--frame:var(--canvas);--bar:var(--bg);--muted:var(--text-3);--ink:var(--text);--head:var(--bg-subtle);font-size:14px}
21
- .banner{border-radius:10px}
22
- .source,.source-code,.composer textarea,.composer button,.unit-actions button,.toast,.change-map-tooltip,.review-mode,.review-mode select,.review-complete,.change.standalone{background:var(--bg);color:var(--text)}
23
- .banner{background:var(--accent-soft);border-color:var(--accent-line)}.banner .details{background:var(--bg-subtle)}
24
- .source-title{color:var(--text-2)}
25
- .source-code del{background:var(--red-soft);color:var(--red)}
26
- .source-code ins{background:var(--green-soft);color:var(--green)}
27
- .remark{background:var(--accent-soft)}.histories,.caption{background:var(--bg-subtle);color:var(--text-2)}
28
- /* Bibliography entries and their checks follow the theme. */
29
- :root{--ok-soft:var(--green-soft);--bad-soft:var(--red-soft);--warn:var(--amber-text);--warn-soft:var(--amber-soft);--warn-line:var(--amber-line)}
30
- .references,.reference-entry{background:var(--bg);color:var(--text)}
31
- .reference-fields th,.reference-status,.reference-lines,.reference-cited,.reference-side,.reference-resolved{color:var(--text-3)}
32
- .toast.error{background:var(--red-soft);color:var(--red)}
33
- /* Papilot's commit step at the end of the completion card. */
34
- .review-complete{align-items:center}
35
- .review-complete-actions{flex-wrap:wrap;justify-content:flex-end;max-width:100%}
36
- .review-complete-actions .commit-state{font-size:13px;color:var(--text-3)}
37
- .review-complete-actions .commit-button{display:inline-flex;align-items:center;height:28px;padding:0 12px;border:1px solid var(--line-strong);border-radius:7px;background:var(--bg);color:var(--text);font:500 13px var(--sans);cursor:pointer;box-shadow:0 1px 2px rgb(0 0 0/.06)}
38
- .review-complete-actions .commit-button:hover{background:var(--bg-subtle);border-color:var(--line-hover)}
39
- .review-complete-actions .commit-button:focus-visible{outline:none;box-shadow:var(--ring)}
40
- .review-complete-actions .commit-button{height:auto;min-height:30px;padding:5px 12px;white-space:nowrap}
41
- .review-complete-actions .commit-button:disabled{opacity:.5;cursor:default}
42
- :root[data-papilot-phone] .review-complete-actions{justify-content:flex-start;margin-left:0}
43
- :root[data-papilot-phone] .review-complete-actions .commit-state{flex-basis:100%}
44
- :root[data-papilot-phone] .review-complete-actions .commit-button{min-height:40px}
45
- /* Page images follow the theme like the manuscript's PDF. They are
46
- transparent: the sheet is the paper, and the before/after rows tint it. */
47
- .pdf-strip{color-scheme:light}.pdf-strip img{filter:var(--pdf-filter)}.sheet{background:var(--pdf-page)}
48
- :root[data-theme="dark"]{--before:#432c30;--after:#28392d}
49
- .bar{display:flex;align-items:center;height:var(--papilot-bar-height,44px);min-height:var(--papilot-bar-height,44px);padding:0 max(14px,calc(var(--papilot-tools,0px) + 4px)) 0 calc(var(--papilot-lead,0px) + 14px);gap:12px;flex-wrap:nowrap;overflow:hidden}
50
- .bar .overview-link,.bar .identity h1,.bar .identity span{display:none}
51
- .bar .identity{flex:1;min-width:0;flex-direction:row;gap:6px}
52
- .bar .identity span{font-size:13px;font-weight:600;color:var(--text-2);overflow:hidden;text-overflow:ellipsis}
53
- .bar .meter{display:flex;order:initial;width:auto;font-size:13px}
54
- .bar .bar-end{margin-left:0;gap:6px;flex-wrap:wrap;justify-content:flex-end;min-width:0}
55
- .bar .ghost{font-size:13px;font-weight:500;height:28px;padding:0 10px;border-radius:7px}
56
- .bar .ghost:hover{text-decoration:none;background:var(--bg-hover)}
57
- .bar .accept-all,.bar .reject-all{display:inline-flex;align-items:center;gap:6px;border-color:var(--line-strong);background:var(--bg);color:var(--ink);box-shadow:0 1px 2px rgb(0 0 0/.06)}
58
- .bar .accept-all:hover,.bar .reject-all:hover{background:var(--bg-subtle);border-color:var(--line-hover)}
59
- .bar .ghost.round{display:none}
60
- .bar .status{font-size:13px}
61
- .sheet{border-radius:4px;box-shadow:0 1px 2px rgb(0 0 0/.06),0 8px 24px rgb(0 0 0/.08)}
62
- .change-head{font-size:13px;background:var(--bg-subtle)}.link{font-size:13px}
63
- /* The current change: a thin accent outline and a warm header, like a selected
64
- row in the workspace, rather than a blue frame on a blue-grey header. */
65
- .change.current{box-shadow:0 0 0 1px var(--accent-line),0 0 0 4px rgb(37 99 235/.07)}
66
- .change.current .change-head{background:var(--bg-muted);color:var(--ink)}
67
- .change-head .link{display:inline-flex;align-items:center;height:28px;padding:0 8px;border-radius:7px;color:var(--text-2);font-weight:500}
68
- .change-head .link:hover{background:var(--bg-hover);color:var(--ink);text-decoration:none}
69
- .change-head .link.active{background:var(--accent-soft);color:var(--accent);text-decoration:none}
70
- /* Decision buttons are plain text actions like the rest of the header
71
- (Copy reference, LaTeX, Undo): a coloured icon says what each does, and
72
- hovering tints it green, red or blue. On phones the bar is a solid
73
- toolbar at the bottom. */
74
- :root{--icon-copy:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'><rect x='8' y='8' width='12' height='12' rx='2'/><path d='M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2'/></svg>");--icon-check:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>");--icon-cross:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'><path d='M18 6 6 18M6 6l12 12'/></svg>");--icon-comment:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'><path d='M20 15a2 2 0 0 1-2 2H8l-4 4V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2z'/></svg>")}
75
- .change-head .actions .accept::before,.change-head .actions .reject::before,.change-head .actions .comment::before,.bar .accept-all::before,.bar .reject-all::before{content:"";flex:none;width:13px;height:13px;background:currentColor;-webkit-mask:var(--icon) center/contain no-repeat;mask:var(--icon) center/contain no-repeat}
76
- .change-head .actions .accept,.bar .accept-all{--icon:var(--icon-check)}.change-head .actions .reject,.bar .reject-all{--icon:var(--icon-cross)}.change-head .actions .comment{--icon:var(--icon-comment)}
77
- .change-head .actions .accept::before,.bar .accept-all::before{background:var(--accept)}.change-head .actions .reject::before,.bar .reject-all::before{background:var(--reject)}.change-head .actions .comment::before{background:var(--accent)}
78
- .change-head .actions{gap:3px;padding:4px;background:var(--bg);border:1px solid var(--line-strong);border-radius:12px;box-shadow:0 1px 2px rgb(0 0 0/.06),0 4px 12px rgb(0 0 0/.06)}
79
- .change-head .actions button{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:28px;padding:0 11px;border:1px solid transparent;border-radius:7px;font-size:13px;font-weight:500;line-height:1;transition:background-color .15s,border-color .15s}
80
- .change-head .actions .nav{width:28px;padding:0;font-size:19px;font-weight:400;color:var(--text-2)}
81
- .change-head .actions .nav:hover:not(:disabled){background:var(--bg-hover)}
82
- .change-head .actions .nav:disabled{color:var(--text-3);opacity:1}
83
- .change-head .position{min-width:38px;font-size:12.5px;color:var(--text-2);font-variant-numeric:tabular-nums}
84
- .change-head .actions .accept,.change-head .actions .reject,.change-head .actions .comment,.change-head .actions .skip{background:transparent;color:var(--ink)}
85
- .change-head .actions .accept:hover:not(:disabled){background:var(--green-soft);color:var(--accept)}
86
- .change-head .actions .reject:hover:not(:disabled){background:var(--red-soft);color:var(--reject)}
87
- .change-head .actions .comment:hover:not(:disabled){background:var(--accent-soft);color:var(--accent)}
88
- .change-head .actions .skip:hover{background:var(--bg-hover)}
89
- .change-head .actions button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
90
- .change-head .complete{display:inline-flex;align-items:center;gap:6px;padding:0 8px;font-size:13px;font-weight:500;color:var(--accept)}
91
- .change-head .complete::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
92
- .change-head .actions .undo{margin-left:3px;padding:0 9px;font-weight:400;color:var(--text-2)}
93
- .change-head .actions .undo:hover:not(:disabled){background:var(--bg-hover)}
94
- .change-head .actions .undo:disabled{color:var(--text-3);opacity:1}
95
- .change-head .actions .accept:disabled,.change-head .actions .reject:disabled,.change-head .actions .comment:disabled{opacity:.4}
96
- /* Uncommitted changes: Stage is the check, Unstage a minus and Revert an
97
- arrow back. The last revert is undone from the bar. */
98
- :root{--icon-minus:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'><path d='M5 12h14'/></svg>");--icon-revert:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M9 14 4 9l5-5'/><path d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/></svg>")}
99
- .change-head .actions .unstage::before{content:"";flex:none;width:13px;height:13px;background:var(--text-2);-webkit-mask:var(--icon-minus) center/contain no-repeat;mask:var(--icon-minus) center/contain no-repeat}
100
- [data-mode=changes] .change-head .actions .reject{--icon:var(--icon-revert)}
101
- .change-head .actions .unstage{background:transparent;color:var(--ink)}
102
- .change-head .actions .unstage:hover:not(:disabled){background:var(--bg-hover)}
103
- .change-head .actions .unstage:disabled{opacity:.4}
104
- .unit-actions .unstage{color:var(--text-2)}
105
- .bar .ghost.undo{flex-shrink:0;white-space:nowrap}
106
- /* A narrow desktop pane keeps the actions with its change. Wrapping
107
- the header preserves its tools without switching to a phone dock. */
108
- .change-head{flex-wrap:wrap;align-items:center;gap:4px 6px;padding:5px 8px 5px 12px;min-height:40px}
109
- .change-head .dock,.change-head .actions{display:contents}
110
- .change-head .actions>.nav:first-child{order:1}.change-head .change-number{order:2}.change-head .actions>.nav:not(:first-child){order:3}
111
- .change-head .change-where{order:4;flex:1 1 100px;min-width:0;margin-left:4px}
112
- .change-head .change-kind,.change-head .badge{order:5}
113
- .change-head .actions>*{order:6}
114
- .change-head .link{order:7}
115
- :root:not([data-papilot-phone]) .change-head .position,:root:not([data-papilot-phone]) .change-head .complete{display:none}
116
- .change-head .actions .undo:disabled{display:none}
117
- .change-head .actions .nav{width:28px;height:28px;font-size:18px}
118
- .change-head .copy-reference{width:28px;padding:0;justify-content:center;font-size:0}
119
- .change-head .copy-reference::before{content:"";width:15px;height:15px;background:currentColor;-webkit-mask:var(--icon-copy) center/contain no-repeat;mask:var(--icon-copy) center/contain no-repeat}
120
- @media(max-width:680px){
121
- :root:not([data-papilot-phone]){
122
- .change-head .dock{display:flex;order:8;flex:1 0 100%;margin:0}
123
- .change-head .actions{display:flex;width:100%;flex-wrap:wrap;gap:3px;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
124
- .change-head .position{display:inline;order:2;min-width:30px}
125
- .change-head .actions>.nav:not(:first-child){margin-right:auto}
126
- .change-head .actions button{padding:0 6px;font-size:12.5px}
127
- .change-head .actions .nav{padding:0;font-size:18px}
128
- }
129
- }
130
- #paper{--paper-top:14px;padding-top:14px}
131
- .review-body>#paper{padding-right:34px;overscroll-behavior:contain}
132
- .change-map{top:10px;bottom:10px;right:8px;width:14px;border:0;border-radius:0;background:none;box-shadow:none}
133
- .change-map::before{content:"";position:absolute;top:0;bottom:0;left:50%;width:2px;margin-left:-1px;border-radius:2px;background:var(--line)}
134
- .change-map-viewport{left:50%;right:auto;width:4px;margin-left:-2px;border:0;border-radius:999px;background:var(--scroll-thumb);transition:width .15s,margin .15s,background-color .15s}
135
- .change-map:hover .change-map-viewport,.change-map-viewport:active{width:6px;margin-left:-3px;background:var(--scroll-hover)}
136
- .change-map-mark{--mark:var(--text-3);left:50%;width:4px;min-height:3px;margin-left:-2px;border-radius:999px;transition:width .15s,margin .15s}
137
- .change-map-mark[aria-current]{outline:0;width:6px;margin-left:-3px;box-shadow:0 0 0 2px var(--frame)}
138
- .change-map:hover .change-map-mark{width:6px;margin-left:-3px}
139
- .change-map .change-map-mark:hover{outline:0;width:8px;margin-left:-4px;box-shadow:0 0 0 2px var(--frame)}
140
- .change-map-mark:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
141
- ::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track,::-webkit-scrollbar-corner{background:transparent}
142
- ::-webkit-scrollbar-thumb{background-color:var(--scroll-thumb);border:3px solid transparent;border-radius:999px;background-clip:padding-box}
143
- ::-webkit-scrollbar-thumb:hover{background-color:var(--scroll-active);border-width:2px}
144
- @supports not selector(::-webkit-scrollbar){*{scrollbar-width:thin;scrollbar-color:var(--scroll-hover) transparent}}
145
- .part-title{font-size:15px;margin:6px 0 10px}
146
- .side .pdf-strip,.context .pdf-strip{max-width:none}
147
- /* Only the host window, never an iframe's width, selects the phone
148
- layout. Navigation and position stay alongside the decisions. */
149
- :root[data-papilot-phone]{
150
- .bar{gap:8px}.bar .ghost:not(.history){min-height:36px;font-size:12px}
151
- .review-body>#paper{padding-left:8px;padding-right:24px;padding-bottom:132px}
152
- .change-map{right:4px;width:12px}
153
- .side.before::after,.side.after::after{content:none}
154
- .change-head{padding:4px 6px 4px 10px;gap:6px}
155
- .change-head .link{min-height:36px;padding:0 6px}
156
- .change-head .dock{display:flex;position:fixed;z-index:6;left:8px;right:8px;bottom:8px;margin:0}
157
- .change-head .actions{display:flex;width:100%;flex-wrap:wrap;justify-content:center;gap:4px;padding:5px;border-radius:12px;border-color:var(--line-strong);box-shadow:0 2px 4px rgb(0 0 0/.05),0 6px 20px rgb(0 0 0/.12)}
158
- .change-head .actions>*{order:initial!important}
159
- .change-head .actions button{flex:1 1 auto;min-width:0;height:44px;gap:5px;padding:0 6px;border-radius:8px;font-size:13px}
160
- .change-head .actions .nav{flex:0 0 32px;width:32px;min-width:32px;height:44px;padding:0}
161
- .change-head .position{min-width:30px;font-size:11.5px}
162
- .change-head .actions .undo{flex:0 0 auto;margin-left:0;padding:0 6px;font-size:13px}
163
- @media(max-width:360px){
164
- .change-head .actions:has(.nav){display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
165
- .change-head .actions .nav{width:100%;min-width:0;grid-row:1}
166
- .change-head .actions>.nav:first-child{grid-column:1}
167
- .change-head .actions>.nav:not(:first-child){grid-column:3}
168
- .change-head .position{grid-row:1;grid-column:2;justify-self:center}
169
- .change-head .actions button:not(.nav){grid-row:2}
170
- }
171
- .composer{left:0!important;right:0!important;width:auto!important;max-width:none;top:var(--papilot-review-bar-height,48px);bottom:auto;transform:none;max-height:calc(100% - var(--papilot-review-bar-height,48px) - var(--keyboard,0px));overflow:auto;border-width:0 0 1px;border-radius:0 0 16px 16px}
172
- #root:has(>.composer) .change-head .dock{display:none}
173
- .composer textarea{font-size:16px;min-height:76px;max-height:min(140px,30vh);resize:none}.composer button{min-height:44px}
174
- .composer-row{justify-content:flex-end;gap:8px}.composer-row .muted{display:none}
175
- .side .pdf-strip,.context .pdf-strip{width:calc(100% * var(--pdf-crop-scale,1));margin-left:calc(-100% * var(--pdf-crop-scale,1) * var(--pdf-crop-shift,0))}
176
- .side,.context{overflow-x:clip}
177
- }
178
- /* History shares the PDF tools' size. Shortcut settings live in Papilot. */
179
- .bar .ghost.history{display:inline-flex;align-items:center;justify-content:center;width:var(--papilot-button-size,30px);height:var(--papilot-button-size,30px);min-height:0;padding:0;font-size:0}
180
- .bar .history::before{content:"";width:16px;height:16px;background:currentColor;-webkit-mask:var(--icon-history) center/contain no-repeat;mask:var(--icon-history) center/contain no-repeat}
181
- /* Reserve the outer tools' row when there is too little room. Keep
182
- progress, batch counts and history; shorten only the batch labels. */
183
- .bar{container:review-bar/inline-size;height:auto;gap:8px}
184
- .bar .accept-all,.bar .reject-all{flex-shrink:0;white-space:nowrap}
185
- .bar .batch-count{margin-left:0;background:var(--bg-muted);color:var(--text-2)}
186
- :root[data-papilot-toolbar-stacked] .bar{padding:calc(var(--papilot-bar-height,44px) + 4px) 8px 4px;min-height:calc(var(--papilot-bar-height,44px) + 44px)}
187
- :root[data-papilot-toolbar-stacked] .bar .identity{display:none}
188
- :root[data-papilot-toolbar-stacked] .bar .bar-end{margin-left:auto}
189
- @container review-bar (max-width:340px){.bar .batch-label{display:none}.bar .accept-all,.bar .reject-all{padding:0 8px}.bar .bar-end{gap:4px}}
190
- :root{--icon-history:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12a9 9 0 1 0 2.6-6.4L3 8'/><path d='M3 3v5h5M12 7v5l3 2'/></svg>")}
191
- `,zt(window.document.documentElement,e.documentElement),i.textContent+=pt,e.head.append(i)}function xn(e){let t=1,n=0;for(let r of e.querySelectorAll(`.pdf-strip`)){let e=r.getBoundingClientRect();if(e.width)for(let i of r.querySelectorAll(`.pdf-text-line`)){let r=i.firstElementChild?.getBoundingClientRect(),a=i.lastElementChild?.getBoundingClientRect();r?.width&&a?.width&&(t=Math.min(t,(r.left-e.left)/e.width),n=Math.max(n,(a.right-e.left)/e.width))}}let r=e.documentElement.style,i=n-t+.04;n<=t||i>=.95?(r.removeProperty(`--pdf-crop-scale`),r.removeProperty(`--pdf-crop-shift`)):(r.setProperty(`--pdf-crop-scale`,(1/i).toFixed(4)),r.setProperty(`--pdf-crop-shift`,Math.max(0,t-.02).toFixed(4)))}function Sn({task:e,changesOf:t,tools:n,lead:r,completion:i,onSendNotes:a,onDecided:o}){let s=sn(),c=_n(),l=Bt(),u=(0,S.useRef)(l);u.current=l;let d=e?l?.focus?.change.round:void 0,f=d===e?.review?.round?l?.focus?.change.stop:void 0,p=e?l?.focus?.sequence:void 0,[m,h]=(0,S.useState)(null),g=(0,S.useRef)(null),_=(0,S.useRef)(null),v=(0,S.useRef)(null),y=(0,S.useRef)(null),[b,x]=(0,S.useState)(0),[w,E]=(0,S.useState)(0),D=(0,S.useRef)(o);D.current=o;let O=(0,S.useRef)(null),k=(0,S.useRef)(null),[A,j]=(0,S.useState)(0),[M,N]=(0,S.useState)(`loading`),P=ne().language;(0,S.useEffect)(()=>{if(m&&g.current)return un(g.current,m)},[m]),(0,S.useEffect)(()=>{let e=m?.defaultView;e&&e.dispatchEvent(new CustomEvent(Gt,{detail:s}))},[m,s]),(0,S.useEffect)(()=>{m?.defaultView?.dispatchEvent(new CustomEvent(fn,{detail:c}))},[m,c]),(0,S.useEffect)(()=>{let e=m?.defaultView;if(!e)return;let t=e=>{e.preventDefault(),window.dispatchEvent(new Event(`papilot:open-shortcuts`))};return e.addEventListener(`latex-review:help`,t),()=>e.removeEventListener(`latex-review:help`,t)},[m]),(0,S.useEffect)(()=>{N(`loading`);let e=setTimeout(()=>N(e=>e===`loading`?`slow`:e),15e3);return()=>{clearTimeout(e),O.current?.disconnect(),k.current?.disconnect()}},[A,P,d,p]),(0,S.useEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>x(Math.ceil(e.offsetWidth)));return t.observe(e),()=>t.disconnect()},[!!n]),(0,S.useEffect)(()=>{let e=v.current;if(!e){E(0);return}let t=new ResizeObserver(()=>E(Math.ceil(e.offsetWidth)));return t.observe(e),()=>t.disconnect()},[!!r]),(0,S.useEffect)(()=>{if(!m||!g.current||!y.current)return;let e=m.documentElement,t=m.querySelector(`.bar`),n=window.matchMedia(`(max-width: 520px)`),r=g.current,i=y.current,a=()=>{if(!r.isConnected||!i.isConnected)return;e.toggleAttribute(`data-papilot-phone`,n.matches),e.style.setProperty(`--papilot-tools`,`${b}px`),e.style.setProperty(`--papilot-lead`,`${w}px`),e.style.setProperty(`--papilot-bar-height`,`${i.offsetHeight}px`),e.toggleAttribute(`data-papilot-toolbar-stacked`,r.clientWidth-b-w<220);let a=_.current?.querySelector(`.icon-button`);a&&e.style.setProperty(`--papilot-button-size`,`${a.offsetWidth}px`),t&&e.style.setProperty(`--papilot-review-bar-height`,`${t.offsetHeight}px`)},o=new ResizeObserver(a);return o.observe(r),o.observe(i),t&&o.observe(t),n.addEventListener(`change`,a),a(),()=>{o.disconnect(),n.removeEventListener(`change`,a)}},[b,w,m]);function F(){O.current?.disconnect();try{let e=g.current?.contentDocument;if(!e||!e.getElementById(`root`)&&!e.getElementById(`paper`)){N(`error`);return}bn(e,b,w,!!t),h(e),g.current?.contentWindow?.addEventListener(`latex-review:decided`,()=>{D.current?.(),u.current?.reload()});let n=e.getElementById(`root`);e.addEventListener(`scroll`,t=>{let r=t.target===e?e.scrollingElement:t.target===n?n:null;r&&(r.scrollTop||r.scrollLeft)&&r.scrollTo(0,0)},!0);let r;k.current?.disconnect(),k.current=new MutationObserver(()=>{clearTimeout(r),r=setTimeout(()=>xn(e),150)}),k.current.observe(e.body,{childList:!0,subtree:!0});let i=()=>{let n=e.getElementById(`paper`);n&&(n.querySelector(`[role="alert"]`)?N(`error`):(t||!n.querySelector(`.waiting`))&&(N(`ready`),O.current?.disconnect(),xn(e)))};O.current=new MutationObserver(i),O.current.observe(e.body,{childList:!0,subtree:!0}),i()}catch{N(`error`)}}(0,S.useEffect)(()=>{if(!m)return;let e=window.document.documentElement,t=()=>zt(e,m.documentElement);t();let n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`style`]}),()=>n.disconnect()},[m]),(0,S.useEffect)(()=>{let e=window.visualViewport;if(!m||!e)return;let t=()=>{let t=g.current?.getBoundingClientRect();t&&m.documentElement.style.setProperty(`--keyboard`,`${Math.max(0,Math.round(t.bottom-e.offsetTop-e.height))}px`)};return t(),e.addEventListener(`resize`,t),e.addEventListener(`scroll`,t),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,t),window.removeEventListener(`resize`,t)}},[m]);let I=M===`ready`,[ee,L]=(0,S.useState)(null),[te,z]=(0,S.useState)(!1);(0,S.useEffect)(()=>{if(!m||!I){L(null);return}let e=()=>L(m.querySelector(`.review-complete-actions`));e();let t=new MutationObserver(e);return t.observe(m.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[m,I]),(0,S.useEffect)(()=>{z(!1);let e=ee?.closest(`.review-complete`),t=m?.getElementById(`paper`);if(!e||!t||!i)return;let n=new IntersectionObserver(([e])=>z(!e.isIntersecting),{root:t});return n.observe(e),()=>n.disconnect()},[m,ee,!!i]);function re(){let e=ee?.closest(`.review-complete`),t=m?.getElementById(`paper`);e&&t&&(e.focus({preventScroll:!0}),t.scrollTo({top:Math.max(0,t.scrollTop+e.getBoundingClientRect().top-t.getBoundingClientRect().top-14),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`}))}return(0,C.jsxs)(`div`,{className:`review-viewport`+(I?``:` review-pending`),"aria-busy":!I,children:[(0,C.jsx)(`iframe`,{ref:g,title:e?R(`{title} PDF change review`,{title:e.title}):R(`Uncommitted changes in the PDF`),src:e?vn(e,d,f):yn(t),onLoad:F,onError:()=>N(`error`),className:`review-frame`,"aria-hidden":!I,tabIndex:I?0:-1},`${A}:${P}:${d||``}:${p||``}`),e&&I&&(0,C.jsx)(Ut,{doc:m,round:d||e.review?.round||0}),(0,C.jsxs)(`div`,{ref:y,className:`review-host-bar`,children:[r&&(0,C.jsx)(`div`,{ref:v,className:`review-lead`,children:r}),(0,C.jsxs)(`div`,{ref:_,className:`review-tools`,children:[e&&a&&(0,C.jsx)(Dt,{doc:I?m:null,task:e,onSend:a}),n]})]}),ee&&i?(0,Ne.createPortal)(i,ee):null,m&&ee&&i&&te?(0,Ne.createPortal)((0,C.jsxs)(`div`,{className:`review-complete-jump`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(T,{name:`check`,size:15}),R(`Review complete`)]}),(0,C.jsxs)(`button`,{type:`button`,onClick:re,children:[R(`Back to summary`),(0,C.jsx)(T,{name:`arrowUp`,size:14})]})]}),m.body):null,!I&&(0,C.jsxs)(`div`,{className:`review-loading`,children:[(0,C.jsx)(`p`,{role:M===`error`?`alert`:`status`,children:R(M===`error`?`The PDF review could not be loaded.`:M===`slow`?`The PDF review is taking longer than expected.`:`Loading PDF review…`)}),M!==`loading`&&(0,C.jsx)(`button`,{className:`button secondary`,onClick:()=>{N(`loading`),j(e=>e+1)},children:R(`Reload review`)})]})]})}var Cn=`modulepreload`,wn=function(e){return`/`+e},Tn={},En=function(e){return e.pathname.endsWith(`.css`)},Dn=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},On=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=wn(t,n);let r=s(t),i=En(r);return Dn(Tn,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Cn,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},kn=(0,S.lazy)(()=>On(()=>import(`./pdf-view-Bnb2uIBE.js`).then(e=>({default:e.PdfView})),[])),An=()=>{};function jn({task:e,api:t,lead:n,tools:r,onCopied:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)(0),[d,f]=(0,S.useState)(``),[p,m]=(0,S.useState)([]),[h,g]=(0,S.useState)(0),_=(0,S.useRef)(null),v=`/tasks/${e.id}/ai-review`;(0,S.useEffect)(()=>{let e=new AbortController;return t(v,void 0,e.signal).then(e=>{o(e),c(``)},t=>{e.signal.aborted||c(t.message)}),()=>e.abort()},[v,e.updatedAt,e.aiReview?.revision,l,t]);let y=e=>o(t=>t&&{...t,notes:t.notes.map(t=>t.id===e.id?e:t)});return(0,C.jsxs)(`div`,{className:`ai-review-view`,children:[s&&(0,C.jsxs)(`div`,{className:`connection-banner`,role:`alert`,children:[(0,C.jsx)(`span`,{children:s}),(0,C.jsx)(`button`,{onClick:()=>u(e=>e+1),children:R(`Retry`)})]}),a?(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(`div`,{className:`review-loading`,children:(0,C.jsx)(`p`,{children:R(`Opening the PDF…`)})}),children:(0,C.jsx)(kn,{ref:_,readOnly:!0,url:`/api${v}/pdf?key=${a.key}`,words:`/api${v}/words?key=${a.key}`,notes:a.notes.filter(e=>e.key===a.key).map((e,t)=>({note:e,number:t+1})),active:d,onSelect:e=>{f(e.id),_.current?.goToNote(e)},onDeselect:()=>f(``),region:!1,setRegion:An,onCreate:async()=>{},outline:p,section:h,onOutline:m,onSection:g,lead:n,tools:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`review-copy-label`,title:R(`Suggestions stay in this task until you copy them to the manuscript`),children:R(`Review copy`)}),r,(0,C.jsx)(`a`,{className:`icon-button`,href:`/api${v}/pdf`,target:`_blank`,rel:`noreferrer`,"aria-label":R(`Open PDF`),title:R(`Open PDF`),children:(0,C.jsx)(T,{name:`external`,size:16})})]}),noteActions:{has:e=>!!a.notes.find(t=>t.id===e)?.aiReview?.copiedTo,toggle:An,onEditing:An,onBusy:An,disabled:!1,edit:async()=>{},copy:async e=>{let n=await t(`${v}/${e.id}/copy`,{});y(n.note),i()},remove:async e=>{await t(`${v}/${e.id}/delete`,{}),o(t=>t&&{...t,notes:t.notes.filter(t=>t.id!==e.id)})},restore:async e=>{let n=await t(`${v}/${e.id}/restore`,{});o(e=>e&&{...e,notes:[...e.notes.filter(e=>e.id!==n.id),n].sort((e,t)=>e.createdAt-t.createdAt||e.id.localeCompare(t.id))}),f(n.id)}}})}):!s&&(0,C.jsx)(`div`,{className:`review-loading`,children:(0,C.jsx)(`p`,{role:`status`,children:R(`Opening the PDF…`)})})]})}function Mn(e){if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`a[href], button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), summary, [tabindex="0"]`)).filter(e=>e.getClientRects().length>0&&!e.closest(`[inert]`)),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}function Nn({task:e,submit:t,onClose:n,onDeleted:r,refresh:i}){let a=(0,S.useRef)(null),o=(0,S.useRef)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),d=[`running`,`waiting_input`,`queued`].includes(e.status)?R(`Pause this task before deleting it.`):e.status===`building`?R(`Wait for the PDF build to finish before deleting this task.`):e.status===`uncertain`?R(`Check task status before deleting this task.`):``;(0,S.useEffect)(()=>{let e=document.activeElement,t=a.current;return t.showModal(),t.querySelector(`[data-cancel]`)?.focus(),()=>{t.close(),e?.isConnected&&e.getClientRects().length&&!e.closest(`[inert]`)?e.focus():Array.from(document.querySelectorAll(`.sidebar .new-task, .sidebar-toggle`)).find(e=>e.getClientRects().length&&!e.closest(`[inert]`))?.focus()}},[]);async function f(){if(!(o.current||d)){o.current=!0,c(!0),u(``);try{await t(),r()}catch(e){u(e instanceof Error?e.message:String(e)),i()}finally{o.current=!1,c(!1)}}}return(0,C.jsx)(`dialog`,{ref:a,className:`modal-backdrop`,"aria-labelledby":`delete-title`,"aria-describedby":`delete-description`,onKeyDown:Mn,onCancel:e=>{e.preventDefault(),s||n()},onClick:e=>{e.target===e.currentTarget&&!s&&n()},children:(0,C.jsxs)(`section`,{className:`modal delete-dialog`,children:[(0,C.jsx)(`h2`,{id:`delete-title`,children:R(`Delete task?`)}),(0,C.jsx)(`p`,{className:`delete-task-name`,children:e.title}),(0,C.jsx)(`p`,{id:`delete-description`,children:R(`This permanently removes the task from Papilot, including its conversation, worktree, and PDF review files. Unaccepted edits and saved comments will be discarded, and review decisions can no longer be undone.`)}),(0,C.jsx)(`p`,{children:R(`Accepted changes in your manuscript stay in place. Other tasks are not affected.`)}),e.status===`deleting`&&(0,C.jsx)(`p`,{className:`muted`,children:R(`Deletion has already started. Retry to confirm the cleanup and remove the task.`)}),d&&(0,C.jsx)(`p`,{className:`inline-error`,role:`status`,children:d}),l&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:l}),(0,C.jsxs)(`div`,{className:`button-row`,children:[(0,C.jsx)(`button`,{"data-cancel":!0,className:`button secondary`,disabled:s,onClick:n,children:R(`Cancel`)}),(0,C.jsx)(`button`,{className:`button danger`,disabled:s||!!d,onClick:()=>void f(),children:s?R(`Deleting…`):e.status===`deleting`?R(`Retry deletion`):R(`Delete task`)})]})]})})}function Pn({label:e,value:t,options:n,onChange:r,disabled:i,icon:a,className:o=``}){return(0,C.jsxs)(`label`,{className:`chip-select `+o,title:e,children:[a&&(0,C.jsx)(T,{name:a,size:14}),(0,C.jsx)(`span`,{className:`chip-value`,children:n.find(e=>e.value===t)?.label??t}),(0,C.jsx)(`select`,{"aria-label":e,disabled:i,value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,C.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})}var Fn=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20fill='none'%3e%3crect%20x='18'%20y='48'%20width='14'%20height='10'%20fill='%23F0F4F8'%20stroke='%23000000'%20stroke-width='2'/%3e%3crect%20x='32'%20y='48'%20width='14'%20height='10'%20fill='%23C6D5E5'%20stroke='%23000000'%20stroke-width='2'/%3e%3cpath%20d='M32%206L12%2034L18%2048H32V6Z'%20fill='%23FFFFFF'/%3e%3cpath%20d='M32%206L52%2034L46%2048H32V6Z'%20fill='%23356AA0'/%3e%3cpath%20d='M32%206L52%2034L46%2048H18L12%2034L32%206Z'%20stroke='%23000000'%20stroke-width='2'%20stroke-linejoin='miter'%20stroke-miterlimit='2'/%3e%3cpath%20d='M32%206V20'%20stroke='%23000000'%20stroke-width='2'/%3e%3cpath%20d='M32%2020Q35%2031%2046%2034Q35%2037%2032%2048Q29%2037%2018%2034Q29%2031%2032%2020Z'%20fill='%23FFFFFF'%20stroke='%23000000'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e`,In=e=>[`installing`,`waiting`,`restarting`].includes(e.phase),Ln=!1,Rn=e=>e.replace(/(-dev\.[a-f0-9]{7})[a-f0-9]{33}$/,`$1`);function zn(e){return e===`The dev build needs at least 2 GB of free disk space. Free some space and retry.`?R(`The dev build needs at least 2 GB of free disk space. Free some space and retry.`):e===`Could not check for updates. Try again when connected.`?R(`Could not check for updates. Try again when connected.`):e}function Bn(e,t){let[n,r]=(0,S.useState)(null),i=(0,S.useRef)(0),a=e=>{i.current++,r(e)},o=(0,S.useRef)(t),s=(0,S.useRef)(n);return s.current=n,(0,S.useEffect)(()=>{let t=!1,n=!1,a,c=async()=>{if(n)return;n=!0;let l=++i.current;try{let n=await e(`/updates`);if(t||l!==i.current||!n?.currentVersion)return;o.current??=n.currentVersion,r(n),n.phase===`updated`&&n.currentVersion!==o.current&&!Ln&&(Ln=!0,location.reload())}catch{}finally{n=!1,t||(a=setTimeout(c,s.current&&In(s.current)?2e3:3e4))}};c();let l=()=>{clearTimeout(a),c()};return window.addEventListener(`online`,l),window.addEventListener(`focus`,l),window.addEventListener(`papilot:updates`,l),()=>{t=!0,clearTimeout(a),window.removeEventListener(`online`,l),window.removeEventListener(`focus`,l),window.removeEventListener(`papilot:updates`,l)}},[e,n?.phase]),{status:n,setStatus:a}}function Vn({api:e,version:t}){let{status:n,setStatus:r}=Bn(e,t),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(``),u=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!i)return;let e=document.activeElement,t=u.current;return t.showModal(),()=>{t.close(),e?.isConnected&&e.focus()}},[i]);let d=(0,C.jsxs)(`span`,{className:`brand-version`,title:R(`Papilot {version}`,{version:t}),children:[`v`,Rn(t)]});if(!n)return d;let f=In(n),p=n.latestVersion&&n.latestVersion!==n.currentVersion;if(!i&&!f&&n.phase!==`failed`&&(!p||n.phase===`idle`))return d;let m=n.phase===`installing`?R(`Updating…`):n.phase===`waiting`?R(`Update ready`):n.phase===`restarting`?R(`Restarting…`):n.phase===`failed`?R(`Update failed`):R(`New version`),h=`${R(`Papilot {version}`,{version:Rn(t)})} · ${m}${n.latestVersion?` · v${Rn(n.latestVersion)}`:``}`;async function g(){if(n&&!o){s(!0),l(``);try{r(await e(`/updates/install`,{version:n.latestVersion}))}catch(e){l(e instanceof Error?e.message:R(`Could not start the update. Please retry.`))}finally{s(!1)}}}return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{type:`button`,className:`brand-version update-badge`+(n.phase===`failed`?` failed`:``),"aria-label":h,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-busy":f||void 0,title:h,onClick:()=>a(!0),children:[`v`,Rn(t),(0,C.jsx)(`span`,{className:`update-dot`,"aria-hidden":`true`})]}),i&&(0,C.jsxs)(`dialog`,{ref:u,className:`update-dialog`,"aria-labelledby":`update-title`,onCancel:e=>{e.preventDefault(),a(!1)},onKeyDown:Mn,onClick:e=>{e.target===e.currentTarget&&a(!1)},children:[(0,C.jsxs)(`div`,{className:`update-heading`,children:[(0,C.jsx)(`h2`,{id:`update-title`,children:R(`Update Papilot`)}),(0,C.jsx)(`button`,{className:`icon-button`,"aria-label":R(`Close`),onClick:()=>a(!1),children:(0,C.jsx)(T,{name:`close`,size:16})})]}),(0,C.jsxs)(`p`,{className:`update-versions`,children:[(0,C.jsx)(`span`,{children:Rn(n.currentVersion)}),(0,C.jsx)(T,{name:`arrowRight`,size:14}),(0,C.jsx)(`strong`,{children:Rn(n.latestVersion||n.currentVersion)})]}),(0,C.jsx)(`p`,{role:`status`,children:n.phase===`installing`?R(`Downloading and checking the new version…`):n.phase===`waiting`?R(`The update is ready. Waiting for tasks and PDF builds to finish before restarting.`):n.phase===`restarting`?R(`Restarting Papilot. This page will reconnect automatically; your drafts are kept.`):n.phase===`failed`?R(`The update did not finish. Your current version is still available. You can retry here.`):R(`Install the new version and restart automatically when tasks are idle. Your papers, tasks and settings stay in place.`)}),!n.canUpdate&&(0,C.jsx)(`p`,{className:`inline-error`,children:R(`Papilot cannot find npm on this computer. Updates are unavailable until npm is installed.`)}),(c||n.error)&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:zn(c||n.error)}),(0,C.jsxs)(`div`,{className:`update-actions`,children:[(0,C.jsx)(`button`,{className:`button ghost`,onClick:()=>a(!1),children:R(f?`Close`:`Later`)}),!f&&(0,C.jsx)(`button`,{className:`button primary`,disabled:o||!n.canUpdate||!p,onClick:()=>void g(),children:o?R(`Updating…`):n.phase===`failed`?R(`Retry update`):R(`Update to {version}`,{version:Rn(n.latestVersion||``)})})]})]})]})}function Hn({api:e}){let{status:t,setStatus:n}=Bn(e),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(``);async function s(t,r={}){i(!0),o(``);try{n(await e(t,r)),window.dispatchEvent(new Event(`papilot:updates`))}catch(e){o(e instanceof Error?e.message:R(`Could not check for updates. Try again when connected.`))}finally{i(!1)}}if(!t)return(0,C.jsx)(`div`,{className:`update-settings settings-page`,children:(0,C.jsxs)(`section`,{className:`settings-card update-summary update-loading`,children:[(0,C.jsx)(`p`,{role:`status`,children:R(`Reading update status…`)}),(0,C.jsx)(`button`,{className:`button secondary`,disabled:r,onClick:()=>void s(`/updates/check`),children:R(`Check for updates`)}),a&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:zn(a)})]})});let c=In(t),l=t.latestVersion&&t.latestVersion!==t.currentVersion&&t.phase!==`idle`&&t.phase!==`checking`,u=t.phase===`checking`,d=a||t.error,f=!!d&&!c&&!u&&t.phase!==`failed`,p=t.phase===`installing`?R(`Updating…`):t.phase===`waiting`?R(`Update ready`):t.phase===`restarting`?R(`Restarting…`):u?R(`Checking for updates…`):t.phase===`failed`?R(`Update failed`):f?R(`Could not check for updates`):l?R(`Update available`):t.latestVersion?R(`Up to date`):R(`Ready to check for updates`),m=t.phase===`failed`?`failed`:f?`warning`:c||u?`active`:l?`available`:t.latestVersion?`current`:`idle`,h=m===`failed`||m===`warning`?`alert`:c||u?`refresh`:l?`arrowUp`:t.latestVersion?`check`:`refresh`;return(0,C.jsx)(`div`,{className:`update-settings settings-page`,children:(0,C.jsxs)(`section`,{className:`settings-card update-summary`,"aria-label":R(`Update Papilot`),children:[(0,C.jsxs)(`div`,{className:`update-product-row`,children:[(0,C.jsxs)(`div`,{className:`update-product`,children:[(0,C.jsx)(`span`,{className:`update-product-mark`,children:(0,C.jsx)(`img`,{src:Fn,width:`34`,height:`34`,alt:``})}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{children:`Papilot`}),(0,C.jsxs)(`p`,{className:`update-current-version`,children:[(0,C.jsx)(`span`,{children:R(`Current version`)}),(0,C.jsx)(`code`,{title:t.currentVersion,children:Rn(t.currentVersion)})]})]})]}),(0,C.jsxs)(`button`,{className:`button secondary update-check`,disabled:r||c||u,onClick:()=>void s(`/updates/check`),children:[(0,C.jsx)(T,{name:`refresh`,size:14}),R(`Check for updates`)]})]}),(0,C.jsxs)(`div`,{className:`update-status `+m,children:[(0,C.jsxs)(`div`,{className:`update-summary-heading`,role:`status`,children:[(0,C.jsx)(`span`,{className:`update-summary-icon`,children:(0,C.jsx)(T,{name:h,size:17})}),(0,C.jsx)(`h4`,{id:`update-settings-title`,children:p})]}),!f&&(0,C.jsx)(`p`,{className:`update-status-description`,children:t.phase===`installing`?t.channel===`dev`?R(`Downloading and building the selected GitHub commit…`):R(`Downloading and checking the new version…`):t.phase===`waiting`?R(`The update is ready. Waiting for tasks and PDF builds to finish before restarting.`):t.phase===`restarting`?R(`Restarting Papilot. This page will reconnect automatically; your drafts are kept.`):u?null:t.phase===`failed`?R(`The update did not finish. Your current version is still available. You can retry here.`):l?R(`Install the new version and restart automatically when tasks are idle. Your papers, tasks and settings stay in place.`):t.latestVersion?R(`You are using the latest version on this channel.`):R(`Check for updates to see the latest version.`)}),d&&(0,C.jsx)(`p`,{className:`update-status-error`,role:`alert`,children:d===`Could not check for updates. Try again when connected.`?R(`Check your connection and try again.`):zn(d)}),t.latestVersion&&t.latestVersion!==t.currentVersion&&(0,C.jsxs)(`div`,{className:`update-release`,children:[(0,C.jsxs)(`p`,{id:`update-latest-version`,children:[(0,C.jsx)(`span`,{children:R(`Latest version`)}),(0,C.jsx)(`code`,{title:t.latestVersion,children:Rn(t.latestVersion)})]}),l&&!c&&(0,C.jsxs)(`button`,{className:`button primary`,"aria-describedby":`update-latest-version`,disabled:r||!t.canUpdate,onClick:()=>void s(`/updates/install`,{version:t.latestVersion}),children:[(0,C.jsx)(T,{name:`arrowUp`,size:15}),t.phase===`failed`?R(`Retry update`):R(`Update now`)]})]})]}),!t.canUpdate&&(0,C.jsxs)(`p`,{className:`update-settings-notice`,children:[(0,C.jsx)(T,{name:`info`,size:15}),(0,C.jsx)(`span`,{children:R(`Papilot cannot find npm on this computer. Updates are unavailable until npm is installed.`)})]}),(0,C.jsxs)(`div`,{className:`update-channel`,children:[(0,C.jsxs)(`div`,{className:`update-channel-copy`,children:[(0,C.jsx)(`h4`,{children:R(`Update channel`)}),(0,C.jsx)(`p`,{children:t.channel===`dev`?R(`Early updates from GitHub main. May be less stable.`):R(`Published releases, recommended for everyday use.`)})]}),(0,C.jsx)(Pn,{label:R(`Update channel`),icon:t.channel===`dev`?`branch`:void 0,value:t.channel||`stable`,disabled:r||c,onChange:e=>void s(`/updates/channel`,{channel:e}),options:[{value:`stable`,label:R(`Stable`)},{value:`dev`,label:R(`Dev (GitHub main)`)}]})]})]})})}function Un({paper:e,canManage:t,save:n,remove:r,onClose:i}){let a=(0,S.useRef)(null),o=(0,S.useRef)(!1),[s,c]=(0,S.useState)({name:e.name,path:e.path}),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(``);(0,S.useEffect)(()=>{let e=a.current;e.showModal();let t=e.querySelector(`[name="name"]`);return t?.focus(),t?.select(),()=>{e.close(),document.querySelector(`.project-switcher, .add-project, .sidebar-toggle`)?.focus()}},[]),(0,S.useEffect)(()=>{l&&a.current?.querySelector(`[data-cancel]`)?.focus()},[l]);function h(){d||(l?(u(!1),m(``),requestAnimationFrame(()=>a.current?.querySelector(`[data-remove]`)?.focus())):i())}async function g(){if(!o.current){o.current=!0,f(!0),m(``);try{l?await r():await n({name:s.name.trim().replace(/\s+/g,` `),path:s.path.trim()}),i()}catch(e){m(e instanceof Error?e.message:String(e))}finally{o.current=!1,f(!1)}}}return(0,C.jsx)(`dialog`,{ref:a,className:`modal-backdrop`,"aria-labelledby":`paper-dialog-title`,onKeyDown:Mn,onCancel:e=>{e.preventDefault(),h()},onClick:e=>{e.target===e.currentTarget&&h()},children:(0,C.jsxs)(`section`,{className:`modal paper-dialog`,children:[(0,C.jsx)(`button`,{className:`modal-close icon-button`,"aria-label":R(`Close`),disabled:d,onClick:i,children:(0,C.jsx)(T,{name:`close`})}),(0,C.jsx)(`h2`,{id:`paper-dialog-title`,children:R(l?`Remove paper?`:`Edit paper`)}),l?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`paper-dialog-name`,children:e.name}),(0,C.jsx)(`p`,{children:R(`Remove this paper and its tasks, conversations and notes from Papilot?`)}),(0,C.jsx)(`p`,{children:R(`Files on disk, Git history and task worktrees will stay in place.`)})]}):(0,C.jsx)(`p`,{className:`modal-description`,children:R(`LaTeX Git repository · Requires a commit and latexmk`)}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g()},children:[!l&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{children:[R(`Repository path`),(0,C.jsx)(`input`,{name:`path`,value:s.path,onChange:e=>c({...s,path:e.target.value}),required:!0,maxLength:4e3,disabled:d||!t,spellCheck:!1,autoComplete:`off`})]}),(0,C.jsxs)(`label`,{children:[R(`Paper name`),(0,C.jsx)(`input`,{name:`name`,value:s.name,onChange:e=>c({...s,name:e.target.value}),required:!0,maxLength:120,disabled:d,autoComplete:`off`})]})]}),p&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:p}),(0,C.jsxs)(`div`,{className:`button-row paper-dialog-actions`,children:[!l&&t&&(0,C.jsxs)(`button`,{type:`button`,"data-remove":!0,className:`button ghost danger-text paper-remove`,disabled:d,onClick:()=>{m(``),u(!0)},children:[(0,C.jsx)(T,{name:`trash`,size:15}),R(`Remove paper`)]}),(0,C.jsx)(`button`,{type:`button`,"data-cancel":!0,className:`button secondary`,disabled:d,onClick:h,children:R(`Cancel`)}),(0,C.jsx)(`button`,{className:`button `+(l?`danger`:`primary`),type:`submit`,disabled:d||!l&&(!s.name.trim()||!s.path.trim()),children:R(d?l?`Removing…`:`Saving…`:l?`Remove from Papilot`:`Save`)})]})]})]})})}var Wn=`papilot:paper-import`,Gn=e=>e.split(`/`).some(e=>[`.git`,`__macosx`,`.ds_store`,`node_modules`,`.papilot`].includes(e.toLowerCase())||e.startsWith(`._`));function Kn(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(R(`Could not read the selected file.`))),r.onload=()=>t(String(r.result).split(`,`)[1]),r.readAsDataURL(e)})}function qn({api:e,agent:t,canRepair:n,onDone:r,onClose:i}){let a=(0,S.useRef)(null),o=(0,S.useRef)(null),s=(0,S.useRef)(null),c=(0,S.useRef)(!1),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)({name:``,path:``,main:``,engine:`pdflatex`}),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(``),[_,v]=(0,S.useState)(!1),y=l?.phase===`building`||l?.phase===`repairing`,b=p||y;function x(e){u(e),f(t=>({...t,name:e.name,main:e.main,engine:e.engine})),D.setItem(Wn,e.id)}(0,S.useEffect)(()=>{let t=a.current,n=document.activeElement;t.showModal(),o.current?.setAttribute(`webkitdirectory`,``),t.querySelector(`[data-choose-folder]`)?.focus();let r=D.getItem(Wn),i=!0;return r&&(m(!0),e(`/imports/`+r).then(e=>{i&&x(e)},()=>D.removeItem(Wn)).finally(()=>{i&&m(!1)})),()=>{i=!1,t.close(),n?.isConnected&&n.focus()}},[]),(0,S.useEffect)(()=>{if(!l||!y)return;let t=!0,n;async function r(){try{let n=await e(`/imports/`+l.id);t&&(x(n),g(``))}catch(e){t&&g(e.message)}t&&(n=setTimeout(r,1e3))}return n=setTimeout(r,500),()=>{t=!1,clearTimeout(n)}},[l?.id,y]);async function w(e){if(!c.current){c.current=!0,m(!0),g(``);try{await e()}catch(e){g(e instanceof Error?e.message:String(e))}finally{c.current=!1,m(!1)}}}async function E(t){x(t),t.main&&!t.error&&t.phase===`choose`&&x(await e(`/imports/${t.id}/build`,{main:t.main,engine:t.engine,name:t.name}))}async function O(t,n){await w(async()=>{let r=t.filter(e=>!Gn(e.webkitRelativePath||e.name));if(!r.length||r.length>5e3||r.reduce((e,t)=>e+t.size,0)>67108864)throw Error(R(`Choose up to 5,000 files, totaling less than 64 MB.`));if(n&&(r.length!==1||!/\.zip$/i.test(r[0].name)))throw Error(R(`Drop one LaTeX ZIP file.`));let i=n?r[0].name.replace(/\.zip$/i,``):(r[0].webkitRelativePath||r[0].name).split(`/`)[0];await E(await e(`/imports`,n?{zip:await Kn(r[0]),name:i.slice(0,120)}:{files:await Promise.all(r.map(async e=>({path:e.webkitRelativePath||e.name,data:await Kn(e)}))),name:i.slice(0,120)},void 0,12e4))})}let k=(n=!1)=>w(async()=>x(await e(`/imports/${l.id}/${n?`repair`:`build`}`,{name:d.name,main:d.main,engine:d.engine,agent:t}))),A=()=>w(async()=>{let t=await e(`/imports/${l.id}/finish`,{});D.removeItem(Wn),await r(t)}),j=l?.error||``,M=/not found|ENOENT|not installed/i.test(j)&&/latexmk|pdflatex|xelatex|lualatex/i.test(j)?R(`Install TeX Live or MacTeX with latexmk on the computer running Papilot, then retry.`):/fontspec|Unicode character|xeCJK/i.test(j)?R(`This paper may need XeLaTeX. Change the engine below and retry.`):/not found|missing|cannot find/i.test(j)?R(`A package, font or source file may be missing. Check the details below, restore the missing file or ask for help.`):R(`Check the main file and engine, or ask the assistant to fix compilation. You can also edit the saved files and retry.`);function N(){p||i()}return(0,C.jsx)(`dialog`,{ref:a,className:`modal-backdrop`,"aria-labelledby":`import-title`,onKeyDown:Mn,onCancel:e=>{e.preventDefault(),N()},onClick:e=>{e.target===e.currentTarget&&N()},children:(0,C.jsxs)(`section`,{className:`modal import-dialog`,children:[(0,C.jsx)(`button`,{className:`modal-close icon-button`,"aria-label":R(`Close`),disabled:p,onClick:N,children:(0,C.jsx)(T,{name:`close`})}),(0,C.jsx)(`h2`,{id:`import-title`,children:R(`Add a paper`)}),(0,C.jsx)(`p`,{className:`modal-description`,children:R(`Bring your LaTeX files. Papilot prepares version history and checks compilation.`)}),l?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`ol`,{className:`import-steps`,"aria-label":R(`Import progress`),children:[(0,C.jsx)(`li`,{className:`done`,children:R(`Files received`)}),(0,C.jsx)(`li`,{className:l.versioned?`done`:``,children:R(`Version history`)}),(0,C.jsx)(`li`,{className:l.phase===`ready`?`done`:``,children:R(`PDF compilation`)})]}),(0,C.jsxs)(`p`,{className:`import-location`,children:[R(`Saved folder`),(0,C.jsx)(`br`,{}),(0,C.jsx)(`code`,{children:l.path})]}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),k()},children:[(0,C.jsxs)(`label`,{children:[R(`Paper name`),(0,C.jsx)(`input`,{required:!0,maxLength:120,value:d.name,disabled:b,onChange:e=>f({...d,name:e.target.value})})]}),(0,C.jsxs)(`div`,{className:`import-settings`,children:[(0,C.jsxs)(`label`,{children:[R(`Main TeX file`),(0,C.jsxs)(`select`,{"aria-label":R(`Main TeX file`),value:d.main,disabled:b,onChange:e=>f({...d,main:e.target.value}),children:[(0,C.jsx)(`option`,{value:``,children:R(`Choose a main file`)}),l.candidates.map(e=>(0,C.jsx)(`option`,{children:e},e))]})]}),(0,C.jsxs)(`label`,{children:[R(`LaTeX engine`),(0,C.jsxs)(`select`,{"aria-label":R(`LaTeX engine`),value:d.engine,disabled:b,onChange:e=>f({...d,engine:e.target.value}),children:[(0,C.jsx)(`option`,{value:`pdflatex`,children:`pdfLaTeX`}),(0,C.jsx)(`option`,{value:`xelatex`,children:`XeLaTeX`}),(0,C.jsx)(`option`,{value:`lualatex`,children:`LuaLaTeX`})]})]})]}),!l.candidates.length&&(0,C.jsx)(`p`,{role:`alert`,children:R(`No TeX files found. Choose a folder or ZIP containing the LaTeX source.`)}),l.candidates.length>1&&l.phase===`choose`&&(0,C.jsx)(`p`,{children:R(`Several TeX files were found. Check the selected main document before continuing.`)}),y&&(0,C.jsxs)(`p`,{className:`import-status`,role:`status`,children:[(0,C.jsx)(`span`,{className:`spinner`}),l.phase===`repairing`?R(`The assistant is fixing compilation…`):R(`Preparing version history and compiling the PDF…`)]}),l.phase===`ready`&&(0,C.jsx)(`p`,{className:`import-success`,role:`status`,children:R(`Your paper compiled successfully. It is ready for editing.`)}),(j||l.phase===`failed`)&&(0,C.jsxs)(`div`,{className:`import-problem`,role:`alert`,children:[(0,C.jsx)(`strong`,{children:R(`The paper needs a little help`)}),(0,C.jsx)(`p`,{children:M}),(0,C.jsxs)(`details`,{children:[(0,C.jsx)(`summary`,{children:R(`Compilation details`)}),(0,C.jsx)(`pre`,{children:j})]})]}),l.summary&&(0,C.jsxs)(`div`,{className:`import-summary`,children:[(0,C.jsx)(`strong`,{children:R(`Repair summary`)}),(0,C.jsx)(`p`,{children:l.summary}),(0,C.jsx)(`p`,{children:R(`Repairs are saved as uncommitted changes. Review them in the paper’s file changes.`)})]}),(0,C.jsxs)(`div`,{className:`button-row import-actions`,children:[l.phase===`failed`&&(0,C.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:b||!n||!d.main,onClick:()=>void k(!0),children:R(`Help fix compilation`)}),(0,C.jsx)(`button`,{className:`button secondary`,disabled:b||!d.main||!d.name.trim(),type:`submit`,children:l.phase===`choose`?R(`Prepare and compile`):R(`Retry compilation`)}),l.versioned&&!y&&(0,C.jsx)(`button`,{type:`button`,className:`button primary`,disabled:p||d.main!==l.main||d.engine!==l.engine||d.name!==l.name,onClick:()=>void A(),children:l.phase===`ready`?R(`Open paper`):R(`Add and fix later`)})]}),l.phase===`failed`&&!n&&(0,C.jsx)(`p`,{className:`modal-description`,children:R(`Connect an assistant in Settings to help repair this paper.`)})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`import-drop`+(_?` dragging`:``),onDragOver:e=>{e.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:e=>{e.preventDefault(),v(!1),b||O(Array.from(e.dataTransfer.files),!0)},children:[(0,C.jsx)(T,{name:`file`,size:28}),(0,C.jsx)(`strong`,{children:R(`Drop a LaTeX ZIP here`)}),(0,C.jsx)(`span`,{children:R(`Up to 64 MB · Folders and ZIPs are copied into Papilot`)}),(0,C.jsxs)(`div`,{className:`button-row`,children:[(0,C.jsx)(`button`,{"data-choose-folder":!0,className:`button secondary`,disabled:b,onClick:()=>o.current?.click(),children:R(`Choose folder`)}),(0,C.jsx)(`button`,{className:`button secondary`,disabled:b,onClick:()=>s.current?.click(),children:R(`Choose ZIP`)})]})]}),(0,C.jsx)(`input`,{hidden:!0,webkitdirectory:``,ref:o,type:`file`,multiple:!0,"aria-label":R(`Choose folder`),onChange:e=>{O(Array.from(e.target.files||[]),!1),e.target.value=``}}),(0,C.jsx)(`input`,{hidden:!0,ref:s,type:`file`,accept:`.zip,application/zip`,"aria-label":R(`Choose ZIP`),onChange:e=>{O(Array.from(e.target.files||[]),!0),e.target.value=``}}),(0,C.jsxs)(`details`,{className:`import-path`,children:[(0,C.jsx)(`summary`,{children:R(`Use a folder on this computer`)}),(0,C.jsx)(`p`,{children:R(`Use the original files on the computer running Papilot.`)}),(0,C.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),w(async()=>E(await e(`/imports`,{path:d.path})))},children:[(0,C.jsxs)(`label`,{children:[R(`Folder path`),(0,C.jsx)(`input`,{value:d.path,required:!0,disabled:b,maxLength:4e3,onChange:e=>f({...d,path:e.target.value}),placeholder:R(`/Users/you/papers/my-paper`),spellCheck:!1})]}),(0,C.jsx)(`button`,{className:`button secondary`,disabled:b,children:R(`Read folder`)})]})]}),p&&(0,C.jsx)(`p`,{role:`status`,children:R(`Reading paper files…`)})]}),h&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:h}),(0,C.jsxs)(`div`,{className:`button-row import-footer`,children:[l&&!y&&(0,C.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:p,onClick:()=>{D.removeItem(Wn),u(null),g(``)},children:R(`Choose different files`)}),(0,C.jsx)(`button`,{className:`button secondary`,disabled:p,onClick:N,children:R(l?`Continue later`:`Cancel`)})]})]})})}function Jn({status:e,label:t,disabled:n,className:r=``,onCompile:i}){let a=(0,S.useRef)(!1),[o,s]=(0,S.useState)(!1),c=o?`building`:e,l=R(c===`building`?`Compiling the PDF…`:c===`failed`?`Compilation failed. Click to retry.`:c===`ready`?`PDF compiled successfully.`:`Compilation status unavailable.`);async function u(){if(!(a.current||n||c===`building`)){a.current=!0,s(!0);try{await i()}finally{a.current=!1,s(!1)}}}return(0,C.jsx)(`button`,{type:`button`,className:`icon-button compile-button ${r}`,"data-state":c,"aria-label":t,"aria-description":l,title:`${t} · ${l}`,"aria-busy":c===`building`,disabled:n||c===`building`,onClick:()=>void u(),children:c===`building`?(0,C.jsx)(`span`,{className:`spinner`,"aria-hidden":`true`}):(0,C.jsx)(T,{name:`compile`,size:24})})}function Yn(e){switch(e.kind){case`reference`:return R(`Undefined reference`);case`citation`:return R(`Undefined citation`);case`label`:return R(`Label defined more than once`);case`missing-file`:return R(`Missing file`);case`glyph`:return R(`Missing character`);case`overfull`:return R(`Line too wide by {amount}pt`,{amount:e.amount??0});default:return e.message}}var Xn=e=>e.key&&[`reference`,`citation`,`label`,`missing-file`,`glyph`].includes(e.kind),Zn=e=>{let t=_e(e);return t.errors+t.warnings+t.minor},Qn=e=>e.file?`${e.file}${e.line?`:${e.line}${e.end?`–${e.end}`:``}`:``}`:``,$n=e=>{let t={reference:`Undefined reference \`${e.key}\``,citation:`Undefined citation \`${e.key}\``,label:`Label \`${e.key}\` defined more than once`,"missing-file":`Missing file \`${e.key}\``,glyph:`Missing character ${e.key}`,overfull:`Overfull line, ${e.amount}pt too wide`}[e.kind]||e.message,n=Qn(e);return`- ${n?n+` — `:``}${t}`};function er(e,t=40){let n=e.filter(e=>e.kind!==`other`),r=n.slice(0,t).map($n);return n.length>t&&r.push(`- …and ${n.length-t} more in the build log`),`Fix these problems from the last compilation:\n${r.join(`
192
- `)}`}var tr=(0,S.forwardRef)(function({counts:e,status:t,pdfKey:n,logUrl:r,load:i,onJump:a,onFix:o},s){let c=(0,S.useId)(),l=(0,S.useRef)(null),u=(0,S.useRef)(null),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(``),_=(0,S.useRef)(i);_.current=i;let v=e?.errors||0,y=e?.warnings||0,b=v||y,x=JSON.stringify([e,t,n]);(0,S.useEffect)(()=>{if(!d)return;let e=!0;return g(``),_.current().then(t=>{e&&m(t)},t=>{e&&g(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[d,x]),(0,S.useEffect)(()=>{if(!d)return;let e=()=>u.current?.hidePopover();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);function w(){let e=u.current,t=l.current.getBoundingClientRect();e.showPopover(),window.matchMedia(`(max-width: 680px)`).matches?(e.style.left=``,e.style.top=``):(e.style.left=`${Math.max(8,Math.min(t.right-e.offsetWidth,window.innerWidth-e.offsetWidth-8))}px`,e.style.top=`${Math.max(8,Math.min(t.bottom+6,window.innerHeight-e.offsetHeight-8))}px`)}(0,S.useImperativeHandle)(s,()=>({open(){u.current?.matches(`:popover-open`)||w()}}),[]);let E=p?.problems||[],D=[[R(`Errors`),E.filter(e=>e.severity===`error`)],[R(`Warnings`),E.filter(e=>e.severity===`warning`)]],O=E.filter(e=>e.severity===`minor`),k=E.filter(e=>e.kind!==`other`),A=v?z(v,`{n} compilation error`,`{n} compilation errors`):y?z(y,`{n} compilation warning`,`{n} compilation warnings`):R(`Compilation log`),j=(e,t)=>{let r=Qn(e),i=e.page!==void 0&&!!e.rect&&p?.key===n,o=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`span`,{className:`problem-title`,children:[e.message.includes(`
193
- `)&&e.kind===`error`?(0,C.jsx)(`span`,{className:`problem-output`,children:e.message}):(0,C.jsx)(`span`,{children:Yn(e)}),Xn(e)&&(0,C.jsx)(`code`,{children:e.key}),(e.count||0)>1&&(0,C.jsxs)(`span`,{className:`problem-repeat`,title:R(`Reported {n} times`,{n:e.count}),children:[`×`,e.count]})]}),(r||e.page!==void 0)&&(0,C.jsxs)(`span`,{className:`problem-place`,children:[r&&(0,C.jsx)(`span`,{className:`problem-file`,title:r,children:r}),e.page!==void 0&&(0,C.jsx)(`span`,{className:`problem-page`,children:R(`p. {page}`,{page:e.page+1})})]})]});return(0,C.jsx)(`li`,{"data-severity":e.severity,children:i?(0,C.jsx)(`button`,{type:`button`,onClick:()=>{u.current?.hidePopover(),a(e)},children:o}):(0,C.jsx)(`div`,{className:`problem-static`,children:o})},t)};return(0,C.jsxs)(`span`,{className:`menu-anchor problems-anchor`,children:[(0,C.jsxs)(`button`,{ref:l,type:`button`,className:`icon-button problems-button`,"data-severity":v?`error`:y?`warning`:void 0,"aria-label":A,title:A,"aria-haspopup":`dialog`,"aria-expanded":d,"aria-controls":c,popoverTarget:c,onClick:e=>{e.preventDefault(),u.current?.matches(`:popover-open`)?u.current.hidePopover():w()},children:[(0,C.jsx)(T,{name:`log`,size:17}),b>0&&(0,C.jsx)(`b`,{className:`problems-count`,"aria-hidden":`true`,children:b>99?`99+`:b})]}),(0,C.jsxs)(`div`,{ref:u,id:c,popover:`auto`,role:`dialog`,"aria-label":R(`Compilation problems`),className:`problems-panel`,onToggle:e=>f(e.nativeEvent.newState===`open`),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),u.current?.hidePopover(),l.current?.focus())},children:[(0,C.jsxs)(`header`,{className:`problems-header`,children:[(0,C.jsx)(`strong`,{children:R(`Compilation problems`)}),t===`building`&&(0,C.jsx)(`span`,{className:`problems-status`,children:R(`Recompiling; this list will update.`)})]}),(0,C.jsx)(`div`,{className:`problems-body`,"aria-busy":!p&&!h,children:h?(0,C.jsx)(`p`,{className:`problems-empty`,role:`alert`,children:h}):p?E.length?(0,C.jsxs)(C.Fragment,{children:[D.map(([e,t])=>t.length>0&&(0,C.jsxs)(`section`,{children:[(0,C.jsxs)(`h3`,{children:[e,` `,(0,C.jsx)(`span`,{children:Zn(t)})]}),(0,C.jsx)(`ul`,{children:t.map(j)})]},e)),O.length>0&&(0,C.jsxs)(`details`,{className:`problems-minor`,open:!D.some(([,e])=>e.length),children:[(0,C.jsxs)(`summary`,{children:[R(`Typesetting and other remarks`),` `,(0,C.jsx)(`span`,{children:Zn(O)})]}),(0,C.jsx)(`ul`,{children:O.map(j)})]})]}):(0,C.jsx)(`p`,{className:`problems-empty`,children:p.status===`building`?R(`The first build is still running.`):R(`No problems in the last build.`)}):(0,C.jsx)(`p`,{className:`problems-empty`,children:R(`Loading…`)})}),(p?.log||o&&k.length>0)&&(0,C.jsxs)(`footer`,{className:`problems-footer`,children:[p?.log&&(0,C.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,children:R(`Raw log`)}),o&&k.length>0&&(0,C.jsxs)(`button`,{type:`button`,className:`button ghost compact`,onClick:()=>{u.current?.hidePopover(),o(k)},children:[(0,C.jsx)(T,{name:`tool`,size:14}),R(`Fix with an agent…`)]})]})]})]})}),nr=`papilot:theme`;function rr(e){return e===`light`||e===`dark`?e:`system`}function ir(){let[e,t]=(0,S.useState)(()=>rr(D.getItem(nr))),[n,r]=(0,S.useState)(()=>Pt(D.getItem(kt))),[i,a]=(0,S.useState)(()=>matchMedia(`(prefers-color-scheme: dark)`).matches),o=e===`system`?i?`dark`:`light`:e;return(0,S.useEffect)(()=>{let e=matchMedia(`(prefers-color-scheme: dark)`),n=()=>a(e.matches),i=e=>{(e.key===nr||e.key===null)&&t(rr(D.getItem(nr))),(e.key===`papilot:appearance`||e.key===null)&&r(Pt(D.getItem(kt)))};return n(),e.addEventListener(`change`,n),window.addEventListener(`storage`,i),()=>{e.removeEventListener(`change`,n),window.removeEventListener(`storage`,i)}},[]),(0,S.useLayoutEffect)(()=>{document.documentElement.dataset.theme=o;let e=Lt(n,o);for(let[t,n]of Object.entries(e))document.documentElement.style.setProperty(t,n);document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e[`--bg`])},[o,n]),{theme:e,resolved:o,appearance:n,setTheme:e=>{D.setItem(nr,e),t(e)},setAppearance:e=>{D.setItem(kt,JSON.stringify(e)),r(e)}}}var ar={codex:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'%3e%3c/path%3e%3c/svg%3e`,claude:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%3c/title%3e%3cpath%20d='M4.709%2015.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0%2011.784l.055-.352.48-.321.686.06%201.52.103%202.278.158%201.652.097%202.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686%201.908%201.476%202.491%201.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97%202.97%200%2001-.104-.729L6.283.134%206.696%200l.996.134.42.364.62%201.414%201.002%202.229%201.555%203.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286%201.851-.559%202.903-.364%201.942h.212l.243-.242.985-1.306%201.652-2.064.73-.82.85-.904.547-.431h1.033l.76%201.129-.34%201.166-1.064%201.347-.881%201.142-1.264%201.7-.79%201.36.073.11.188-.02%202.856-.606%201.543-.28%201.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061%201.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093%201.068%202.006%201.81%202.509%202.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649%202.345%203.521.122%201.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674%207.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434%201.967-2.18%202.945-1.726%201.845-.414.164-.717-.37.067-.662.401-.589%202.388-3.036%201.44-1.882.93-1.086-.006-.158h-.055L4.132%2018.56l-1.13.146-.487-.456.061-.746.231-.243%201.908-1.312-.006.006z'%3e%3c/path%3e%3c/svg%3e`,cursor:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCursor%3c/title%3e%3cpath%20d='M22.106%205.68L12.5.135a.998.998%200%2000-.998%200L1.893%205.68a.84.84%200%2000-.419.726v11.186c0%20.3.16.577.42.727l9.607%205.547a.999.999%200%2000.998%200l9.608-5.547a.84.84%200%2000.42-.727V6.407a.84.84%200%2000-.42-.726zm-.603%201.176L12.228%2022.92c-.063.108-.228.064-.228-.061V12.34a.59.59%200%2000-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264%200%20.428.286.296.514z'%3e%3c/path%3e%3c/svg%3e`,antigravity:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAntigravity%3c/title%3e%3cpath%20d='M21.751%2022.607c1.34%201.005%203.35.335%201.508-1.508C17.73%2015.74%2018.904%201%2012.037%201%205.17%201%206.342%2015.74.815%2021.1c-2.01%202.009.167%202.511%201.507%201.506%205.192-3.517%204.857-9.714%209.715-9.714%204.857%200%204.522%206.197%209.714%209.715z'%3e%3c/path%3e%3c/svg%3e`,kimi:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eKimi%3c/title%3e%3cpath%20d='M21.846%200a1.923%201.923%200%20110%203.846H20.15a.226.226%200%2001-.227-.226V1.923C19.923.861%2020.784%200%2021.846%200z'%3e%3c/path%3e%3cpath%20d='M11.065%2011.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164%200%2000-.117.051l-7.82%207.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103%200-.186.103-.186.23V19.77c0%20.128.083.23.186.23h2.69c.103%200%20.186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158%200%2001.205-.023l6.484%204.772a7.677%207.677%200%20003.453%201.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028%205.028%200%2001-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z'%3e%3c/path%3e%3c/svg%3e`,glm:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eChatGLM%3c/title%3e%3cpath%20d='M9.917%202c4.906%200%2010.178%203.947%208.93%2010.58-.014.07-.037.14-.057.21l-.003-.277c-.083-3-1.534-8.934-8.87-8.934-3.393%200-8.137%203.054-7.93%208.158-.04%204.778%203.555%208.4%207.95%208.332l.073-.001c1.2-.033%202.763-.429%203.1-1.657.063-.031.26.534.268.598.048.256.112.369.192.34.981-.348%202.286-1.222%201.952-2.38-.176-.61-1.775-.147-1.921-.347.418-.979%202.234-.926%203.153-.716.443.102.657.38%201.012.442.29.052.981-.2.96.242C17.226%2019.632%2013.833%2022%209.918%2022%203.654%2022%200%2016.574%200%2011.737%200%205.947%204.959%202%209.917%202zM9.9%205.3c.484%200%201.125.225%201.38.585%203.669.145%204.313%202.686%204.694%205.444.255%201.838.315%202.3.182%201.387l.083.59c.068.448.554.737.982.516.144-.075.254-.231.328-.47a.2.2%200%2001.258-.13l.625.22a.2.2%200%2001.124.238%202.172%202.172%200%2001-.51.92c-.878.917-2.757.664-3.08-.62-.14-.554-.055-.626-.345-1.242-.292-.621-1.238-.709-1.69-.295-.345.315-.407.805-.406%201.282L12.6%2015.9a.9.9%200%2001-.9.9h-1.4a.9.9%200%2001-.9-.9v-.65a1.15%201.15%200%2010-2.3%200v.65a.9.9%200%2001-.9.9H4.8a.9.9%200%2001-.9-.9l.035-3.239c.012-1.884.356-3.658%202.47-4.134.2-.045.252.13.29.342.025.154.043.252.053.294.701%203.058%201.75%204.299%203.144%203.722l.66-.331.254-.13c.158-.082.25-.131.276-.15.012-.01-.165-.206-.407-.464l-1.012-1.067a8.925%208.925%200%2001-.199-.216c-.047-.034-.116.068-.208.306-.074.157-.251.252-.272.326-.013.058.108.298.362.72.164.288.22.508-.31.343-1.04-.8-1.518-2.273-1.684-3.725-.004-.035-.162-1.913-.162-1.913a1.2%201.2%200%20011.113-1.281L9.9%205.3zm12.994%208.68c.037.697-.403.704-1.213.591l-1.783-.276c-.265-.053-.385-.099-.313-.147.47-.315%203.268-.93%203.31-.168zm-.915-.083l-.926.042c-.85.077-1.452.24.338.336l.103.003c.815.012%201.264-.359.485-.381zm1.667-3.601h.01c.79.398.067%201.03-.65%201.393-.14.07-.491.176-1.052.315-.241.04-.457.092-.333.16l.01.005c1.952.958-3.123%201.534-2.495%201.285l.38-.148c.68-.266%201.614-.682%201.666-1.337.038-.48%201.253-.442%201.493-.968.048-.106%200-.236-.144-.389-.05-.047-.094-.094-.107-.148-.073-.305.7-.431%201.222-.168zm-2.568-.474c-.135%201.198-2.479%204.192-1.949%202.863l.017-.042c.298-.717.376-2.221%201.337-3.221.25-.26.636.035.595.4zm-7.976-.253c.02-.694%201.002-.968%201.346-.347.01-1.274-1.941-.768-1.346.347z'%3e%3c/path%3e%3c/svg%3e`,deepseek:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDeepSeek%3c/title%3e%3cpath%20d='M23.748%204.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434%201.202-.422%201.84.027%201.436.633%202.58%201.838%203.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526%205.526%200%2001-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365%2011.365%200%2000-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055%203.055%200%2001-.465.137%209.597%209.597%200%2000-2.883-.102c-1.885.21-3.39%201.102-4.497%202.623C.082%208.606-.231%2010.684.152%2012.85c.403%202.284%201.569%204.175%203.36%205.653%201.858%201.533%203.997%202.284%206.438%202.14%201.482-.085%203.133-.284%204.994-1.86.47.234.962.327%201.78.397.63.059%201.236-.03%201.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926%201.096-1.296%202.746-2.642%203.392-7.003.05-.347.007-.565%200-.845-.004-.17.035-.237.23-.256a4.173%204.173%200%20001.545-.475c1.396-.763%201.96-2.015%202.093-3.517.02-.23-.004-.467-.247-.588zM11.581%2018c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696%204.696%200%20011.529-.039c2.132.312%203.946%201.265%205.468%202.774.868.86%201.525%201.887%202.202%202.891.72%201.066%201.494%202.082%202.48%202.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306%200%2001.415-.287.302.302%200%2001.2.288.306.306%200%2001-.31.307.303.303%200%2001-.304-.308zm3.11%201.596c-.2.081-.399.151-.59.16a1.245%201.245%200%2001-.798-.254c-.274-.23-.47-.358-.552-.758a1.73%201.73%200%2001.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559%200%2001-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136%201.146.016.352.144.618.408%201.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z'%3e%3c/path%3e%3c/svg%3e`,qwen:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eQwen%3c/title%3e%3cpath%20d='M19.713%202.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46%201.46%200%200%200%2011.559%200h-1.58c-.52%200-1%20.275-1.26.728l-2.42%204.19a1.45%201.45%200%200%200%200%201.453l.791%201.37c.26.448.74.727%201.26.727h11.36c.52%200%201-.275%201.26-.728l.79-1.37a1.45%201.45%200%200%200%200-1.451l-.79-1.37a1.46%201.46%200%200%200-1.26-.728zM.195%209.905l2.951%205.115a1.46%201.46%200%200%200-.531.531l-.791%201.37a1.45%201.45%200%200%200%200%201.452l.79%201.37c.26.448.74.727%201.26.727h4.84c.52%200%201-.275%201.26-.728l.79-1.37a1.45%201.45%200%200%200%200-1.451L5.086%207.083a1.46%201.46%200%200%200-1.26-.728h-1.58c-.52%200-1%20.276-1.26.728l-.79%201.37a1.45%201.45%200%200%200%200%201.452m15.888%2013.367%202.951-5.115c.217.125.469.196.728.196h1.582c.52%200%201-.275%201.26-.728l.79-1.37a1.45%201.45%200%200%200%200-1.451l-2.42-4.191a1.46%201.46%200%200%200-1.259-.728h-1.582c-.52%200-1%20.276-1.259.728l-5.678%209.838a1.45%201.45%200%200%200%200%201.452l.79%201.37c.26.448.74.727%201.26.727h1.582c.52%200%201-.275%201.26-.728z'%3e%3c/path%3e%3c/svg%3e`,opencode:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eopencode%3c/title%3e%3cpath%20d='M16%206H8v12h8V6zm4%2016H4V2h16v20z'%3e%3c/path%3e%3c/svg%3e`,git:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e`,latex:`/assets/latex-BarqJFtQ.svg`};function or({name:e,size:t=24}){return(0,C.jsx)(`i`,{className:`brand-icon`,"data-brand":e,"aria-hidden":`true`,style:{"--brand-image":`url("${ar[e]}")`,width:t,height:t}})}var sr=`papilot:notifications`,cr=[`input`,`approval`,`review`,`finished`,`error`],lr={input:!0,approval:!0,review:!0,finished:!0,error:!0};function ur(){let e=D.getItem(sr)===`on`,t={...lr};for(let e of cr)t[e]=D.getItem(`${sr}:${e}`)!==`off`;return typeof window>`u`||!(`Notification`in window)?{on:e,events:t,permission:`unsupported`}:window.isSecureContext?{on:e,events:t,permission:Notification.permission}:{on:e,events:t,permission:`insecure`}}var dr=ur(),fr=new Set;function pr(){let e=ur();(e.on!==dr.on||e.permission!==dr.permission||cr.some(t=>e.events[t]!==dr.events[t]))&&(dr=e,fr.forEach(e=>e()))}typeof window<`u`&&(window.addEventListener(`storage`,e=>{(e.key===sr||e.key?.startsWith(`${sr}:`)||e.key===null)&&pr()}),window.addEventListener(`focus`,pr));var mr=()=>dr,hr=()=>dr.on&&dr.permission===`granted`&&cr.some(e=>dr.events[e]);function gr(e){return fr.add(e),()=>{fr.delete(e)}}function _r(){return(0,S.useSyncExternalStore)(gr,mr)}async function vr(e){e&&dr.permission==="default"&&await Notification.requestPermission(),e?D.setItem(sr,`on`):D.removeItem(sr),pr()}function yr(e,t){t?D.removeItem(`${sr}:${e}`):D.setItem(`${sr}:${e}`,`off`),pr()}function br(e,t,n=lr){let r=[];for(let i of t.tasks){let a=e.tasks.find(e=>e.id===i.id);if(!a)continue;let o=he[i.agent||`codex`]||`Codex`,s=t.requests.filter(t=>t.taskId===i.id&&!e.requests.some(e=>e.id===t.id)&&n[t.method.endsWith(`requestUserInput`)?`input`:`approval`]);if(s.length){let e=s.some(e=>e.method.endsWith(`requestUserInput`));r.push({taskId:i.id,event:e?`input`:`approval`,title:R(e?`{agent} needs your input`:`{agent} is waiting for your approval`,{agent:o}),body:i.title})}else if(a.status===`building`&&i.status===`reviewing`){let e=i.review?.counts?.pending||0;r.push({taskId:i.id,event:e?`review`:`finished`,title:e?z(e,`Review ready · {n} change to decide`,`Review ready · {n} changes to decide`):R(`{agent} finished`,{agent:o}),body:i.title})}else i.status!==a.status&&(i.status===`failed`||i.status===`uncertain`||i.status===`interrupted`&&i.error)&&r.push({taskId:i.id,event:`error`,title:R(`A task needs attention`),body:xr(i,i.title)})}return r.filter(e=>n[e.event])}function xr(e,t){let n=e.error?.split(`
194
- `).find(e=>e.trim())?.trim();return n?`${t}\n${n.slice(0,160)}`:t}function Sr(e,t){if(hr()&&dr.events[e.event])try{let n=new Notification(e.title,{body:e.body,tag:`papilot:`+e.taskId,renotify:!0,icon:`/favicon.png`});n.onclick=()=>{window.focus(),t(e.taskId),n.close()}}catch{}}function Cr(){try{return new Notification(R(`Notifications are on`),{body:R(`Papilot will tell you here when a task needs you.`),tag:`papilot:test`,icon:`/favicon.png`}),!0}catch{return!1}}function wr(){let e=[{event:`input`,label:R(`Input needed`),detail:R(`Notify me when an agent asks me a question.`)},{event:`approval`,label:R(`Approval requests`),detail:R(`Notify me when an agent needs my approval to continue.`)},{event:`review`,label:R(`Review ready`),detail:R(`Notify me when changes are ready for review.`)},{event:`finished`,label:R(`Task finished`),detail:R(`Notify me when an agent finishes without changes to review.`)},{event:`error`,label:R(`Task errors`),detail:R(`Notify me when a task fails or stops unexpectedly.`)}],t=_r(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(``),c=t.on&&t.permission===`granted`,l=t.permission===`unsupported`?R(`This browser cannot show notifications.`):t.permission===`insecure`?R(`Browsers show notifications only on HTTPS or localhost. Open Papilot at a secure address to use them.`):t.permission===`denied`?R(`Notifications are blocked for this site. Allow them in the browser’s site settings, then turn them on here.`):``;async function u(e){r(!0),a(``),s(``);try{await vr(e)}catch{s(R(`This browser could not enable notifications.`))}finally{r(!1)}}return(0,C.jsxs)(`div`,{className:`settings-page`,children:[(0,C.jsxs)(`section`,{className:`settings-card`,children:[(0,C.jsxs)(`div`,{className:`settings-row settings-notifications`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`label`,{className:`settings-name`,htmlFor:`settings-notify`,children:R(`Notifications`)}),(0,C.jsx)(`p`,{id:`settings-notify-detail`,children:l||R(`Show desktop notifications while Papilot is in the background.`)})]}),(0,C.jsx)(`input`,{id:`settings-notify`,type:`checkbox`,role:`switch`,className:`switch`,"aria-describedby":`settings-notify-detail`,checked:c,disabled:n||!!l&&!c,onChange:e=>void u(e.target.checked)})]}),o&&(0,C.jsx)(`p`,{role:`alert`,className:`settings-test`,children:o}),c&&(0,C.jsxs)(`div`,{className:`settings-test`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`button secondary compact`,onClick:()=>a(Cr()?`sent`:`failed`),children:[(0,C.jsx)(T,{name:`bell`,size:14}),R(`Send a test notification`)]}),i&&(0,C.jsx)(`span`,{role:`status`,children:R(i===`sent`?`Sent. If nothing appeared, allow notifications for this browser in your system settings.`:`This browser could not show the notification.`)})]})]}),(0,C.jsxs)(`section`,{"aria-labelledby":`settings-notify-events`,children:[(0,C.jsx)(`h3`,{id:`settings-notify-events`,className:`settings-section-title`,children:R(`Notify me about`)}),(0,C.jsx)(`div`,{className:`settings-card`,children:e.map(({event:e,label:n,detail:r})=>(0,C.jsxs)(`div`,{className:`settings-row settings-notification-event`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:n}),(0,C.jsx)(`p`,{children:r})]}),(0,C.jsx)(Pn,{label:n,value:t.events[e]?`push`:`off`,options:[{value:`push`,label:R(`Push`)},{value:`off`,label:R(`Off`)}],onChange:t=>yr(e,t===`push`)})]},e))})]})]})}function Tr({appearance:e,mode:t}){return(0,C.jsxs)(`span`,{className:`appearance-mini`,style:Lt(e,t),children:[(0,C.jsxs)(`span`,{className:`appearance-mini-sidebar`,children:[(0,C.jsx)(T,{name:`paper`,size:10}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{})]}),(0,C.jsxs)(`span`,{className:`appearance-mini-page`,children:[(0,C.jsx)(`b`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`em`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{})]}),(0,C.jsxs)(`span`,{className:`appearance-mini-chat`,children:[(0,C.jsx)(`b`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`em`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`span`,{})]})]})}function Er({label:e,value:t,onChange:n}){let[r,i]=(0,S.useState)(null),a=r!==null&&!Nt(r);function o(){let e=Nt(r);e&&n(e),a||i(null)}return(0,C.jsxs)(`div`,{className:`appearance-color-field`,children:[(0,C.jsxs)(`div`,{className:`appearance-color-chip`,children:[(0,C.jsx)(`label`,{className:`appearance-swatch`,style:{background:t},title:R(`Choose {color} color`,{color:e}),children:(0,C.jsx)(`input`,{type:`color`,"aria-label":R(`Choose {color} color`,{color:e}),value:t,onChange:e=>{i(null),n(e.target.value)}})}),(0,C.jsx)(`input`,{className:`appearance-hex`,"aria-label":e,"aria-invalid":a||void 0,"aria-describedby":a?`appearance-${e}-error`:void 0,spellCheck:!1,autoComplete:`off`,maxLength:7,value:r??t.toUpperCase(),onChange:e=>i(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o()),e.key===`Escape`&&r!==null&&(e.preventDefault(),e.stopPropagation(),i(null))}})]}),a&&(0,C.jsx)(`small`,{id:`appearance-${e}-error`,className:`appearance-color-error`,children:R(`Use a hex color, like #2563EB.`)})]})}function Dr({theme:e,onTheme:t,resolved:n,appearance:r,onAppearance:i}){let a=It(r,n),o=Object.values(r.colors).some(e=>e.background||e.foreground),s=[{value:`papilot`,label:`Papilot`},{value:`paper`,label:R(`Paper`)},{value:`slate`,label:R(`Slate`)}],c=[{value:`default`,label:R(`Default`)},{value:`blue`,label:R(`Slate blue`)},{value:`graphite`,label:R(`Graphite`)},{value:`stone`,label:R(`Stone`)}],l=(e,t)=>i({...r,colors:{...r.colors,[n]:{...r.colors[n],[e]:t}}});return(0,C.jsxs)(`div`,{className:`settings-page appearance-settings`,children:[(0,C.jsxs)(`section`,{"aria-labelledby":`appearance-visual-style`,children:[(0,C.jsx)(`h3`,{className:`settings-section-title`,id:`appearance-visual-style`,children:R(`Visual style`)}),(0,C.jsx)(`div`,{className:`settings-card appearance-mode-card`,children:(0,C.jsxs)(`div`,{className:`settings-row`,children:[(0,C.jsx)(`span`,{className:`settings-name`,id:`appearance-mode`,children:R(`Mode`)}),(0,C.jsx)(`div`,{className:`appearance-modes`,role:`radiogroup`,"aria-labelledby":`appearance-mode`,children:[`system`,`light`,`dark`].map(n=>(0,C.jsxs)(`label`,{className:`appearance-mode`,children:[(0,C.jsx)(`input`,{type:`radio`,name:`theme`,value:n,checked:e===n,onChange:()=>t(n)}),(0,C.jsxs)(`span`,{className:`appearance-preview appearance-preview-${n}`,"aria-hidden":`true`,children:[(0,C.jsx)(Tr,{appearance:r,mode:n===`system`?`light`:n}),n===`system`&&(0,C.jsx)(`span`,{className:`appearance-preview-half`,children:(0,C.jsx)(Tr,{appearance:r,mode:`dark`})})]}),(0,C.jsxs)(`span`,{className:`appearance-mode-label`,children:[(0,C.jsx)(T,{name:n===`system`?`monitor`:n===`light`?`sun`:`moon`,size:13}),R(n===`system`?`System`:n===`light`?`Light`:`Dark`)]})]},n))})]})}),(0,C.jsxs)(`div`,{className:`settings-card appearance-colors-card`,children:[(0,C.jsxs)(`div`,{className:`settings-row`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Theme`)}),(0,C.jsxs)(`div`,{className:`appearance-theme-controls`,children:[o&&(0,C.jsx)(`span`,{className:`appearance-customized`,children:R(`Customized`)}),(0,C.jsx)(`span`,{className:`appearance-theme-picker`,children:(0,C.jsx)(Pn,{label:R(`Theme`),value:r.preset,options:s,onChange:e=>i({...r,preset:e,accent:`default`,colors:{light:{},dark:{}}})})})]})]}),(0,C.jsxs)(`div`,{className:`settings-row`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Accent`)}),(0,C.jsxs)(`span`,{className:`appearance-accent-picker`,children:[(0,C.jsx)(`i`,{className:`appearance-accent-dot`,style:{background:r.accent==="default"?a.accent:Mt[r.accent]}}),(0,C.jsx)(Pn,{label:R(`Accent`),value:r.accent,options:c,onChange:e=>i({...r,accent:e})})]})]}),(0,C.jsxs)(`div`,{className:`settings-row`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Background`)}),(0,C.jsx)(Er,{label:R(`Background`),value:a.background,onChange:e=>l(`background`,e)},`background-${n}-${r.preset}`)]}),(0,C.jsxs)(`div`,{className:`settings-row`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Foreground`)}),(0,C.jsx)(Er,{label:R(`Foreground`),value:a.foreground,onChange:e=>l(`foreground`,e)},`foreground-${n}-${r.preset}`)]})]}),(0,C.jsx)(`p`,{className:`appearance-hint`,children:R(n===`light`?`Editing light mode colors. Changes are saved automatically.`:`Editing dark mode colors. Changes are saved automatically.`)})]}),(0,C.jsxs)(`details`,{className:`appearance-advanced`,children:[(0,C.jsxs)(`summary`,{children:[R(`Advanced`),(0,C.jsx)(T,{name:`chevronRight`,size:15})]}),(0,C.jsx)(`div`,{className:`settings-card`,children:(0,C.jsxs)(`div`,{className:`settings-row settings-choice`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`PDF appearance`)}),(0,C.jsx)(`p`,{children:R(`Choose how paper pages look in dark mode.`)})]}),(0,C.jsx)(Pn,{label:R(`PDF appearance`),value:r.pdf,options:[{value:`theme`,label:R(`Follow mode`)},{value:`light`,label:R(`Always light`)}],onChange:e=>i({...r,pdf:e})})]})})]}),(0,C.jsxs)(`button`,{type:`button`,className:`appearance-reset`,onClick:()=>{i(At),t(`system`)},children:[(0,C.jsx)(T,{name:`restore`,size:15}),R(`Reset appearance`)]})]})}function Or(e){return[`accept`,`reject`,`comment`,`undo`].includes(e)?`decisions`:[`next`,`previous`,`pending`].includes(e)?`navigation`:`view`}var kr=e=>[...e].map(e=>({key:e})),Ar=[[...kr("`1234567890-="),{key:`Backspace`,label:`⌫`,width:2}],[{key:`Tab`,label:`tab`,width:1.5},...kr(`qwertyuiop[]`),{key:`\\`,width:1.5}],[{key:`CapsLock`,label:`caps`,width:1.75},...kr(`asdfghjkl;'`),{key:`Enter`,label:`↵`,width:2.25}],[{key:`Shift`,label:`⇧`,width:2.25},...kr(`zxcvbnm,./`),{key:`Shift`,label:`⇧`,width:2.75}],[{key:`Ctrl`,width:1.25},{key:`Alt`,width:1.25},{key:`Meta`,width:1.25},{key:` `,label:``,width:7},{key:`Meta`,width:1.25},{key:`ArrowLeft`,label:`←`},{key:`arrows`},{key:`ArrowRight`,label:`→`}]];function jr(e){let t=e.split(`+`).at(-1);return t===`?`?`/`:t}function Mr(e,t){return jr(e)===t||e.split(`+`).slice(0,-1).includes(t)||t===`Shift`&&e.endsWith(`?`)}function Nr({shortcuts:e,labels:t,mac:n,keyLabel:r,active:i,onHighlight:a,onEdit:o}){let[s,c]=(0,S.useState)(null),l=t=>qt.filter(n=>e[n].some(e=>jr(e)===t)),u=s?l(s):[];function d({key:s,label:u,width:f=1},p=0){if(s===`arrows`)return(0,C.jsxs)(`span`,{className:`shortcut-keyboard-arrows`,children:[d({key:`ArrowUp`,label:`↑`}),d({key:`ArrowDown`,label:`↓`})]},s);let m=l(s),h=i&&m.includes(i)?i:m[0],g=i&&e[i].some(e=>Mr(e,s)),_=u??(s===`Meta`?n?`⌘`:`Win`:s===`Alt`&&n?`⌥`:s.toUpperCase()),v=`shortcut-keycap`+(m.length?` assigned`:``)+(g?` lit`:``),y=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{children:_}),s===`/`&&(0,C.jsx)(`small`,{children:`?`}),m.length>0&&(0,C.jsx)(`i`,{})]});return m.length?(0,C.jsx)(`button`,{type:`button`,className:v,style:{flexGrow:f},"data-key":s,"data-tone":Or(h),"aria-label":R(`Keyboard key {key}: {actions}`,{key:_,actions:m.map(n=>`${t[n][0]} (${e[n].filter(e=>jr(e)===s).map(r).join(`, `)})`).join(`; `)}),onMouseEnter:()=>a(h),onMouseLeave:()=>a(null),onFocus:()=>a(h),onBlur:()=>a(null),onClick:()=>{m.length===1?(c(null),o(h)):c(s)},children:y},`${s}-${p}`):(0,C.jsx)(`span`,{className:v,style:{flexGrow:f},"data-key":s,"data-tone":g&&i?Or(i):void 0,"aria-hidden":`true`,children:y},`${s}-${p}`)}return(0,C.jsxs)(`section`,{className:`shortcut-overview`,"aria-labelledby":`shortcut-keyboard-title`,children:[(0,C.jsxs)(`header`,{className:`shortcut-overview-header`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{id:`shortcut-keyboard-title`,children:R(`Your review keyboard`)}),(0,C.jsx)(`p`,{children:R(`Click a highlighted key to customize it.`)})]}),(0,C.jsx)(`span`,{className:`shortcut-layout-label`,children:`QWERTY`})]}),(0,C.jsx)(`div`,{className:`shortcut-keyboard`,role:`group`,"aria-label":R(`Review shortcut keyboard`),children:Ar.map((e,t)=>(0,C.jsx)(`div`,{className:`shortcut-keyboard-row`,children:e.map(d)},t))}),(0,C.jsxs)(`div`,{className:`shortcut-keyboard-legend`,children:[(0,C.jsxs)(`span`,{"data-tone":`decisions`,children:[(0,C.jsx)(`i`,{className:`shortcut-dot`}),R(`Review decisions`)]}),(0,C.jsxs)(`span`,{"data-tone":`navigation`,children:[(0,C.jsx)(`i`,{className:`shortcut-dot`}),R(`Review navigation`)]}),(0,C.jsxs)(`span`,{"data-tone":`view`,children:[(0,C.jsx)(`i`,{className:`shortcut-dot`}),R(`View & help`)]})]}),(0,C.jsx)(`div`,{className:`shortcut-keyboard-detail`,children:u.length>1?(0,C.jsxs)(`div`,{className:`shortcut-keyboard-choices`,children:[(0,C.jsx)(`span`,{children:R(`Choose a shortcut to edit:`)}),u.map(n=>(0,C.jsxs)(`button`,{type:`button`,onClick:()=>{c(null),o(n)},children:[t[n][0],` `,(0,C.jsx)(`kbd`,{children:e[n].filter(e=>jr(e)===s).map(r).join(` / `)})]},n))]}):i?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`shortcut-detail-keys`,children:e[i].map(e=>(0,C.jsx)(`kbd`,{children:r(e)},e))}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:t[i][0]}),(0,C.jsx)(`span`,{className:`shortcut-detail-description`,children:t[i][1]})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(T,{name:`keyboard`,size:19}),(0,C.jsx)(`span`,{children:R(`Hover over a highlighted key to see what it does.`)})]})})]})}function Pr(){let e=sn(),t=ln(),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(null),c=(0,S.useRef)({}),l=/Mac|iPhone|iPad/.test(navigator.platform),u=e=>l?$t(e).replace(/⌘\+/g,`⌘`).replace(/Ctrl\+/g,`⌃`).replace(/Alt\+/g,`⌥`).replace(/Shift\+/g,`⇧`):$t(e),d={accept:[R(`Accept change`),R(`Accept the current proposal. In Changes, stage or unstage it.`)],reject:[R(`Reject change`),R(`Reject the current proposal. In Changes, revert it.`)],comment:[R(`Request a revision`),R(`Write feedback on the current proposed change.`)],next:[R(`Next change`),R(`Move to the next visible change.`)],previous:[R(`Previous change`),R(`Move to the previous visible change.`)],pending:[R(`Next undecided change`),R(`Jump to the next change that still needs a decision.`)],source:[R(`Show LaTeX source`),R(`Show or hide the source for the current change.`)],undo:[R(`Undo review decision`),R(`Undo the last review decision or revert.`)],help:[R(`Keyboard shortcuts`),R(`Open these shortcut settings.`)]},f=[{label:R(`Review decisions`),actions:[`accept`,`reject`,`comment`,`undo`]},{label:R(`Review navigation`),actions:[`next`,`previous`,`pending`]},{label:R(`View & help`),actions:[`source`,`help`]}];function p(t,n){let r=qt.find(r=>r!==t&&n.some(t=>e[r].includes(t)));return r&&a(R(`Already used for {action}. Choose another shortcut.`,{action:d[r][0]})),!!r}function m(n,i){if(r(null),a(``),!i)cn({...t,[n]:e[n]}),on({...e,[n]:[]});else{let r=t[n].length?t[n]:Kt[n];if(p(n,r))return;on({...e,[n]:r})}}function h(e){c.current[e]?.focus(),r(e),a(``)}return(0,C.jsxs)(`div`,{className:`shortcut-settings settings-page`,children:[(0,C.jsx)(Nr,{shortcuts:e,labels:d,mac:l,keyLabel:u,active:n||o,onHighlight:s,onEdit:h}),(0,C.jsxs)(`div`,{className:`shortcut-customize-header`,children:[(0,C.jsx)(`h3`,{className:`settings-section-title`,children:R(`Customize shortcuts`)}),(0,C.jsx)(`p`,{className:`settings-intro`,id:`shortcut-instructions`,children:R(`Click a key to change it, then press the new shortcut. Escape cancels; Backspace clears it.`)})]}),i&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:i}),f.map(i=>(0,C.jsxs)(`section`,{className:`shortcut-group`,"data-tone":Or(i.actions[0]),children:[(0,C.jsxs)(`h3`,{className:`settings-section-title`,children:[(0,C.jsx)(`span`,{className:`shortcut-dot`}),i.label]}),(0,C.jsx)(`div`,{className:`shortcut-list`,children:i.actions.map(i=>{let l=e[i].length>0,f=l?e[i]:t[i];return(0,C.jsxs)(`div`,{className:`shortcut-row`+(l?``:` disabled`)+(n===i||o===i?` highlighted`:``),onMouseEnter:()=>s(i),onMouseLeave:()=>s(null),onFocus:()=>s(i),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s(null)},children:[(0,C.jsx)(`input`,{id:`shortcut-toggle-${i}`,type:`checkbox`,role:`switch`,className:`switch`,"aria-label":R(`Enable shortcut: {action}`,{action:d[i][0]}),checked:l,onChange:e=>m(i,e.target.checked)}),(0,C.jsxs)(`label`,{htmlFor:`shortcut-toggle-${i}`,className:`shortcut-label`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:d[i][0]}),(0,C.jsx)(`span`,{className:`shortcut-description`,children:d[i][1]})]}),(0,C.jsx)(`button`,{ref:e=>{e?c.current[i]=e:delete c.current[i]},type:`button`,className:`shortcut-key`+(n===i?` recording`:``),"aria-label":R(`Change shortcut: {action}`,{action:d[i][0]}),"aria-describedby":`shortcut-instructions`,onClick:()=>h(i),onBlur:()=>r(null),onKeyDown:o=>{if(n!==i)return;if(o.key===`Tab`){r(null);return}if(o.preventDefault(),o.stopPropagation(),o.key===`Escape`){r(null),a(``);return}let s=Jt(o.nativeEvent);if(!s)return;let c=o.key===`Backspace`&&!o.ctrlKey&&!o.metaKey&&!o.altKey&&!o.shiftKey;if(!c&&Xt(s)){a(R(`This key is reserved for the browser or text editing. Choose another shortcut.`));return}if(!c&&p(i,[s]))return;let u=c?[]:[s];cn({...t,[i]:u}),(l||c)&&on({...e,[i]:u}),r(null),a(``)},children:n===i?(0,C.jsx)(`span`,{children:R(`Press a key…`)}):f.length?f.map(e=>(0,C.jsx)(`kbd`,{children:u(e)},e)):(0,C.jsx)(`span`,{children:R(`Not assigned`)})})]},i)})})]},i.label)),(0,C.jsxs)(`section`,{className:`shortcut-system`,children:[(0,C.jsx)(`h3`,{className:`settings-section-title`,children:R(`Standard shortcuts`)}),(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`These keep the usual browser and text-editing behavior.`)}),(0,C.jsxs)(`dl`,{children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Copy selected PDF text`)}),(0,C.jsx)(`dd`,{children:(0,C.jsx)(`kbd`,{children:l?`⌘C`:`Ctrl+C`})})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Undo typing, a deleted note, or the last review decision, depending on focus.`)}),(0,C.jsx)(`dd`,{children:(0,C.jsx)(`kbd`,{children:l?`⌘Z`:`Ctrl+Z`})})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Send the review comment being written.`)}),(0,C.jsx)(`dd`,{children:(0,C.jsx)(`kbd`,{children:l?`⌘↩`:`Ctrl+Enter`})})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Close the current editor or cancel region selection.`)}),(0,C.jsx)(`dd`,{children:(0,C.jsx)(`kbd`,{children:`Esc`})})]})]})]}),(0,C.jsxs)(`footer`,{className:`shortcut-footer`,children:[(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`Review shortcuts work while the PDF review is focused. They pause while you type or select text. Changes are saved in this browser.`)}),(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:JSON.stringify(e)===JSON.stringify(Kt)&&JSON.stringify(t)===JSON.stringify(Kt),onClick:()=>{cn(Zt({})),on(Zt({})),r(null),a(``)},children:R(`Restore default shortcuts`)})]})]})}var Fr={version:`0.8.0`,repository:`https://github.com/PapilotAI/papilot`,issues:`https://github.com/PapilotAI/papilot/issues`,license:`MIT`,licenseText:`MIT License
195
-
196
- Copyright (c) 2026 Cui Chen
197
-
198
- Permission is hereby granted, free of charge, to any person obtaining a copy
199
- of this software and associated documentation files (the "Software"), to deal
200
- in the Software without restriction, including without limitation the rights
201
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
202
- copies of the Software, and to permit persons to whom the Software is
203
- furnished to do so, subject to the following conditions:
204
-
205
- The above copyright notice and this permission notice shall be included in all
206
- copies or substantial portions of the Software.
207
-
208
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
209
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
210
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
211
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
212
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
213
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
214
- SOFTWARE.`};function Ir({href:e,icon:t,title:n,detail:r}){return(0,C.jsxs)(`a`,{className:`settings-navigation-row settings-resource`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,C.jsx)(T,{name:t,size:18}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:n}),r&&(0,C.jsx)(`small`,{children:r})]}),(0,C.jsx)(T,{name:`external`,size:14}),(0,C.jsx)(`span`,{className:`sr-only`,children:R(`Opens in a new tab`)})]})}function Lr({onLicenses:e}){return(0,C.jsxs)(`div`,{className:`about-settings settings-page`,children:[(0,C.jsxs)(`section`,{className:`settings-card settings-card-body`,children:[(0,C.jsxs)(`div`,{className:`settings-product`,children:[(0,C.jsx)(`img`,{src:Fn,width:`52`,height:`52`,alt:``}),(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`div`,{className:`settings-product-name`,children:[`Papilot `,(0,C.jsxs)(`span`,{className:`settings-version`,title:Fr.version,children:[`v`,Rn(Fr.version)]})]}),(0,C.jsx)(`p`,{children:R(`A workspace for your papers.`)})]})]}),(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`Read, annotate, and revise your papers with AI, all in one place.`)})]}),(0,C.jsxs)(`section`,{className:`settings-card settings-resources`,children:[(0,C.jsx)(Ir,{href:Fr.repository,icon:`github`,title:R(`GitHub repository`),detail:new URL(Fr.repository).pathname.slice(1)}),(0,C.jsx)(Ir,{href:Fr.issues,icon:`chat`,title:R(`Feedback & issues`),detail:R(`Report a bug or suggest an improvement.`)}),(0,C.jsx)(Ir,{href:`${Fr.repository}/blob/main/docs/guide.md`,icon:`paper`,title:R(`User guide`),detail:R(`Get started and make Papilot your own.`)}),(0,C.jsx)(Ir,{href:`${Fr.repository}/blob/main/CHANGELOG.md`,icon:`restore`,title:R(`Changelog`),detail:R(`See what changed in each release.`)}),(0,C.jsx)(Ir,{href:`${Fr.repository}/blob/main/CONTRIBUTING.md`,icon:`people`,title:R(`Contribute`),detail:R(`Help improve Papilot with code, docs, and ideas.`)})]}),(0,C.jsxs)(`section`,{children:[(0,C.jsx)(`h3`,{className:`settings-section-title`,children:R(`Licenses & acknowledgments`)}),(0,C.jsxs)(`div`,{className:`settings-card`,children:[(0,C.jsxs)(`details`,{className:`settings-project-license`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(`span`,{children:R(`Papilot license`)}),(0,C.jsx)(`span`,{className:`settings-license-badge`,children:Fr.license}),(0,C.jsx)(T,{name:`chevronDown`,size:15})]}),(0,C.jsx)(`pre`,{tabIndex:0,"aria-label":R(`Papilot license`),children:Fr.licenseText})]}),(0,C.jsxs)(`button`,{type:`button`,className:`settings-navigation-row settings-resource`,"data-settings-page":`licenses`,onClick:e,children:[(0,C.jsx)(T,{name:`code`,size:18}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:R(`Third-party licenses`)}),(0,C.jsx)(`small`,{children:R(`Libraries, fonts, and the people behind them.`)})]}),(0,C.jsx)(T,{name:`chevronRight`,size:15})]})]})]}),(0,C.jsx)(`p`,{className:`settings-credit`,children:R(`Made by Cui Chen and the Papilot contributors.`)})]})}function Rr(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(``);(0,S.useEffect)(()=>{let e=!0;return r(!1),On(()=>import(`./_virtual_papilot-licenses-D7ro6ecN.js`).then(n=>{e&&t(n.default)},()=>{e&&r(!0)}),[]),()=>{e=!1}},[i]);let c=o.trim().toLowerCase(),l=e?.filter(e=>`${e.name} ${e.version} ${e.license}`.toLowerCase().includes(c)),u;return u=n?(0,C.jsxs)(`div`,{role:`alert`,className:`settings-license-error`,children:[(0,C.jsx)(`p`,{children:R(`Could not load the license notices.`)}),(0,C.jsx)(`button`,{className:`button secondary`,onClick:()=>a(e=>e+1),children:R(`Retry`)})]}):l?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{role:`status`,className:`settings-license-count`,children:R(`{shown} of {total} components`,{shown:l.length,total:e.length})}),l.length?(0,C.jsx)(`div`,{className:`settings-license-list settings-card`,children:l.map(e=>(0,C.jsxs)(`details`,{className:`settings-license-item`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsxs)(`span`,{className:`settings-license-component`,children:[(0,C.jsx)(`strong`,{children:e.name}),e.version&&(0,C.jsxs)(`small`,{children:[`v`,e.version]})]}),(0,C.jsx)(`span`,{className:`settings-license-badge`,children:e.license||R(`See license notice`)}),(0,C.jsx)(T,{name:`chevronDown`,size:15})]}),(0,C.jsxs)(`div`,{className:`settings-license-body`,children:[(0,C.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[R(`Component source`),(0,C.jsx)(T,{name:`external`,size:13}),(0,C.jsx)(`span`,{className:`sr-only`,children:R(`Opens in a new tab`)})]}),e.notices.length?e.notices.map(t=>(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h4`,{children:t.name}),(0,C.jsx)(`pre`,{tabIndex:0,"aria-label":`${e.name} — ${t.name}`,children:t.text})]},t.name)):(0,C.jsx)(`p`,{className:`muted`,children:R(`License text is not included in this package. See the component source for its terms.`)})]})]},`${e.name}@${e.version}`))}):(0,C.jsx)(`p`,{className:`settings-license-empty`,children:R(`No components match your search.`)})]}):(0,C.jsx)(`p`,{role:`status`,className:`muted`,children:R(`Loading license notices…`)}),(0,C.jsxs)(`div`,{className:`license-settings settings-page`,children:[(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`Libraries and fonts used by Papilot and its review engine. Each component is covered by its own license.`)}),(0,C.jsxs)(`label`,{className:`settings-license-search`,children:[(0,C.jsx)(T,{name:`search`,size:17}),(0,C.jsx)(`input`,{type:`search`,value:o,onChange:e=>s(e.target.value),placeholder:R(`Search components or licenses…`),"aria-label":R(`Search components or licenses`)})]}),u]})}var zr={pro:`Pro`,plus:`Plus`,team:`Team`,business:`Business`,enterprise:`Enterprise`,edu:`Edu`,free:`Free`,go:`Go`};function Br(e){return e===10080?R(`Weekly limit`):e===1440?R(`Daily limit`):e&&e%1440==0?R(`{n}-day limit`,{n:e/1440}):e&&e%60==0?R(`{n}-hour limit`,{n:e/60}):e?R(`{n}-minute limit`,{n:e}):R(`Usage limit`)}function Vr(e,t=Date.now()){let n=e-t;if(n<=6e4)return R(`resets now`);if(n<864e5){let e=Math.floor(n/36e5),t=Math.round(n%36e5/6e4);return e?R(`resets in {hours} h {minutes} min`,{hours:e,minutes:t}):R(`resets in {minutes} min`,{minutes:t})}let r=new Date(e);return R(`resets {time}`,{time:n<5184e5?r.toLocaleString(te(),{weekday:`short`,hour:`numeric`,minute:`2-digit`}):r.toLocaleDateString(te(),{month:`short`,day:`numeric`})})}function Hr({window:e,reached:t}){let n=Math.round(e.usedPercent),r=Br(e.minutes);return(0,C.jsxs)(`div`,{className:`usage-limit `+(t||n>=90?`critical`:n>=75?`warning`:``),children:[(0,C.jsx)(`span`,{className:`usage-name`,children:r}),(0,C.jsx)(`span`,{className:`usage-bar`,role:`meter`,"aria-label":R(`{name} used`,{name:r}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n,"aria-valuetext":R(`{used}% used`,{used:n}),children:(0,C.jsx)(`span`,{style:{width:`${n}%`}})}),(0,C.jsx)(`span`,{className:`usage-value`,children:t&&n>=100?R(`Limit reached`):R(`{used}% used`,{used:n})}),e.resetsAt&&(0,C.jsx)(`span`,{className:`usage-reset`,children:Vr(e.resetsAt)})]})}function Ur({usage:e,agent:t=`Codex`,expanded:n=!1}){let r=e.credits,i=e.windows.reduce((e,t)=>!e||t.usedPercent>e.usedPercent?t:e,void 0),a=i?Math.round(i.usedPercent):0,o=e.reached||a>=90?`critical`:a>=75?`warning`:``,s=r?r.unlimited?R(`Unlimited credits`):r.balance===null?R(`Credits available`):R(`{n} credits`,{n:Math.floor(r.balance).toLocaleString(te())}):``,c=(0,C.jsxs)(`div`,{className:`usage-details`,children:[e.windows.map((t,n)=>(0,C.jsx)(Hr,{window:t,reached:e.reached},n)),r&&(0,C.jsx)(`span`,{className:`usage-credits`,children:s})]});return(0,C.jsx)(`section`,{className:`usage`,"aria-label":R(`{agent} usage`,{agent:t}),children:n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`usage-expanded-head `+o,children:[e.plan&&(0,C.jsx)(`span`,{className:`usage-plan`,children:zr[e.plan]||e.plan}),e.reached&&(0,C.jsx)(`span`,{className:`usage-value`,children:R(`Limit reached`)})]}),c]}):(0,C.jsxs)(`details`,{children:[(0,C.jsxs)(`summary`,{className:o,"aria-label":R(`{agent} usage details`,{agent:t}),children:[(0,C.jsxs)(`span`,{className:`usage-account`,children:[t,e.plan&&(0,C.jsx)(`span`,{className:`usage-plan`,children:zr[e.plan]||e.plan})]}),(0,C.jsxs)(`span`,{className:`usage-overview`,title:i?Br(i.minutes):void 0,children:[i&&(0,C.jsx)(`span`,{className:`usage-bar`,"aria-hidden":`true`,children:(0,C.jsx)(`span`,{style:{width:`${a}%`}})}),(0,C.jsx)(`span`,{className:`usage-value`,children:e.reached?R(`Limit reached`):i?R(`{used}% used`,{used:a}):s})]}),(0,C.jsx)(T,{name:`chevronDown`,size:13})]}),c]},t)})}function Wr(e){let t={codex:[`codex`,`PAPILOT_CODEX_BIN`],claude:[`claude`,`PAPILOT_CLAUDE_BIN`],antigravity:[`agy`,`PAPILOT_AGY_BIN`],kimi:[`kimi`,`PAPILOT_KIMI_BIN`],deepseek:[`dsh`,`PAPILOT_DSH_BIN`],qwen:[`qwen`,`PAPILOT_QWEN_BIN`],opencode:[`opencode`,`PAPILOT_OPENCODE_BIN`]};if(e===`cursor`)return{summary:R(`Cursor SDK credentials were not detected.`),reason:R(`The last connection attempt found neither CURSOR_API_KEY nor a saved Cursor SDK login for the user running Papilot. Signing in to the Cursor desktop app or CLI does not configure this SDK.`),steps:[R(`Create a Cursor API key in the Cursor dashboard, or configure the Cursor SDK login on this host.`),R(`Provide CURSOR_API_KEY to the process or service that starts Papilot, then restart Papilot. The SDK is installed automatically when used.`)],existing:R(`An environment variable set in a new terminal does not reach an already running server. Restart Papilot with the credentials; Reconnect alone cannot change its environment.`)};if(e===`glm`)return{summary:R(`No GLM API key was found.`),reason:R(`The last connection attempt found neither ZHIPU_API_KEY nor ZAI_API_KEY in the Papilot server environment. A Claude login or a GLM website login does not supply these keys.`),steps:[R(`Create a GLM Coding Plan or API key with Zhipu or Z.ai.`),R(`Set ZHIPU_API_KEY for open.bigmodel.cn, or ZAI_API_KEY for api.z.ai, in the environment that starts Papilot. Then restart Papilot.`)],existing:R(`An environment variable set in a new terminal does not reach an already running server. Restart Papilot with the credentials; Reconnect alone cannot change its environment.`)};let[n,r]=t[e];return{summary:e===`claude`?R(`Claude Code or API credentials were not detected.`):R(`{command} was not found by Papilot.`,{command:n}),reason:e===`claude`?R(`The last connection attempt found neither Claude Code nor supported API credentials in the Papilot server environment.`):R(`The last connection attempt could not find a runnable {command} CLI in the Papilot server environment. It may still be installed in another location or for another user.`,{command:n}),steps:[e===`codex`?R(`Run papilot codex login on the host. It installs a supported Codex CLI when needed.`):R(`Install {command} on the host running Papilot, then complete its login or provider setup below.`,{command:n}),R(`If it is already installed, set {variable} to its executable path in the environment that starts Papilot, then restart Papilot.`,{variable:r}),...e===`claude`?[R(`For the SDK instead, start Papilot with ANTHROPIC_API_KEY or a supported cloud provider configured. Restart Papilot after changing its environment.`)]:[]],existing:R(`The browser and the Papilot server may run on different computers. Background services can also use a different PATH or user account from your terminal.`)}}function Gr({models:e,connected:t}){let[n,r]=(0,S.useState)(!1),i=n?e:e.slice(0,6);return(0,C.jsxs)(`section`,{className:`runtime-agent-models`,"aria-label":R(`Available models`),children:[(0,C.jsxs)(`h5`,{children:[R(`Available models`),t&&e.length>0&&(0,C.jsx)(`small`,{children:e.length})]}),t?e.length?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`ul`,{className:`runtime-model-list`,tabIndex:n?0:void 0,children:i.map(e=>(0,C.jsxs)(`li`,{title:e.id,children:[(0,C.jsx)(`span`,{children:e.name||e.id}),e.isDefault&&(0,C.jsx)(`small`,{children:R(`Default`)})]},e.id))}),e.length>6&&(0,C.jsxs)(`button`,{type:`button`,className:`runtime-model-more`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[n?R(`Show fewer models`):R(`Show {n} more models`,{n:e.length-i.length}),(0,C.jsx)(T,{name:n?`chevronUp`:`chevronDown`,size:13})]})]}):(0,C.jsx)(`p`,{children:R(`This agent has not reported a model list. Its configured default can still be used.`)}):(0,C.jsx)(`p`,{children:R(`Connect and sign in to load the model list.`)})]})}var Kr=`(max-width: 1000px)`,qr=()=>window.matchMedia(Kr).matches?2:3;function Jr(e){let t=window.matchMedia(Kr);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Yr({tiles:e,selectedIndex:t,drawer:n}){let r=(0,S.useSyncExternalStore)(Jr,qr),i=t<0?-1:Math.min(Math.ceil((t+1)/r)*r,e.length)-1;return(0,C.jsx)(`ul`,{className:`diagnostic-agent-grid`,children:e.flatMap((e,t)=>t===i&&n?[e,(0,C.jsx)(`li`,{className:`runtime-agent-drawer`,children:n},`drawer`)]:[e])})}function Xr(e){return{description:{codex:R(`Uses a compatible local Codex CLI. Papilot installs its own copy when needed.`),claude:R(`Uses Claude Code when installed, or the Claude Agent SDK with API credentials.`),cursor:R(`Uses the Cursor SDK with CURSOR_API_KEY. Papilot installs the SDK on first use.`),antigravity:R(`Uses the local Antigravity CLI and its saved Google login.`),kimi:R(`Uses Kimi Code CLI and its saved login through ACP.`),glm:R(`Uses Claude Code or the Claude Agent SDK with ZHIPU_API_KEY or ZAI_API_KEY.`),deepseek:R(`Uses DeepSeek Harness and the providers configured in dsh.`),qwen:R(`Uses Qwen Code and its saved login through ACP.`),opencode:R(`Uses OpenCode with the providers and models you have connected.`)}[e],command:{codex:`papilot codex login`,claude:`claude auth login`,cursor:`CURSOR_API_KEY`,antigravity:`agy`,kimi:`kimi login`,glm:`ZHIPU_API_KEY / ZAI_API_KEY`,deepseek:`dsh web`,qwen:`qwen`,opencode:`opencode auth login`}[e],key:e===`cursor`||e===`glm`}}function Zr(e,t){return!e||!t?`unknown`:t.installed===!1?`missing`:t.connected?t.authenticated?t.usage?.reached?`limited`:`ready`:`signin`:t.error?`unavailable`:`connecting`}function Qr({online:e,runtimes:t,report:n,busy:r,checkFailed:i,checkAgain:a,reconnect:o}){let[s,c]=(0,S.useState)(null),l=(0,S.useRef)({}),[u,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(!1),m={ready:R(`Ready`),limited:R(`Limit reached`),missing:R(`Not detected`),signin:R(`Sign-in required`),connecting:R(`Connecting…`),unavailable:R(`Unavailable`),unknown:R(`Unknown`)},h={ready:`check`,limited:`alert`,missing:`minus`,signin:`key`,connecting:`refresh`,unavailable:`alert`,unknown:`minus`};(0,S.useEffect)(()=>{p(!1)},[s]);let g=()=>{s&&l.current[s]?.focus(),c(null)},_=s?t[s]:void 0,v=Zr(e,_),y=s?Xr(s):null,b=n?.checks.find(e=>e.id===`agent.${s}`),x=e&&_?.connected&&_.authenticated,w=v===`missing`||v===`signin`||v===`unavailable`,E=s?Wr(s):null;async function D(){if(!u){d(!0),p(!1);try{await o()}catch{p(!0)}finally{d(!1)}}}let O=me.map(n=>{let r=Zr(e,t[n]);return{id:n,availability:r,active:r===`ready`||r===`limited`}}).sort((e,t)=>Number(t.active)-Number(e.active)),k=[...O.map(({id:e,availability:t})=>(0,C.jsx)(`li`,{className:`diagnostic-agent-card`,"data-agent":e,"data-availability":t,children:(0,C.jsxs)(`button`,{type:`button`,className:`diagnostic-agent-button`,ref:t=>{l.current[e]=t},"aria-label":R(`{agent} details`,{agent:he[e]}),"aria-expanded":s===e,"aria-controls":s===e?`runtime-agent-detail`:void 0,title:t===`missing`?Wr(e).reason:R(`View installation, account, and usage`),onClick:()=>s===e?g():c(e),onKeyDown:t=>{t.key===`Escape`&&s===e&&(t.preventDefault(),t.stopPropagation(),g())},children:[(0,C.jsxs)(`div`,{className:`diagnostic-agent-heading`,children:[(0,C.jsx)(or,{name:e,size:28}),(0,C.jsx)(`h4`,{children:he[e]})]}),(0,C.jsxs)(`div`,{className:`diagnostic-agent-footer`,children:[(0,C.jsxs)(`span`,{className:`diagnostic-availability `+t,children:[(0,C.jsx)(T,{name:h[t],size:13}),m[t]]}),(0,C.jsx)(`span`,{className:`diagnostic-agent-chevron`,children:(0,C.jsx)(T,{name:s===e?`chevronUp`:`chevronDown`,size:14})})]})]})},e)),(0,C.jsx)(`li`,{className:`diagnostic-agent-card runtime-agent-contribute`,children:(0,C.jsxs)(Ue,{label:R(`Support more`),className:`diagnostic-agent-button`,align:`start`,actions:[{label:R(`Suggest an agent`),icon:`chat`,href:`${Fr.issues}/new?template=feature_request.yml&title=Agent%20support%3A%20`,title:R(`Opens in a new tab`)},{label:R(`Contribute an integration`),icon:`code`,href:`${Fr.repository}/compare`,title:R(`Opens in a new tab`)}],children:[(0,C.jsxs)(`div`,{className:`diagnostic-agent-heading`,children:[(0,C.jsx)(T,{name:`plus`,size:28}),(0,C.jsx)(`h4`,{children:R(`Support more`)})]}),(0,C.jsx)(`div`,{className:`diagnostic-agent-footer`,children:(0,C.jsxs)(`span`,{className:`diagnostic-agent-action`,children:[R(`Contribute`),(0,C.jsx)(T,{name:`chevronRight`,size:14})]})})]})},`contribute`)],A=(0,C.jsxs)(`a`,{className:`runtime-agent-guide`,href:`${Fr.repository}/blob/main/docs/guide.md#agents`,target:`_blank`,rel:`noopener noreferrer`,children:[R(`Setup guide`),(0,C.jsx)(T,{name:`external`,size:12}),(0,C.jsx)(`span`,{className:`sr-only`,children:R(`Opens in a new tab`)})]}),j=s&&y&&(0,C.jsxs)(`section`,{className:`runtime-agent-detail runtime-agent-compact settings-card settings-card-body`,id:`runtime-agent-detail`,"aria-labelledby":`runtime-agent-title`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g())},children:[(0,C.jsxs)(`header`,{className:`runtime-agent-header`,children:[(0,C.jsx)(`h4`,{id:`runtime-agent-title`,tabIndex:-1,children:he[s]}),x&&(0,C.jsx)(`span`,{className:`runtime-agent-account`,"aria-label":R(`Account`),children:_.account||R(`Signed in`)}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Close agent details`),onClick:g,children:(0,C.jsx)(T,{name:`close`,size:16})})]}),w&&E&&(0,C.jsxs)(`section`,{className:`runtime-agent-help`,"aria-label":R(`Set up this agent`),children:[(0,C.jsx)(`p`,{className:`runtime-agent-reason`,title:_?.error||void 0,children:v===`missing`?b?.ok?R(`The latest configuration check found this agent. Reconnect to refresh its live status.`):E.summary:v===`signin`?R(`Sign in on the Papilot host to continue.`):_?.error||R(`The agent could not connect. Check its setup and try again.`)}),v===`missing`&&!b?.ok&&(0,C.jsx)(`p`,{children:E.steps[0]}),!(v===`missing`&&b?.ok)&&(0,C.jsx)(`code`,{className:`runtime-agent-command`,children:y.command}),(0,C.jsxs)(`div`,{className:`runtime-setup-actions`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`button secondary compact`,disabled:!e||u,onClick:()=>void D(),children:[(0,C.jsx)(T,{name:`refresh`,size:13}),R(u?`Connecting…`:`Reconnect`)]}),A]}),f&&(0,C.jsx)(`p`,{role:`alert`,children:R(`Could not reconnect. Check the server connection and try again.`)})]}),x?(0,C.jsxs)(`div`,{className:`runtime-agent-overview`,children:[(0,C.jsx)(Gr,{models:_.models,connected:!0},s),(0,C.jsxs)(`section`,{className:`runtime-agent-usage`,children:[(0,C.jsx)(`h5`,{children:R(`Usage & limits`)}),_.usage?(0,C.jsx)(Ur,{usage:_.usage,agent:he[s],expanded:!0}):(0,C.jsx)(`p`,{className:`runtime-agent-note`,children:R(`Usage not reported`)})]})]}):!w&&(0,C.jsx)(`p`,{className:`runtime-agent-note`,children:R(`Connect to view account, models, and usage.`)}),(0,C.jsxs)(`details`,{className:`runtime-agent-detection`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(T,{name:`terminal`,size:14}),(0,C.jsx)(`span`,{children:R(`Installation & setup`)}),(0,C.jsx)(T,{name:`chevronDown`,size:14})]}),(0,C.jsxs)(`div`,{className:`runtime-agent-installation`,children:[(0,C.jsx)(`p`,{children:y.description}),w&&E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{children:v===`missing`?E.reason:R(v===`signin`?`Papilot reached this agent, but could not confirm a signed-in account on this host.`:`Papilot could not establish a working connection to this agent. The latest connection error is shown below.`)}),_?.error&&(0,C.jsx)(`p`,{className:`runtime-agent-error`,children:_.error}),v===`missing`&&b?.ok?(0,C.jsx)(`p`,{children:R(`If the live status still disagrees with the check, restart Papilot under the same user and environment where you configured the agent.`)}):v===`signin`?(0,C.jsx)(`p`,{children:R(`Sign in as the user running Papilot, then restart Papilot.`)}):v===`unavailable`?(0,C.jsx)(`p`,{children:R(`Check the connection error above and the agent’s login, provider, and network settings on this host. Restart Papilot after changing credentials or executable paths.`)}):(0,C.jsx)(`ol`,{children:E.steps.map(e=>(0,C.jsx)(`li`,{children:e},e))}),(0,C.jsxs)(`p`,{children:[(0,C.jsx)(`strong`,{children:R(`Already set up?`)}),` `,E.existing]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`runtime-agent-caption`,children:y.key?R(`Environment variable`):R(`Set up on the host`)}),(0,C.jsx)(`code`,{className:`runtime-agent-command`,children:y.command})]}),(0,C.jsxs)(`div`,{className:`runtime-agent-check-heading`,children:[(0,C.jsx)(`h5`,{children:R(`Installation check`)}),!r&&b&&(0,C.jsx)(`span`,{className:`diagnostic-state ${b.ok?`ok`:b.severity===`error`?`error`:b.severity===`warn`?`warn`:`info`}`,children:b.ok?R(`Passed`):b.severity===`error`?R(`Needs attention`):b.severity===`warn`?R(`Warning`):R(`Not found`)})]}),r?(0,C.jsx)(`p`,{role:`status`,children:R(`Checking…`)}):i?(0,C.jsx)(`p`,{role:`alert`,children:R(`Could not complete the environment checks. Check the connection and try again.`)}):b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{children:b.detail}),!b.ok&&b.fix&&(0,C.jsxs)(`p`,{className:`diagnostic-fix`,children:[(0,C.jsx)(`strong`,{children:R(`Suggested fix`)}),b.fix]})]}):(0,C.jsx)(`p`,{children:R(`No installation details were returned. Run the checks again to refresh.`)}),(0,C.jsxs)(`div`,{className:`runtime-setup-actions`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`button secondary compact`,disabled:r||!e,onClick:a,children:[(0,C.jsx)(T,{name:`refresh`,size:13}),R(r?`Checking…`:`Check again`)]}),!w&&A]})]})]},s+String(w))]}),M=O.findIndex(e=>e.id===s);return(0,C.jsx)(`section`,{"aria-label":R(`Agents`),children:(0,C.jsx)(Yr,{tiles:k,selectedIndex:M,drawer:j})})}function $r({online:e,runtimes:t,project:n,check:r,reconnect:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!0),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(0);return(0,S.useEffect)(()=>{let e=new AbortController;return c(!0),u(!1),o(null),r(n?.id,e.signal).then(t=>{e.signal.aborted||o(t)},()=>{e.signal.aborted||u(!0)}).finally(()=>{e.signal.aborted||c(!1)}),()=>e.abort()},[d,n?.id,r]),(0,C.jsx)(`div`,{className:`diagnostics-settings settings-page`,children:(0,C.jsx)(Qr,{online:e,runtimes:t,report:a,busy:s,checkFailed:l,checkAgain:()=>f(e=>e+1),reconnect:async()=>{await i(),f(e=>e+1)}})})}function ei({load:e,online:t}){let[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(!0),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(0);return(0,S.useEffect)(()=>{let t=new AbortController;return a(!0),s(!1),r(null),e(t.signal).then(e=>{t.signal.aborted||r(e)},()=>{t.signal.aborted||s(!0)}).finally(()=>{t.signal.aborted||a(!1)}),()=>t.abort()},[e,c]),(0,C.jsx)(`div`,{className:`latex-settings settings-page`,children:(0,C.jsxs)(`section`,{className:`settings-card settings-card-body`,"aria-label":R(`LaTeX installation`),children:[(0,C.jsxs)(`header`,{className:`latex-installation-header`,children:[(0,C.jsx)(or,{name:`latex`,size:32}),(0,C.jsx)(`h3`,{children:n?.distribution||R(`LaTeX installation`)}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Detect again`),title:R(`Detect again`),disabled:i||!t,onClick:()=>l(e=>e+1),children:(0,C.jsx)(T,{name:`refresh`,size:16})})]}),i?(0,C.jsx)(`p`,{role:`status`,className:`settings-intro`,children:R(`Detecting LaTeX installation…`)}):o?(0,C.jsx)(`p`,{role:`alert`,className:`settings-intro`,children:R(`Could not read the LaTeX installation. Try again.`)}):n?(0,C.jsxs)(`dl`,{className:`latex-installation-facts`,children:[!n.distribution&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Distribution`)}),(0,C.jsx)(`dd`,{children:R(`Unknown`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Version`)}),(0,C.jsx)(`dd`,{children:n.version||R(`Unknown`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:R(`Installation location`)}),(0,C.jsx)(`dd`,{children:(0,C.jsx)(`code`,{children:n.path})})]})]}):(0,C.jsx)(`p`,{role:`status`,className:`settings-intro`,children:R(`No LaTeX installation was detected on this host.`)})]})})}function ti(){}function ni(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function ri(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ii=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ai=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oi={};function si(e,t){return((t||oi).jsx?ai:ii).test(e)}var ci=/[ \t\n\f\r]/g;function li(e){return typeof e==`object`?e.type===`text`&&ui(e.value):ui(e)}function ui(e){return e.replace(ci,``)===``}var di=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};di.prototype.normal={},di.prototype.property={},di.prototype.space=void 0;function fi(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new di(n,r,t)}function pi(e){return e.toLowerCase()}var mi=class{constructor(e,t){this.attribute=t,this.property=e}};mi.prototype.attribute=``,mi.prototype.booleanish=!1,mi.prototype.boolean=!1,mi.prototype.commaOrSpaceSeparated=!1,mi.prototype.commaSeparated=!1,mi.prototype.defined=!1,mi.prototype.mustUseProperty=!1,mi.prototype.number=!1,mi.prototype.overloadedBoolean=!1,mi.prototype.property=``,mi.prototype.spaceSeparated=!1,mi.prototype.space=void 0;var hi=s({boolean:()=>G,booleanish:()=>_i,commaOrSpaceSeparated:()=>xi,commaSeparated:()=>bi,number:()=>K,overloadedBoolean:()=>vi,spaceSeparated:()=>yi}),gi=0,G=Si(),_i=Si(),vi=Si(),K=Si(),yi=Si(),bi=Si(),xi=Si();function Si(){return 2**++gi}var Ci=Object.keys(hi),wi=class extends mi{constructor(e,t,n,r){let i=-1;if(super(e,t),Ti(this,`space`,r),typeof n==`number`)for(;++i<Ci.length;){let e=Ci[i];Ti(this,Ci[i],(n&hi[e])===hi[e])}}};wi.prototype.defined=!0;function Ti(e,t,n){n&&(e[t]=n)}function Ei(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new wi(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pi(r)]=r,n[pi(a.attribute)]=r}return new di(t,n,e.space)}var Di=Ei({properties:{ariaActiveDescendant:null,ariaAtomic:_i,ariaAutoComplete:null,ariaBusy:_i,ariaChecked:_i,ariaColCount:K,ariaColIndex:K,ariaColSpan:K,ariaControls:yi,ariaCurrent:null,ariaDescribedBy:yi,ariaDetails:null,ariaDisabled:_i,ariaDropEffect:yi,ariaErrorMessage:null,ariaExpanded:_i,ariaFlowTo:yi,ariaGrabbed:_i,ariaHasPopup:null,ariaHidden:_i,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yi,ariaLevel:K,ariaLive:null,ariaModal:_i,ariaMultiLine:_i,ariaMultiSelectable:_i,ariaOrientation:null,ariaOwns:yi,ariaPlaceholder:null,ariaPosInSet:K,ariaPressed:_i,ariaReadOnly:_i,ariaRelevant:null,ariaRequired:_i,ariaRoleDescription:yi,ariaRowCount:K,ariaRowIndex:K,ariaRowSpan:K,ariaSelected:_i,ariaSetSize:K,ariaSort:null,ariaValueMax:K,ariaValueMin:K,ariaValueNow:K,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Oi(e,t){return t in e?e[t]:t}function ki(e,t){return Oi(e,t.toLowerCase())}var Ai=Ei({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:bi,acceptCharset:yi,accessKey:yi,action:null,allow:null,allowFullScreen:G,allowPaymentRequest:G,allowUserMedia:G,alpha:G,alt:null,as:null,async:G,autoCapitalize:null,autoComplete:yi,autoFocus:G,autoPlay:G,blocking:yi,capture:null,charSet:null,checked:G,cite:null,className:yi,closedBy:null,colorSpace:null,cols:K,colSpan:K,command:null,commandFor:null,content:null,contentEditable:_i,controls:G,controlsList:yi,coords:K|bi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:G,defer:G,dir:null,dirName:null,disabled:G,download:vi,draggable:_i,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:G,formTarget:null,headers:yi,height:K,hidden:vi,high:K,href:null,hrefLang:null,htmlFor:yi,httpEquiv:yi,id:null,imageSizes:null,imageSrcSet:null,inert:G,inputMode:null,integrity:null,is:null,isMap:G,itemId:null,itemProp:yi,itemRef:yi,itemScope:G,itemType:yi,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:G,low:K,manifest:null,max:null,maxLength:K,media:null,method:null,min:null,minLength:K,multiple:G,muted:G,name:null,nonce:null,noModule:G,noValidate:G,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:G,optimum:K,pattern:null,ping:yi,placeholder:null,playsInline:G,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:G,referrerPolicy:null,rel:yi,required:G,reversed:G,rows:K,rowSpan:K,sandbox:yi,scope:null,scoped:G,seamless:G,selected:G,shadowRootClonable:G,shadowRootCustomElementRegistry:G,shadowRootDelegatesFocus:G,shadowRootMode:null,shadowRootSerializable:G,shape:null,size:K,sizes:null,slot:null,span:K,spellCheck:_i,src:null,srcDoc:null,srcLang:null,srcSet:null,start:K,step:null,style:null,tabIndex:K,target:null,title:null,translate:null,type:null,typeMustMatch:G,useMap:null,value:_i,width:K,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yi,axis:null,background:null,bgColor:null,border:K,borderColor:null,bottomMargin:K,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:G,declare:G,event:null,face:null,frame:null,frameBorder:null,hSpace:K,leftMargin:K,link:null,longDesc:null,lowSrc:null,marginHeight:K,marginWidth:K,noResize:G,noHref:G,noShade:G,noWrap:G,object:null,profile:null,prompt:null,rev:null,rightMargin:K,rules:null,scheme:null,scrolling:_i,standby:null,summary:null,text:null,topMargin:K,valueType:null,version:null,vAlign:null,vLink:null,vSpace:K,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:G,disablePictureInPicture:G,disableRemotePlayback:G,exportParts:bi,part:yi,prefix:null,property:null,results:K,security:null,unselectable:null},space:`html`,transform:ki}),ji=Ei({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:xi,accentHeight:K,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:K,amplitude:K,arabicForm:null,ascent:K,attributeName:null,attributeType:null,azimuth:K,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:K,by:null,calcMode:null,capHeight:K,className:yi,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:K,diffuseConstant:K,direction:null,display:null,dur:null,divisor:K,dominantBaseline:null,download:G,dx:null,dy:null,edgeMode:null,editable:null,elevation:K,enableBackground:null,end:null,event:null,exponent:K,externalResourcesRequired:null,fill:null,fillOpacity:K,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:bi,g2:bi,glyphName:bi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:K,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:K,horizOriginX:K,horizOriginY:K,id:null,ideographic:K,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:K,k:K,k1:K,k2:K,k3:K,k4:K,kernelMatrix:xi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:K,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:K,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:K,overlineThickness:K,paintOrder:null,panose1:null,path:null,pathLength:K,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yi,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:K,pointsAtY:K,pointsAtZ:K,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xi,rev:xi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xi,requiredFeatures:xi,requiredFonts:xi,requiredFormats:xi,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:K,specularExponent:K,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:K,strikethroughThickness:K,string:null,stroke:null,strokeDashArray:xi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:K,strokeOpacity:K,strokeWidth:null,style:null,surfaceScale:K,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xi,tabIndex:K,tableValues:null,target:null,targetX:K,targetY:K,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:K,underlineThickness:K,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:K,values:null,vAlphabetic:K,vMathematical:K,vectorEffect:null,vHanging:K,vIdeographic:K,version:null,vertAdvY:K,vertOriginX:K,vertOriginY:K,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:K,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Oi}),Mi=Ei({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()}}),Ni=Ei({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ki}),Pi=Ei({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Fi={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`},Ii=/[A-Z]/g,Li=/-[a-z]/g,Ri=/^data[-\w.:]+$/i;function zi(e,t){let n=pi(t),r=t,i=mi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ri.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Li,Vi);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Li.test(e)){let n=e.replace(Ii,Bi);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=wi}return new i(r,t)}function Bi(e){return`-`+e.toLowerCase()}function Vi(e){return e.charAt(1).toUpperCase()}var Hi=fi([Di,Ai,Mi,Ni,Pi],`html`),Ui=fi([Di,ji,Mi,Ni,Pi],`svg`);function Wi(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Gi(e){return e.join(` `).trim()}var Ki=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(`
215
- `);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})),qi=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(Ki());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),Ji=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))}})),Yi=o(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(qi()),i=Ji();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),Xi=q(`end`),Zi=q(`start`);function q(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 Qi(e){let t=Zi(e),n=Xi(e);if(t&&n)return{start:t,end:n}}function $i(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ta(e.position):`start`in e||`end`in e?ta(e):`line`in e||`column`in e?ea(e):``}function ea(e){return na(e&&e.line)+`:`+na(e&&e.column)}function ta(e){return ea(e&&e.start)+`-`+ea(e&&e.end)}function na(e){return e&&typeof e==`number`?e:1}var ra=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=$i(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}};ra.prototype.file=``,ra.prototype.name=``,ra.prototype.reason=``,ra.prototype.message=``,ra.prototype.stack=``,ra.prototype.column=void 0,ra.prototype.line=void 0,ra.prototype.ancestors=void 0,ra.prototype.cause=void 0,ra.prototype.fatal=void 0,ra.prototype.place=void 0,ra.prototype.ruleId=void 0,ra.prototype.source=void 0;var ia=l(Yi(),1),aa={}.hasOwnProperty,oa=new Map,sa=/[A-Z]/g,ca=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),la=new Set([`td`,`th`]),ua=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function da(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=Sa(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=xa(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`?Ui:Hi,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=fa(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function fa(e,t,n){if(t.type===`element`)return pa(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ma(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ga(e,t,n);if(t.type===`mdxjsEsm`)return ha(e,t);if(t.type===`root`)return _a(e,t,n);if(t.type===`text`)return va(e,t)}function pa(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ui,e.schema=i),e.ancestors.push(t);let a=Oa(e,t.tagName,!1),o=Ca(e,t),s=Ta(e,t);return ca.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!li(e)})),ya(e,o,a,t),ba(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ma(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)}ka(e,t.position)}function ha(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ka(e,t.position)}function ga(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ui,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Oa(e,t.name,!0),o=wa(e,t),s=Ta(e,t);return ya(e,o,a,t),ba(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function _a(e,t,n){let r={};return ba(r,Ta(e,t)),e.create(t,e.Fragment,r,n)}function va(e,t){return t.value}function ya(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ba(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function xa(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 Sa(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Zi(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 Ca(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&aa.call(t.properties,i)){let a=Ea(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&la.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 wa(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 ka(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 ka(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Ta(e,t){let n=[],r=-1,i=e.passKeys?new Map:oa;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=fa(e,a,o);s!==void 0&&n.push(s)}return n}function Ea(e,t,n){let r=zi(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ri(n):Gi(n)),r.property===`style`){let t=typeof n==`object`?n:Da(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Aa(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Fi[r.property]||r.property:r.attribute,n]}}function Da(e,t){try{return(0,ia.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new ra("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=ua+`#cannot-parse-style-attribute`,r}}function Oa(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=si(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=si(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return aa.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ka(e)}function ka(e,t){let n=new ra("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=ua+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Aa(e){let t={},n;for(n in e)aa.call(e,n)&&(t[ja(n)]=e[n]);return t}function ja(e){let t=e.replace(sa,Ma);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Ma(e){return`-`+e.toLowerCase()}var Na={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`]},Pa={};function Fa(e,t){let n=t||Pa;return Ia(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Ia(e,t,n){if(Ra(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 La(e.children,t,n)}return Array.isArray(e)?La(e,t,n):``}function La(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ia(e[i],t,n);return r.join(``)}function Ra(e){return!!(e&&typeof e==`object`)}var za=document.createElement(`i`);function Ba(e){let t=`&`+e+`;`;za.innerHTML=t;let n=za.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Va(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 Ha(e,t){return e.length>0?(Va(e,e.length,0,t),e):t}var Ua={}.hasOwnProperty;function Wa(e){let t={},n=-1;for(;++n<e.length;)Ga(t,e[n]);return t}function Ga(e,t){let n;for(n in t){let r=(Ua.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ua.call(r,a)||(r[a]=[]);let e=i[a];Ka(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ka(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Va(e,0,0,r)}function qa(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 Ja(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ya=ao(/[A-Za-z]/),Xa=ao(/[\dA-Za-z]/),Za=ao(/[#-'*+\--9=?A-Z^-~]/);function Qa(e){return e!==null&&(e<32||e===127)}var $a=ao(/\d/),eo=ao(/[\dA-Fa-f]/),to=ao(/[!-/:-@[-`{-~]/);function J(e){return e!==null&&e<-2}function no(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var ro=ao(/\p{P}|\p{S}/u),io=ao(/\s/);function ao(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function oo(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Xa(e.charCodeAt(n+1))&&Xa(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 X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function so(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&Y(t)?(e.enter(r),c(t)):l(t)}function c(t){return Y(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var co={tokenize:lo};function lo(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(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);else return J(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var uo=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){fo(this,e,t,n,!1)}addBefore(e,t,n){fo(this,e,t,n,!0)}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,this.index.clear()}};function fo(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var po={tokenize:ho},mo={tokenize:go};function ho(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++;let c=new uo;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),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(mo,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(mo,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);else 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);else return J(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++;let l=new uo;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}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 go(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function _o(e){if(e===null||no(e)||io(e))return 1;if(ro(e))return 2}function vo(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 yo={name:`attention`,resolveAll:bo,tokenize:xo};function bo(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};So(o,-a),So(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Ha(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Ha(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Ha(r,vo(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Ha(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Ha(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),Va(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function xo(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=_o(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=_o(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function So(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Co={name:`autolink`,tokenize:wo};function wo(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 Ya(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Xa(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||Xa(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||Qa(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Za(t)?(e.consume(t),l):n(t)}function u(e){return Xa(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||Xa(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var To={partial:!0,tokenize:Eo};function Eo(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||J(e)?t(e):n(e)}}var Do={continuation:{tokenize:ko},exit:Ao,name:`blockQuote`,tokenize:Oo};function Oo(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 Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ko(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Do,t,n)(r)}}function Ao(e){e.exit(`blockQuote`)}var jo={name:`characterEscape`,tokenize:Mo};function Mo(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 to(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Z={name:`characterReference`,tokenize:No};function No(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=Xa,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=eo,u):(e.enter(`characterReferenceValue`),a=7,o=$a,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Xa&&!Ba(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 Po={partial:!0,tokenize:Fo};function Fo(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 Io={concrete:!0,name:`codeFenced`,tokenize:Lo};function Lo(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`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||J(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Po,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||J(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||J(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&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||J(t)?e.check(Po,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||J(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`),Y(t)?X(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`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||J(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var Ro={name:`codeIndented`,tokenize:Bo},zo={partial:!0,tokenize:Vo};function Bo(e,t,n){return r;function r(t){return e.enter(`codeIndented`),so(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):J(t)?e.attempt(zo,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||J(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Vo(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):J(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):so(e,t,a,`linePrefix`,4,4)(o)}function a(e){return J(e)?i(e):n(e)}}var Ho={name:`codeText`,previous:Wo,resolve:Uo,tokenize:Go};function Uo(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 Wo(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Go(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)):J(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||J(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 Ko=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&&qo(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),qo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qo(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);qo(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);qo(this.left,t.reverse())}}}};function qo(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 Jo(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Ko(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,Yo(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 Va(e,0,1/0,u.slice(0)),!l}function Yo(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 Xo={resolve:Qo,tokenize:$o},Zo={partial:!0,tokenize:es};function Qo(e){return Jo(e),e}function $o(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):J(t)?e.check(Zo,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 es(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||J(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 ts(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||Qa(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||J(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||no(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||Qa(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 ns(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):J(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||J(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function rs(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):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||J(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 is(e,t){let n;return r;function r(i){return J(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var as={name:`definition`,tokenize:ss},os={partial:!0,tokenize:cs};function ss(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ns.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ja(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 no(t)?is(e,l)(t):l(t)}function l(t){return ts(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(os,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||J(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function cs(e,t,n){return r;function r(t){return no(t)?is(e,i)(t):n(t)}function i(t){return rs(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||J(e)?t(e):n(e)}}var ls={name:`hardBreakEscape`,tokenize:us};function us(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return J(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var ds={name:`headingAtx`,resolve:fs,tokenize:ps};function fs(e,t){let n=e.length-2,r=3;if(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){let 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`};Va(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function ps(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||no(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||J(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(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||no(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ms=`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(`.`),hs=[`pre`,`script`,`style`,`textarea`],gs={concrete:!0,name:`htmlFlow`,resolveTo:vs,tokenize:ys},_s={partial:!0,tokenize:bs};function vs(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 ys(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:I):Ya(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):Ya(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):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 Ya(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||no(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&hs.includes(l)?(i=1,r.interrupt?t(s):O(s)):ms.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||Xa(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 Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ya(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Xa(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(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):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||J(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||no(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||J(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ee):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):J(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(_s,L,k)(t)):t===null||J(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Po,A,L)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||J(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return hs.includes(n)?(e.consume(t),ee):O(t)}return Ya(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),ee):t===45&&i===2?(e.consume(t),I):O(t)}function ee(t){return t===null||J(t)?(e.exit(`htmlFlowData`),L(t)):(e.consume(t),ee)}function L(n){return e.exit(`htmlFlow`),t(n)}}function bs(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(To,t,n)}}var xs={name:`htmlText`,tokenize:Ss};function Ss(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):Ya(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):Ya(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):J(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):J(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):J(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):J(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Ya(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Xa(t)?(e.consume(t),S):C(t)}function C(t){return J(t)?(o=C,N(t)):Y(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Xa(t)?(e.consume(t),w):t===47||t===62||no(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Ya(t)?(e.consume(t),E):J(t)?(o=T,N(t)):Y(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Xa(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):J(t)?(o=D,N(t)):Y(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):J(t)?(o=O,N(t)):Y(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):J(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||no(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||no(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Y(t)?X(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Cs={name:`labelEnd`,resolveAll:Ds,resolveTo:Os,tokenize:ks},ws={tokenize:As},Ts={tokenize:js},Es={tokenize:Ms};function Ds(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&&Va(e,0,e.length,n),e}function Os(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Ha(o,e.slice(i+1,i+r+3)),o=Ha(o,[[`enter`,l,t]]),o=Ha(o,vo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Ha(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Ha(o,e.slice(a+1)),o=Ha(o,[[`exit`,s,t]]),Va(e,i,e.length,o),e}function ks(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Ja(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(ws,u,o?u:d)(t):t===91?e.attempt(Ts,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Es,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function As(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 no(t)?is(e,a)(t):a(t)}function a(t){return t===41?u(t):ts(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return no(t)?is(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?rs(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return no(t)?is(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 js(e,t,n){let r=this;return i;function i(t){return ns.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ja(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Ms(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 Ns={name:`labelStartImage`,resolveAll:Cs.resolveAll,tokenize:Ps};function Ps(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Fs={name:`labelStartLink`,resolveAll:Cs.resolveAll,tokenize:Is};function Is(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Ls={name:`lineEnding`,tokenize:Rs};function Rs(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var zs={name:`thematicBreak`,tokenize:Bs};function Bs(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||J(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Vs={continuation:{tokenize:Gs},exit:qs,name:`list`,tokenize:Ws},Hs={partial:!0,tokenize:Js},Us={partial:!0,tokenize:Ks};function Ws(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:$a(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(zs,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 $a(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(To,r.interrupt?n:u,e.attempt(Hs,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(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 Gs(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(To,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(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(Us,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Vs,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ks(e,t,n){let r=this;return X(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 qs(e){e.exit(this.containerState.type)}function Js(e,t,n){let r=this;return X(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!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ys={name:`setextUnderline`,resolveTo:Xs,tokenize:Zs};function Xs(e,t){let n=new uo,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Zs(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`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||J(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Qs={tokenize:$s};function $s(e){let t=this,n=e.attempt(To,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Xo,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ec={resolveAll:ic()},tc=rc(`string`),nc=rc(`text`);function rc(e){return{resolveAll:ic(e===`text`?ac: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);else 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 ic(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 ac(e,t){let n=new uo,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var oc=s({attentionMarkers:()=>mc,contentInitial:()=>cc,disable:()=>hc,document:()=>sc,flow:()=>uc,flowInitial:()=>lc,insideSpan:()=>pc,string:()=>dc,text:()=>fc}),sc={42:Vs,43:Vs,45:Vs,48:Vs,49:Vs,50:Vs,51:Vs,52:Vs,53:Vs,54:Vs,55:Vs,56:Vs,57:Vs,62:Do},cc={91:as},lc={[-2]:Ro,[-1]:Ro,32:Ro},uc={35:ds,42:zs,45:[Ys,zs],60:gs,61:Ys,95:zs,96:Io,126:Io},dc={38:Z,92:jo},fc={[-5]:Ls,[-4]:Ls,[-3]:Ls,33:Ns,38:Z,42:yo,60:[Co,xs],91:Fs,92:[ls,jo],93:Cs,95:yo,96:Ho},pc={null:[yo,ec]},mc={null:[42,95]},hc={null:[]};function gc(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=Ha(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=vo(a,l.events,l),l.events):[]}function f(e,t){return vc(p(e),t)}function p(e){return _c(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(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){J(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&&Va(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 _c(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 vc(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=`
216
- `;break;case-3:o=`\r
217
- `;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 yc(e){let t={constructs:Wa([oc,...(e||{}).extensions||[]]),content:n(co),defined:[],document:n(po),flow:n(Qs),lazy:{},string:n(tc),text:n(nc)};return t;function n(e){return n;function n(n){return gc(t,e,n)}}}function bc(e){for(;!Jo(e););return e}var xc=/[\0\t\n\r]/g;function Sc(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){xc.lastIndex=c;let n=xc.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Cc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function wc(e){return e.replace(Cc,Tc)}function Tc(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return qa(n.slice(t?2:1),t?16:10)}return Ba(n)||e}var Ec={}.hasOwnProperty;function Dc(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Oc(n)(bc(yc(n).document().write(Sc()(e,t,!0))))}function Oc(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(H),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(ue),blockQuote:o(se),characterEscape:E,characterReference:E,codeFenced:o(ce),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(ce,s),codeText:o(B,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(V),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(le),hardBreakEscape:o(de),hardBreakTrailing:o(de),htmlFlow:o(fe,s),htmlFlowData:E,htmlText:o(fe,s),htmlTextData:E,image:o(pe),label:s,link:o(H),listItem:o(he),listItemValue:p,listOrdered:o(me,f),listUnordered:o(me),paragraph:o(ge),reference:ne,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(ue),strong:o(_e),thematicBreak:o(ye)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:oe,autolinkProtocol:ae,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:re,characterReference:ie,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(P),label:I,labelText:F,lineEnding:O,link:l(N),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:R,resourceDestinationString:ee,resourceTitleString:L,resource:te,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};Ac(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),Ec.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||Mc).call(o,void 0,e[0])}for(r.position={start:kc(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:kc(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];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 n=r;for(s=void 0;n--;){let t=e[n];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=n}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),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(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:kc(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+$i({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Mc).call(this,e,r[0])),n.position.end=kc(e.end)}function d(){return Fa(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(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 m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){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 v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ja(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=ve(),n.position={start:kc(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=kc(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=kc(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function N(){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 P(){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 F(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=wc(t),n.identifier=Ja(t).toLowerCase()}function I(){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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function te(){this.data.inReference=void 0}function ne(){this.data.referenceType=`collapsed`}function R(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ja(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function re(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=qa(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ba(t);let i=this.stack[this.stack.length-1];i.value+=r}function ie(e){let t=this.stack.pop();t.position.end=kc(e.end)}function ae(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function oe(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function se(){return{type:`blockquote`,children:[],position:void 0}}function ce(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function B(){return{type:`inlineCode`,value:``,position:void 0}}function V(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function le(){return{type:`emphasis`,children:[],position:void 0}}function ue(){return{type:`heading`,depth:0,children:[],position:void 0}}function de(){return{type:`break`,position:void 0}}function fe(){return{type:`html`,value:``,position:void 0}}function pe(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function H(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function me(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function he(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function ge(){return{type:`paragraph`,children:[],position:void 0}}function _e(){return{type:`strong`,children:[],position:void 0}}function ve(){return{type:`text`,value:``,position:void 0}}function ye(){return{type:`thematicBreak`,position:void 0}}}function kc(e){return{line:e.line,column:e.column,offset:e.offset}}function Ac(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Ac(e,r):jc(e,r)}}function jc(e,t){let n;for(n in t)if(Ec.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`afterExit`:case`beforeEnter`:{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 Mc(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+$i({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+$i({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+$i({start:t.start,end:t.end})+`) is still open`)}function Nc(e){let t=this;t.parser=n;function n(n){return Dc(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Pc(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 Fc(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
218
- `}]}function Ic(e,t){let n=t.value?t.value+`
219
- `:``,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 Lc(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rc(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zc(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=oo(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 Bc(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 Vc(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Hc(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 Uc(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Hc(e,t);let i={src:oo(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 Wc(e,t){let n={src:oo(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 Gc(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 Kc(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Hc(e,t);let i={href:oo(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 qc(e,t){let n={href:oo(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 Jc(e,t,n){let r=e.all(t),i=n?Yc(n):Xc(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:`
220
- `}),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:`
221
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Yc(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Xc(n[r])}return t}function Xc(e){return e.spread??e.children.length>1}function Zc(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 Qc(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $c(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function el(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tl(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=Zi(t.children[1]),o=Xi(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 nl(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 rl(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var il=9,al=32;function ol(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(sl(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(sl(t.slice(i),i>0,!1)),a.join(``)}function sl(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===il||t===al;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===il||t===al;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function cl(e,t){let n={type:`text`,value:ol(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ll(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var ul={blockquote:Pc,break:Fc,code:Ic,delete:Lc,emphasis:Rc,footnoteReference:zc,heading:Bc,html:Vc,imageReference:Uc,image:Wc,inlineCode:Gc,linkReference:Kc,link:qc,listItem:Jc,list:Zc,paragraph:Qc,root:$c,strong:el,table:tl,tableCell:rl,tableRow:nl,text:cl,thematicBreak:ll,toml:dl,yaml:dl,definition:dl,footnoteDefinition:dl};function dl(){}var{defineProperty:fl}=Object,pl=typeof self==`object`?self:globalThis,ml=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new pl[e](t)},hl=(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__`?fl(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 pl[e]==`function`?ml(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(ml(a,o),i)};return r},gl=e=>hl(new Map,e)(0),_l=``,{toString:vl}={},{keys:yl,is:bl}=Object,xl=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=vl.call(e).slice(8,-1);switch(n){case`Array`:return[1,_l];case`Object`:return[2,_l];case`Date`:return[3,_l];case`RegExp`:return[4,_l];case`Map`:return[5,_l];case`Set`:return[6,_l];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Sl=([e,t])=>e===0&&(t===`function`||t===`symbol`),Cl=(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]=xl(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&bl(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 yl(o))(e||!Sl(xl(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?_l: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||!(Sl(xl(n))||Sl(xl(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!Sl(xl(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},wl=(e,{json:t,lossy:n}={})=>{let r=[];return Cl(!(t||n),!!t,new Map,r)(e),r},Tl=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?gl(wl(e,t)):structuredClone(e):(e,t)=>gl(wl(e,t));function El(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 Dl(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Ol(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||El,r=e.options.footnoteBackLabel||Dl,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=oo(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:{...Tl(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
222
- `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
223
- `}]}}var kl=(function(e){if(e==null)return Pl;if(typeof e==`function`)return Nl(e);if(typeof e==`object`)return Array.isArray(e)?Al(e):jl(e);if(typeof e==`string`)return Ml(e);throw Error(`Expected function, string, or object as test`)});function Al(e){let t=[],n=-1;for(;++n<e.length;)t[n]=kl(e[n]);return Nl(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function jl(e){let t=e;return Nl(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Ml(e){return Nl(t);function t(t){return t&&t.type===e}}function Nl(e){return t;function t(t,n,r){return!!(Fl(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Pl(){return!0}function Fl(e){return typeof e==`object`&&!!e&&`type`in e}function Il(e){return e}var Ll=[],Rl=`skip`;function zl(e,t,n,r){if(!e||typeof e!=`object`)throw Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,a,o,s,c;if(typeof n==`function`||n&&typeof n==`object`?(a=t,o=n,r&&(i=!1)):(o=t,n&&(i=!1)),typeof o==`function`)s=o;else if(o&&typeof o==`object`){if(o.enter!==null&&o.enter!==void 0){if(typeof o.enter==`function`)s=o.enter;else throw Error("Unexpected value `"+o.enter+"` for `visitors.enter`, expected optional visitor")}if(typeof o.exit==`function`)c=o.exit;else throw Error("Unexpected value `"+o.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw Error("Unexpected value `"+o+"` for `enter` or `visitors`, expected visitor or object with visitors");let l=kl(a),u=i?1:-1;d(e,void 0,[])();function d(e,t,n){let r=e&&typeof e==`object`?e:{};if(typeof r.type==`string`){let t=typeof r.tagName==`string`?r.tagName:typeof r.name==`string`?r.name:void 0;Object.defineProperty(o,"name",{value:`node (`+Il(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=Ll;if(s&&r&&(o=Bl(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e<t.children.length;){let n=t.children[e],i=d(n,e,r)();if(i[0]===!1)return i;e=typeof i[1]==`number`?i[1]:e+u}}}if(c&&r){let r=Bl(c(e,n,t));if(r[0]===`skip`)throw Error("Unexpected value `"+r[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(r[0]===!1||typeof r[1]==`number`)return r}return o}}}function Bl(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ll:[e]}function Vl(e,t,n,r){let i,a,o;typeof n==`function`||n&&typeof n==`object`?(i=t,a=n,o=r):(a=t,o=n),typeof a==`function`?zl(e,i,Ul(a),o):zl(e,i,Hl(a),o)}function Hl(e){return!e||typeof e!=`object`?e:{enter:typeof e.enter==`function`?Ul(e.enter):e.enter,exit:typeof e.exit==`function`?Ul(e.exit):e.exit}}function Ul(e){return t;function t(t,n,r){return e(t,r,n[n.length-1])}}var Wl={}.hasOwnProperty,Gl={};function Kl(e,t){let n=t||Gl,r=new Map,i=new Map,a={all:s,applyData:Jl,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...ul,...n.handlers},one:o,options:n,patch:ql,wrap:Xl};return Vl(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(Wl.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=Tl(n);return r.children=a.all(e),r}return Tl(e)}return(a.options.unknownHandler||Yl)(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=Zl(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Zl(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function ql(e,t){e.position&&(t.position=Qi(e))}function Jl(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,Tl(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Yl(e,t){let n=t.data||{},r=`value`in t&&!(Wl.call(n,`hProperties`)||Wl.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 Xl(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
224
- `});++r<e.length;)r&&n.push({type:`text`,value:`
225
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
226
- `}),n}function Zl(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ql(e,t){let n=Kl(e,t),r=n.one(e,void 0),i=Ol(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
227
- `},i)),a}function $l(e,t){return e&&`run`in e?async function(n,r){let i=Ql(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ql(n,{file:r,...e||t})}}function eu(e){if(e)throw e}var tu=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 nu(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 ru(){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);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?iu(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 iu(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 au={basename:ou,dirname:su,extname:cu,join:lu,sep:`/`};function ou(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);fu(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 su(e){if(fu(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 cu(e){fu(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}}else 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 lu(...e){let t=-1,n;for(;++t<e.length;)fu(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:uu(n)}function uu(e){fu(e);let t=e.codePointAt(0)===47,n=du(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function du(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 fu(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var pu={cwd:mu};function mu(){return`/`}function hu(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function gu(e){if(typeof e==`string`)e=new URL(e);else if(!hu(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 _u(e)}function _u(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 vu=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],yu=class{constructor(e){let t;t=e?hu(e)?{path:e}:typeof e==`string`||Cu(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:pu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<vu.length;){let e=vu[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)vu.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?au.basename(this.path):void 0}set basename(e){xu(e,`basename`),bu(e,`basename`),this.path=au.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?au.dirname(this.path):void 0}set dirname(e){Su(this.basename,`dirname`),this.path=au.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?au.extname(this.path):void 0}set extname(e){if(bu(e,`extname`),Su(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=au.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){hu(e)&&(e=gu(e)),xu(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?au.basename(this.path,this.extname):void 0}set stem(e){xu(e,`stem`),bu(e,`stem`),this.path=au.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 ra(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 bu(e,t){if(e&&e.includes(au.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+au.sep+"`")}function xu(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Su(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Cu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var wu=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Tu=l(tu(),1),Eu={}.hasOwnProperty,Du=new class e extends wu{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=ru()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Tu.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Au(`data`,this.frozen),this.namespace[e]=t,this):Eu.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Au(`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=Nu(e),n=this.parser||this.Parser;return Ou(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ou(`process`,this.parser||this.Parser),ku(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Nu(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);Fu(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(),Ou(`processSync`,this.parser||this.Parser),ku(`processSync`,this.compiler||this.Compiler),this.process(e,r),Mu(`processSync`,`process`,t),n;function r(e,r){t=!0,eu(e),n=r}}run(e,t,n){ju(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=Nu(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),Mu(`runSync`,`run`,n),r;function i(e,t){eu(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Nu(t),r=this.compiler||this.Compiler;return ku(`stringify`,r),ju(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Au(`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,Tu.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];nu(o)&&nu(r)&&(r=(0,Tu.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ou(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function ku(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Au(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 ju(e){if(!nu(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Mu(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Nu(e){return Pu(e)?e:new yu(e)}function Pu(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Fu(e){return typeof e==`string`||Iu(e)}function Iu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Lu=[],Ru={allowDangerousHtml:!0},zu=/^(https?|ircs?|mailto|xmpp)$/i,Bu=[{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 Vu(e){let t=Hu(e),n=Uu(e);return Wu(t.runSync(t.parse(n),n),e)}function Hu(e){let t=e.rehypePlugins||Lu,n=e.remarkPlugins||Lu,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ru}:Ru;return Du().use(Nc).use(n).use($l,r).use(t)}function Uu(e){let t=e.children||``,n=new yu;return typeof t==`string`?n.value=t:``+t,n}function Wu(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Gu;for(let e of Bu)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Vl(e,l),da(e,{Fragment:C.Fragment,components:i,ignoreInvalidStyle:!0,jsx:C.jsx,jsxs:C.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 Na)if(Object.hasOwn(Na,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Na[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 Gu(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||zu.test(e.slice(0,t))?e:``}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=kl((n||{}).ignore||[]),i=Yu(t),a=-1;for(;++a<i.length;)zl(e,o);function o(e,t,n){if(e.type===`text`&&typeof n==`number`)return s(e,t,n);if(r(e,n,t[t.length-1]))return Rl}function s(e,t,n){let r=t[t.length-1],o=i[a][0],s=i[a][1],c=0,l=!1,u=[];o.lastIndex=0;let d=o.exec(e.value);for(;d;){let n=d.index,r={index:d.index,input:d.input,stack:[...t,e]},i=s(...d,r);if(typeof i==`string`&&(i=i.length>0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c<e.value.length&&f({type:`text`,value:e.value.slice(c)}),r.children.splice(n,1,...u)):u=[e],n+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function Yu(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],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 ed(){return{transforms:[cd],enter:{literalAutolink:nd,literalAutolinkEmail:rd,literalAutolinkHttp:rd,literalAutolinkWww:rd},exit:{literalAutolink:sd,literalAutolinkEmail:od,literalAutolinkHttp:id,literalAutolinkWww:ad}}}function td(){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 nd(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function rd(e){this.config.enter.autolinkProtocol.call(this,e)}function id(e){this.config.exit.autolinkProtocol.call(this,e)}function ad(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 od(e){this.config.exit.autolinkEmail.call(this,e)}function sd(e){this.exit(e)}function cd(e){Ju(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ld],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ud]],{ignore:[`link`,`linkReference`]})}function ld(e,t,n,r,i){let a=``;if(!pd(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!dd(n)))return!1;let o=fd(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 ud(e,t,n,r){return!pd(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function dd(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 fd(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 pd(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||io(n)||ro(n))&&(!t||n!==47)}Cd.peek=Sd;function md(){this.buffer()}function hd(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function gd(){this.buffer()}function _d(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function vd(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ja(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yd(e){this.exit(e)}function bd(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ja(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xd(e){this.exit(e)}function Sd(){return`[`}function Cd(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 wd(){return{enter:{gfmFootnoteCallString:md,gfmFootnoteCall:hd,gfmFootnoteDefinitionLabelString:gd,gfmFootnoteDefinition:_d},exit:{gfmFootnoteCallString:vd,gfmFootnoteCall:yd,gfmFootnoteDefinitionLabelString:bd,gfmFootnoteDefinition:xd}}}function Td(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Cd},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?`
228
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Dd:Ed))),s(),o}}function Ed(e,t,n){return t===0?e:Dd(e,t,n)}function Dd(e,t,n){return(n?``:` `)+e}var Od=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Nd.attention=Pd,Nd.peek=Fd;function kd(){return{canContainEols:[`delete`],enter:{strikethrough:jd},exit:{strikethrough:Md}}}function Ad(){return{handlers:{delete:Nd},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Od}]}}function jd(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Md(e){this.exit(e)}function Nd(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function Pd(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function Fd(){return`~`}function Id(e){return e.length}function Ld(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Id,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=Rd(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]=zd(r[d]);else{let e=zd(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(`
229
- `)}function Rd(e){return e==null?``:String(e)}function zd(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}var Bd=kl([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Vd(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()),Hd);return i(),o}function Hd(e,t,n){return`>`+(n?``:` `)+e}function Ud(e,t){return Wd(e,t.inConstruct,!0)&&!Wd(e,t.notInConstruct,!1)}function Wd(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 Gd(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
230
- `&&!e.before&&!e.after&&Ud(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
231
- `}function Kd(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 qd(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function Jd(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Yd(e,t,n,r){let i=Jd(n),a=e.value||``;if(qd(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Xd);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(Kd(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
232
- `,encode:["`"],...o.current()})),t()}return u+=o.move(`
233
- `),a&&(u+=o.move(a+`
234
- `)),u+=o.move(s),c(),u}function Xd(e,t,n){return(n?``:` `)+e}function Zd(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Qd(e,t,n,r){let i=Zd(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?` `:`
235
- `,...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 $d(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ef(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function tf(e){let t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function nf(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function rf(e,t,n){let r=_o(e),i=_o(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}}function af(e){if(e.charCodeAt(0)!==60)return;let t=e.charCodeAt(1);if(t===33){let t=e.charCodeAt(2);return t===45?2:t===91?5:Ya(t)?4:void 0}if(t===63)return 3;let n=t===47,r=n?2:1,i=r,a=e.charCodeAt(i);if(!Ya(a))return;for(;a===45||Xa(a);)a=e.charCodeAt(++i);let o=e.slice(r,i).toLowerCase();return!n&&a!==47&&hs.includes(o)?1:ms.includes(o)?6:7}var of=new Map([[`*`,!1],[`_`,!0]]);function sf(e,t,n){let r=new Set;for(let i of e){let e=n.get(i);if(e&&i.attention&&t.some(e=>e.attention===i.attention))for(let t of e.tokens)r.add(t.attention)}let i=[];for(let t of e)t.attention&&r.delete(t.attention)&&i.push(t.attention);return i.reverse(),i}function cf(e,t,n){let r=[],i=new Map,a=new Map,o=0;for(;o<e.length;){if(!e[o].attention){o++;continue}let s=e[o].value.charAt(0),c=of.get(s),l=o+1;for(;l<e.length&&e[l].attention&&e[l].value.charAt(0)===s;)l++;let u=o?e[o-1].value:t,d=_o(u.charCodeAt(u.length-1)),f=_o((l<e.length?e[l].value:n).charCodeAt(0)),p=!f||f===2&&!!d,m=!d||d===2&&!!f,h={tokens:e.slice(o,l),markers:[],start:0,end:0,open:c?p&&(!!d||!m):p,close:c?m&&(!!f||!p):m,split:c!==void 0};for(let e of h.tokens){i.set(e,[...h.tokens]),a.set(e,h);let t=e.value.length;for(;t--;)h.markers.push(e)}h.end=h.markers.length,r.push(h),o=l}for(df(r,i),o=-1;++o<e.length;){let t=i.get(e[o]);if(t)return{attention:sf(e,t,a),index:o}}}function lf(e,t){let n=e[t?0:e.length-1];if(!n||n.attention)return;let r=t?ef(n.value):tf(n.value),i=nf(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let e=n.value.slice(0,n.value.length-r.length),t=0;for(;e.charCodeAt(e.length-1-t)===92;)t++;t%2&&(e+=`\\`),n.value=e+i}}function uf(e,t,n,r,i){for(let a of n.attention){let o=t.get(a)||a.sequences[0];for(let s of a.sequences){if(s===o)continue;let c=new Map(t);c.set(a,s);let l=hf(e,c,r,i),u=cf(l,r,i);if(!u||u.index>n.index)return{chosen:c,mistake:u,tokens:l}}}}function df(e,t){let n=new Map;for(let r of e){let e=r.tokens[0].value.charAt(0),i=n.get(e);i||(i=[],n.set(e,i));let a=r.close?i.length:0;for(;a--&&r.start<r.end;){let e=i[a],n=e.end-e.start,o=r.end-r.start;if(r.split?(e.close||r.open)&&o%3&&!((n+o)%3):n!==e.markers.length||n!==o)continue;let s=r.split?n>1&&o>1?2:1:o,c=e.markers.slice(e.end-s,e.end),l=r.markers.slice(r.start,r.start+s),u=c[0],d=l[0];if(u===c[s-1]&&u.value.length===s&&d===l[s-1]&&d.value.length===s&&u.attention===d.attention)t.delete(u),t.delete(d);else{let e=[...new Set([...c,...l])];for(let n of e){let r=t.get(n);r&&r.push(...e)}}e.end-=s,r.start+=s,e.start===e.end&&i.splice(a,1),a=i.length}r.open&&r.start<r.end&&i.push(r)}}function ff(e,t,n){if(t.length===0)throw Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(let t of n)if(!Number.isSafeInteger(t)||t<1)throw Error("Cannot serialize `"+e+"` as attention with `"+t+"` as size, expected positive integer");let r=[];for(let i of t){if(i.length!==1)throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!to(i.charCodeAt(0)))throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(let e of n)r.push(i.repeat(e))}return r}function pf(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before;r.push(-1);let c=t.createTracker(n);for(;++o<i.length;){let l=i[o],u;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),u=n?ef(n(i[o+1],e,t,{before:``,after:``,...c.current()})):``}else u=n.after;let d=a[a.length-1];typeof d==`string`&&(s===`\r`||s===`
236
- `)&&l.type===`html`&&af(l.value)!==7&&(a[a.length-1]=d.replace(/(\r?\n|\r)$/,` `),s=` `,c=t.createTracker(n),c.move(gf(a,n.before,n.after)));let f=t.handle.handlers[l.type];if(f&&f.attention){let e=mf(l,f.attention,t,c);a.push(e),s=tf(e.sequences[0])}else{let n=t.handle(l,e,t,{...c.current(),after:u,before:s});if(!n)continue;c.move(n),a.push(n),s=tf(n)}}return r.pop(),a}function mf(e,t,n,r){let{construct:i,markers:a,sizes:o}=t(e,n),s=ff(e.type,a,o),c=s[0],l=n.enter(i);r.move(c);let u=pf(e,n,{...r.current(),before:c,after:c});return r.move(gf(u,c,c)),r.move(c),l(),{children:u,sequences:s}}function hf(e,t,n,r){let i=[],a,o=tf(n),s=-1;for(;++s<e.length;){let n=e[s];if(typeof n==`string`){let e={value:n,attention:void 0};a&&a===ef(n)&&lf([e],!0),a=void 0,i.push(e),e.value&&(o=tf(e.value));continue}let c=t.get(n)||n.sequences[0],l=c.charAt(0),u=e[s+1],d=o,f=ef(u===void 0?r:typeof u==`string`?u:t.get(u)||u.sequences[0]),p=hf(n.children,t,c,c),m=p.length>0?p[0].value:``,h=rf(d.charCodeAt(d.length-1),m.charCodeAt(0),l);h.inside&&lf(p,!0);let g=p.length>0?tf(p[p.length-1].value):``,_=rf(f.charCodeAt(0),g.charCodeAt(g.length-1),l);_.inside&&lf(p,!1),h.outside&&d!==`
237
- `&&d!==`\r`&&lf(i,!1),_.outside&&(a=f),i.push({value:c,attention:n},...p,{value:c,attention:n}),o=c.charAt(c.length-1)}return i}function gf(e,t,n){let r=new Map,i=hf(e,r,t,n),a=i,o=cf(a,t,n);for(;o;){let s=uf(e,r,o,t,n);if(!s){a=i;break}r=s.chosen,a=s.tokens,o=s.mistake}let s=``;for(let e of a)s+=e.value;return s}_f.attention=vf,_f.peek=yf;function _f(e,t,n,r){let i=n.enter(`phrasing`),a=gf([mf(e,vf,n,n.createTracker(r))],r.before,r.after);return i(),a}function vf(e,t){return{construct:`emphasis`,markers:$d(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function yf(e,t,n){return n.options.emphasis||`*`}function bf(e,t){let n=!1;return Vl(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)&&Fa(e)&&(t.options.setext||n))}function xf(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(bf(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
238
- `,after:`
239
- `});return r(),t(),o+`
240
- `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
241
- `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
242
- `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=nf(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Sf.peek=Cf;function Sf(e){return e.value||``}function Cf(){return`<`}wf.peek=Tf;function wf(e,t,n,r){let i=Zd(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 Tf(){return`!`}Ef.peek=Df;function Ef(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=u.filter(function(e){return e!==`phrasing`}),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 Df(){return`!`}Of.peek=kf;function Of(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;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 kf(){return"`"}function Af(e,t){let n=Fa(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))}jf.peek=Mf;function jf(e,t,n,r){let i=Zd(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Af(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`),u=n.containerPhrasing(e,{before:l,after:`](`,...o.current()});l+=o.move(u),c(),l+=o.move(`](`);let d=/[\0- \u007F]/.test(e.url),f=r.before.charAt(r.before.length-1),p=e.title||void 0;if(!p&&!d&&(f===`
243
- `||f===`\r`)){let e=0;for(;e<u.length&&u.charCodeAt(e)!==93;)e+=u.charCodeAt(e)===92?2:1;u.charCodeAt(e+1)===58&&(p=``)}return!e.url&&typeof p==`string`||d?(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:typeof p==`string`?` `:`)`,...o.current()}))),c(),typeof p==`string`&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(p,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Mf(e,t,n){return Af(e,n)?`<`:`[`}Nf.peek=Pf;function Nf(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=u.filter(function(e){return e!==`phrasing`}),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 Pf(){return`[`}function Ff(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 If(e){let t=Ff(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 Lf(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Rf(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 zf(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Lf(n):Ff(n),s=e.ordered?o===`.`?`)`:`.`:If(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),Rf(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 Bf(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 Vf(e,t,n,r){let i=Bf(n),a=n.bulletCurrent||Ff(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 Q(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Hf(e,t,n,r){if(!e.children.some(function(e){return Bd(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function Uf(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Wf.attention=Gf,Wf.peek=Kf;function Wf(e,t,n,r){let i=n.enter(`phrasing`),a=gf([mf(e,Gf,n,n.createTracker(r))],r.before,r.after);return i(),a}function Gf(e,t){return{construct:`strong`,markers:Uf(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function Kf(e,t,n){return n.options.strong||`*`}function qf(e,t,n,r){let i=t?t.children:[],a=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function Jf(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 Yf(e,t,n){let r=(Rf(n)+(n.options.ruleSpaces?` `:``)).repeat(Jf(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Xf={blockquote:Vd,break:Gd,code:Yd,definition:Qd,emphasis:_f,hardBreak:Gd,heading:xf,html:Sf,image:wf,imageReference:Ef,inlineCode:Of,link:jf,linkReference:Nf,list:zf,listItem:Vf,paragraph:Q,root:Hf,strong:Wf,text:qf,thematicBreak:Yf};function Zf(){return{enter:{table:Qf,tableData:np,tableHeader:np,tableRow:ep},exit:{codeText:rp,table:$f,tableData:tp,tableHeader:tp,tableRow:tp}}}function Qf(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 $f(e){this.exit(e),this.data.inTable=void 0}function ep(e){this.enter({type:`tableRow`,children:[]},e)}function tp(e){this.exit(e)}function np(e){this.enter({type:`tableCell`,children:[]},e)}function rp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ip));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ip(e,t){return t===`|`?t:e}function ap(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
244
- `,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(`
245
- `))}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 Ld(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=Xf.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function op(){return{exit:{taskListCheckValueChecked:cp,taskListCheckValueUnchecked:cp,paragraph:lp}}}function sp(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:up}}}function cp(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function lp(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 up(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=Xf.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 dp(){return[ed(),wd(),kd(),Zf(),op()]}function fp(e){return{extensions:[td(),Td(e),Ad(),ap(e),sp()]}}var pp={tokenize:Dp,partial:!0},mp={tokenize:Op,partial:!0},hp={tokenize:kp,partial:!0},gp={tokenize:Ap,partial:!0},_p={tokenize:jp,partial:!0},vp={name:`wwwAutolink`,tokenize:Tp,previous:Mp},yp={name:`protocolAutolink`,tokenize:Ep,previous:Np},bp={name:`emailAutolink`,tokenize:wp,previous:Pp},xp={};function Sp(){return{text:xp}}for(var Cp=48;Cp<123;)xp[Cp]=bp,Cp++,Cp===58?Cp=65:Cp===91&&(Cp=97);xp[43]=bp,xp[45]=bp,xp[46]=bp,xp[95]=bp,xp[72]=[bp,yp],xp[104]=[bp,yp],xp[87]=[bp,vp],xp[119]=[bp,vp];function wp(e,t,n){let r=this,i,a;return o;function o(t){return!Fp(t)||!Pp.call(r,r.previous)||Ip(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Fp(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(_p,u,l)(t):t===45||t===95||Xa(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&&Ya(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Tp(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Mp.call(r,r.previous)||Ip(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(pp,e.attempt(mp,e.attempt(hp,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Ep(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Np.call(r,r.previous)&&!Ip(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ya(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||Qa(t)||no(t)||io(t)||ro(t)?n(t):e.attempt(mp,e.attempt(hp,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Dp(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 Op(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(gp,c,s)(t):t===null||no(t)||io(t)||t!==45&&ro(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 kp(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(gp,t,a)(o):o===null||no(o)||io(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Ap(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||no(o)||io(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||no(e)||io(e)?t(e):r(e)}function a(e){return Ya(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ya(t)?(e.consume(t),o):n(t)}}function jp(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Xa(e)?n(e):t(e)}}function Mp(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||no(e)}function Np(e){return!Ya(e)}function Pp(e){return!(e===47||Fp(e))}function Fp(e){return e===43||e===45||e===46||e===95||Xa(e)}function Ip(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 Lp={tokenize:Gp,partial:!0};function Rp(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Hp,continuation:{tokenize:Up},exit:Wp}},text:{91:{name:`gfmFootnoteCall`,tokenize:Vp},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:zp,resolveTo:Bp}}}}function zp(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=Ja(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 Bp(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 Vp(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||no(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Ja(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return no(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 Hp(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||no(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Ja(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return no(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),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Up(e,t,n){return e.check(To,t,e.attempt(Lp,t,n))}function Wp(e){e.exit(`gfmFootnoteDefinition`)}function Gp(e,t,n){let r=this;return X(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 Kp(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&&Va(o,o.length,0,vo(s,e.slice(r+1,n),t)),Va(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Va(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=_o(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=_o(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var qp=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){Jp(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,this.index.clear()}};function Jp(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function Yp(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 Xp(){return{flow:{null:{name:`table`,tokenize:Zp,resolveAll:Qp}}}}function Zp(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{type:e}=r.events[t][1];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||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):J(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(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||no(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,Y(t)?X(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 Y(t)?X(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||J(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 Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||J(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||J(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||no(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 Qp(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 qp;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(em(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=$p(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=$p(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=$p(f,t,o,i,n,d)):(o[0]=o[1],d=$p(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&em(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=Yp(t.events,n))}return e}function $p(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},tm(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=tm(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=tm(t.events,n[2]),a=tm(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({},tm(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function em(e,t,n,r,i){let a=[],o=tm(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 tm(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var nm={name:`tasklistCheck`,tokenize:im};function rm(){return{text:{91:nm}}}function im(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 no(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 J(r)?t(r):Y(r)?e.check({tokenize:am},t,n)(r):n(r)}}function am(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function om(e){return Wa([Sp(),Rp(),Kp(e),Xp(),rm()])}var sm={};function cm(e){let t=this,n=e||sm,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(om(n)),a.push(dp()),o.push(fp(n))}function lm({path:e,children:t}){let[n,r]=(0,S.useState)(!1);async function i(){let t=e;try{t=decodeURI(e)}catch{}let n=!1;try{await navigator.clipboard.writeText(t),n=!0}catch{let e=document.createElement(`textarea`);e.value=t,e.style.position=`fixed`,e.style.opacity=`0`,document.body.append(e),e.select();try{n=document.execCommand(`copy`)}finally{e.remove()}}r(n)}return(0,C.jsx)(`button`,{type:`button`,className:`file-reference`,title:e,"aria-label":n?R(`Copied path`):R(`Copy path: {path}`,{path:e}),onClick:()=>void i(),children:t})}var um=/(```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)|`[^`\n]+`)/,dm=e=>e.split(um).some((e,t)=>t%2==0&&/\$|\\\(|\\\[/.test(e));function fm(e){return e.split(um).map((e,t)=>t%2?e:mm(e.replace(/(^|\n)([ \t]*)\\\[((?:(?!\\\]|\n[ \t]*\n)[\s\S])+?)\\\][ \t]*(?=\n|$)/g,(e,t,n,r)=>`${t}${n}$$\n${pm(r,n)}\n${n}$$`).replace(/(?<!\\)\\\[((?:(?!\\\])[^\n])+?)\\\]/g,(e,t)=>`$$${t.trim()}$$`).replace(/(?<!\\)\\\(((?:(?!\\\))[^\n])+?)\\\)/g,(e,t)=>`$${t.trim()}$`))).join(``)}function pm(e,t){let n=e.split(`
246
- `);return n[0].trim()?n[0]=t+n[0].trim():n.shift(),n.length>1&&!n[n.length-1].trim()?n.pop():n[n.length-1]=n[n.length-1].trimEnd(),n.join(`
247
- `)}function mm(e){let t=``;for(let n=0;n<e.length;){if(e[n]===`\\`){t+=e.slice(n,n+2),n+=2;continue}if(e[n]!==`$`){t+=e[n++];continue}if(e[n+1]===`$`){let r=e.indexOf(`$$`,n+2);t+=e.slice(n,r<0?n+2:r+2),n=r<0?n+2:r+2;continue}let r=-1;if(/\S/.test(e[n+1]||``))for(let t=n+1;t<e.length;t++)if(e[t]===`\\`)t++;else{if(e.startsWith(`
248
-
249
- `,t))break;if(e[t]===`$`){e[t+1]!==`$`&&/\S/.test(e[t-1])&&!/\d/.test(e[t+1]||``)&&(r=t);break}}r<0?(t+=`\\$`,n++):(t+=e.slice(n,r+1),n=r+1)}return t}var hm=null,gm=null;function _m(e){let[t,n]=(0,S.useState)(hm);return(0,S.useEffect)(()=>{if(!e||t)return;let r=!0;return gm??=On(()=>import(`./math-V9uUaUzA.js`).then(e=>hm=e.math),__vite__mapDeps([0,1])),gm.then(e=>{r&&n(e)},()=>{gm=null}),()=>{r=!1}},[e,t]),e?t:null}function vm({text:e,math:t}){return(0,C.jsx)(Vu,{remarkPlugins:[cm,...t?.remark||[]],rehypePlugins:t?.rehype,urlTransform:e=>/^(?:https?:\/\/|mailto:|#)/i.test(e)||!/^[a-z][a-z\d+.-]*:/i.test(e)&&!e.startsWith(`//`)?e:``,components:{h1:({children:e})=>(0,C.jsx)(`h3`,{children:e}),h2:({children:e})=>(0,C.jsx)(`h4`,{children:e}),h3:({children:e})=>(0,C.jsx)(`h5`,{children:e}),h4:({children:e})=>(0,C.jsx)(`h6`,{children:e}),h5:({children:e})=>(0,C.jsx)(`h6`,{children:e}),a:({href:e,children:t,title:n})=>e?/^(?:https?:\/\/|mailto:)/i.test(e)?(0,C.jsx)(`a`,{href:e,title:n,target:`_blank`,rel:`noreferrer`,children:t}):e.startsWith(`#`)?(0,C.jsx)(`a`,{href:e,children:t}):(0,C.jsx)(lm,{path:e,children:t}):(0,C.jsx)(C.Fragment,{children:t}),table:({children:e})=>(0,C.jsx)(`div`,{className:`markdown-table`,children:(0,C.jsx)(`table`,{children:e})}),pre:({children:e})=>(0,C.jsx)(`pre`,{tabIndex:0,children:e}),img:({alt:e})=>(0,C.jsx)(`span`,{children:e})},children:t?fm(e):e})}function ym({text:e}){return(0,C.jsx)(vm,{text:e,math:_m(dm(e))})}function bm(e){let t=e.startsWith(``)?``:``,n=e.slice(t.length);return{bom:t,source:n,header:/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(n),newline:n.includes(`\r
250
- `)?`\r
251
- `:`
252
- `}}function xm(e){let{header:t}=bm(e),n={};for(let e of t?.[1].split(/\r?\n/)||[]){let t=/^([A-Za-z-]+):\s*(.*)$/.exec(e);if(t){let e=t[2].trim(),r=e.replace(/^(['"])(.*)\1$/,`$2`);if(e.startsWith(`"`)&&e.endsWith(`"`))try{r=JSON.parse(e)}catch{}n[t[1].toLowerCase()]=r}}return n}var Sm=e=>{let{source:t,header:n}=bm(e);return t.slice(n?.[0].length||0)};function Cm(e,t,n){let{bom:r,source:i,header:a,newline:o}=bm(e),s=n.replace(/[\r\n]/g,` `),c=`${t}: ${t===`icon`?s:JSON.stringify(s)}`;if(!a)return`${r}---${o}${c}${o}---${o}${o}${i}`;let l=a[1].split(/\r?\n/),u=RegExp(`^${t}:`,`i`),d=l.findIndex(e=>u.test(e)),f=l.filter(e=>!u.test(e));f.splice(d<0?f.length:d,0,c);let p=a[0].endsWith(`
253
- `)?o:``;return`${r}---${o}${f.join(o)}${o}---${p}${i.slice(a[0].length)}`}function wm(e,t){let{bom:n,source:r,header:i,newline:a}=bm(e);return i?`${n}${i[0]}${i[0].endsWith(`
254
- `)?``:a}${t}`:`${n}${t}`}function Tm({value:e,onChange:t,disabled:n}){let r=(0,S.useId)(),i=(0,S.useRef)(null),a=(0,S.useRef)(null),[o,s]=(0,S.useState)(!1),c=We.find(t=>t.id===e);function l(e=!1){a.current?.hidePopover(),e&&i.current?.focus()}(0,S.useEffect)(()=>{n&&l()},[n]),(0,S.useEffect)(()=>{if(!o)return;let e=()=>l(),t=e=>{e.target instanceof Node&&e.target.contains(i.current)&&!a.current?.contains(e.target)&&l()};return window.addEventListener(`resize`,e),document.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,t,!0)}},[o]);function u(){let e=a.current,t=i.current.getBoundingClientRect();e.showPopover(),s(!0),e.style.left=`${Math.max(12,Math.min(t.left,window.innerWidth-e.offsetWidth-12))}px`;let n=t.bottom+8,r=t.top-e.offsetHeight-8;e.style.top=`${Math.max(12,Math.min(n+e.offsetHeight>window.innerHeight-12&&r>=12?r:n,window.innerHeight-e.offsetHeight-12))}px`,e.querySelector(`[aria-checked="true"]`)?.focus()}return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{ref:i,type:`button`,className:`skill-icon-trigger`,"aria-label":R(`Choose an icon`),title:`${R(`Choose an icon`)} · ${R(c.label)}`,"aria-haspopup":`dialog`,"aria-expanded":o,popoverTarget:r,disabled:n,onClick:e=>{e.preventDefault(),a.current?.matches(`:popover-open`)?l():u()},children:[(0,C.jsx)(T,{name:e,size:25}),(0,C.jsx)(`span`,{children:(0,C.jsx)(T,{name:`chevronDown`,size:10})})]}),(0,C.jsxs)(`div`,{ref:a,id:r,popover:`auto`,role:`dialog`,"aria-label":R(`Choose an icon`),className:`skill-icon-popover`,onToggle:e=>s(e.nativeEvent.newState===`open`),onKeyDown:e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),l(!0);else if(e.key===`Tab`)l(!0);else if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){e.preventDefault(),e.stopPropagation();let r=Array.from(a.current.querySelectorAll(`[role="radio"]`)),i=r.indexOf(document.activeElement),o=e.key===`ArrowDown`?4:e.key===`ArrowUp`?-4:e.key===`ArrowRight`?1:-1,s=e.key===`Home`?0:e.key===`End`?r.length-1:(i+o+r.length)%r.length;r[s]?.focus(),!n&&We[s]&&t(We[s].id)}},children:[(0,C.jsx)(`p`,{children:R(`Choose an icon`)}),(0,C.jsx)(`div`,{className:`skill-icon-grid`,role:`radiogroup`,"aria-label":R(`Skill icon`),children:We.map(r=>(0,C.jsx)(`button`,{type:`button`,role:`radio`,"aria-label":R(r.label),title:R(r.label),"aria-checked":r.id===e,tabIndex:r.id===e?0:-1,disabled:n,onClick:()=>{t(r.id),l(!0)},children:(0,C.jsx)(T,{name:r.id,size:21})},r.id))})]})]})}var Em=e=>`${e.source}/${e.id}`,Dm=e=>R(e===`builtin`?`Built-in`:e===`user`?`Global`:`This paper`);function Om(e){let t=e instanceof Error?e.message:String(e);switch(t){case`This skill changed on disk. Reload it before saving.`:return R(`This skill changed on disk. Reload it before saving.`);case`This skill changed on disk. Reload it before deleting.`:return R(`This skill changed on disk. Reload it before deleting.`);case`A skill with this ID already exists in this location.`:return R(`A skill with this ID already exists in this location.`);case`This skill no longer exists. Refresh the list.`:return R(`This skill no longer exists. Refresh the list.`);case`This skill was removed on disk. Reload the list before saving.`:return R(`This skill was removed on disk. Reload the list before saving.`);case`The skill must contain instructions.`:return R(`The skill must contain instructions.`);case`Skill content must contain 1–20,000 characters.`:return R(`Skill content must contain 1–20,000 characters.`);default:return t}}function km({project:e,api:t,onChanged:n,onClose:r,controls:i}){let a=(0,S.useRef)(null),o=(0,S.useRef)(0),s=(0,S.useRef)(!0),c=(0,S.useRef)(!1),l=(0,S.useRef)(null),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(``),[g,_]=(0,S.useState)(`all`),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(!1),[w,E]=(0,S.useState)(``),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(`edit`),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null),ee=e?`?projectId=${encodeURIComponent(e.id)}`:``,L=!(!f||f.saved&&f.content===f.saved.content),te=f?.source===`builtin`;(0,S.useEffect)(()=>(s.current=!0,re(),()=>{s.current=!1,o.current++}),[]),(0,S.useEffect)(()=>{if(!L)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[L]),(0,S.useEffect)(()=>{(F||j)&&a.current?.querySelector(`[data-keep-editing]`)?.focus()},[F,j]),(0,S.useImperativeHandle)(i,()=>({cancel:ce,navigate:ne}));function ne(e){v||(L?I({proceed:e}):(M(!1),e()))}async function z(e){let n=++o.current;P(!0),x(!0),E(``),O(!1),M(!1),p(null);try{let r=await t(`/skills/${Em(e)}${ee}`);s.current&&n===o.current&&(p({...r,saved:r}),A(r.source===`builtin`?`preview`:`edit`),requestAnimationFrame(()=>a.current?.querySelector(`.skill-library-editor-heading h3`)?.focus()))}catch(e){s.current&&n===o.current&&E(Om(e))}finally{s.current&&n===o.current&&x(!1)}}async function re(){let e=++o.current;P(!1),x(!0),E(``),p(null),O(!1),M(!1);try{let n=await t(`/skills${ee}`);if(!s.current||e!==o.current)return;d(n),x(!1)}catch(t){s.current&&e===o.current&&(E(Om(t)),x(!1))}}function ie(e){o.current++,P(!0),x(!1),E(``),O(!1),A(`edit`),M(!1);let t=e?.id||``;if(e){let n=1;for(;u?.skills.some(e=>e.source===`user`&&e.id===t);)t=`${e.id.slice(0,37)}-copy${n++>1?n-1:``}`}let n=e?Cm(e.content,`icon`,qe({id:e.id,icon:xm(e.content).icon})):`---\nname: ${R(`New skill`)}\ndescription: \nicon: spark\n---\n\n`;p({id:t,source:`user`,content:n}),requestAnimationFrame(()=>a.current?.querySelector(`[name="skill-id"]`)?.focus())}function ae(){ne(()=>{o.current++,P(!1),p(null),x(!1),E(``),requestAnimationFrame(()=>{let e=l.current;e?.isConnected?e.focus():a.current?.querySelector(`.skill-library-new`)?.focus()})})}function oe(e){p(t=>t?{...t,...e}:null),O(!1),M(!1)}async function se(r=!1){if(f&&!c.current){c.current=!0,y(!0),E(``),O(!1);try{let i=await t(`/skills/${Em(f)}${r?`/remove`:``}`,{projectId:e?.id,content:f.content,revision:f.saved?.revision});if(n(),!s.current)return;M(!1),r?(p(null),await re(),requestAnimationFrame(()=>a.current?.querySelector(`.skill-library-new`)?.focus())):(p({...i,saved:i}),O(!0),d(await t(`/skills${ee}`)))}catch(e){s.current&&E(Om(e))}finally{c.current=!1,s.current&&y(!1)}}}function ce(){v||(F?I(null):j?M(!1):ne(r))}let B=(u?.skills||[]).filter(e=>(g===`all`||e.source===g)&&`${e.id} ${Je(e)} ${Ye(e)}`.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase())),V=xm(f?.content||``),le=Sm(f?.content||``),ue=qe({id:f?.id||``,icon:V.icon}),de=!!(f&&L&&!te&&le.trim()&&!v&&f.content.length<=2e4&&/^[a-z0-9][a-z0-9-]{0,47}$/.test(f.id)),fe=w&&(0,C.jsxs)(`p`,{className:`inline-error`,role:`alert`,children:[w,(0,C.jsx)(`button`,{className:`button secondary compact`,disabled:v,onClick:()=>ne(()=>void re()),children:R(`Refresh skills`)})]});return(0,C.jsxs)(`div`,{ref:a,className:`skill-library`+(N?` has-editor`:``),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),de&&!F&&!j&&se())},children:[(0,C.jsxs)(`div`,{className:`skill-library-layout`,inert:!!(F||j),children:[(0,C.jsxs)(`div`,{className:`skill-library-browse`,hidden:N,children:[(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`Reusable instructions for your revisions. Choose a skill from the / menu when starting a task.`)}),(0,C.jsxs)(`div`,{className:`skill-library-tools`,children:[(0,C.jsxs)(`div`,{className:`skill-library-search`,children:[(0,C.jsx)(T,{name:`search`,size:16}),(0,C.jsx)(`input`,{type:`search`,"aria-label":R(`Search skills`),placeholder:R(`Search skills`),value:m,onChange:e=>h(e.target.value)})]}),(0,C.jsx)(`button`,{className:`icon-button`,"aria-label":R(`Refresh skills`),title:R(`Refresh skills`),disabled:v||b,onClick:()=>ne(()=>void re()),children:(0,C.jsx)(T,{name:`refresh`,size:16})}),(0,C.jsxs)(`button`,{className:`button secondary compact skill-library-new`,disabled:!u||v,onClick:e=>{l.current=e.currentTarget,ne(()=>ie())},children:[(0,C.jsx)(T,{name:`plus`,size:16}),R(`New skill`)]})]}),(0,C.jsxs)(`div`,{className:`skill-library-filter`,role:`group`,"aria-label":R(`Skill scope`),children:[(0,C.jsx)(`button`,{"aria-pressed":g===`all`,onClick:()=>_(`all`),children:R(`All`)}),(0,C.jsx)(`button`,{"aria-pressed":g===`user`,onClick:()=>_(`user`),children:R(`Global`)}),e&&(0,C.jsx)(`button`,{"aria-pressed":g===`paper`,onClick:()=>_(`paper`),children:R(`This paper`)}),(0,C.jsx)(`button`,{"aria-pressed":g===`builtin`,onClick:()=>_(`builtin`),children:R(`Built-in`)})]}),(0,C.jsxs)(`nav`,{className:`skill-library-list settings-card`,"aria-label":R(`Skills`),children:[B.map(e=>(0,C.jsxs)(`button`,{className:`skill-library-item`,disabled:v,onClick:t=>{l.current=t.currentTarget,ne(()=>void z(e))},children:[(0,C.jsx)(`span`,{className:`skill-library-item-icon`,"data-skill-icon":qe(e),children:(0,C.jsx)(T,{name:qe(e),size:18})}),(0,C.jsxs)(`span`,{className:`skill-library-item-text`,children:[(0,C.jsx)(`strong`,{children:Je(e)}),(0,C.jsxs)(`small`,{children:[e.active?null:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`skill-library-overridden`,children:R(`Overridden`)}),` · `]}),Ye(e)||`/${e.id}`]})]}),(0,C.jsx)(`span`,{className:`skill-library-source`,children:Dm(e.source)}),(0,C.jsx)(T,{name:`chevronRight`,size:15})]},Em(e))),b&&(0,C.jsx)(`p`,{className:`skill-library-empty`,role:`status`,children:R(`Loading skills…`)}),u&&!b&&!B.length&&(0,C.jsx)(`p`,{className:`skill-library-empty`,children:R(`No matching skills`)})]}),!N&&fe]}),(0,C.jsxs)(`div`,{className:`skill-library-detail`+(te?` is-readonly`:``),hidden:!N,children:[(0,C.jsxs)(`button`,{className:`skill-library-back settings-back`,onClick:ae,children:[(0,C.jsx)(T,{name:`chevronLeft`,size:15}),R(`All skills`)]}),b?(0,C.jsx)(`p`,{className:`skill-library-empty`,role:`status`,children:R(`Loading skills…`)}):f?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`skill-library-editor-body`,children:[(0,C.jsxs)(`div`,{className:`skill-library-editor-heading`,children:[(0,C.jsxs)(`div`,{className:`skill-library-heading-identity`,children:[te?(0,C.jsx)(`span`,{className:`skill-library-heading-icon`,children:(0,C.jsx)(T,{name:ue,size:25})}):(0,C.jsx)(Tm,{value:ue,disabled:v,onChange:e=>oe({content:Cm(f.content,`icon`,e)})}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{tabIndex:-1,children:te&&f.saved?Je(f.saved):V.name||f.id||R(`New skill`)}),(0,C.jsxs)(`div`,{className:`skill-library-heading-meta`,children:[(0,C.jsx)(`span`,{className:`skill-library-source`,children:Dm(f.source)}),f.id&&(0,C.jsxs)(`code`,{children:[`/`,f.id]}),f.source===`paper`&&e&&(0,C.jsx)(`span`,{children:e.name})]})]})]}),f.saved&&(0,C.jsxs)(`button`,{className:`button secondary compact`,disabled:v,onClick:()=>ne(()=>ie(f)),children:[(0,C.jsx)(T,{name:`copy`,size:14}),R(`Copy and edit`)]})]}),!te&&k!==`source`&&(0,C.jsxs)(`div`,{className:`skill-library-metadata settings-card`,children:[(0,C.jsxs)(`label`,{children:[R(`Skill name`),(0,C.jsx)(`input`,{name:`skill-name`,value:V.name||``,maxLength:60,placeholder:R(`Give your skill a name`),disabled:v,onChange:e=>oe({content:Cm(f.content,`name`,e.target.value)})})]}),(0,C.jsxs)(`label`,{children:[R(`Description`),(0,C.jsx)(`input`,{value:V.description||``,maxLength:300,placeholder:R(`What does this skill help with?`),disabled:v,onChange:e=>oe({content:Cm(f.content,`description`,e.target.value)})})]})]}),!f.saved&&(0,C.jsxs)(`div`,{className:`skill-library-new-fields`,children:[(0,C.jsxs)(`label`,{children:[R(`Skill ID`),(0,C.jsx)(`input`,{name:`skill-id`,value:f.id,placeholder:`my-skill`,pattern:`[a-z0-9][a-z0-9-]{0,47}`,maxLength:48,disabled:v,onChange:e=>oe({id:e.target.value}),spellCheck:!1})]}),(0,C.jsxs)(`label`,{children:[R(`Save to`),(0,C.jsxs)(`select`,{value:f.source,disabled:v,onChange:e=>oe({source:e.target.value}),children:[(0,C.jsx)(`option`,{value:`user`,children:R(`Global`)}),e&&(0,C.jsx)(`option`,{value:`paper`,children:R(`This paper`)})]})]}),(0,C.jsx)(`p`,{children:R(`Use lowercase letters, numbers and hyphens. This is also the / command name.`)})]}),te?(0,C.jsx)(`p`,{className:`skill-library-notice`,children:R(`Copy this built-in skill to customize it for all papers or this paper.`)}):(0,C.jsxs)(`div`,{className:`skill-library-edit-tools`,children:[(0,C.jsx)(`span`,{children:R(`Instructions`)}),(0,C.jsxs)(`div`,{className:`segmented`,role:`group`,"aria-label":R(`Skill content view`),children:[(0,C.jsx)(`button`,{"aria-pressed":k===`edit`,onClick:()=>A(`edit`),children:R(`Edit`)}),(0,C.jsx)(`button`,{"aria-pressed":k===`preview`,onClick:()=>A(`preview`),children:R(`Preview`)}),(0,C.jsxs)(`button`,{"aria-pressed":k===`source`,onClick:()=>A(`source`),children:[(0,C.jsx)(T,{name:`code`,size:13}),R(`Source`)]})]})]}),k===`preview`?(0,C.jsx)(`div`,{className:`skill-library-preview`,children:(0,C.jsx)(ym,{text:le.trim()})}):(0,C.jsx)(`textarea`,{className:`skill-library-content`,"aria-label":R(k===`source`?`Skill content (Markdown)`:`Instructions`),value:k===`source`?f.content:le,onChange:e=>oe({content:k===`source`?e.target.value:wm(f.content,e.target.value)}),disabled:v,maxLength:k===`source`?2e4:Math.max(0,2e4-f.content.length+le.length),placeholder:R(`Describe what the agent should do, what to preserve, and how to present the result.`),spellCheck:!1}),f.content.length>2e4&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:R(`Skill content must contain 1–20,000 characters.`)}),f.saved&&!f.saved.active&&(0,C.jsx)(`p`,{className:`skill-library-notice`,children:R(`A skill with the same ID takes priority here: this paper, then global, then built-in.`)})]}),!te&&(0,C.jsxs)(`footer`,{className:`skill-library-editor-actions`,children:[f.saved&&(0,C.jsxs)(`button`,{className:`button ghost danger-text compact`,disabled:v,onClick:()=>M(!0),children:[(0,C.jsx)(T,{name:`trash`,size:14}),R(`Delete skill`)]}),(0,C.jsx)(`span`,{role:`status`,children:D?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(T,{name:`check`,size:13}),R(`Saved`)]}):L?R(`Unsaved changes`):``}),(0,C.jsx)(`button`,{className:`button primary compact`,disabled:!de,onClick:()=>void se(),children:R(v?`Saving…`:`Save`)})]})]}):!w&&(0,C.jsx)(`p`,{className:`skill-library-empty`,children:R(`Select a skill or create your own.`)}),N&&fe]})]}),(F||j)&&(0,C.jsxs)(`div`,{className:`skill-library-confirm`,role:`alert`,children:[(0,C.jsx)(`p`,{children:R(F?`Discard unsaved skill changes?`:`Delete this skill? Only its Markdown file is removed; supporting files stay in place.`)}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`button`,{"data-keep-editing":!0,className:`button secondary compact`,disabled:v,onClick:()=>{I(null),M(!1)},children:R(`Keep editing`)}),(0,C.jsx)(`button`,{className:`button danger compact`,disabled:v,onClick:()=>{if(F){let{proceed:e}=F;I(null),M(!1),e()}else se(!0)},children:R(F?`Discard changes`:`Delete skill`)})]})]})]})}var Am=e=>e.charAt(0).toUpperCase()+e.slice(1),jm=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`];function Mm({efforts:e,value:t,fallback:n,onChange:r,label:i=R(`Reasoning effort`),description:a}){let o=(0,S.useId)();if(!e.length)return null;let s=e.find(e=>e===t)||e.find(e=>e===n),c=s?e.indexOf(s):Math.floor((e.length-1)/2),l=e.length>1?c/(e.length-1):1,u=s?Am(s):R(`Model default`),d=s?jm.includes(s)?s:`custom`:`default`,f=t=>`calc(15px + ${e.length>1?t/(e.length-1):1} * (100% - 30px))`,p={"--effort-position":f(c),"--effort-fill-width":`calc(30px + ${l} * (100% - 30px))`};return(0,C.jsxs)(`div`,{className:`agent-effort`,"data-effort":d,style:p,children:[(0,C.jsxs)(`div`,{className:`effort-head`,children:[(0,C.jsx)(`span`,{children:i}),(0,C.jsx)(`strong`,{className:`effort-value`,children:u},u)]}),a&&(0,C.jsx)(`p`,{className:`effort-description`,id:o,children:a}),(0,C.jsxs)(`div`,{className:`effort-track`+(s?``:` unset`),children:[(0,C.jsx)(`span`,{className:`effort-aura`,"aria-hidden":`true`}),(0,C.jsxs)(`span`,{className:`effort-fill`,"aria-hidden":`true`,children:[(0,C.jsx)(`span`,{className:`effort-flow`}),d===`ultra`&&(0,C.jsxs)(`span`,{className:`effort-stars`,children:[(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{})]})]}),e.map((e,t)=>t!==c&&(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`effort-stop`+(s&&t<c?` on`:``),style:{left:f(t)}},e)),(0,C.jsx)(`span`,{className:`effort-thumb`,"aria-hidden":`true`,children:d===`ultra`&&(0,C.jsx)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,fill:`currentColor`,children:(0,C.jsx)(`path`,{d:`M10 1.5 12.4 7.6 18.5 10 12.4 12.4 10 18.5 7.6 12.4 1.5 10 7.6 7.6Z`})})}),(0,C.jsx)(`input`,{type:`range`,min:0,max:e.length-1,step:1,value:c,"aria-label":i,"aria-valuetext":u,"aria-describedby":a?o:void 0,disabled:e.length<2,onChange:t=>r(e[Number(t.target.value)])})]}),(0,C.jsxs)(`div`,{className:`effort-scale`,children:[(0,C.jsx)(`span`,{children:Am(e[0])}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>r(``),disabled:!t,children:R(`Model default`)}),(0,C.jsx)(`span`,{children:Am(e[e.length-1])})]})]})}function Nm({agents:e,agent:t,model:n,effort:r,onSelect:i,onEffort:a}){let o=e.map(e=>({...e,choices:[{id:``,name:R(`Model default`)},...e.runtime?.models||[],...e.value===t&&n&&!e.runtime?.models.some(e=>e.id===n)?[{id:n,name:n}]:[]]})),s=o.find(e=>e.value===t),c=s?.runtime?.models||[],l=c.find(e=>e.id===n)||c.find(e=>e.isDefault),u=`${s?.label||t} · ${s?.choices.find(e=>e.id===n)?.name||R(`Model default`)}`,d=JSON.stringify([t,n]);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`settings-row settings-choice`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Default model`)}),(0,C.jsx)(`p`,{children:R(`Used for new tasks. Saved in this browser.`)})]}),(0,C.jsxs)(`label`,{className:`chip-select settings-model-select`,title:u,children:[(0,C.jsx)(`span`,{className:`chip-value`,children:u}),(0,C.jsx)(`select`,{"aria-label":R(`Default model`),value:d,onChange:e=>{for(let t of o){let n=t.choices.find(n=>JSON.stringify([t.value,n.id])===e.target.value);if(n){i(t.value,n.id);break}}},children:o.map(e=>(0,C.jsx)(`optgroup`,{label:e.label,children:e.choices.map(t=>(0,C.jsx)(`option`,{value:JSON.stringify([e.value,t.id]),children:t.name},t.id))},e.value))})]})]}),(0,C.jsx)(`div`,{className:`settings-row settings-effort`,children:l?.efforts.length?(0,C.jsx)(Mm,{efforts:l.efforts,value:r,fallback:l.defaultEffort,onChange:a,label:R(`Default reasoning effort`),description:R(`Available levels depend on the selected model.`)}):(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Default reasoning effort`)}),(0,C.jsx)(`p`,{children:R(`This model uses its own reasoning settings.`)})]})})]})}function Pm({api:e,projects:t,ago:n,controls:r}){let[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)({}),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,_]=(0,S.useState)([]);(0,S.useEffect)(()=>{v(`load`,()=>e(`/people`))},[]),(0,S.useImperativeHandle)(r,()=>({isBusy:()=>!!(c&&c!==`load`)}));async function v(e,t){l(e),s(``);try{let e=await t();e&&a(e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(``)}}let y=()=>v(`invite`,async()=>{let t=await e(`/people`,{name:m.trim(),projects:g});return d(e=>({...e,[t.id]:t.link})),h(``),_([]),e(`/people`)}),b=t=>v(`link:`+t.id,async()=>{let{link:n}=await e(`/people/${t.id}/invite`,{});d(e=>({...e,[t.id]:n}))}),x=(t,n,r)=>{let i=r?[...t.projects,n]:t.projects.filter(e=>e!==n);return a(e=>e&&{...e,people:e.people.map(e=>e.id===t.id?{...e,projects:i}:e)}),v(`share:`+t.id,()=>e(`/people/${t.id}/share`,{projects:i}).catch(async t=>{throw a(await e(`/people`)),t}))},w=(t,n)=>v(`device:`+n.id,()=>e(`/people/${t.id}/devices/${n.id}/remove`,{})),E=t=>v(`remove:`+t.id,()=>e(`/people/${t.id}/remove`,{})),D=t=>v(`sign-out:`+t.id,()=>e(`/people/${t.id}/sign-out`,{})),O=(e,n,r,i)=>(0,C.jsxs)(`fieldset`,{className:`people-papers`,disabled:r,children:[(0,C.jsx)(`legend`,{children:i}),t.map(t=>(0,C.jsxs)(`label`,{className:`checkbox`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:e.includes(t.id),onChange:e=>n(t.id,e.target.checked)}),t.name]},t.id))]});return(0,C.jsxs)(`div`,{className:`people-settings settings-page`,children:[(0,C.jsx)(`p`,{className:`settings-intro`,children:R(`Share your papers and manage the people you work with.`)}),(0,C.jsxs)(`aside`,{className:`people-warning`,"aria-labelledby":`people-warning-title`,children:[(0,C.jsx)(T,{name:`alert`,size:20}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{id:`people-warning-title`,children:R(`Sharing is not sandboxed`)}),(0,C.jsx)(`p`,{children:R(`Invited people can access all files readable by Papilot, including credentials and unshared papers.`)}),(0,C.jsx)(`p`,{children:R(`Run Papilot and its agents in an isolated container such as Docker to limit access; mounted files remain accessible.`)}),(0,C.jsxs)(`details`,{className:`people-access-details`,children:[(0,C.jsxs)(`summary`,{children:[R(`What can invited people do?`),(0,C.jsx)(T,{name:`chevronDown`,size:13})]}),(0,C.jsx)(`p`,{children:R(`People you invite sign in with a passkey at the public address and can do everything you can in the papers you share with them, including approving the commands agents run on this host and pushing with its Git credentials.`)})]})]})]}),i&&!i.origin&&(0,C.jsxs)(`section`,{className:`people-setup settings-card settings-card-body`,"aria-labelledby":`people-setup-title`,children:[(0,C.jsxs)(`div`,{className:`people-setup-heading`,children:[(0,C.jsx)(`span`,{className:`people-setup-icon`,children:(0,C.jsx)(T,{name:`people`,size:23})}),(0,C.jsx)(`span`,{className:`people-badge`,children:R(`Setup required`)})]}),(0,C.jsx)(`h3`,{id:`people-setup-title`,children:R(`Bring your collaborators in`)}),(0,C.jsx)(`p`,{children:R(`Connect a public HTTPS address to invite people to your papers. They can sign in securely with a passkey.`)}),(0,C.jsxs)(`a`,{className:`button secondary`,href:`${Fr.repository}/blob/main/docs/guide.md#collaborators`,target:`_blank`,rel:`noopener noreferrer`,children:[R(`Set up sharing`),(0,C.jsx)(T,{name:`external`,size:14}),(0,C.jsx)(`span`,{className:`sr-only`,children:R(`Opens in a new tab`)})]})]}),i?.origin&&(0,C.jsxs)(`form`,{className:`people-invite settings-card settings-card-body`,onSubmit:e=>{e.preventDefault(),m.trim()&&y()},children:[(0,C.jsxs)(`div`,{className:`people-invite-heading`,children:[(0,C.jsx)(T,{name:`people`,size:18}),(0,C.jsx)(`h3`,{children:R(`Invite someone`)})]}),(0,C.jsx)(`p`,{className:`people-invite-description`,children:R(`Choose the papers to share, then send a personal invite link.`)}),(0,C.jsxs)(`label`,{children:[(0,C.jsx)(`span`,{children:R(`Name`)}),(0,C.jsx)(`input`,{"aria-label":R(`Invite someone`),value:m,maxLength:80,onChange:e=>h(e.target.value),placeholder:R(`Their name, as others will see it`),autoComplete:`off`})]}),O(g,(e,t)=>_(n=>t?[...n,e]:n.filter(t=>t!==e)),c===`invite`,R(`Papers they can open`)),(0,C.jsx)(`div`,{className:`button-row`,children:(0,C.jsx)(`button`,{className:`button primary`,disabled:!m.trim()||!!c,children:R(c===`invite`?`Creating…`:`Create invite link`)})})]}),o&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:o}),!i&&c===`load`&&(0,C.jsx)(`p`,{className:`muted`,role:`status`,children:R(`Loading people…`)}),i&&(0,C.jsxs)(`section`,{className:`people-members`,"aria-labelledby":`people-members-title`,children:[(0,C.jsxs)(`div`,{className:`people-section-heading`,children:[(0,C.jsx)(`h3`,{id:`people-members-title`,children:R(`Members`)}),(0,C.jsx)(`span`,{className:`people-count`,children:i.people.length})]}),(0,C.jsx)(`ul`,{className:`people-list settings-card`,children:i.people.map(e=>{let t=e.role===`owner`,r=e.devices.filter(e=>e.kind===`session`);return(0,C.jsxs)(`li`,{className:`person`,children:[(0,C.jsxs)(`div`,{className:`person-head`,children:[(0,C.jsx)(`span`,{className:`person-avatar`,"aria-hidden":`true`,children:Array.from(e.name.trim())[0]?.toLocaleUpperCase()||`?`}),(0,C.jsxs)(`div`,{className:`person-identity`,children:[(0,C.jsx)(`strong`,{children:t?R(`{name} (you)`,{name:e.name}):e.name}),(0,C.jsx)(`span`,{children:t?R(`Access to all papers`):e.joined?e.lastSeenAt?R(`Last active {time}`,{time:n(e.lastSeenAt)}):R(`Joined`):R(`Invited, not joined yet`)})]}),t&&(0,C.jsx)(`span`,{className:`people-badge`,children:R(`Owner`)})]}),!t&&O(e.projects,(t,n)=>void x(e,t,n),c===`share:`+e.id,R(`Papers {name} can open`,{name:e.name})),u[e.id]&&(0,C.jsxs)(`div`,{className:`invite-link`,children:[(0,C.jsx)(`input`,{readOnly:!0,"aria-label":R(`Invite link for {name}`,{name:e.name}),value:u[e.id],onFocus:e=>e.currentTarget.select()}),(0,C.jsxs)(`button`,{type:`button`,className:`button secondary compact`,onClick:()=>void navigator.clipboard?.writeText(u[e.id]),children:[(0,C.jsx)(T,{name:`copy`,size:14}),R(`Copy`)]}),(0,C.jsx)(`small`,{className:`muted`,children:t?R(`Open it on the device you want to sign in from. It works once, within 15 minutes.`):R(`Send it to {name} yourself. It works once, within 7 days.`,{name:e.name})})]}),e.devices.length>0&&(0,C.jsx)(`ul`,{className:`device-list`,children:e.devices.map(t=>(0,C.jsxs)(`li`,{children:[(0,C.jsx)(T,{name:t.kind===`passkey`?`key`:`monitor`,size:14}),(0,C.jsx)(`span`,{children:t.kind===`passkey`?R(`Passkey · {label}`,{label:t.label}):R(`Signed in · {label}`,{label:t.label})}),(0,C.jsx)(`span`,{className:`muted`,children:t.lastUsedAt?R(`used {time}`,{time:n(t.lastUsedAt)}):R(`added {time}`,{time:n(t.createdAt)})}),(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!c,"aria-label":R(`Remove {device}`,{device:t.label}),onClick:()=>void w(e,t),children:R(`Remove`)})]},t.id))}),i.origin&&(0,C.jsxs)(`div`,{className:`person-actions`,children:[(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!c,onClick:()=>void b(e),children:t?R(`Sign in from anywhere`):e.joined?R(`Invite link for a new device`):R(`New invite link`)}),r.length>0&&(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!c,onClick:()=>void D(e),children:R(`Sign out everywhere`)}),!t&&(f===e.id?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,className:`button danger compact`,disabled:!!c,onClick:()=>{p(``),E(e)},children:R(`Remove {name}`,{name:e.name})}),(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,onClick:()=>p(``),children:R(`Cancel`)})]}):(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!c,onClick:()=>p(e.id),children:R(`Remove…`)}))]})]},e.id)})})]})]})}var Fm=`latex-review:references`;function Im({theme:e,onTheme:t,resolved:n,appearance:r,onAppearance:i,onClose:a,people:o,onSignOut:s,accountName:c,diagnostics:l,skills:u,updates:d,modelDefaults:f,initialPage:p=`general`}){let m=(0,S.useRef)(null),h=(0,S.useRef)(null),[g,_]=(0,S.useState)(!1),v=(0,S.useRef)(null),{choice:y}=ne(),b=_n(),[x,w]=(0,S.useState)(p),[E,O]=(0,S.useState)(()=>p===`general`&&window.matchMedia(`(max-width: 760px)`).matches),[A,j]=(0,S.useState)(``),[N,P]=(0,S.useState)(()=>D.getItem(Fm)!==`off`);(0,S.useEffect)(()=>{let e=document.activeElement,t=m.current;return t.showModal(),()=>{t.close(),e?.isConnected&&e.getClientRects().length&&e.focus()}},[]),(0,S.useEffect)(()=>{let e=m.current;e.querySelector(`.settings-content`).scrollTop=0,(E?e.querySelector(`.settings-category[aria-current="page"]`)||e.querySelector(`.settings-search input`):e.querySelector(`#settings-title`))?.focus()},[x,E]);function F(e){h.current?.isBusy()||(x===`skills`?v.current?.navigate(e):e())}function I(e){let t=()=>{e===`people`&&_(!0),w(e),O(!1)};e===x?t():F(t)}function L(){F(()=>{w(`general`),O(!0)})}let te=k.find(e=>e.id===M()).name,z=()=>{h.current?.isBusy()||(x===`skills`?v.current?.cancel():F(a))},re=[{label:R(`Personal`),entries:[{page:`general`,label:R(`General`),icon:`settings`,keywords:`${R(`Language`)} ${R(`Default model`)} ${R(`Default reasoning effort`)}`},{page:`appearance`,label:R(`Appearance`),icon:`sun`,keywords:`${R(`Light`)} ${R(`Dark`)} ${R(`System`)} ${R(`Theme`)} ${R(`Accent`)} ${R(`Background`)} ${R(`Foreground`)}`},{page:`notifications`,label:R(`Notifications`),icon:`bell`},{page:`review`,label:R(`Review preferences`),icon:`diff`,keywords:`${R(`Check references online`)} ${R(`Expand indirect changes`)}`},{page:`shortcuts`,label:R(`Keyboard shortcuts`),icon:`keyboard`}]},{label:R(`Workspace`),entries:[...u?[{page:`skills`,label:R(`Skills`),icon:`spark`}]:[],...o?[{page:`people`,label:R(`Sharing`),icon:`people`}]:[]]},{label:R(`Runtime`),entries:l?[{page:`agents`,label:R(`Agents`),icon:`terminal`,keywords:`${R(`Agent configuration`)} ${R(`Available models`)} ${R(`Usage & limits`)}`},{page:`latex`,label:`LaTeX`,icon:`paper`,keywords:`TeX Live MacTeX BasicTeX MiKTeX`}]:[]},{label:R(`Application`),entries:[...d?[{page:`updates`,label:R(`Updates`),icon:`refresh`}]:[],{page:`about`,label:R(`About Papilot`),icon:`info`,keywords:R(`Third-party licenses`)}]}],ie=x===`licenses`?R(`Third-party licenses`):re.flatMap(e=>e.entries).find(e=>e.page===x).label,ae=A.trim().toLocaleLowerCase(),oe=re.map(e=>({...e,entries:e.entries.filter(t=>`${e.label} ${t.label} ${t.keywords||``}`.toLocaleLowerCase().includes(ae))})).filter(e=>e.entries.length);return(0,C.jsx)(`dialog`,{ref:m,className:`modal-backdrop`,"aria-label":x===`general`?R(`Settings`):ie,onKeyDown:Mn,onCancel:e=>{e.preventDefault(),z()},onClick:e=>{e.target===e.currentTarget&&z()},children:(0,C.jsxs)(`section`,{className:`modal settings-dialog`+(E?` settings-browse`:``),children:[(0,C.jsx)(`button`,{className:`modal-close icon-button`,"aria-label":R(`Close`),onClick:z,children:(0,C.jsx)(T,{name:`close`})}),(0,C.jsxs)(`aside`,{className:`settings-sidebar`,children:[(0,C.jsx)(`h2`,{className:`settings-sidebar-title`,children:R(`Settings`)}),(0,C.jsxs)(`label`,{className:`settings-search`,children:[(0,C.jsx)(T,{name:`search`,size:17}),(0,C.jsx)(`input`,{type:`search`,"aria-label":R(`Search settings`),placeholder:R(`Search settings`),value:A,onChange:e=>j(e.target.value)})]}),(0,C.jsxs)(`nav`,{className:`settings-categories`,"aria-label":R(`Settings categories`),children:[oe.map(e=>(0,C.jsxs)(`section`,{className:`settings-category-group`,children:[(0,C.jsx)(`h3`,{children:e.label}),e.entries.map(e=>(0,C.jsxs)(`button`,{type:`button`,className:`settings-category`,"data-settings-page":e.page,"aria-current":e.page===x||x===`licenses`&&e.page===`about`?`page`:void 0,onClick:()=>I(e.page),children:[e.page===`about`?(0,C.jsx)(`img`,{src:Fn,width:`18`,height:`18`,alt:``}):e.page===`latex`?(0,C.jsx)(or,{name:e.page,size:18}):(0,C.jsx)(T,{name:e.icon,size:18}),(0,C.jsx)(`span`,{children:e.label})]},e.label))]},e.label)),!oe.length&&(0,C.jsx)(`p`,{className:`settings-search-empty`,children:R(`No matching settings`)})]}),(0,C.jsxs)(`div`,{className:`settings-sidebar-bottom`,children:[s&&(0,C.jsxs)(`button`,{type:`button`,className:`settings-category settings-account`,onClick:()=>F(s),children:[(0,C.jsx)(T,{name:`signOut`,size:18}),(0,C.jsxs)(`span`,{children:[R(`Sign out`),c&&(0,C.jsx)(`small`,{children:c})]})]}),(0,C.jsxs)(`footer`,{className:`settings-footer`,children:[(0,C.jsxs)(`span`,{children:[`Papilot · v`,Rn(Fr.version)]}),(0,C.jsx)(`a`,{href:Fr.repository,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`GitHub · ${R(`Opens in a new tab`)}`,children:(0,C.jsx)(T,{name:`github`,size:16})})]})]})]}),(0,C.jsxs)(`div`,{className:`settings-content settings-content-${x}`,children:[(0,C.jsxs)(`header`,{className:`settings-content-header`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`settings-back settings-mobile-back`,onClick:L,children:[(0,C.jsx)(T,{name:`chevronLeft`,size:14}),R(`Settings`)]}),x===`licenses`&&(0,C.jsxs)(`button`,{type:`button`,className:`settings-back`,onClick:()=>I(`about`),children:[(0,C.jsx)(T,{name:`chevronLeft`,size:14}),R(`About Papilot`)]}),(0,C.jsxs)(`h2`,{id:`settings-title`,tabIndex:-1,children:[x===`latex`&&(0,C.jsx)(or,{name:x,size:30}),ie]})]}),x===`general`&&(0,C.jsxs)(`section`,{className:`settings-card`,children:[(0,C.jsxs)(`div`,{className:`settings-row settings-choice`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`span`,{className:`settings-name`,children:R(`Language`)}),(0,C.jsx)(`p`,{children:R(`Language for the Papilot interface.`)})]}),(0,C.jsx)(Pn,{label:R(`Language`),value:y,onChange:e=>ee(e),options:[{value:`system`,label:R(`Browser default ({language})`,{language:te})},...k.map(e=>({value:e.id,label:e.name}))]})]}),(0,C.jsx)(Nm,{...f})]}),x===`appearance`&&(0,C.jsx)(Dr,{theme:e,onTheme:t,resolved:n,appearance:r,onAppearance:i}),x===`review`&&(0,C.jsxs)(`section`,{className:`settings-card`,children:[(0,C.jsxs)(`div`,{className:`settings-row settings-toggle`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`label`,{className:`settings-name`,htmlFor:`settings-references`,children:R(`Check references online`)}),(0,C.jsx)(`p`,{id:`settings-references-detail`,children:R(`When a change adds or edits a bibliography entry, look up its title, authors, year and DOI in Crossref, DBLP and arXiv. Nothing else from your paper is sent.`)})]}),(0,C.jsx)(`input`,{id:`settings-references`,type:`checkbox`,role:`switch`,className:`switch`,"aria-describedby":`settings-references-detail`,checked:N,onChange:e=>{P(e.target.checked),D.setItem(Fm,e.target.checked?`on`:`off`)}})]}),(0,C.jsxs)(`div`,{className:`settings-row settings-toggle`,children:[(0,C.jsxs)(`div`,{className:`settings-text`,children:[(0,C.jsx)(`label`,{className:`settings-name`,htmlFor:`settings-effects`,children:R(`Expand indirect changes`)}),(0,C.jsx)(`p`,{id:`settings-effects-detail`,children:R(`Expand changes elsewhere, such as contents and reference numbering. Off by default; edits with no visible change at their source, such as macro definitions, still show their effects.`)})]}),(0,C.jsx)(`input`,{id:`settings-effects`,type:`checkbox`,role:`switch`,className:`switch`,"aria-describedby":`settings-effects-detail`,checked:b,onChange:e=>gn(e.target.checked)})]})]}),x===`notifications`&&(0,C.jsx)(wr,{}),x===`shortcuts`&&(0,C.jsx)(Pr,{}),x===`about`&&(0,C.jsx)(Lr,{onLicenses:()=>I(`licenses`)}),x===`licenses`&&(0,C.jsx)(Rr,{}),x===`agents`&&l&&(0,C.jsx)($r,{...l}),x===`latex`&&l&&(0,C.jsx)(ei,{online:l.online,load:l.latex}),x===`updates`&&d&&(0,C.jsx)(Hn,{api:d}),g&&o&&(0,C.jsx)(`div`,{hidden:x!==`people`,children:(0,C.jsx)(Pm,{...o,controls:h})}),x===`skills`&&u&&(0,C.jsx)(km,{...u,controls:v,onClose:a})]})]})})}function Lm({branch:e,files:t,staged:n,remote:r,agent:i,generate:a,commit:o,onClose:s}){let c=(0,S.useRef)(null),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(``),[p,m]=(0,S.useState)(``),h=(0,S.useRef)(!1);async function g(e){f(`writing`),m(``);try{let t=await a(e);h.current||u(t)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(e=>e===`writing`?``:e)}}(0,S.useEffect)(()=>{let e=document.activeElement,t=c.current;return t.showModal(),t.querySelector(`textarea`)?.focus(),g(!1),()=>{t.close(),e?.isConnected&&e.getClientRects().length&&e.focus()}},[]);async function _(e){if(!d&&l.trim()){f(e?`push`:`commit`),m(``);try{await o(l.trim(),e)}catch(e){m(e instanceof Error?e.message:String(e)),f(``)}}}let v=()=>{d!==`commit`&&d!==`push`&&s()};return(0,C.jsx)(`dialog`,{ref:c,className:`modal-backdrop`,"aria-labelledby":`commit-title`,onKeyDown:Mn,onCancel:e=>{e.preventDefault(),v()},onClick:e=>{e.target===e.currentTarget&&v()},children:(0,C.jsxs)(`section`,{className:`modal commit-dialog`,children:[(0,C.jsx)(`button`,{className:`modal-close icon-button`,"aria-label":R(`Close`),onClick:v,children:(0,C.jsx)(T,{name:`close`})}),(0,C.jsx)(`h2`,{id:`commit-title`,children:e?R(`Commit to {branch}`,{branch:e}):R(`Commit`)}),(0,C.jsx)(`p`,{className:`modal-description`,children:n?z(t.length,`What is staged, in {n} file:`,`What is staged, in {n} files:`):z(t.length,`What this task accepted, in {n} file:`,`What this task accepted, in {n} files:`)}),(0,C.jsx)(`ul`,{className:`commit-files`,children:t.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsx)(`code`,{children:e})},e))}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_(!1)},children:[(0,C.jsxs)(`div`,{className:`git-message-box`,children:[(0,C.jsx)(`textarea`,{"aria-label":R(`Commit message`),rows:3,value:l,readOnly:d===`commit`||d===`push`,placeholder:d===`writing`?R(`{agent} is writing a commit message…`,{agent:i}):R(`Commit message`),onChange:e=>{h.current=!0,u(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.nativeEvent.isComposing&&(e.preventDefault(),_(!1))}}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button git-generate`,"aria-label":R(`Generate commit message`),title:R(`Write a commit message for the chosen files with {agent}`,{agent:i}),disabled:!!d,onClick:()=>{h.current=!1,g(!0)},children:d===`writing`?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(T,{name:`spark`,size:15})})]}),p&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:p}),(0,C.jsxs)(`div`,{className:`button-row`,children:[(0,C.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:d===`commit`||d===`push`,onClick:v,children:R(`Cancel`)}),r&&(0,C.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:!!d||!l.trim(),onClick:()=>void _(!0),children:R(d===`push`?`Committing and pushing…`:`Commit and push`)}),(0,C.jsx)(`button`,{className:`button primary`,disabled:!!d||!l.trim(),children:R(d===`commit`?`Committing…`:`Commit`)})]})]})]})})}function Rm({draft:e,branch:t,isolated:n,remote:r,apply:i,disabled:a,agent:o,generate:s,commit:c}){let l=(0,S.useSyncExternalStore)(e.subscribe,e.getSnapshot);(0,S.useEffect)(()=>{s&&e.write(s)},[e,!!s]);let u=(0,S.useRef)(null),d=()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,132)}px`)};if((0,S.useLayoutEffect)(d,[l.message,!!s,l.result]),(0,S.useEffect)(()=>{let e=u.current;if(!e)return;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,d())});return n.observe(e),()=>n.disconnect()},[!!s,l.result]),l.result)return(0,C.jsx)(`span`,{className:`commit-state`,role:`status`,children:l.result});let f=a||!!l.busy,p=(t=!1)=>{f||e.submit(t?`push`:`commit`,e=>c(e,t))};return(0,C.jsxs)(`form`,{className:`task-commit`,"aria-label":R(`Save accepted changes`),onSubmit:e=>{e.preventDefault(),p()},children:[(0,C.jsxs)(`div`,{className:`task-commit-compose`,children:[s&&(0,C.jsx)(`textarea`,{ref:u,"aria-label":R(`Commit message`),"aria-busy":l.writing,rows:1,value:l.message,readOnly:f,placeholder:l.writing?R(`{agent} is writing a commit message…`,{agent:o}):R(`Commit message`),onChange:t=>e.edit(t.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.nativeEvent.isComposing&&(e.preventDefault(),p())}}),(0,C.jsxs)(`div`,{className:`task-commit-toolbar`,children:[s&&(0,C.jsxs)(`span`,{className:`task-commit-branch`,title:t?R(`Commit to {branch}`,{branch:t}):R(`Commit`),children:[(0,C.jsx)(T,{name:`branch`,size:13}),(0,C.jsx)(`span`,{children:t||R(`Commit`)})]}),s&&(0,C.jsx)(`button`,{type:`button`,className:`task-commit-generate`,"aria-label":R(`Generate commit message`),"aria-busy":l.writing,title:R(`Write a commit message for the chosen files with {agent}`,{agent:o}),disabled:f||l.writing,onClick:()=>void e.write(s,!0),children:l.writing?(0,C.jsx)(`span`,{className:`task-commit-spinner`,"aria-hidden":`true`}):(0,C.jsx)(T,{name:`spark`,size:15})}),(0,C.jsxs)(`div`,{className:`task-commit-actions`,children:[i&&(0,C.jsx)(`button`,{type:`button`,className:`task-commit-alternative`,disabled:f,onClick:()=>void e.submit(`apply`,i),children:l.busy===`apply`?R(`Applying…`):R(`Apply to working directory`)}),s&&(0,C.jsxs)(C.Fragment,{children:[r&&(0,C.jsx)(`button`,{type:`button`,className:`task-commit-alternative`,disabled:f||!l.message.trim(),onClick:()=>p(!0),children:l.busy===`push`?R(`Committing and pushing…`):R(`Commit and push`)}),(0,C.jsxs)(`button`,{className:`task-commit-primary`,"aria-label":n?R(`Commit to task branch`):void 0,disabled:f||!l.message.trim(),children:[l.busy===`commit`?R(`Committing…`):R(`Commit`),(0,C.jsx)(T,{name:`arrowRight`,size:14})]})]})]})]})]}),l.writing&&(0,C.jsx)(`span`,{className:`task-commit-hint`,role:`status`,children:R(`{agent} is writing a commit message…`,{agent:o})}),l.error&&(0,C.jsx)(`p`,{className:`task-commit-error`,role:`alert`,children:l.error})]})}var zm=class{state={message:``,writing:!1,busy:``,error:``,result:``};revision=0;generation=0;requested=!1;listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;update(e){this.state={...this.state,...e};for(let e of this.listeners)e()}edit(e){this.revision++,this.update({message:e})}async write(e,t=!1){if(this.state.busy||this.state.result||this.state.writing||!t&&this.requested)return;this.requested=!0;let n=++this.generation,r=this.revision;this.update({writing:!0,error:``});try{let i=await e(t);n===this.generation&&r===this.revision&&this.update({message:i})}catch(e){n===this.generation&&this.update({error:e instanceof Error?e.message:String(e)})}finally{n===this.generation&&this.update({writing:!1})}}async submit(e,t){if(!(this.state.busy||this.state.result||e!==`apply`&&!this.state.message.trim())){this.generation++,this.update({busy:e,writing:!1,error:``});try{this.update({result:await t(this.state.message.trim())})}catch(e){this.update({error:e instanceof Error?e.message:String(e)})}finally{this.update({busy:``})}}}};function Bm(e){return e.status!==`reviewing`||e.review?.state!==`done`||e.review.round===null||e.review.counts.pending||e.review.files?.length!==0||e.pendingReview||e.delivery?.pending?null:e.deferred?e.delivery?.mode===`workspace`?`applied`:e.delivery?.commit?`committed`:null:e.committed?e.committed.pushed?`pushed`:`committed`:null}function Vm(e){let t=[],n=1;return{rows:e.map(e=>{let r=t.includes(e.hash);r||t.push(e.hash);let i=[...t],a=i.indexOf(e.hash),o=i.filter(t=>t!==e.hash);for(let[t,n]of e.parents.entries())o.includes(n)||o.splice(Math.min(a+t,o.length),0,n);let s=i.flatMap((t,n)=>t===e.hash?[]:[{from:n,to:o.indexOf(t),parent:!1}]);return s.push(...e.parents.map(e=>({from:a,to:o.indexOf(e),parent:!0}))),n=Math.max(n,i.length,o.length),t=o,{commit:e,lane:a,incoming:r,edges:s}}),lanes:n}}function Hm({status:e}){let t=e.merging?.conflicts.length??e.files.filter(e=>e.status===`U`).length,n=e.files.filter(e=>e.staged&&e.status!==`U`).length,r=e.files.filter(e=>e.unstaged&&e.status!==`?`).length,i=e.files.filter(e=>e.status===`?`).length;return(0,C.jsxs)(`span`,{className:`git-status-counts`,children:[!e.files.length&&(0,C.jsxs)(`span`,{className:`is-clean`,children:[(0,C.jsx)(T,{name:`check`,size:12}),R(`clean`)]}),t>0&&(0,C.jsx)(`span`,{className:`has-conflicts`,children:R(`{n} conflicts`,{n:t})}),n>0&&(0,C.jsx)(`span`,{children:R(`{n} staged`,{n})}),r>0&&(0,C.jsx)(`span`,{children:R(`{n} unstaged`,{n:r})}),i>0&&(0,C.jsx)(`span`,{children:R(`{n} untracked`,{n:i})}),e.merging&&(0,C.jsx)(`span`,{className:`has-conflicts`,children:R(`Merge in progress`)})]})}var Um=e=>e.branch||(e.bare?R(`Bare repository`):R(`detached HEAD`)),Wm=[`var(--accent)`,`var(--green)`,`var(--graph-purple)`,`var(--amber-text)`,`var(--graph-pink)`];function Gm({git:e,load:t,tasks:n,onOpenTask:r,taskStatus:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)(!0),[d,f]=(0,S.useState)(0),[p,m]=(0,S.useState)(``),[h,g]=(0,S.useState)(``),_=JSON.stringify([e.head?.hash,e.branch,e.ahead,e.behind,e.files,e.merging]);(0,S.useEffect)(()=>{let e=new AbortController,n;async function r(){if(document.hidden)n=setTimeout(r,1e4);else{u(!0);try{let n=await t(e.signal);e.signal.aborted||(o(n),c(``))}catch(t){e.signal.aborted||c(t instanceof Error?t.message:String(t))}finally{e.signal.aborted||(u(!1),n=setTimeout(r,1e4))}}}return r(),()=>{e.abort(),clearTimeout(n)}},[t,_,d]);let v=a?.worktrees||[],y=new Map(n.map(e=>[e.id,e])),b=e=>e.taskId?y.get(e.taskId):void 0,x=e=>b(e)?.title||(e.current?R(`Manuscript`):Um(e)),w=v.find(e=>e.path===p)||v.find(e=>e.current),E=Vm(a?.commits||[]),D=20+E.lanes*16;return(0,C.jsxs)(`div`,{className:`git-repository`,children:[(0,C.jsxs)(`section`,{"aria-label":R(`Worktrees`),children:[(0,C.jsxs)(`div`,{className:`git-overview-heading`,children:[(0,C.jsxs)(`h3`,{children:[(0,C.jsx)(T,{name:`branch`,size:14}),R(`Worktrees`),a&&(0,C.jsx)(`span`,{className:`count`,children:v.length})]}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Refresh worktrees and history`),title:R(`Refresh worktrees and history`),disabled:l,onClick:()=>f(e=>e+1),children:l?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(T,{name:`refresh`,size:14})})]}),s&&(0,C.jsxs)(`p`,{className:`inline-error git-overview-note`,role:`alert`,children:[R(`Could not refresh the repository.`),a&&(0,C.jsxs)(C.Fragment,{children:[` `,R(`Showing the last update.`)]}),` `,(0,C.jsx)(`span`,{children:s}),(0,C.jsx)(`button`,{type:`button`,className:`button ghost compact`,onClick:()=>f(e=>e+1),children:R(`Retry`)})]}),!a&&!s&&(0,C.jsx)(`p`,{className:`git-overview-note`,role:`status`,children:R(`Reading worktrees and history…`)}),(0,C.jsx)(`ul`,{className:`git-worktrees`,children:v.map(t=>{let n=t.current?e:t.status,a=h===t.path,o=b(t);return(0,C.jsxs)(`li`,{className:`git-worktree`+(t.path===w?.path?` selected`:``),"data-task-id":o?.id,children:[(0,C.jsxs)(`div`,{className:`git-worktree-row`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`git-worktree-button`,"aria-expanded":a,onClick:()=>{m(t.path),g(a?``:t.path)},children:[(0,C.jsxs)(`span`,{className:`git-worktree-title`,children:[(0,C.jsx)(T,{name:a?`chevronDown`:`chevronRight`,size:12}),(0,C.jsx)(`strong`,{title:x(t),children:x(t)}),o?.archivedAt&&(0,C.jsx)(`span`,{title:R(`Archived task`),"aria-label":R(`Archived task`),children:(0,C.jsx)(T,{name:`archive`,size:12})}),t.current&&(0,C.jsx)(`span`,{className:`git-current-badge`,children:R(`Current`)}),o&&i(o)]}),(0,C.jsxs)(`span`,{className:`git-worktree-meta`,children:[n?(0,C.jsx)(Hm,{status:n}):(0,C.jsx)(`span`,{className:`git-worktree-unavailable`,children:t.bare?R(`Bare repository`):R(`Status unavailable`)}),n?.upstream&&(n.ahead>0||n.behind>0)&&(0,C.jsxs)(`span`,{className:`git-worktree-sync`,title:R(`Compared with {upstream}`,{upstream:n.upstream}),children:[`↑`,n.ahead,` ↓`,n.behind]}),t.locked!==void 0&&(0,C.jsx)(`span`,{className:`git-worktree-flag`,title:t.locked,children:R(`Locked`)}),t.prunable!==void 0&&(0,C.jsx)(`span`,{className:`git-worktree-flag`,title:t.prunable,children:R(`Missing worktree`)})]})]}),o&&(0,C.jsx)(`button`,{type:`button`,className:`icon-button git-open-task`,"aria-label":R(`Open task: {title}`,{title:o.title}),title:R(`Open task: {title}`,{title:o.title}),onClick:()=>r(o.id),children:(0,C.jsx)(T,{name:`arrowRight`,size:14})})]}),a&&(0,C.jsxs)(`div`,{className:`git-worktree-detail`,children:[(0,C.jsxs)(`p`,{className:`git-worktree-branch`,children:[(0,C.jsx)(T,{name:`branch`,size:12}),(0,C.jsx)(`code`,{children:Um(t)}),t.head&&(0,C.jsx)(`code`,{children:t.head.slice(0,7)}),!o&&!t.current&&(0,C.jsx)(`span`,{children:R(`No linked task`)})]}),(0,C.jsx)(`p`,{className:`git-worktree-path`,children:t.path}),n?.head&&(0,C.jsx)(`p`,{children:n.head.subject}),n?.upstream?(0,C.jsxs)(`p`,{className:`git-worktree-tracking`,children:[(0,C.jsx)(`code`,{children:n.upstream}),(0,C.jsx)(`span`,{children:R(`{ahead} ahead · {behind} behind`,{ahead:n.ahead,behind:n.behind})})]}):n&&(0,C.jsx)(`p`,{children:R(`No upstream branch`)}),t.error&&(0,C.jsx)(`p`,{className:`inline-error`,children:R(`Could not read this worktree.`)}),t.locked&&(0,C.jsxs)(`p`,{children:[R(`Locked`),`: `,t.locked]}),t.prunable&&(0,C.jsxs)(`p`,{children:[R(`Missing worktree`),`: `,t.prunable]}),n&&n.files.length>0&&(0,C.jsx)(`ul`,{className:`git-worktree-files`,"aria-label":R(`Changed files in {branch}`,{branch:x(t)}),children:n.files.map(e=>(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`code`,{className:e.status===`U`?`has-conflicts`:``,children:e.status===`?`?`?`:e.status}),(0,C.jsx)(`span`,{children:e.path}),e.staged&&(0,C.jsx)(`small`,{children:R(`Staged`)})]},e.path))})]})]},t.path)})}),a&&v.length===1&&(0,C.jsx)(`p`,{className:`git-overview-note`,children:R(`No other worktrees in this repository.`)})]}),(0,C.jsxs)(`section`,{className:`git-history`,"aria-label":R(`Commit graph`),children:[(0,C.jsxs)(`div`,{className:`git-overview-heading`,children:[(0,C.jsxs)(`h3`,{title:R(`Branches and worktrees at each commit. Select a worktree to highlight its HEAD.`),children:[(0,C.jsx)(T,{name:`commit`,size:14}),R(`Commit graph`)]}),(0,C.jsx)(`span`,{children:R(`Newest first`)})]}),a&&!E.rows.length&&(0,C.jsx)(`p`,{className:`git-overview-note`,children:R(`No commits yet`)}),E.rows.length>0&&(0,C.jsxs)(C.Fragment,{children:[w?.head&&!E.rows.some(e=>e.commit.hash===w.head)&&(0,C.jsx)(`p`,{className:`git-overview-note`,children:R(`This worktree’s HEAD is outside the displayed history.`)}),(0,C.jsx)(`div`,{className:`git-graph-scroll`,children:(0,C.jsx)(`ol`,{className:`git-graph-list`,style:{minWidth:D+220},children:E.rows.map(e=>{let{commit:t,lane:n}=e,r=v.filter(e=>e.head===t.hash),i=w?.head===t.hash,a=e=>12+e*16,o=t.refs.filter(e=>!r.some(t=>b(t)&&t.branch===e));return(0,C.jsxs)(`li`,{className:`git-graph-row`+(i?` highlighted`:``),"data-commit":t.hash,children:[(0,C.jsxs)(`div`,{className:`git-graph-rail`,style:{width:D},"aria-hidden":`true`,children:[(0,C.jsxs)(`svg`,{viewBox:`0 0 ${D} 100`,preserveAspectRatio:`none`,className:`git-graph-lines`,children:[e.edges.filter(e=>!e.parent).map((e,t)=>(0,C.jsx)(`path`,{d:`M ${a(e.from)} 0 L ${a(e.from)} 50 C ${a(e.from)} 75 ${a(e.to)} 75 ${a(e.to)} 100`,stroke:Wm[e.to%Wm.length]},`through`+t)),e.incoming&&(0,C.jsx)(`path`,{d:`M ${a(n)} 0 V 50`,stroke:Wm[n%Wm.length]}),e.edges.filter(e=>e.parent).map((e,t)=>(0,C.jsx)(`path`,{d:`M ${a(n)} 50 C ${a(n)} 75 ${a(e.to)} 75 ${a(e.to)} 100`,stroke:Wm[e.to%Wm.length]},`parent`+t))]}),(0,C.jsx)(`span`,{className:`git-graph-dot`+(t.parents.length>1?` merge`:``),style:{left:a(n),background:Wm[n%Wm.length]}})]}),(0,C.jsxs)(`div`,{className:`git-graph-content`,children:[(0,C.jsxs)(`div`,{className:`git-graph-subject`,children:[(0,C.jsx)(`p`,{title:`${t.subject}\n${t.author} · ${new Date(t.date).toLocaleString(te())}`,children:t.subject}),(0,C.jsx)(`code`,{title:t.hash,children:t.hash.slice(0,7)})]}),(r.length>0||o.length>0)&&(0,C.jsxs)(`div`,{className:`git-graph-refs`,children:[r.map(e=>(0,C.jsxs)(`button`,{type:`button`,className:`git-graph-ref worktree-ref`+(e.current?` current-ref`:``),title:`${x(e)}\n${Um(e)}\n${e.path}`,onClick:()=>{m(e.path),g(e.path)},children:[(0,C.jsx)(T,{name:b(e)?`chat`:`branch`,size:10}),(0,C.jsx)(`span`,{children:x(e)})]},e.path)),o.map(e=>(0,C.jsx)(`span`,{className:`git-graph-ref`,title:e,children:e},e))]})]})]},t.hash)})})}),(0,C.jsx)(`p`,{className:`git-overview-note git-history-end`,children:a?.truncated?R(`Showing the latest {n} commits. Older history is not shown.`,{n:E.rows.length}):z(E.rows.length,`{n} commit`,`{n} commits`)})]})]})]})}var Km=()=>D.getItem(`latex-review:references`)!==`off`,qm={doi:`doi.org`,crossref:`Crossref`,dblp:`DBLP`,arxiv:`arXiv`},Jm=e=>({title:R(`Title`),author:R(`Authors`),year:R(`Year`),doi:`DOI`,arxiv:`arXiv`})[e]||e,Ym=()=>L()===`zh-CN`?``:` `,Xm=e=>`${e.section?e.section+` · `:``}${e.file}:${e.line}`,Zm=(e,t)=>{let n=e.fields.find(e=>e.name===t);return n?n.resolved??n.value:``},Qm=e=>e.replace(/\\[a-zA-Z]+\s*/g,``).replace(/[{}$]/g,``).replace(/\s+/g,` `).trim();function $m(e,t,n,r=!0){let[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(!1),u=(0,S.useRef)(!1),[d,f]=(0,S.useState)(0);return(0,S.useEffect)(()=>{a(null),s(``),l(!1)},[e]),(0,S.useEffect)(()=>{if(!r)return;let e=()=>f(e=>e+1);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[r]),(0,S.useEffect)(()=>{if(!e||!r)return;let t=!0,i,o=async()=>{let r=u.current;u.current=!1;try{let u=await n(`/projects/${e}/references${c&&Km()?`?check=1${r?`&retry=1`:``}`:``}`);if(!t)return;a(u),s(``),c&&u.pending?i=setTimeout(()=>void o(),1500):c&&l(!1)}catch(e){t&&(s(e instanceof Error?e.message:String(e)),l(!1))}};return o(),()=>{t=!1,clearTimeout(i)}},[e,t,c,d,n,r]),{report:i,error:o,checking:c,check(e=!1){u.current=e,l(!0),f(e=>e+1)},async confirm(t,r){try{a(await n(`/projects/${e}/references/confirm`,{id:t,confirmed:r}))}catch(e){s(e instanceof Error?e.message:String(e))}}}}function eh(e){let t=[],n=new Map(e.entries.map(e=>[e.id,e]));for(let n of[...new Set(e.missing.map(e=>e.key))]){let r=e.missing.filter(e=>e.key===n).map(e=>`${e.file}:${e.line}`).join(`; `);t.push({id:`missing:${n}`,key:n,label:`\\cite{${n}}`,problems:[R(`No entry has this key.`)+Ym()+r],soft:!1,fix:R(`{cite} ({places}) has no entry with this key.`,{cite:`\\cite{${n}}`,places:r})})}for(let r of e.entries){let i=e.checks[r.id],a=r.id in e.confirmed,o=[],s=[];r.error&&(o.push(R(`BibTeX cannot read it: {error}`,{error:r.error})),s.push(R(`BibTeX cannot read it ({error}).`,{error:r.error}))),e.duplicates.some(e=>e.includes(r.id))&&(o.push(R(`Another entry has the same key.`)),s.push(R(`another entry has the same key.`)));for(let t of e.similar.filter(e=>e.ids.includes(r.id))){let e=t.ids.filter(e=>e!==r.id).map(e=>n.get(e)?.key).join(`, `);o.push(t.by===`doi`?R(`Same DOI as {keys}.`,{keys:e}):R(`Same title as {keys}.`,{keys:e})),s.push(t.by===`doi`?R(`the same work as {keys} (same DOI).`,{keys:e}):R(`possibly the same work as {keys} (same title).`,{keys:e}))}if(i&&!a&&i.status===`mismatch`){let e=i.differences.filter(e=>!e.minor);o.push(e.map(e=>R(`{field}: {bib} here, {record} in {source}`,{field:Jm(e.field),bib:e.bib,record:e.record||`—`,source:qm[i.record?.source||``]||``})).join(`; `)),s.push(R(`{differences} (record: {url}).`,{differences:e.map(e=>R(`{field} is {bib} but {source} has {record}`,{field:Jm(e.field),bib:e.bib,record:e.record||R(`nothing`),source:qm[i.record?.source||``]||``})).join(`; `),url:i.record?.url||``}))}i&&!a&&i.status===`unverified`&&(o.push(R(`No record in Crossref, DBLP or arXiv matches it.`)),s.push(R(`no record in Crossref, DBLP or arXiv matches it.`)));let c=!o.length&&!e.all_cited&&!r.cited.length;c&&(o.push(R(`Not cited in the paper.`)),s.push(R(`it is not cited.`))),o.length&&t.push({id:r.id,key:r.key,label:r.key,entry:r,problems:o,soft:c,fix:R(`{key} ({place}): {problems}`,{key:r.key,place:`${r.file}:${r.lines[0]}`,problems:s.join(Ym())})})}return t}function th(e,t,n){let r=t.checks[e.id];return e.id in t.confirmed&&r?.status!==`verified`?`confirmed`:r?.status||(n?`checking`:`unchecked`)}var nh=e=>({verified:R(`Verified`),mismatch:R(`Differs`),unverified:R(`Not found`),failed:R(`Could not check`),skipped:R(`Nothing to check`),confirmed:R(`Checked by you`),checking:R(`Checking…`),unchecked:R(`Not checked`)})[e]||e,rh=e=>e?eh(e).filter(e=>!e.soft).length:0;function ih({data:e,onInvestigate:t}){let{report:n,error:r,checking:i}=e,[a,o]=(0,S.useState)(`problems`),[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)({}),d=(0,S.useMemo)(()=>n?eh(n):[],[n]),f=e=>l[e.id]??!e.soft,p=(0,S.useCallback)(e=>u(t=>({...t,[e.id]:!(t[e.id]??!e.soft)})),[]);if(r&&!n)return(0,C.jsx)(`section`,{className:`references-panel`,children:(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:r})});if(!n)return(0,C.jsx)(`section`,{className:`references-panel`,children:(0,C.jsx)(`p`,{className:`references-empty`,children:R(`Reading the bibliography…`)})});if(!n.bibs.length)return(0,C.jsx)(`section`,{className:`references-panel`,children:(0,C.jsx)(`p`,{className:`references-empty`,children:R(`This paper names no .bib file with {bibliography} or {addbibresource}.`,{bibliography:`\\bibliography`,addbibresource:`\\addbibresource`})})});let m=e=>n.entries.filter(t=>th(t,n,i)===e).length,h=n.entries.filter(e=>!e.error&&!n.checks[e.id]).length,g=d.filter(f),_=a===`problems`?null:n.entries;return(0,C.jsxs)(`div`,{className:`references-panel`,"aria-busy":i,children:[(0,C.jsxs)(`div`,{className:`references-summary`,children:[(0,C.jsxs)(`p`,{children:[(0,C.jsx)(`strong`,{children:z(n.entries.length,`{n} entry`,`{n} entries`)}),[[`verified`,R(`{n} verified`,{n:m(`verified`)})],[`confirmed`,R(`{n} checked by you`,{n:m(`confirmed`)})],[`mismatch`,R(`{n} differ`,{n:m(`mismatch`)})],[`unverified`,R(`{n} not found`,{n:m(`unverified`)})],[`failed`,R(`{n} could not be checked`,{n:m(`failed`)})]].map(([e,t])=>m(e)>0&&(0,C.jsx)(`span`,{className:`references-stat s-`+e,children:t},e)),n.absent.length>0&&(0,C.jsx)(`span`,{className:`references-stat s-mismatch`,children:R(`Missing: {files}`,{files:n.absent.join(`, `)})})]}),(0,C.jsx)(`div`,{className:`references-actions`,children:i?(0,C.jsxs)(`span`,{className:`references-progress`,role:`status`,children:[(0,C.jsx)(`span`,{className:`spinner`}),R(`Checking {n}…`,{n:n.pending||h})]}):(0,C.jsxs)(`button`,{type:`button`,className:`button secondary compact`,disabled:!Km(),title:Km()?R(`Look the entries up in Crossref, DBLP and arXiv. Only their titles, authors, years and identifiers are sent.`):R(`Online checks are off in Settings.`),onClick:()=>e.check(h===0),children:[(0,C.jsx)(T,{name:`refresh`,size:14}),h?h===n.entries.length?R(`Check online`):z(h,`Check {n} more online`,`Check {n} more online`):R(`Check again`)]})}),!Km()&&(0,C.jsx)(`p`,{className:`references-note`,children:R(`Online checks are off in Settings, so only problems found in the files are shown.`)}),r&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:r})]}),(0,C.jsxs)(`div`,{className:`references-filter`,role:`tablist`,"aria-label":R(`Show`),children:[(0,C.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`problems`,onClick:()=>o(`problems`),children:[R(`Problems`),(0,C.jsx)(`span`,{className:`count`,children:d.filter(e=>!e.soft).length})]}),(0,C.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`all`,onClick:()=>o(`all`),children:[R(`All entries`),(0,C.jsx)(`span`,{className:`count`,children:n.entries.length})]})]}),a===`problems`&&(d.length?(0,C.jsx)(`ul`,{className:`references-list`,children:d.map(t=>(0,C.jsxs)(`li`,{className:`references-item`+(t.soft?` soft`:``),"data-open":s===t.id,"data-state":t.entry?th(t.entry,n,i):`missing`,children:[(0,C.jsxs)(`div`,{className:`references-row`,children:[(0,C.jsx)(`input`,{type:`checkbox`,"aria-label":R(`Include {key} in the task`,{key:t.label}),checked:f(t),onChange:()=>p(t)}),(0,C.jsxs)(`button`,{type:`button`,className:`references-head`,"aria-expanded":t.entry?s===t.id:void 0,disabled:!t.entry,onClick:()=>c(s===t.id?``:t.id),children:[(0,C.jsx)(`code`,{children:t.label}),t.entry&&(0,C.jsx)(`span`,{className:`references-state s-`+th(t.entry,n,i),children:nh(th(t.entry,n,i))}),(0,C.jsx)(`span`,{className:`references-problems`,children:t.problems.join(Ym())})]})]}),t.entry&&s===t.id&&(0,C.jsx)(ah,{entry:t.entry,check:n.checks[t.entry.id],confirmed:t.entry.id in n.confirmed,onConfirm:n=>void e.confirm(t.entry.id,n)})]},t.id))}):(0,C.jsxs)(`p`,{className:`references-empty`,children:[(0,C.jsx)(T,{name:`check`,size:15}),R(h?`No problems in the files. Check online to compare the entries with their records.`:`No problems found.`)]})),_&&(0,C.jsx)(`ul`,{className:`references-list`,children:_.map(t=>{let r=th(t,n,i);return(0,C.jsxs)(`li`,{className:`references-item`,"data-open":s===t.id,children:[(0,C.jsxs)(`button`,{type:`button`,className:`references-head`,"aria-expanded":s===t.id,onClick:()=>c(s===t.id?``:t.id),children:[(0,C.jsx)(`code`,{children:t.key}),(0,C.jsx)(`span`,{className:`references-state s-`+r,children:nh(r)}),(0,C.jsx)(`span`,{className:`references-title`,children:Qm(Zm(t,`title`))||t.type}),(0,C.jsx)(`span`,{className:`references-meta`,children:[Qm(Zm(t,`author`)).split(/\s+and\s+/i)[0],Zm(t,`year`)].filter(Boolean).join(` · `)})]}),s===t.id&&(0,C.jsx)(ah,{entry:t,check:n.checks[t.id],confirmed:t.id in n.confirmed,onConfirm:n=>void e.confirm(t.id,n)})]},t.id)})}),a===`problems`&&d.length>0&&(0,C.jsxs)(`div`,{className:`references-fix`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`button primary compact`,disabled:!g.length,onClick:()=>t([R(`Find out what happened with these bibliography problems and report back. Do not edit any file. For each, check whether the work exists and what its published record says (authors, title, year, venue, DOI), find where the entry or citation came from in the Git history of the .bib and .tex files, and say what you would suggest. Mark which findings you confirmed in a source and which are guesses.`),...g.map(e=>`- `+e.fix)].join(`
255
- `)),children:[(0,C.jsx)(T,{name:`search`,size:14}),z(g.length,`Ask an agent to look into {n} problem`,`Ask an agent to look into {n} problems`)]}),(0,C.jsx)(`span`,{children:R(`Opens a new task you can edit before sending. The agent reports what it finds and changes nothing.`)})]})]})}function ah({entry:e,check:t,confirmed:n,onConfirm:r}){return(0,C.jsxs)(`div`,{className:`references-detail`,children:[(0,C.jsx)(`table`,{children:(0,C.jsx)(`tbody`,{children:e.fields.map(e=>(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{scope:`row`,children:e.name}),(0,C.jsxs)(`td`,{children:[e.value,e.resolved&&(0,C.jsxs)(`span`,{className:`references-resolved`,children:[` = `,e.resolved]})]})]},e.name))})}),(0,C.jsxs)(`p`,{className:`references-where`,children:[e.file,`:`,e.lines[0],`–`,e.lines[1],Ym()||` · `,e.cited.length?z(e.cited.length,`Cited {n} time: {places}`,`Cited {n} times: {places}`,{places:e.cited.map(Xm).join(`; `)}):R(`Not cited in the paper.`)]}),t?.record&&(0,C.jsxs)(`p`,{className:`references-record`,children:[(0,C.jsxs)(`span`,{children:[t.status===`unverified`?R(`Closest record`):R(`Record`),` · `,qm[t.record.source]]}),(0,C.jsx)(`a`,{href:t.record.url,target:`_blank`,rel:`noopener noreferrer`,children:t.record.title}),[t.record.authors.join(`, `),t.record.venue,t.record.year,t.record.doi&&`doi:${t.record.doi}`].filter(Boolean).map((e,t)=>(0,C.jsxs)(`span`,{children:[` · `,e]},t))]}),t&&t.differences.length>0&&(0,C.jsx)(`dl`,{className:`references-differences`,children:t.differences.map((e,n)=>(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`dt`,{children:[Jm(e.field),e.minor?` · ${R(`small`)}`:``]}),(0,C.jsxs)(`dd`,{children:[(0,C.jsx)(`span`,{children:e.bib}),(0,C.jsxs)(`span`,{children:[qm[t.record?.source||``]||R(`Record`),`: `,e.record||`—`]})]})]},n))}),t?.unavailable.length?(0,C.jsx)(`p`,{className:`references-note`,children:R(`{sources} could not be reached.`,{sources:t.unavailable.join(`, `)})}):null,!e.error&&(n?(0,C.jsxs)(`p`,{className:`references-confirmed`,children:[R(`You checked this entry yourself.`),` `,(0,C.jsx)(`button`,{type:`button`,className:`button ghost compact`,onClick:()=>r(!1),children:R(`Undo`)})]}):t?.status!==`verified`&&(0,C.jsxs)(`button`,{type:`button`,className:`button ghost compact`,onClick:()=>r(!0),children:[(0,C.jsx)(T,{name:`check`,size:14}),R(`I checked it myself`)]}))]})}function oh(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function sh(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function ch(){return lh.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var lh={stubThis:e=>e};function uh(e){let{id:t}=e;return{...e,id:sh(t),transports:e.transports,type:e.type}}function dh(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var fh=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function ph({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new fh({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new fh({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new fh({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new fh({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new fh({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new fh({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new fh({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new fh({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!dh(t))return new fh({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new fh({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new fh({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new fh({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var mh=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},hh=[`cross-platform`,`platform`];function gh(e){if(e&&!(hh.indexOf(e)<0))return e}async function _h(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!ch())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:sh(t.challenge),user:{...t.user,id:sh(t.user.id)},excludeCredentials:t.excludeCredentials?.map(uh)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=mh.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw ph({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){vh(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=oh(e))}catch(e){vh(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=oh(c.getAuthenticatorData())}catch(e){vh(`getAuthenticatorData()`,e)}return{id:o,rawId:oh(s),response:{attestationObject:oh(c.attestationObject),clientDataJSON:oh(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:gh(a.authenticatorAttachment)}}function vh(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function yh(){if(!ch())return bh.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?bh.stubThis(new Promise(e=>e(!1))):bh.stubThis(e.isConditionalMediationAvailable())}var bh={stubThis:e=>e};function xh({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new fh({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new fh({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!dh(t))return new fh({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new fh({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new fh({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Sh(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!ch())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(uh));let a={...t,challenge:sh(t.challenge),allowCredentials:i},o={};if(n){if(!await yh())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=mh.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw xh({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=oh(u.userHandle)),{id:c,rawId:oh(l),response:{authenticatorData:oh(u.authenticatorData),clientDataJSON:oh(u.clientDataJSON),signature:oh(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:gh(s.authenticatorAttachment)}}var Ch=e=>e instanceof Error&&(e.name===`NotAllowedError`||e.name===`AbortError`),wh=e=>e instanceof Error?e.message:String(e);function Th({api:e,onSignedIn:t}){let[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(``);async function o(){r(!0),a(``);try{await e(`/auth/verify`,{response:await Sh({optionsJSON:await e(`/auth/options`,{})})}),t()}catch(e){a(Ch(e)?R(`Signing in was cancelled. Try again when you are ready.`):wh(e))}finally{r(!1)}}return(0,C.jsx)(`div`,{className:`home sign-in`,children:(0,C.jsxs)(`div`,{className:`home-inner`,children:[(0,C.jsx)(`img`,{className:`home-logo`,src:Fn,alt:``}),(0,C.jsx)(`h1`,{children:R(`Sign in to Papilot`)}),ch()?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`home-copy`,children:R(`Use the passkey you created from your invite link.`)}),(0,C.jsxs)(`button`,{className:`button primary`,disabled:n,"aria-busy":n,onClick:()=>void o(),children:[(0,C.jsx)(T,{name:`key`,size:16}),R(n?`Waiting for your passkey…`:`Sign in with a passkey`)]})]}):(0,C.jsx)(`p`,{className:`home-copy`,children:R(`This browser cannot use passkeys. Open this page in a current version of Safari, Chrome, Edge or Firefox.`)}),i&&(0,C.jsx)(`p`,{className:`inline-error home-error`,role:`alert`,children:i}),(0,C.jsx)(`p`,{className:`home-copy muted sign-in-help`,children:R(`No passkey on this device? Ask the person who invited you for a new invite link.`)})]})})}function Eh({api:e,onDone:t}){let[n]=(0,S.useState)(()=>location.hash.slice(1)),[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(``);(0,S.useEffect)(()=>{history.replaceState(null,``,`/invite`),n?e(`/auth/invite`,{token:n}).then(i,e=>c(wh(e))):c(R(`This invite link is incomplete. Copy the whole link and open it again.`))},[]);async function l(){o(!0),c(``);try{let r=await _h({optionsJSON:await e(`/auth/invite/options`,{token:n})});await e(`/auth/invite/verify`,{token:n,response:r}),history.replaceState(null,``,`/`),t()}catch(e){c(Ch(e)?R(`Creating the passkey was cancelled. The link still works; try again when you are ready.`):wh(e))}finally{o(!1)}}let u=r?.papers.join(R(`, `))||``;return(0,C.jsx)(`div`,{className:`home sign-in`,children:(0,C.jsxs)(`div`,{className:`home-inner`,children:[(0,C.jsx)(`img`,{className:`home-logo`,src:Fn,alt:``}),(0,C.jsx)(`h1`,{children:r?.adding?R(`Add a passkey`):R(`Join Papilot`)}),r&&(0,C.jsx)(`p`,{className:`home-copy`,children:r.owner?R(`Create a passkey to sign in to your Papilot from anywhere.`):r.adding?R(`Create a passkey on this device to sign in as {name}.`,{name:r.name}):u?R(`{inviter} invited you to work on {papers}. You will appear as {name}.`,{inviter:r.inviter,papers:u,name:r.name}):R(`{inviter} invited you to Papilot. You will appear as {name}.`,{inviter:r.inviter,name:r.name})}),r&&(ch()?(0,C.jsxs)(`button`,{className:`button primary`,disabled:a,"aria-busy":a,onClick:()=>void l(),children:[(0,C.jsx)(T,{name:`key`,size:16}),R(a?`Waiting for your passkey…`:`Create a passkey`)]}):(0,C.jsx)(`p`,{className:`home-copy`,children:R(`This browser cannot use passkeys. Open this page in a current version of Safari, Chrome, Edge or Firefox.`)})),!r&&!s&&(0,C.jsx)(`p`,{className:`home-copy`,role:`status`,children:(0,C.jsx)(`span`,{className:`spinner`})}),s&&(0,C.jsx)(`p`,{className:`inline-error home-error`,role:`alert`,children:s}),r&&(0,C.jsx)(`p`,{className:`home-copy muted sign-in-help`,children:R(`A passkey signs you in with Face ID, Touch ID, Windows Hello or your phone. Papilot never sees a password.`)})]})})}var Dh=!1,Oh=new Set;function kh(e){if(Dh!==e){Dh=e;for(let e of Oh)e()}}var Ah=()=>Dh;function jh(){return(0,S.useSyncExternalStore)(e=>(Oh.add(e),()=>Oh.delete(e)),()=>Dh)}function Mh(){rt();try{for(let e of Object.keys(localStorage))(e.startsWith(`papilot:`)||e.startsWith(`latex-review:`))&&e!==`papilot:theme`&&e!==`papilot:appearance`&&e!==`papilot:language`&&D.removeItem(e)}catch{}}function Nh({model:e,effort:t,fast:n}){return(0,C.jsxs)(`span`,{className:`agent-model-label`,children:[(0,C.jsx)(`span`,{className:`agent-model-name`,children:e}),t&&(0,C.jsx)(`small`,{children:Am(t)}),n&&(0,C.jsx)(T,{name:`bolt`,size:13})]})}function Ph({name:e,runtime:t,reconnecting:n,onReconnect:r}){if(!t||t.connected&&t.authenticated)return null;let i=t.error||``,a=i.split(/:\s|\.\s/)[0],o=t.installed===!1?R(`{agent} was not found on this computer. Install or set it up, then select Reconnect.`,{agent:e}):i?a.length<=120?a:R(`{agent} is unavailable`,{agent:e}):R(`Connecting to {agent}…`,{agent:e});return(0,C.jsxs)(`div`,{className:`agent-connection`,children:[(0,C.jsxs)(`div`,{className:`agent-connection-message`,role:`status`,children:[(0,C.jsx)(T,{name:`alert`,size:15}),(0,C.jsx)(`span`,{children:o})]}),i&&i!==o&&(0,C.jsxs)(`details`,{children:[(0,C.jsx)(`summary`,{children:R(`Connection details`)}),(0,C.jsx)(`p`,{children:i})]}),(0,C.jsxs)(`button`,{type:`button`,disabled:n,onClick:r,children:[(0,C.jsx)(T,{name:`refresh`,size:12}),R(n?`Connecting…`:`Reconnect`)]})]})}var Fh=`papilot:recent-models`;function Ih(){try{let e=JSON.parse(D.getItem(Fh)||`[]`);return Array.isArray(e)?e.filter(e=>e&&typeof e.agent==`string`&&typeof e.model==`string`).slice(0,3):[]}catch{return[]}}function Lh(e,t){let n=[{agent:e,model:t},...Ih().filter(n=>n.agent!==e||n.model!==t)].slice(0,3);D.setItem(Fh,JSON.stringify(n))}function Rh(e){return e?.installed===!1?R(`Not found`):!e||!e.connected&&!e.error?R(`Connecting…`):e.connected?e.authenticated?``:R(`Sign-in required`):R(`Unavailable`)}function zh({agents:e,agent:t,model:n,effort:r,fast:i,reconnecting:a,onReconnect:o,onSelect:s,onChange:c,disabled:l}){let u=(0,S.useId)(),d=(0,S.useRef)(null),f=(0,S.useRef)(null),p=(0,S.useRef)(null),m=(0,S.useRef)(null),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(``),[x,w]=(0,S.useState)(Ih),E=e.find(e=>e.value===t)||e[0],D=E?.runtime,O=D?.models||[],k=O.find(e=>e.id===n)||O.find(e=>e.isDefault),A=E?.label||t,j=k?.name||n||A,M=r||k?.defaultEffort,N=t===`codex`?k?.fastMode:void 0,P=D&&(!D.connected||!D.authenticated),F=[A,j,M?Am(M):``,N&&i?R(`Fast`):``].filter((e,t,n)=>e&&n.indexOf(e)===t).join(` · `),I=e=>{let t=e.runtime?.models||[];return t.length?t.map(t=>({key:`${e.value}\n${t.id}`,agent:e,model:t.id,name:t.name,isDefault:t.isDefault,recent:!1})):[{key:`${e.value}\n`,agent:e,model:``,name:R(`Default model`),isDefault:!1,recent:!1}]},ee=_.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean),L=e=>ee.every(t=>`${e.agent.label} ${e.name} ${e.model}`.toLocaleLowerCase().includes(t)),te=e.map(e=>({option:e,items:I(e).filter(L)})).filter(e=>e.items.length),ne=ee.length?[]:x.flatMap(t=>{let n=e.find(e=>e.value===t.agent),r=n&&I(n).find(e=>e.model===t.model);return r?[{...r,key:`recent\n${r.key}`,recent:!0}]:[]}),z=[...ne,...te.flatMap(e=>e.items)],re=e=>e.agent.value===t&&(e.model===n||!n&&(e.isDefault||e.model===``));function ie(){let e=f.current,t=d.current.getBoundingClientRect();e.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-e.offsetWidth-8))}px`;let n=t.bottom+6,r=t.top-e.offsetHeight-6;e.style.top=`${Math.max(8,Math.min(n+e.offsetHeight>window.innerHeight-8&&r>=8?r:n,window.innerHeight-e.offsetHeight-8))}px`}(0,S.useLayoutEffect)(()=>{h&&ie()},[h,t,n,k]),(0,S.useEffect)(()=>{if(!h)return;let e=()=>f.current?.hidePopover(),t=t=>{t.target instanceof Node&&t.target.contains(d.current)&&!f.current?.contains(t.target)&&e()},n=new ResizeObserver(()=>{f.current?.matches(`:popover-open`)&&ie()});return f.current&&n.observe(f.current),window.addEventListener(`resize`,e),document.addEventListener(`scroll`,t,!0),()=>{n.disconnect(),window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,t,!0)}},[h]),(0,S.useEffect)(()=>{l&&f.current?.hidePopover()},[l]),(0,S.useEffect)(()=>{h&&y&&m.current?.querySelector(`[data-key="${CSS.escape(y)}"]`)?.scrollIntoView({block:`nearest`})},[y,h]);function ae(){v(``),w(Ih()),f.current?.showPopover(),ie(),g(!0);let e=z.find(re);b(e?.key||z[0]?.key||``),requestAnimationFrame(()=>m.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})),window.matchMedia(`(pointer: coarse)`).matches||p.current?.focus()}function oe(e){s(e.agent.value,e.model),Lh(e.agent.value,e.model),b(e.key)}function se(e){if(!z.length)return;let t=z.findIndex(e=>e.key===y);b(z[(t+e+z.length)%z.length].key)}let ce=e=>{let t=re(e),n=Rh(e.agent.runtime);return(0,C.jsxs)(`div`,{id:`${u}-${e.key.replace(/\W/g,`_`)}`,"data-key":e.key,role:`option`,"aria-selected":t,"aria-label":`${e.name} · ${e.agent.label}`,className:`model-option`+(e.key===y?` active`:``),onPointerMove:()=>b(e.key),onClick:()=>oe(e),children:[e.recent&&(0,C.jsx)(or,{name:e.agent.value,size:15}),(0,C.jsx)(`span`,{className:`model-option-name`,children:e.name}),e.isDefault&&!e.recent&&(0,C.jsx)(`small`,{className:`model-option-tag`,children:R(`Default`)}),(e.recent||n)&&(0,C.jsx)(`small`,{className:`model-option-agent`+(n?` warn`:``),children:e.recent?e.agent.label:n}),t&&(0,C.jsx)(T,{name:`check`,size:14})]},e.key)},B=z.find(e=>e.key===y);return(0,C.jsxs)(`span`,{className:`agent-picker`,children:[(0,C.jsxs)(`button`,{ref:d,type:`button`,className:`agent-picker-trigger`,"aria-label":R(`Agent settings`),title:F+(P?` · ${R(`{agent} is unavailable`,{agent:A})}`:``),"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":u,disabled:l,onClick:()=>f.current?.matches(`:popover-open`)?f.current.hidePopover():ae(),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),ae())},children:[(0,C.jsx)(or,{name:t,size:15}),j!==A&&(0,C.jsx)(`span`,{className:`agent-picker-agent`,children:A}),(0,C.jsx)(Nh,{model:j,effort:M,fast:!!(N&&i)}),(0,C.jsx)(T,{name:`chevronDown`,size:13}),P&&(0,C.jsx)(`span`,{className:`agent-status-mark`,children:(0,C.jsx)(T,{name:`alert`,size:13})})]}),(0,C.jsxs)(`div`,{ref:f,id:u,popover:`auto`,role:`dialog`,"aria-label":R(`Agent settings`),className:`agent-picker-panel`,onToggle:e=>{let t=e.nativeEvent.newState===`open`;g(t),t||document.activeElement&&document.activeElement!==document.body&&!f.current?.contains(document.activeElement)||d.current?.focus()},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f.current?.hidePopover(),d.current?.focus())},children:[(0,C.jsxs)(`label`,{className:`model-search`,children:[(0,C.jsx)(T,{name:`search`,size:14}),(0,C.jsx)(`input`,{ref:p,type:`search`,value:_,placeholder:R(`Search models`),"aria-label":R(`Search models`),role:`combobox`,"aria-expanded":`true`,"aria-controls":`${u}-list`,"aria-autocomplete":`list`,"aria-activedescendant":B?`${u}-${B.key.replace(/\W/g,`_`)}`:void 0,onChange:t=>{v(t.target.value);let n=t.target.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean),r=e.flatMap(I).find(e=>n.every(t=>`${e.agent.label} ${e.name} ${e.model}`.toLocaleLowerCase().includes(t)));b(r?.key||``)},onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),se(e.key===`ArrowDown`?1:-1)):e.key===`Enter`&&B&&(e.preventDefault(),oe(B))}})]}),(0,C.jsxs)(`div`,{ref:m,id:`${u}-list`,role:`listbox`,"aria-label":R(`Models`),className:`model-list`,children:[ne.length>0&&(0,C.jsxs)(`div`,{role:`group`,"aria-label":R(`Recent`),className:`model-group`,children:[(0,C.jsx)(`div`,{className:`model-group-head`,"aria-hidden":`true`,children:R(`Recent`)}),ne.map(ce)]}),te.map(e=>(0,C.jsxs)(`div`,{role:`group`,"aria-label":e.option.label,className:`model-group`,children:[(0,C.jsxs)(`div`,{className:`model-group-head`,"aria-hidden":`true`,children:[(0,C.jsx)(or,{name:e.option.value,size:15}),e.option.label]}),e.items.map(ce)]},e.option.value)),!z.length&&(0,C.jsx)(`p`,{className:`model-empty`,children:R(`No models match “{query}”`,{query:_.trim()})})]}),(0,C.jsx)(Ph,{name:A,runtime:D,reconnecting:a,onReconnect:o},t),k?.efforts.length?(0,C.jsx)(Mm,{efforts:k.efforts,value:r,fallback:k.defaultEffort,onChange:e=>c({effort:e})}):null,N&&(0,C.jsxs)(`label`,{className:`agent-fast`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsxs)(`strong`,{children:[(0,C.jsx)(T,{name:`bolt`,size:14}),R(`Fast mode`)]}),(0,C.jsx)(`small`,{children:N.description||R(`Faster responses; may use more of your limit.`)})]}),(0,C.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-label":R(`Fast mode`),checked:i,onChange:e=>c({fast:e.target.checked})})]})]})]})}var Bh=`high`;function Vh(e,t){return e===``?``:e&&(!t||t.efforts.includes(e))?e:t?.efforts.includes(Bh)?Bh:``}function Hh({task:e,sidebarShown:t,onArrive:n}){let r=(0,S.useRef)(null);return(0,S.useLayoutEffect)(()=>{let i=r.current,a=matchMedia(`(prefers-reduced-motion: reduce)`);t&&document.querySelector(`.task-list`)?.scrollTo({top:0,behavior:`instant`});let o=t?document.querySelector(`.task-row[data-task="${CSS.escape(e.id)}"]`):[...document.querySelectorAll(`.sidebar-toggle`)].find(e=>e.getBoundingClientRect().width>0);if(!i||!o||a.matches){n(e);return}let s=o.getBoundingClientRect(),c=e.source;if(!s.width||!c.width){n(e);return}let l=Math.min(c.width,360);i.style.width=`${l}px`;let u={x:c.left+c.width/2-l/2,y:c.top+Math.min(c.height/2,64)-32},d={x:s.left,y:s.top},f=s.width/l,p=s.height/64,m=Math.min(150,Math.abs(d.x-u.x)*.16+40),h=[0,.12,.35,.65,.85,1].map(e=>{let n=Math.max(0,(e-.12)/.88),r=u.x+(d.x-u.x)*n,i=Math.max(8,u.y+(d.y-u.y)*n-Math.sin(e*Math.PI)*m),a=n*n;return{offset:e,transform:`translate(${r}px, ${i}px) rotate(${-5*Math.sin(e*Math.PI)}deg) scale(${1+(f-1)*a}, ${1+(p-1)*a})`,opacity:t?1:1-n**5}}),g=!0,_=()=>{g&&(g=!1,n(e))},v=i.animate(h,{duration:1100,easing:`cubic-bezier(.4,0,.2,1)`,fill:`both`});return window.addEventListener(`resize`,_),a.addEventListener(`change`,_),v.finished.then(_,()=>{}),()=>{g=!1,v.cancel(),window.removeEventListener(`resize`,_),a.removeEventListener(`change`,_)}},[e,t,n]),(0,Ne.createPortal)((0,C.jsxs)(`div`,{ref:r,className:`task-flight`,"aria-hidden":`true`,children:[(0,C.jsx)(`span`,{className:`task-flight-icon`,children:(0,C.jsx)(T,{name:`paper`,size:19})}),(0,C.jsx)(`span`,{className:`task-flight-title`,children:e.title}),(0,C.jsx)(T,{name:`arrowUp`,size:17})]}),document.body)}function Uh(e,t,n,r,i,a){let[o,s]=(0,S.useState)(()=>{let t=Number(D.getItem(e));return Number.isFinite(t)&&t>0?t:0}),c=(0,S.useRef)(null),l=(0,S.useRef)(null),[u,d]=(0,S.useState)({current:300,max:300}),f=()=>{l.current=null,document.body.classList.remove(`resizing`)};(0,S.useEffect)(()=>{o?D.setItem(e,String(o)):D.removeItem(e)},[e,o]),(0,S.useLayoutEffect)(()=>{let e=c.current?.parentElement,t=e?.querySelector(n);if(!i||!e||!t)return;let r=new ResizeObserver(()=>d({current:Math.round(t.getBoundingClientRect().width),max:Math.max(300,Math.floor(e.getBoundingClientRect().width-360))}));return r.observe(e),r.observe(t),()=>{r.disconnect(),f()}},[i,n]);let p=e=>Math.round(Math.max(300,Math.min(e,u.max))),m=()=>c.current?.parentElement?.querySelector(n)?.getBoundingClientRect().width??u.current,h=e=>{s(e),a?.()};return{style:o?{[t]:`${o}px`}:void 0,resizer:i&&(0,C.jsx)(`div`,{ref:c,className:`panel-resizer manuscript-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":r,"aria-valuenow":u.current,"aria-valuemin":300,"aria-valuemax":u.max,tabIndex:0,title:R(`Drag to resize · Double-click to reset`),onPointerDown:e=>{e.button!==0||l.current||(e.preventDefault(),e.currentTarget.focus(),l.current={x:e.clientX,width:m()},e.currentTarget.setPointerCapture(e.pointerId),document.body.classList.add(`resizing`))},onPointerMove:e=>{l.current&&h(p(l.current.width+l.current.x-e.clientX))},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),f()},onPointerCancel:f,onLostPointerCapture:f,onDoubleClick:()=>h(0),onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault(),h(0);return}let t=m(),n=e.key===`ArrowLeft`?t+24:e.key===`ArrowRight`?t-24:e.key===`Home`?u.max:e.key===`End`?300:null;n!==null&&(e.preventDefault(),h(p(n)))}})}}var Wh=(0,S.lazy)(()=>On(()=>import(`./pdf-view-Bnb2uIBE.js`).then(e=>({default:e.PdfView})),[])),Gh=``,Kh=()=>crypto.randomUUID?.()||Array.from(crypto.getRandomValues(new Uint8Array(20)),e=>e.toString(16).padStart(2,`0`)).join(``);async function $(e,t,n,r=t===void 0?15e3:3e4){let i=AbortSignal.timeout(r);try{let r=await fetch(`/api`+e,{method:t===void 0?`GET`:`POST`,headers:{"Content-Type":t instanceof File?`application/octet-stream`:`application/json`,"X-Papilot-Token":Gh,...t instanceof File?{"X-Papilot-Filename":encodeURIComponent(t.name)}:{}},...t===void 0?{}:{body:t instanceof File?t:JSON.stringify(t)},signal:n?AbortSignal.any([n,i]):i});if(r.status===401&&(!e.startsWith(`/auth/`)||e===`/auth/logout`))throw kh(!0),Error(R(`Sign in to continue.`));let a=await r.json();if(!r.ok)throw Error(a.error||R(`Request failed. Please try again.`));return a}catch(e){throw i.aborted?Error(R(t===void 0?`The connection is taking too long. Check your network and try again.`:`The request timed out and may still be processing. Check the task status before retrying.`)):e}}var qh=(e,t,n)=>$(`/projects/${e}/attachments`,t,n,12e4),Jh=e=>$(`/runtime/latex`,void 0,e,3e4),Yh=(e,t)=>$(`/diagnostics`,{projectId:e},t,6e4),Xh=he,Zh=e=>Xh[e.agent||`codex`]||`Codex`,Qh=e=>e.status===`reviewing`&&e.review?.round===null&&e.review.state!==`build_failed`&&!e.review.counts.pending,$h=()=>({idle:R(`Ready`),queued:R(`Queued`),waiting_input:R(`Needs your reply`),building:R(`Preparing task results`),reviewing:R(`Ready for review`),interrupted:R(`Paused`),failed:R(`Needs attention`),uncertain:R(`Check task status`),deleting:R(`Deleting task`)}),eg=[`running`,`waiting_input`,`queued`];function tg({task:e}){let t=Qh(e),n=e.status===`reviewing`&&e.review?.state===`done`,r=Bm(e);return(0,C.jsxs)(`span`,{className:`status ${e.status}${n||t?` done`:``}`,children:[(0,C.jsx)(`i`,{}),r===`pushed`?R(`Committed and pushed`):r===`committed`?R(`Committed`):r===`applied`?R(`Applied to working directory`):t?R(`Completed`):n?R(`Review complete`):e.status===`running`?R(`{agent} is working`,{agent:Zh(e)}):$h()[e.status]||e.status]})}function ng(e){return new Date(e).toLocaleTimeString(te(),{hour:`2-digit`,minute:`2-digit`})}function rg(e){let t=Math.floor((Date.now()-e)/6e4);return t<1?R(`now`):t<60?R(`{n}m`,{n:t}):t<1440?R(`{n}h`,{n:Math.floor(t/60)}):t<10080?R(`{n}d`,{n:Math.floor(t/1440)}):new Date(e).toLocaleDateString(te(),{month:`short`,day:`numeric`})}var ig=e=>Date.now()-e<6e4?R(`just now`):R(`{time} ago`,{time:rg(e)}),ag=()=>window.matchMedia(`(pointer: coarse)`).matches;function og(e){let[t,n]=(0,S.useState)(()=>window.matchMedia(e).matches);return(0,S.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function sg({label:e,value:t,placeholder:n,onChange:r,onSubmit:i,readOnly:a,autoFocus:o,inputRef:s,footer:c,action:l,large:u,skills:d,skill:f,onSkill:p,attachments:m,upload:h,filesDisabled:g,imageHint:_}){let v=(0,S.useRef)(null),y=s||v,b=(0,S.useRef)(null),x=(0,S.useRef)(0),[w,T]=(0,S.useState)(!1),E=!(!m||!h||a||g);function D(e){E&&e.length&&(m.add(e,h),y.current?.focus())}let O=(0,S.useId)(),[k,A]=(0,S.useState)(null),[j,M]=(0,S.useState)(0),N=d?.length&&p&&!a?Xe(t):null,P=N!==null&&k!==t,F=P?Ze(d,N):[];(0,S.useEffect)(()=>M(0),[N]),(0,S.useEffect)(()=>{k!==null&&t!==k&&A(null)},[t,k]),(0,S.useLayoutEffect)(()=>{let e=y.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[y,t]),(0,S.useEffect)(()=>{o&&!ag()&&y.current?.focus()},[o,y]);function I(e){p?.(e),r(``),y.current?.focus()}function ee(e){if(P&&!e.nativeEvent.isComposing&&e.keyCode!==229){if((e.key===`ArrowDown`||e.key===`ArrowUp`)&&F.length){e.preventDefault(),M(t=>(t+(e.key===`ArrowDown`?1:F.length-1))%F.length);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&F.length){e.preventDefault(),I(F[Math.min(j,F.length-1)]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),A(t);return}}e.key===`Backspace`&&f&&p&&!t&&!a?(e.preventDefault(),p(null)):Ce(e.nativeEvent,ag())&&(e.preventDefault(),i())}return(0,C.jsxs)(`form`,{className:`composer`+(u?` large`:``)+(w?` dragging`:``),onDragEnter:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),E&&++x.current===1&&T(!0))},onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=E?`copy`:`none`)},onDragLeave:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),--x.current<=0&&(x.current=0,T(!1)))},onDrop:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),x.current=0,T(!1),D(Array.from(e.dataTransfer.files)))},onPaste:e=>{let n=Array.from(e.clipboardData.files);if(n.length){e.preventDefault(),D(n);let i=e.clipboardData.getData(`text/plain`);if(E&&i&&y.current){let e=y.current;r(t.slice(0,e.selectionStart)+i+t.slice(e.selectionEnd))}}},onSubmit:e=>{e.preventDefault(),i()},onPointerDown:e=>{e.target===e.currentTarget&&(e.preventDefault(),y.current?.focus())},children:[m&&h&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`input`,{ref:b,type:`file`,multiple:!0,hidden:!0,"aria-label":R(`Choose attachments`),disabled:!E,onChange:e=>{D(Array.from(e.target.files||[])),e.target.value=``}}),(0,C.jsx)(ct,{draft:m,upload:h,discard:e=>{$(`/projects/${e.projectId}/attachments/${e.id}/discard`,{}).catch(()=>{})},disabled:a||g})]}),w&&(0,C.jsx)(`div`,{className:`attachment-drop-hint`,children:R(`Drop files to attach`)}),_&&(0,C.jsx)(`p`,{className:`attachment-agent-hint`,children:R(`Antigravity opens images through its file tools. For direct image input, choose Codex or Claude.`)}),P&&(0,C.jsx)(Qe,{id:O,skills:F,active:j,onActive:M,onPick:I}),f&&(0,C.jsx)(`div`,{className:`composer-skill`,children:(0,C.jsx)($e,{skill:f,onRemove:p&&!a?()=>{p(null),y.current?.focus()}:void 0})}),(0,C.jsx)(`textarea`,{ref:y,rows:1,"aria-label":e,maxLength:2e4,placeholder:f?f.source!==`builtin`&&f.hint||R(`Details (optional)`):n,value:t,readOnly:a,onChange:e=>r(e.target.value),onKeyDown:ee,...p&&d?.length?{"aria-autocomplete":`list`,"aria-controls":P?O:void 0,"aria-activedescendant":P&&F.length?`${O}-${Math.min(j,F.length-1)}`:void 0}:{}}),(0,C.jsxs)(`div`,{className:`composer-footer`,children:[typeof c==`function`?c(()=>b.current?.click()):c,l]})]})}function cg({request:e,agent:t,answerDrafts:n,onDone:r}){let[i,a]=(0,S.useState)(()=>n.get(e.id)||{});function o(t){n.set(e.id,t),a(t)}let[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),d=e.method.endsWith(`requestUserInput`)&&e.params.questions||[];async function f(t){c(!0),u(``);try{await $(`/requests/`+e.id,{decision:t,answers:i}),n.delete(e.id),r()}catch(e){u(e.message)}finally{c(!1)}}return(0,C.jsxs)(`div`,{className:`request-card`,children:[(0,C.jsxs)(`h3`,{children:[(0,C.jsx)(T,{name:d.length?`chat`:`alert`,size:16}),d.length?R(`{agent} needs your input`,{agent:t}):R(`Approve this action`)]}),d.map(e=>(0,C.jsxs)(`fieldset`,{className:`question`,children:[(0,C.jsx)(`legend`,{children:e.question||e.header}),e.options?.length>0&&(0,C.jsx)(`div`,{className:`answer-options`,children:e.options.map(t=>(0,C.jsxs)(`button`,{type:`button`,disabled:s,"aria-pressed":i[e.id]===t.label,className:i[e.id]===t.label?`selected`:``,onClick:()=>o({...i,[e.id]:t.label}),children:[t.label,t.description&&(0,C.jsx)(`small`,{children:t.description})]},t.label))}),!(e.isOther===!1&&e.options?.length>0)&&(0,C.jsx)(`input`,{disabled:s,"aria-label":e.question||e.header,placeholder:R(`Or type your own answer`),value:i[e.id]||``,onChange:t=>o({...i,[e.id]:t.target.value})})]},e.id)),!d.length&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{children:e.params.reason||R(`{agent} is requesting permission for this action.`,{agent:t})}),(0,C.jsx)(`pre`,{children:e.params.command||(e.params.permissions?JSON.stringify(e.params.permissions,null,2):e.params.grantRoot||R(`Apply file changes`))})]}),l&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:l}),(0,C.jsxs)(`div`,{className:`button-row`,children:[!d.length&&(0,C.jsx)(`button`,{disabled:s,className:`button secondary`,onClick:()=>void f(`decline`),children:R(`Decline`)}),(0,C.jsx)(`button`,{disabled:s||d.some(e=>!i[e.id]?.trim()),className:`button primary`,onClick:()=>void f(d.length?void 0:`accept`),children:s?R(`Submitting…`):d.length?R(`Reply to {agent}`,{agent:t}):R(`Allow this action`)})]})]})}function lg({text:e}){let[t,n]=(0,S.useState)(!1);(0,S.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1600);return()=>clearTimeout(e)},[t]);async function r(){try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement(`textarea`);t.value=e,t.readOnly=!0,t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove()}n(!0)}return(0,C.jsxs)(`button`,{type:`button`,className:`message-action`,"aria-label":R(t?`Copied`:`Copy message`),onClick:()=>void r(),children:[(0,C.jsx)(T,{name:t?`check`:`copy`,size:14}),(0,C.jsx)(`span`,{children:R(t?`Copied`:`Copy`)})]})}var ug=e=>e.match(/^\/bin\/(?:ba|z)?sh -lc (['"])([\s\S]*)\1$/)?.[2]??e,dg=(e,t)=>t&&e.startsWith(t+`/`)?e.slice(t.length+1):e,fg=(e,t)=>e.text.split(`
256
- `).filter(Boolean).map(e=>dg(e,t)),pg=e=>e.status===`inProgress`?`running`:e.status&&e.status!==`completed`?`failed`:``,mg=(0,S.createContext)(null);function hg(e){let t=(0,S.useContext)(mg),n=!t||(e?e.id===t.id:t.role===`owner`);return{mine:n,name:n?``:e?.name||t?.owner||``}}var gg=(e,t)=>e.mine?R(`You, {time}`,{time:ng(t)}):R(`{name}, {time}`,{name:e.name,time:ng(t)}),_g=({sender:e})=>e.mine?null:(0,C.jsx)(`div`,{className:`message-author`,children:e.name});function vg({item:e,notes:t}){let n=hg(e.meta?.author),r=Bt(),i=(t,n)=>(0,C.jsxs)(`li`,{"data-note-result":`${e.id}:${n}`,tabIndex:-1,className:r?.selected===`${e.id}:${n}`?`linked-note-selected`:``,children:[(0,C.jsxs)(`span`,{className:`sent-note-where`,children:[(0,C.jsx)(`span`,{className:`sent-note-number`,"aria-hidden":`true`,children:n+1}),(0,C.jsx)(`span`,{className:`sent-note-location`,children:ut(t.where)})]}),t.quote?(0,C.jsx)(`blockquote`,{children:t.quote}):(0,C.jsx)(`span`,{className:`sent-note-region`,children:R(`Marked region`)}),t.comment&&(0,C.jsx)(`p`,{children:t.comment}),(0,C.jsx)(Ht,{noteKey:`${e.id}:${n}`})]},n);return(0,C.jsxs)(`article`,{className:`message user notes-message`,"aria-label":gg(n,e.createdAt),children:[(0,C.jsx)(_g,{sender:n}),(0,C.jsxs)(`div`,{className:`message-body`,title:ng(e.createdAt),children:[e.meta?.skill&&(0,C.jsx)($e,{skill:e.meta.skill}),e.meta?.notes&&e.text&&(0,C.jsx)(`p`,{className:`notes-request`,children:e.text}),(0,C.jsxs)(`div`,{className:`sent-notes-head`,children:[(0,C.jsx)(T,{name:`notes`,size:14}),t.some(e=>e.group)?R(`PDF annotations`):z(t.length,`Note on the PDF`,`{n} notes on the PDF`)]}),_(t).map(({group:t,entries:n})=>(0,C.jsxs)(ce,{group:t,count:n.length,active:n.some(({index:t})=>r?.selected===`${e.id}:${t}`),children:[e.meta?.groupInstructions?.[t]&&(0,C.jsx)(`p`,{className:`group-instruction-sent`,children:e.meta.groupInstructions[t]}),(0,C.jsx)(`ol`,{className:`sent-notes`,children:n.map(({note:e,index:t})=>i(e,t))})]},t)),(0,C.jsx)(`ol`,{className:`sent-notes`,children:t.map((e,t)=>!e.group&&i(e,t))}),(0,C.jsx)(lt,{files:e.meta?.attachments})]})]})}function yg({feedback:e}){let t=[e.accepted&&[`accepted`,R(`{n} accepted`,{n:e.accepted})],e.rejected&&[`rejected`,R(`{n} rejected`,{n:e.rejected})],e.comments.length&&[`commented`,z(e.comments.length,`{n} comment`,`{n} comments`)],e.undone&&[`undone`,R(`{n} undone`,{n:e.undone})],e.buildError&&[`failed`,R(`build error`)]].filter(Boolean);return(0,C.jsxs)(C.Fragment,{children:[t.length>0&&(0,C.jsx)(`div`,{className:`feedback-counts`,children:t.map(([e,t])=>(0,C.jsx)(`span`,{className:e,children:t},e))}),e.comments.length>0&&(0,C.jsx)(`ol`,{className:`sent-notes`,children:e.comments.map((e,t)=>(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`span`,{className:`sent-note-where`,children:ut(e.where)}),(0,C.jsx)(`p`,{children:e.text})]},t))})]})}function bg({item:e,agent:t}){let n=hg(e.meta?.author),r=e.meta?.notes||Be(e.text);if(r)return(0,C.jsx)(vg,{item:e,notes:r});let{skill:i,feedback:a,sendsFeedback:o,build:s}=e.meta||{};return s?(0,C.jsx)(`article`,{className:`message user notes-message build-message`,"aria-label":R(`Papilot sent the build error to {agent}, {time}`,{agent:t,time:ng(e.createdAt)}),children:(0,C.jsxs)(`div`,{className:`message-body`,title:ng(e.createdAt),children:[(0,C.jsxs)(`div`,{className:`sent-notes-head`,children:[(0,C.jsx)(T,{name:`alert`,size:14}),R(`Build failed · sent to {agent}`,{agent:t})]}),(0,C.jsx)(`p`,{className:`build-error`,children:[s.error,...s.details].join(`
257
- `)})]})}):o||ve(e.text)?(0,C.jsxs)(`article`,{className:`message user notes-message`,"aria-label":n.mine?R(`You sent review feedback, {time}`,{time:ng(e.createdAt)}):R(`{name} sent review feedback, {time}`,{name:n.name,time:ng(e.createdAt)}),children:[(0,C.jsx)(_g,{sender:n}),(0,C.jsxs)(`div`,{className:`message-body`,title:ng(e.createdAt),children:[(0,C.jsxs)(`div`,{className:`sent-notes-head`,children:[(0,C.jsx)(T,{name:`paper`,size:14}),R(`Review feedback`)]}),a&&(0,C.jsx)(yg,{feedback:a})]})]}):(0,C.jsxs)(`article`,{className:`message user`,"aria-label":gg(n,e.createdAt),children:[(0,C.jsx)(_g,{sender:n}),(0,C.jsxs)(`div`,{className:`message-body`,title:ng(e.createdAt),children:[i&&(0,C.jsx)($e,{skill:i}),i&&e.text?`
258
- `:``,e.text,(0,C.jsx)(lt,{files:e.meta?.attachments}),a&&(0,C.jsxs)(`details`,{className:`feedback-attachment`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(T,{name:`paper`,size:13}),R(`With review feedback`)]}),(0,C.jsx)(yg,{feedback:a})]})]})]})}function xg({item:e,agent:t,root:n}){if(e.type===`user`)return(0,C.jsx)(bg,{item:e,agent:t});if(e.type===`assistant`)return(0,C.jsxs)(`article`,{className:`message assistant`,"aria-label":`${t}, ${ng(e.createdAt)}`,children:[(0,C.jsx)(`div`,{className:`message-body markdown`,children:(0,C.jsx)(ym,{text:e.text})}),(0,C.jsxs)(`div`,{className:`message-actions`,children:[(0,C.jsx)(lg,{text:e.text}),(0,C.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:ng(e.createdAt)})]})]});let r=e.type===`files`?fg(e,n):[],i=e.type===`command`?ug(e.text)||R(`Run command`):e.type===`files`?r.length===1?R(`Edited {file}`,{file:r[0]}):R(`Edited {n} files`,{n:r.length}):e.type===`pdf`?e.text?R(`Viewed the PDF: {places}`,{places:e.text}):R(`Viewed the PDF`):e.text||R(`Run tool`),a=e.type===`files`?r.join(`
259
- `):e.detail,o=pg(e);return(0,C.jsxs)(`details`,{className:`tool-item `+o,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(T,{name:e.type===`command`?`terminal`:e.type===`files`?`diff`:e.type===`pdf`?`pdf`:`tool`,size:14}),(0,C.jsx)(`span`,{className:`tool-label`,children:i}),o===`running`?(0,C.jsx)(`span`,{className:`spinner`,"aria-label":R(`Running`)}):o&&(0,C.jsx)(`span`,{className:`tool-status`,children:e.status===`declined`?R(`Declined`):R(`Failed`)})]}),a&&(0,C.jsx)(`pre`,{children:a})]})}function Sg({items:e,agent:t,root:n}){let r=e.filter(e=>e.type===`command`).length,i=e.filter(e=>e.type===`files`),a=e.filter(e=>e.type===`pdf`).length,o=[...new Set(i.flatMap(e=>fg(e,n)))],s=e.length-r-i.length-a,c=e.some(e=>pg(e)===`running`),l=e.filter(e=>pg(e)===`failed`).length,u=[r?z(r,`ran {n} command`,`ran {n} commands`):``,o.length?o.length===1?R(`edited {file}`,{file:o[0]}):R(`edited {n} files`,{n:o.length}):``,a?R(`viewed the PDF`):``,s?z(s,`used {n} tool`,`used {n} tools`):``].filter(Boolean).join(R(`, `));return(0,C.jsxs)(`details`,{className:`tool-group`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(T,{name:r?`terminal`:o.length?`diff`:`tool`,size:14}),(0,C.jsx)(`span`,{className:`tool-group-label`,children:u[0].toUpperCase()+u.slice(1)}),c?(0,C.jsx)(`span`,{className:`spinner`,"aria-label":R(`Running`)}):l?(0,C.jsx)(`span`,{className:`tool-status`,children:R(`{n} failed`,{n:l})}):null,(0,C.jsx)(T,{name:`chevronDown`,size:13})]}),(0,C.jsx)(`div`,{className:`tool-group-items`,children:e.map(e=>(0,C.jsx)(xg,{item:e,agent:t,root:n},e.id))})]})}function Cg(e){let t=[];for(let n of e){let e=n.type!==`user`&&n.type!==`assistant`,r=t[t.length-1];e&&r&&r[0].type!==`user`&&r[0].type!==`assistant`?r.push(n):t.push([n])}return t}function wg({task:e,models:t,skills:n,composer:r,answerDrafts:i,items:a,loading:o,loadError:s,retry:c,requests:l,refresh:u,reportError:d,pause:f,pausing:p,openReview:m,feedback:h,connection:g,tools:_,lead:v}){let y=(0,S.useRef)(null),{text:b,sending:x,sendingSource:w}=(0,S.useSyncExternalStore)(r.subscribe,r.getSnapshot),E=it(`papilot:files:${(0,S.useContext)(mg)?.id||`owner`}:task:${e.id}`),[D,O]=(0,S.useState)(null);(0,S.useEffect)(()=>O(e=>e&&n.find(t=>t.id===e.id)||null),[n]);let k=(0,S.useRef)(null),A=(0,S.useRef)(!0),[j,M]=(0,S.useState)(!0),N=Bt();(0,S.useLayoutEffect)(()=>{N?.selected&&(A.current=!1,M(!1))},[N?.selected,N?.reveal]);function P(){A.current=!0,M(!0),k.current&&(k.current.scrollTop=k.current.scrollHeight)}(0,S.useEffect)(()=>{A.current&&P()},[a,l]),(0,S.useEffect)(()=>{if(!k.current)return;let e=new ResizeObserver(()=>{A.current&&P()});return e.observe(k.current),()=>e.disconnect()},[]);async function F(t){if(r.sending||[`uncertain`,`deleting`].includes(e.status)||t===`draft`&&E.draft.getSnapshot().blocked)return;let n=t===`draft`?D:null,i=t===`draft`?E.draft.getSnapshot().files:[],a=r.submit(t,t=>$(`/tasks/`+e.id+`/messages`,t),n?.id,i.map(e=>e.id));try{await a&&(E.draft.clear(i),A.current=!0,n&&O(e=>e===n?null:e),u())}catch(e){d(e)}}let I=eg.includes(e.status),ee=[`uncertain`,`deleting`].includes(e.status),L=be(e.review),te=e.status===`deleting`?R(`This task is being deleted`):e.status===`uncertain`?R(`Check task status before sending`):w===`feedback`?R(`Sending feedback…`):x?R(`Sending…`):L?z(L,`{n} review update will be sent with this message`,`{n} review updates will be sent with this message`):I?R(`{agent} is working · new instructions run next`,{agent:Zh(e)}):``,ne=t.find(t=>t.id===e.model)||(e.model?void 0:t.find(e=>e.isDefault)),re=ne?.name||e.model||R(`Default model`);return(0,C.jsxs)(`section`,{id:`conversation-panel`,className:`activity-panel`,"aria-label":R(`{agent} conversation`,{agent:Zh(e)}),children:[(0,C.jsxs)(`div`,{className:`panel-heading`,children:[v,_&&(0,C.jsx)(`div`,{className:`panel-tools`,children:_})]}),(0,C.jsxs)(`div`,{className:`conversation-history`,children:[(0,C.jsx)(`div`,{className:`messages`,ref:k,onScroll:()=>{if(k.current){let e=k.current;A.current=e.scrollHeight-e.scrollTop-e.clientHeight<90,M(A.current)}},children:(0,C.jsxs)(`div`,{className:`thread`,children:[o&&(0,C.jsx)(`p`,{className:`muted`,role:`status`,children:R(`Loading conversation…`)}),s&&(0,C.jsxs)(`div`,{className:`conversation-error`,role:`alert`,children:[(0,C.jsx)(`p`,{children:s}),(0,C.jsx)(`button`,{className:`button secondary compact`,onClick:c,children:R(`Retry conversation`)})]}),Cg(a.filter(e=>e.type!==`reviewOutput`).map(t=>e.mode===`review`&&t.type===`assistant`?{...t,text:ye(t.text)}:t)).map(t=>t.length>1?(0,C.jsx)(Sg,{items:t,agent:Zh(e),root:e.worktree},t[0].id):(0,C.jsx)(xg,{item:t[0],agent:Zh(e),root:e.worktree},t[0].id)),l.map(t=>(0,C.jsx)(cg,{request:t,agent:Zh(e),answerDrafts:i,onDone:u},t.id)),e.status===`running`&&(0,C.jsxs)(`div`,{className:`working`,children:[(0,C.jsxs)(`span`,{className:`working-dots`,children:[(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{}),(0,C.jsx)(`i`,{})]}),R(`{agent} is working on this task`,{agent:Zh(e)})]}),e.status===`queued`&&(0,C.jsx)(`p`,{className:`muted`,children:R(`Task saved. Waiting for an available {agent} session.`,{agent:Zh(e)})}),m&&e.status===`reviewing`&&e.review?.counts?.pending?(0,C.jsxs)(`div`,{className:`review-ready`,children:[(0,C.jsx)(T,{name:`paper`,size:16}),(0,C.jsx)(`span`,{children:z(e.review.counts.pending,`{n} change to review`,`{n} changes to review`)}),(0,C.jsx)(`button`,{className:`button secondary compact`,onClick:m,children:R(`Open review`)})]}):null,h,e.error&&(0,C.jsxs)(`div`,{className:`task-error`,children:[(0,C.jsx)(T,{name:`alert`,size:16}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`strong`,{children:R(`This step needs attention`)}),(0,C.jsx)(`p`,{children:e.error})]})]})]})}),!j&&(0,C.jsxs)(`button`,{className:`jump-latest`,onClick:P,children:[(0,C.jsx)(T,{name:`arrowDown`,size:14}),R(`Latest messages`)]})]}),(0,C.jsxs)(`div`,{className:`composer-wrap`,children:[g,(0,C.jsx)(sg,{attachments:e.mode===`review`?void 0:E.draft,upload:(t,n)=>qh(e.projectId,t,n),filesDisabled:x||ee,imageHint:e.agent===`antigravity`&&E.files.some(e=>e.mime.startsWith(`image/`)),inputRef:y,label:R(`Instructions for {agent}`,{agent:Zh(e)}),value:b,onChange:e=>r.edit(e),onSubmit:()=>void F(`draft`),placeholder:e.mode===`review`?R(`Ask for another review of this PDF version…`):R(I?`Queue instructions for the next turn…`:`Ask a question or request changes…`),skills:e.mode===`review`?[]:n.filter(e=>e.output!==`annotations`),skill:D,onSkill:O,footer:t=>(0,C.jsxs)(`div`,{className:`composer-options`,children:[e.mode!==`review`&&(0,C.jsx)(et,{onAttach:t,skills:n.filter(e=>e.output!==`annotations`),selected:D,disabled:x||ee,onPick:e=>{O(e),y.current?.focus()}}),(0,C.jsx)(`span`,{className:`composer-model`,title:`${Zh(e)} · ${e.model?re:ne?R(`the default model on this host ({model})`,{model:ne.name}):R(`the default model on this host`)}`,children:(0,C.jsx)(Nh,{model:re,effort:e.effort||ne?.defaultEffort,fast:!!(e.serviceTier&&e.serviceTier!=="default")})})]}),action:(0,C.jsxs)(`div`,{className:`composer-actions`,children:[I&&(0,C.jsx)(`button`,{type:`button`,className:`send-button stop`,"aria-label":R(`Pause task`),title:R(`Pause {agent}`,{agent:Zh(e)}),disabled:p,"aria-busy":p,onClick:f,children:(0,C.jsx)(T,{name:`stop`,size:18})}),(!I||b.trim()||D||E.entries.length||x)&&(0,C.jsx)(`button`,{"aria-label":R(`Send instructions`),title:R(`Send (Enter) · New line (Shift+Enter)`),disabled:!b.trim()&&!D&&!E.files.length||E.blocked||x||ee,className:`send-button`,type:`submit`,children:(0,C.jsx)(T,{name:`arrowUp`,size:18})})]})}),te&&(0,C.jsx)(`p`,{className:`composer-hint`,role:`status`,children:te})]})]})}function Tg(e,t){if(e.deferred)return e.status===`reviewing`&&!e.pendingReview&&!e.review?.counts?.pending&&e.review?.files||[];if(!Array.isArray(t?.files)||t.merging||e.status!==`reviewing`||e.review?.counts?.pending)return[];let n=new Set(t.files.map(e=>e.path));return(e.review?.files||[]).filter(e=>n.has(e))}function Eg({task:e,composer:t,refresh:n,reportError:r,onSent:i,card:a}){let{sending:o,sendingSource:s}=(0,S.useSyncExternalStore)(t.subscribe,t.getSnapshot),c=be(e.review),l=e.review?.comments??c,u=e.status===`reviewing`&&!e.review?.counts?.pending,d=c||l;if(!(l>0||u&&c>0&&!e.review?.counts?.accepted)||e.status===`deleting`)return null;async function f(){if(e.status!==`uncertain`)try{await t.submit(`feedback`,t=>$(`/tasks/`+e.id+`/messages`,t))&&(n(),i())}catch(e){r(e)}}return(0,C.jsxs)(`div`,{className:`review-feedback`+(a?` card`:``),children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(T,{name:`chat`,size:15}),z(d,`{n} review update not sent yet`,`{n} review updates not sent yet`)]}),(0,C.jsxs)(`button`,{className:`button primary compact`,title:R(`Send your review decisions and comments to the agent`),disabled:o||e.status===`uncertain`,onClick:()=>void f(),children:[R(s===`feedback`?`Sending feedback…`:`Send feedback`),(0,C.jsx)(T,{name:`arrowRight`,size:14})]})]})}function Dg(e){let t=e.split(`/`).filter(Boolean);return(t.length>2?`…/`:`/`)+t.slice(-2).join(`/`)}function Og(e){if(!Array.isArray(e?.files))return``;let t=[e.ahead?`↑${e.ahead}`:``,e.behind?`↓${e.behind}`:``].filter(Boolean).join(` `);return[e.branch||R(`detached`),e.files.length?R(`{n} changed`,{n:e.files.length}):R(`clean`),t].filter(Boolean).join(` · `)}var kg=e=>e.status===`?`&&!!He(e.path),Ag=()=>({M:R(`Modified`),A:R(`Added`),D:R(`Deleted`),R:R(`Renamed`),C:R(`Copied`),U:R(`Conflict`),"?":R(`Untracked`),T:R(`Type changed`)});function jg({diff:e}){let t=e.diff.split(`
260
- `),n=t.findIndex(e=>e.startsWith(`@@`)),r=n<0?t.filter(e=>e.startsWith(`Binary`)):t.slice(n,n+3e3);return r.length?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`pre`,{className:`git-diff`,children:r.map((e,t)=>(0,C.jsxs)(`span`,{className:e.startsWith(`@@`)?`hunk`:e[0]===`+`?`add`:e[0]===`-`?`del`:e.startsWith(`\\`)?`note`:void 0,children:[e.startsWith(` `)?`\xA0`+e.slice(1):e||` `,`
261
- `]},t))}),(e.truncated||t.length-n>3e3)&&(0,C.jsx)(`p`,{className:`git-diff-note`,children:R(`The diff is too long to show in full.`)})]}):(0,C.jsx)(`p`,{className:`git-diff-note`,children:R(`No textual changes.`)})}function Mg({projectId:e,git:t,onStatus:n,writer:r,tasks:i,onOpenTask:a}){let o=(0,S.useCallback)(t=>$(`/projects/${e}/git/overview`,void 0,t,6e4),[e]),s=`papilot:commit:${e}`,[c,l]=(0,S.useState)(()=>D.getItem(s)||``),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,_]=(0,S.useState)(null),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(null),w=t?.files||[],E=w.find(e=>e.path===v);if((0,S.useEffect)(()=>{if(!E){x(null);return}let t=!0;return x(e=>e?.path===v?e:{path:v,result:null,error:``}),$(`/projects/${e}/git/diff?path=${encodeURIComponent(v)}`).then(e=>{t&&x({path:v,result:e,error:``})},e=>{t&&x({path:v,result:null,error:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[e,v,E?.status,E?.lines?.join()]),!t||!Array.isArray(t.files))return(0,C.jsx)(`section`,{className:`git-panel`,"aria-label":R(`Git status`),children:(0,C.jsx)(`p`,{className:`git-clean`,children:R(`Reading Git status…`)})});let O=w.filter(e=>e.staged),k=O.length?O:w.filter(e=>!kg(e)),A=(t,n)=>{t.length&&P(`stage`,()=>$(`/projects/${e}/git/stage`,{paths:t,stage:n}),()=>``)},j=w.reduce((e,t)=>e+(t.lines?.[0]||0),0),M=w.reduce((e,t)=>e+(t.lines?.[1]||0),0),N=e=>{l(e),e?D.setItem(s,e):D.removeItem(s)};async function P(e,t,r){if(!u){d(e),p(``),h(``);try{let e=await t();n(e.git),h(r(e))}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(``)}}}let F=()=>{let t=c.trim();t&&k.length&&P(`commit`,()=>$(`/projects/${e}/git/commit`,O.length?{message:t,staged:!0}:{message:t,paths:k.map(e=>e.path)}),e=>(N(``),R(`Committed {hash}.`,{hash:e.commit??``})))};async function I(){if(!u&&k.length){d(`message`),p(``),h(``);try{N((await $(`/projects/${e}/git/message`,{paths:k.map(e=>e.path),staged:O.length>0,agent:r.agent,fresh:!!c.trim()},void 0,13e4)).message)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(``)}}}let ee=w.filter(kg),L=[...new Set(ee.map(e=>He(e.path)))],ne=()=>void P(`ignore`,()=>$(`/projects/${e}/git/ignore`,{paths:ee.map(e=>e.path)}),()=>z(L.length,`Added {n} pattern to .gitignore.`,`Added {n} patterns to .gitignore.`)),re=n=>void P(n,()=>$(`/projects/${e}/git/${n}`,{},void 0,13e4),e=>n===`fetch`?e.git.behind?z(e.git.behind,`{n} new commit on {upstream}.`,`{n} new commits on {upstream}.`,{upstream:e.git.upstream??``}):R(`Up to date with the remote.`):n===`pull`?R(`Pulled the latest commits.`):n===`merge`?e.git.merging?R(`The merge stopped at conflicts.`):R(`Merged {upstream}.`,{upstream:t.upstream??``}):e.git.upstream?R(`Pushed to {upstream}.`,{upstream:e.git.upstream}):R(`Pushed to the remote.`)),ie=!t.upstream&&t.remote&&t.branch,ae=t.merging,oe=!!(t.upstream&&t.ahead>0&&t.behind>0&&!ae);return(0,C.jsxs)(`section`,{className:`git-panel`,"aria-label":R(`Git status`),"aria-busy":!!u,children:[(0,C.jsxs)(`div`,{className:`git-current`,role:`group`,"aria-label":R(`Current worktree`),children:[(0,C.jsxs)(`div`,{className:`git-branch`,children:[(0,C.jsxs)(`div`,{className:`git-current-info`,children:[(0,C.jsxs)(`span`,{className:`git-current-ref`,title:t.branch||R(`detached HEAD`),children:[(0,C.jsx)(T,{name:`branch`,size:14}),(0,C.jsx)(`code`,{children:t.branch||R(`detached HEAD`)})]}),(0,C.jsx)(Hm,{status:t}),t.upstream?(0,C.jsx)(`span`,{className:`git-sync`,title:`${R(`Tracking`)} ${t.upstream}`,children:t.ahead||t.behind?(0,C.jsxs)(C.Fragment,{children:[t.ahead>0&&(0,C.jsxs)(`span`,{children:[`↑`,t.ahead]}),t.behind>0&&(0,C.jsxs)(`span`,{children:[`↓`,t.behind]})]}):R(`up to date`)}):(0,C.jsx)(`span`,{className:`git-no-upstream`,children:R(`No upstream branch`)})]}),t.remote&&(0,C.jsxs)(`span`,{className:`git-remote`,children:[!ae&&t.upstream&&t.behind>0&&(oe?(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,title:R(`{branch} and {upstream} have both changed. Merge brings in the remote commits.`,{branch:t.branch??``,upstream:t.upstream}),disabled:!!u,onClick:()=>re(`merge`),children:R(u===`merge`?`Merging…`:`Merge`)}):(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!u,onClick:()=>re(`pull`),children:R(u===`pull`?`Pulling…`:`Pull`)})),!ae&&(t.upstream?t.ahead>0:ie)&&(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!u,onClick:()=>re(`push`),children:u===`push`?R(`Pushing…`):t.upstream?R(`Push`):R(`Publish branch`)}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Fetch from the remote`),title:R(`Fetch from the remote`),disabled:!!u,onClick:()=>re(`fetch`),children:u===`fetch`?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(T,{name:`refresh`,size:15})})]})]}),t.head&&(0,C.jsxs)(`div`,{className:`git-commit`,title:`${t.head.subject}\n${t.head.hash} · ${new Date(t.head.date).toLocaleString(te())}`,children:[(0,C.jsx)(T,{name:`commit`,size:14}),(0,C.jsx)(`span`,{className:`git-commit-subject`,children:t.head.subject}),(0,C.jsx)(`code`,{children:t.head.hash}),(0,C.jsx)(`span`,{className:`git-commit-time`,children:ig(t.head.date)})]})]}),f&&(0,C.jsx)(`p`,{className:`inline-error git-message`,role:`alert`,children:f}),m&&!f&&(0,C.jsxs)(`p`,{className:`git-message git-notice`,role:`status`,children:[(0,C.jsx)(T,{name:`check`,size:14}),m]}),ae&&(0,C.jsxs)(`div`,{className:`git-merge`+(ae.conflicts.length?``:` resolved`),role:`group`,"aria-label":R(`Merge in progress`),children:[(0,C.jsxs)(`p`,{children:[(0,C.jsx)(`strong`,{children:ae.conflicts.length?z(ae.conflicts.length,`Merging: {n} file has conflicts`,`Merging: {n} files have conflicts`):R(`Merging: no conflicts left`)}),(0,C.jsx)(`span`,{children:ae.message})]}),g&&(0,C.jsx)(`div`,{className:`git-merge-summary markdown`,"aria-label":R(`{agent} on the merge`,{agent:g.agent}),children:(0,C.jsx)(ym,{text:g.summary})}),(0,C.jsxs)(`div`,{className:`button-row`,children:[(0,C.jsx)(`button`,{type:`button`,className:`button secondary compact`,disabled:!!u,onClick:()=>void P(`abort`,()=>$(`/projects/${e}/git/abort`,{}),()=>(_(null),R(`The merge was abandoned.`))),children:R(u===`abort`?`Aborting…`:`Abort merge`)}),ae.conflicts.length?(0,C.jsx)(`button`,{type:`button`,className:`button primary compact`,disabled:!!u,onClick:()=>void P(`resolve`,()=>$(`/projects/${e}/git/resolve`,{agent:r.agent,model:r.model||void 0},void 0,62e4),e=>(_({agent:Xh[e.agent],summary:e.summary}),e.remaining.length?z(e.remaining.length,`{n} file still has conflicts.`,`{n} files still have conflicts.`):R(`Conflicts resolved. Read the diffs, then commit the merge.`))),children:u===`resolve`?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`spinner`}),R(`{agent} is resolving…`,{agent:Xh[r.agent]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(T,{name:`spark`,size:14}),R(`Resolve with {agent}`,{agent:Xh[r.agent]})]})}):(0,C.jsx)(`button`,{type:`button`,className:`button primary compact`,disabled:!!u,onClick:()=>void P(`finish`,()=>$(`/projects/${e}/git/finish`,{}),e=>(_(null),R(`Committed {hash}.`,{hash:e.commit}))),children:R(u===`finish`?`Committing…`:`Commit merge`)})]})]}),(0,C.jsxs)(`h3`,{className:`git-section`,children:[w.length>0&&!ae&&(0,C.jsx)(`input`,{type:`checkbox`,"aria-label":R(`Stage all changes`),title:R(`Stage or unstage every change`),disabled:!!u,checked:O.length===w.length&&!w.some(e=>e.unstaged),ref:e=>{e&&(e.indeterminate=O.length>0&&(O.length<w.length||w.some(e=>e.unstaged)))},onChange:e=>A(e.target.checked?w.filter(e=>!kg(e)||e.staged).map(e=>e.path):O.map(e=>e.path),e.target.checked)}),(0,C.jsx)(`span`,{children:R(`Uncommitted changes`)}),w.length>0&&(0,C.jsx)(`span`,{className:`count`,children:w.length}),j||M?(0,C.jsxs)(`span`,{className:`git-total`,children:[(0,C.jsxs)(`ins`,{children:[`+`,j]}),` `,(0,C.jsxs)(`del`,{children:[`−`,M]})]}):null]}),w.length?(0,C.jsxs)(C.Fragment,{children:[ee.length>0&&!ae&&(0,C.jsxs)(`div`,{className:`git-ignore`,title:R(`Untracked build output. Add to .gitignore adds:`)+`
262
- `+L.join(`
263
- `),children:[(0,C.jsx)(`span`,{children:z(ee.length,`{n} build file`,`{n} build files`)}),(0,C.jsx)(`button`,{type:`button`,className:`button ghost compact`,disabled:!!u,onClick:ne,children:R(u===`ignore`?`Adding…`:`Add to .gitignore`)})]}),!ae&&(0,C.jsxs)(`form`,{className:`git-commit-form`,onSubmit:e=>{e.preventDefault(),F()},children:[(0,C.jsxs)(`div`,{className:`git-message-box`,children:[(0,C.jsx)(`textarea`,{"aria-label":R(`Commit message`),placeholder:u===`message`?R(`{agent} is writing a commit message…`,{agent:Xh[r.agent]}):R(`Commit message`),rows:1,value:c,readOnly:u===`commit`||u===`message`,onChange:e=>N(e.target.value),onKeyDown:e=>{Ce(e.nativeEvent,ag())&&(e.preventDefault(),F())}}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button git-generate`,"aria-label":R(`Generate commit message`),title:R(`Write a commit message for the chosen files with {agent}`,{agent:Xh[r.agent]}),disabled:!!u||!k.length,onClick:()=>void I(),children:u===`message`?(0,C.jsx)(`span`,{className:`spinner`}):(0,C.jsx)(T,{name:`spark`,size:15})})]}),(0,C.jsx)(`button`,{className:`button primary`,disabled:!!u||!c.trim()||!k.length,children:u===`commit`?R(`Committing…`):O.length?z(O.length,`Commit staged changes in 1 file`,`Commit staged changes in {n} files`):k.length===w.length?z(w.length,`Commit 1 file`,`Commit all {n} files`):R(`Commit {chosen} of {n} files`,{chosen:k.length,n:w.length})})]}),(0,C.jsx)(`ul`,{className:`git-files`,children:w.map(e=>{let t=e.status===`U`&&ae&&!ae.conflicts.includes(e.path)?`M`:e.status,n=e.path.lastIndexOf(`/`),r=t===`?`?`U`:t===`U`?`!`:t,i=v===e.path;return(0,C.jsxs)(`li`,{className:i?`open`:void 0,children:[(0,C.jsxs)(`div`,{className:`git-row`,children:[!ae&&(0,C.jsx)(`input`,{type:`checkbox`,"aria-label":R(`Stage {path}`,{path:e.path}),title:e.staged?e.unstaged?R(`Partly staged`):R(`Staged`):R(`Not staged`),disabled:!!u,checked:e.staged&&!e.unstaged,ref:t=>{t&&(t.indeterminate=e.staged&&e.unstaged)},onChange:t=>A([e.path],t.target.checked)}),(0,C.jsxs)(`button`,{type:`button`,className:`git-file`,"aria-expanded":i,title:`${Ag()[e.status]||e.status}: ${e.from?`${e.from} → `:``}${e.path}`,onClick:()=>y(i?``:e.path),children:[(0,C.jsx)(`span`,{className:`git-name`,children:e.path.slice(n+1)}),n>0&&(0,C.jsx)(`span`,{className:`git-dir`,children:e.path.slice(0,n)})]}),e.lines&&(0,C.jsxs)(`span`,{className:`git-lines`,children:[(0,C.jsxs)(`ins`,{children:[`+`,e.lines[0]]}),` `,(0,C.jsxs)(`del`,{children:[`−`,e.lines[1]]})]}),(0,C.jsx)(`span`,{className:`git-code s-`+(t===`?`?`u`:t===`U`?`conflict`:t.toLowerCase()),"aria-label":Ag()[t]||t,children:r})]}),i&&(0,C.jsx)(`div`,{className:`git-diff-wrap`,"aria-label":R(`Changes in {path}`,{path:e.path}),role:`region`,children:b?.path===e.path&&b.result?(0,C.jsx)(jg,{diff:b.result}):b?.error?(0,C.jsx)(`p`,{className:`inline-error`,children:b.error}):(0,C.jsx)(`p`,{className:`git-diff-note`,children:R(`Loading the diff…`)})})]},e.path)})})]}):(0,C.jsxs)(`p`,{className:`git-clean`,children:[(0,C.jsx)(T,{name:`check`,size:15}),R(`No uncommitted changes`)]}),(0,C.jsx)(Gm,{git:t,load:o,tasks:i,onOpenTask:a,taskStatus:e=>(0,C.jsx)(tg,{task:e})})]})}function Ng(e){return R(`Page {n}`,{n:e.page+1})+(e.source?` · ${e.source.file}:${e.source.lines[0]}${e.source.lines[1]===e.source.lines[0]?``:`–${e.source.lines[1]}`}`:``)}function Pg(){return(0,C.jsxs)(`small`,{className:`note-placement-warning`,title:R(`The position in the new PDF could not be confirmed. The original text and note are kept.`),children:[(0,C.jsx)(T,{name:`alert`,size:12}),R(`Position needs confirmation`)]})}function Fg({notes:e,currentKey:t,active:n,actions:r,onShow:i,onAnnotate:a,controller:o}){let s=(0,S.useRef)(null),[c,l]=(0,S.useState)({}),u=(0,S.useRef)(c),[d,f]=(0,S.useState)(null),p=(0,S.useRef)(new Map),[m,h]=(0,S.useState)([]),[g,v]=(0,S.useState)({}),y=Object.keys(c).length>0,b=m.length>0,x=b||r.sending,w=r.onEditing;(0,S.useEffect)(()=>(w(y||b),()=>w(!1)),[y,b,w]),(0,S.useEffect)(()=>{n&&s.current?.querySelector(`[data-note="${n}"]`)?.scrollIntoView({block:`nearest`})},[n]),(0,S.useEffect)(()=>{d&&e.some(e=>e.id===d.id)&&f(null)},[e,d]),(0,S.useEffect)(()=>{for(let t of Object.keys(u.current))e.some(e=>e.id===t)||D(t,null)},[e]);let E=e=>v(t=>{let n={...t};return delete n[e],n});function D(e,t){let n={...u.current};t===null?delete n[e]:n[e]=t,u.current=n,l(n)}function O(e,t){if(p.current.has(e)||r.sending)return Promise.resolve(!1);E(e);let n=Promise.resolve().then(t).then(()=>!0,t=>(v(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1)).finally(()=>{p.current.delete(e),h([...p.current.keys()])});return p.current.set(e,n),h([...p.current.keys()]),n}let k=(e,t,n=!1)=>O(e.id,async()=>{await r.edit(e,t),D(e.id,null),n&&j(e)});(0,S.useImperativeHandle)(o,()=>({save:async()=>{if(r.sending||(await Promise.all([...p.current.values()])).some(e=>!e))return!1;for(let[t,n]of Object.entries(u.current)){let r=e.find(e=>e.id===t),i=n.trim();if(r&&i&&i!==r.comment){if(!await k(r,i))return!1}else D(t,null)}return!0}}));let A=x||y,j=e=>r.selection.set([e.id],!r.selection.has(e.id)),M=(e,t)=>(0,C.jsx)(Te,{number:t+1,ai:!!e.aiReview,selected:r.selection.has(e.id),disabled:A,onClick:()=>j(e)}),N=e.filter(e=>!e.aiReview),P=N.filter(e=>r.selection.has(e.id)).length,F=e.filter(e=>e.aiReview&&e.key!==t),I=(e,a)=>(0,C.jsx)(`li`,{"data-note":e.id,"data-selected":r.selection.has(e.id),className:(e.aiReview?`review-suggestion `:``)+(n===e.id?`active `:``)+(e.key===t?``:`stale`),children:(0,C.jsx)(Ee,{inline:!0,note:e,number:a+1,index:0,total:1,selected:r.selection.has(e.id),busy:r.sending||m.includes(e.id),error:g[e.id]||``,draft:c[e.id]??null,onDraftChange:t=>{D(e.id,t),t!==null&&c[e.id]===void 0&&E(e.id)},header:(0,C.jsxs)(`div`,{className:`note-card-context`,children:[(0,C.jsxs)(`div`,{className:`note-head`,children:[(0,C.jsx)(`button`,{type:`button`,className:`note-number`,"aria-label":e.aiReview?R(`Show suggestion {n} on the page`,{n:a+1}):R(`Show note {n} on the page`,{n:a+1}),disabled:e.key!==t,onClick:()=>i(e),children:a+1}),(0,C.jsxs)(`span`,{className:`note-where`,children:[Ng(e),e.aiReview?` · `+Xh[e.aiReview.agent]:e.author?` · `+R(`from {name}`,{name:e.author.name}):``]})]}),(0,C.jsx)(pe,{text:e.quote})]}),onToggle:()=>j(e),onDismiss:()=>void O(e.id,async()=>{await r.remove(e),D(e.id,null),e.aiReview&&f(e)}),onSave:(t,n)=>k(e,t,n===`quote`),children:e.key!==t&&(0,C.jsx)(Pg,{})})},e.id);return(0,C.jsxs)(`section`,{ref:s,className:`notes-panel`,"aria-label":R(`PDF notes`),children:[(0,C.jsxs)(`div`,{className:`draft-notes-head`,children:[N.length>0&&(0,C.jsx)(`div`,{className:`note-selection-head`,children:(0,C.jsx)(`button`,{type:`button`,className:`note-select-all`,"aria-label":R(`Select all notes for this task`),"aria-pressed":P===N.length?!0:P?`mixed`:!1,disabled:A,onClick:()=>r.selection.set(N.map(e=>e.id),P!==N.length),children:P===N.length?R(`Clear selection`):R(`Add all to task`)})}),(0,C.jsxs)(`div`,{className:`note-entry-actions`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`button ghost compact`,disabled:!t||x||!!y,onClick:()=>a(!0),children:[(0,C.jsx)(T,{name:`region`,size:14}),R(`Region note`)]}),(0,C.jsx)(`span`,{className:`note-entry-hint`,children:R(`or select text to annotate`)})]})]}),(0,C.jsx)(`p`,{className:`note-selection-hint`,children:R(`Notes stay here unless you add them to a task.`)}),t&&e.some(e=>e.key!==t)&&(0,C.jsx)(`p`,{className:`note-placement-summary`,role:`status`,children:R(`Some note positions need confirmation. Their original text and comments are kept.`)}),N.length>0&&(0,C.jsxs)(`section`,{className:`note-section`,"aria-label":R(`My notes`),children:[_(e).map(({group:e,entries:a})=>{let o=a.filter(({note:e})=>r.selection.has(e.id)).length;return(0,C.jsx)(ce,{group:e,count:a.length,active:r.group===e||a.some(({note:e})=>e.id===n),selection:{count:o,disabled:A,toggle:()=>r.selection.set(a.map(({note:e})=>e.id),o!==a.length)},children:(0,C.jsx)(`div`,{className:`group-references`,children:a.map(({note:e,index:a})=>(0,C.jsxs)(`div`,{className:`group-location note-card`+(e.id===n?` active`:``),"data-note":e.id,"data-selected":r.selection.has(e.id),children:[(0,C.jsx)(`button`,{type:`button`,className:`note-number`,"aria-label":R(`Show note {n} on the page`,{n:a+1}),disabled:e.key!==t,onClick:()=>i(e),children:a+1}),(0,C.jsxs)(`div`,{className:`group-location-target`,children:[(0,C.jsx)(`blockquote`,{children:e.quote||R(`Marked region`)}),(0,C.jsx)(`span`,{children:Ng(e)}),e.key!==t&&(0,C.jsx)(Pg,{})]}),M(e,a),(0,C.jsx)(`button`,{type:`button`,className:`icon-button group-location-remove`,"aria-label":R(`Delete note {n}`,{n:a+1}),disabled:x,onClick:()=>void O(e.id,()=>r.remove(e)),children:(0,C.jsx)(T,{name:`trash`,size:14})})]},e.id))})},e)}),(0,C.jsx)(`ol`,{className:`note-list`,children:e.map((e,t)=>!e.aiReview&&!e.group&&I(e,t))})]}),F.length>0&&(0,C.jsxs)(`section`,{className:`note-section`,"aria-label":R(`Unplaced suggestions`),children:[(0,C.jsx)(`h3`,{children:R(`Unplaced suggestions`)}),(0,C.jsx)(`ol`,{className:`note-list`,children:e.map((e,n)=>e.aiReview&&e.key!==t&&I(e,n))})]}),d&&(0,C.jsxs)(`div`,{className:`note-dismissed`,role:`status`,children:[R(`Suggestion ignored.`),` `,(0,C.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>void O(d.id,async()=>{await r.restore(d),f(null)}),children:R(`Undo`)})]}),Object.entries(g).filter(([t])=>!e.some(e=>e.id===t&&!e.group)).map(([e,t])=>(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:t},e))]})}function Ig({notes:e,currentKey:t,actions:n,onShow:r}){let i=e.filter(e=>n.selection.has(e.id));if(!i.length)return null;let a=(e,i)=>(0,C.jsxs)(`li`,{"data-note":e.id,className:`task-note-reference`,children:[(0,C.jsxs)(`div`,{className:`note-head`,children:[(0,C.jsx)(`button`,{type:`button`,className:`note-number`,"aria-label":e.aiReview?R(`Show suggestion {n} on the page`,{n:i+1}):R(`Show note {n} on the page`,{n:i+1}),disabled:e.key!==t,onClick:()=>r(e),children:i+1}),(0,C.jsx)(`span`,{className:`note-where`,children:Ng(e)}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":e.aiReview?R(`Remove suggestion {n} from task`,{n:i+1}):R(`Remove note {n} from task`,{n:i+1}),disabled:n.sending,onClick:()=>n.selection.set([e.id],!1),children:(0,C.jsx)(T,{name:`close`,size:13})})]}),(0,C.jsx)(pe,{text:e.quote}),e.comment&&(0,C.jsx)(`p`,{className:`task-note-comment`,children:e.comment}),e.key!==t&&(0,C.jsx)(Pg,{})]},e.id);return(0,C.jsxs)(`section`,{className:`task-notes-panel`,"aria-label":R(`Notes in this task`),children:[(0,C.jsxs)(`div`,{className:`note-selection-head`,children:[(0,C.jsx)(`span`,{children:R(`Added to task: {n}`,{n:i.length})}),(0,C.jsx)(`button`,{type:`button`,className:`note-select-all`,disabled:n.sending,onClick:()=>n.selection.set(i.map(e=>e.id),!1),children:R(`Clear selection`)})]}),_(e).map(({group:e,entries:t})=>{let r=t.filter(({note:e})=>n.selection.has(e.id));return r.length>0&&(0,C.jsxs)(ce,{group:e,count:r.length,children:[(0,C.jsx)(se,{group:e,value:n.instructions.get(e),disabled:n.sending,onChange:t=>n.instructions.set(e,t)}),(0,C.jsx)(`ol`,{className:`task-note-list`,children:r.map(({note:e,index:t})=>a(e,t))})]},e)}),(0,C.jsx)(`ol`,{className:`task-note-list`,children:e.map((e,t)=>!e.group&&n.selection.has(e.id)&&a(e,t))})]})}function Lg({task:e,busy:t,onBuild:n}){let r=Qh(e),i=R(r?`No manuscript changes`:`PDF comparison`),a=R(r?`This task did not change the manuscript. Read the answer in the chat.`:`Only manuscript changes need a PDF comparison. Answers to questions are in the chat.`);return e.status===`building`?(i=R(`Preparing task results…`),a=R(`Checking for manuscript changes. A PDF comparison is generated only when needed.`)):e.status===`running`||e.status===`queued`?(i=e.status===`running`?R(`{agent} is working`,{agent:Zh(e)}):R(`Queued`),a=R(`If the task changes the manuscript, a PDF comparison will appear here. Otherwise, read the answer in the chat.`)):e.status===`waiting_input`?(i=R(`Needs your reply`),a=R(`Reply in the chat to continue. A PDF comparison is needed only if the manuscript changes.`)):e.status===`uncertain`&&(i=R(`Check task status`),a=R(`Confirm whether the task is still running before generating a PDF comparison.`)),(0,C.jsxs)(`div`,{className:`review-placeholder`,children:[(0,C.jsx)(`div`,{className:`placeholder-icon`,children:e.status===`building`?(0,C.jsx)(`span`,{className:`spinner large`}):(0,C.jsx)(T,{name:r?`chat`:`diff`,size:22})}),(0,C.jsx)(`h2`,{children:i}),(0,C.jsx)(`p`,{children:a}),!r&&[`idle`,`interrupted`,`failed`,`reviewing`].includes(e.status)&&(0,C.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:t,onClick:n,children:R(`Generate PDF comparison`)})]})}function Rg({mode:e,onMode:t}){return(0,C.jsxs)(`div`,{className:`pdf-modes`,role:`group`,"aria-label":R(`Show`),children:[(0,C.jsxs)(`button`,{type:`button`,"aria-label":`PDF`,title:`PDF`,"aria-pressed":e===`pdf`,onClick:()=>t(`pdf`),children:[(0,C.jsx)(T,{name:`paper`,size:15}),(0,C.jsx)(`span`,{children:`PDF`})]}),(0,C.jsxs)(`button`,{type:`button`,"aria-label":R(`Changes`),"aria-pressed":e===`changes`,title:R(`What changed since the last commit, to stage, revert and commit change by change`),onClick:()=>t(`changes`),children:[(0,C.jsx)(T,{name:`diff`,size:15}),(0,C.jsx)(`span`,{children:R(`Changes`)})]})]})}function zg({project:e,data:t,error:n,view:r,setView:i,region:a,setRegion:o,active:s,setActive:c,actions:l,newTask:u,tools:d,openPdf:f,navigation:p,onGit:m,writer:h,reportError:g,tasks:_,onOpenTask:v,onFixProblems:y}){let b=t?.build,x=t?.annotations||[],w=t?.git,E=(0,S.useRef)(null),[O,k]=(0,S.useState)(!1),A=(0,S.useRef)(null);async function j(){return O&&A.current&&!await A.current.save()?!1:(k(!1),!0)}let[M,N]=(0,S.useState)(()=>D.getItem(`papilot:manuscript-panel`)===`hidden`),P=og(`(min-width: 681px)`),F=P&&M,I=og(`(min-width: 901px)`),ee=(0,S.useId)(),L=(0,S.useRef)(null),te=Uh(`papilot:manuscript-width`,`--manuscript-width`,`.manuscript-side`,R(`Resize manuscript panel`),I&&!F,()=>E.current?.fitWidth());(0,S.useEffect)(()=>{D.setItem(`papilot:manuscript-panel`,M?`hidden`:`visible`)},[M]);let ne=P&&(0,C.jsx)(`button`,{ref:L,type:`button`,className:`icon-button manuscript-panel-toggle`,"aria-label":R(F?`Expand manuscript panel`:`Collapse manuscript panel`),title:R(F?`Expand manuscript panel`:`Collapse manuscript panel`),"aria-expanded":!F,"aria-controls":ee,onClick:()=>{N(e=>!e),E.current?.fitWidth(),requestAnimationFrame(()=>L.current?.focus())},children:(0,C.jsx)(T,{name:F?`panelExpand`:`panelCollapse`,size:18})}),re=(0,C.jsxs)(C.Fragment,{children:[d,F&&ne,(F||!I)&&f]}),[ie,ae]=(0,S.useState)(`pdf`),[oe,se]=(0,S.useState)(!1),ce=(0,S.useRef)(null),B=(0,C.jsx)(tr,{ref:ce,counts:b?.problems,status:b?.status,pdfKey:b?.key,logUrl:`/api/projects/${e.id}/manuscript/log`,load:()=>$(`/projects/${e.id}/manuscript/problems`,void 0,void 0,6e4),onJump:e=>{if(e.page===void 0||!e.rect)return;_e()&&i(`pdf`);let{page:t,rect:n}=e;requestAnimationFrame(()=>E.current?.showPlace(t,n))},onFix:y&&(e=>{y(er(e)),i(`task`),N(!1)})}),V=(0,C.jsxs)(C.Fragment,{children:[d,B,(0,C.jsx)(`button`,{type:`button`,className:`icon-button`+(O?` active`:``),"aria-label":R(`My notes`),title:R(`My notes`),"aria-pressed":O,onClick:()=>{O?j():(c(``),k(!0))},children:(0,C.jsx)(T,{name:`notes`,size:16})}),F&&ne,(F||!I)&&f]}),le=(0,C.jsxs)(C.Fragment,{children:[p,(0,C.jsx)(Rg,{mode:ie,onMode:async e=>{await j()&&ae(e)}})]}),ue=Array.isArray(w?.files)&&!w.merging?w.files.filter(e=>e.staged).map(e=>e.path):[],de=()=>void $(`/projects/${e.id}/git`).then(m,()=>void 0),fe=e=>ue.length>0&&(e?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`commit-state`,children:z(ue.length,`{n} file staged`,`{n} files staged`)}),(0,C.jsx)(`button`,{type:`button`,className:`commit-button`,onClick:()=>se(!0),children:R(`Commit…`)})]}):(0,C.jsxs)(`button`,{type:`button`,className:`button ghost compact commit-staged`,title:R(`Commit what is staged`),onClick:()=>se(!0),children:[(0,C.jsx)(T,{name:`commit`,size:14}),(0,C.jsx)(`span`,{children:R(`Commit…`)})]})),[pe,H]=(0,S.useState)([]),[me,he]=(0,S.useState)(-1),ge=x.map((e,t)=>({note:e,number:t+1})),_e=()=>window.matchMedia(`(max-width: 680px)`).matches,ve=r===`pdf`?`task`:r;function ye(e){_e()&&i(`pdf`),requestAnimationFrame(()=>E.current?.goTo(e))}async function be(e){e.key===b?.key&&await j()&&(ae(`pdf`),c(e.id),_e()&&i(`pdf`),requestAnimationFrame(()=>E.current?.goToNote(e)))}async function xe(e){await j()&&(ae(`pdf`),o(e),c(``),_e()&&i(`pdf`),!_e()&&ie===`pdf`?E.current?.focus():requestAnimationFrame(()=>E.current?.focus()))}return(0,C.jsxs)(`div`,{className:`manuscript show-`+r+(F?` panel-collapsed`:``),style:te.style,children:[te.resizer,ie===`changes`?(0,C.jsx)(`section`,{className:`manuscript-pages`,"aria-label":R(`Uncommitted changes in the PDF`),children:(0,C.jsx)(Sn,{changesOf:e.id,lead:le,tools:(0,C.jsxs)(C.Fragment,{children:[fe(!1),re]}),completion:fe(!0),onDecided:de},`changes:`+e.id)}):(0,C.jsxs)(`section`,{className:`manuscript-pages`,"aria-label":R(`PDF preview`),"aria-busy":!b||b.status===`building`,children:[!b?.key&&(0,C.jsxs)(`div`,{className:`manuscript-lead`,children:[le,V]}),n&&(0,C.jsx)(`div`,{className:`manuscript-note error`,role:`alert`,children:n}),b?.status===`failed`&&(b.key?(0,C.jsxs)(`div`,{className:`manuscript-note error brief`,role:`alert`,children:[(0,C.jsx)(`span`,{children:R(`The latest changes did not compile. This is the last PDF that did.`)}),(0,C.jsx)(`button`,{type:`button`,className:`note-link`,onClick:()=>ce.current?.open(),children:R(`Show problems`)})]}):(0,C.jsxs)(`div`,{className:`manuscript-note error`,role:`alert`,children:[(0,C.jsx)(`strong`,{children:R(`The manuscript did not compile.`)}),(0,C.jsx)(`pre`,{children:b.error})]})),b?.key?(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(`div`,{className:`review-loading`,children:(0,C.jsx)(`p`,{role:`status`,children:R(`Opening the PDF…`)})}),children:(0,C.jsx)(Wh,{ref:E,url:`/api/projects/${e.id}/manuscript.pdf?key=${b.key}`,words:`/api/projects/${e.id}/manuscript/words?key=${b.key}`,notes:ge.filter(e=>e.note.key===b.key),active:s,region:a,setRegion:o,group:l.group,onGroupChange:l.setGroup,markingDisabled:l.sending,noteActions:{has:l.selection.has,toggle:e=>l.selection.set([e.id],!l.selection.has(e.id)),remove:l.remove,restore:l.restore,edit:l.edit,onEditing:l.onEditing,onBusy:l.onReviewBusy,disabled:l.sending},onDeselect:()=>c(``),onCreate:l.add,onSelect:async e=>{await j()&&c(e.id)},outline:pe,section:me,onOutline:H,onSection:he,lead:le,tools:V})}):!n&&b?.status!==`failed`&&(0,C.jsxs)(`div`,{className:`review-placeholder`,children:[(0,C.jsx)(`div`,{className:`placeholder-icon`,children:(0,C.jsx)(`span`,{className:`spinner large`})}),(0,C.jsx)(`h2`,{children:R(`Compiling the PDF…`)})]}),O&&(0,C.jsxs)(`aside`,{className:`pdf-reading-notes`,"aria-label":R(`PDF note library`),children:[(0,C.jsxs)(`div`,{className:`pdf-reading-notes-head`,children:[(0,C.jsx)(`strong`,{children:R(`My notes`)}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Close notes`),onClick:()=>void j(),children:(0,C.jsx)(T,{name:`close`,size:16})})]}),(0,C.jsx)(Fg,{controller:A,notes:x,currentKey:b?.key,active:s,actions:l,onShow:be,onAnnotate:xe},e.id)]})]}),(0,C.jsxs)(`aside`,{id:ee,className:`manuscript-side`,"aria-label":R(`Manuscript panels`),hidden:F,children:[(0,C.jsxs)(`div`,{className:`manuscript-side-header`,children:[!F&&ne,(0,C.jsxs)(`div`,{className:`side-tabs`,role:`tablist`,"aria-label":R(`Manuscript panels`),children:[(0,C.jsxs)(`button`,{role:`tab`,"aria-selected":ve===`task`,title:R(`New task`),onClick:()=>i(`task`),children:[(0,C.jsx)(T,{name:`compose`,size:14}),(0,C.jsx)(`span`,{className:`tab-label`,children:R(`New task`)}),l.selection.selected.length>0&&(0,C.jsx)(`span`,{className:`count`,"aria-hidden":`true`,children:l.selection.selected.length})]}),(0,C.jsxs)(`button`,{role:`tab`,"aria-selected":ve===`contents`,title:R(`Contents`),onClick:()=>i(`contents`),children:[(0,C.jsx)(T,{name:`list`,size:14}),(0,C.jsx)(`span`,{className:`tab-label`,children:R(`Contents`)})]}),(0,C.jsxs)(`button`,{role:`tab`,"aria-selected":ve===`git`,title:`Git`,onClick:()=>i(`git`),children:[(0,C.jsx)(T,{name:`branch`,size:14}),(0,C.jsx)(`span`,{className:`tab-label`,children:`Git`}),t?.git?.files?.length?(0,C.jsx)(`span`,{className:`count`,children:t.git.files.length}):null]})]}),!F&&I&&f]}),ve===`task`?u((0,C.jsx)(Ig,{notes:x,currentKey:b?.key,actions:l,onShow:be})):ve===`contents`?(0,C.jsx)(`nav`,{className:`contents-panel`,"aria-label":R(`PDF contents`),children:pe.length?(0,C.jsx)(`ol`,{children:pe.map((e,t)=>(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,"aria-current":t===me?`location`:void 0,style:{paddingLeft:12+Math.min(e.level,4)*14},onClick:()=>ye(e),children:[(0,C.jsx)(`span`,{children:e.title}),(0,C.jsx)(`span`,{className:`contents-page`,children:e.page})]})},t))}):(0,C.jsx)(`p`,{className:`muted`,children:b?.key?R(`This PDF has no bookmarks.`):R(`Contents will appear when the PDF is ready.`)})}):(0,C.jsx)(Mg,{projectId:e.id,git:t?.git||null,onStatus:m,writer:h,tasks:_,onOpenTask:v},e.id+e.path)]}),oe&&(0,C.jsx)(Lm,{branch:w?.branch??null,files:ue,staged:!0,remote:!!w?.remote,agent:Xh[h.agent],onClose:()=>se(!1),generate:t=>$(`/projects/${e.id}/git/message`,{paths:ue,staged:!0,agent:h.agent,fresh:t},void 0,13e4).then(e=>e.message),commit:async(t,n)=>{let r=await $(`/projects/${e.id}/git/commit`,{message:t,staged:!0,push:n},void 0,13e4);m(r.git),se(!1),r.pushError&&g(r.pushError)}})]})}function Bg(){let[e,t]=(0,S.useState)(null),[n]=(0,S.useState)(()=>D.getItem(`papilot:task`)),[r,i]=(0,S.useState)(n||``),[a,o]=(0,S.useState)(()=>D.getItem(`papilot:project`)||``),[s,c]=(0,S.useState)({taskId:``,items:[]}),[l,u]=(0,S.useState)(!1),[f,p]=(0,S.useState)({taskId:``,message:``}),h=(0,S.useRef)(null),g=(0,S.useRef)(new Map),_=(0,S.useRef)(new Map),v=(0,S.useRef)(new Map),[y]=(0,S.useState)(()=>new dt),[b]=(0,S.useState)(()=>new dt),[x,w]=(0,S.useState)(!0),[E,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),j=(0,S.useRef)(null),[M,N]=(0,S.useState)(null),[P,F]=(0,S.useState)(null),I=(0,S.useRef)(new Map),ee=(0,S.useRef)(Kh()),L=(0,S.useRef)(null),[te,re]=(0,S.useState)(()=>D.getItem(`papilot:new-task`)||``),[ie,ae]=(0,S.useState)(null),[oe,se]=(0,S.useState)({projectId:``,list:[]}),[ce,B]=(0,S.useState)(0),[V,ue]=(0,S.useState)(()=>{let e=D.getItem(`papilot:agent`);return ge(e)?e:`codex`}),[de,pe]=(0,S.useState)(()=>Object.fromEntries(me.map(e=>[e,{model:D.getItem(`papilot:model:${e}`)??(e===`codex`?D.getItem(`papilot:model`):null)??``,effort:D.getItem(`papilot:effort:${e}`)??(e===`codex`?D.getItem(`papilot:effort`):null),fast:D.getItem(`papilot:fast:${e}`)===`true`}]))),[H,he]=(0,S.useState)(!1),[_e,ve]=(0,S.useState)(``),[ye,be]=(0,S.useState)(null),[Ce,we]=(0,S.useState)(null),Te=(0,S.useCallback)(e=>{we(null),be({id:e.id,title:e.title})},[]);(0,S.useEffect)(()=>{if(!ye)return;let e=setTimeout(()=>be(null),3600);return()=>clearTimeout(e)},[ye]);let[Ee,De]=(0,S.useState)(!1),Oe=(0,S.useRef)(new Set),[ke,Ae]=(0,S.useState)(new Set),[je,Me]=(0,S.useState)(()=>D.getItem(`papilot:sidebar`)!==`hidden`),[Pe,Fe]=(0,S.useState)(()=>{let e=D.getItem(`papilot:layout`);return e===`review`||e===`conversation`?e:`split`}),Ie=og(`(max-width: 900px)`),Le=og(`(max-width: 680px)`),[Re,ze]=(0,S.useState)(`review`),Be=(0,S.useRef)(null),[Ve,He]=(0,S.useState)(``),[We,Ge]=(0,S.useState)(``),[Ke,qe]=(0,S.useState)(!1),Ye=(0,S.useRef)(``);(0,S.useEffect)(()=>{!Ve&&Ye.current&&(document.querySelector(`.task-row[data-task="${Ye.current}"] .task-link`)?.focus(),Ye.current=``)},[Ve]);let[Xe,Ze]=(0,S.useState)(null),[Qe,$e]=(0,S.useState)(()=>window.matchMedia(`(max-width: 680px)`).matches?`pdf`:`task`),[tt,nt]=(0,S.useState)(`manuscript`),[rt,at]=(0,S.useState)(!1),[ot,st]=(0,S.useState)(``),[ct,lt]=(0,S.useState)(null),[ut,pt]=(0,S.useState)(0),mt=(0,S.useRef)([]),ht=(0,S.useRef)(!1);(0,S.useEffect)(()=>{lt(null),mt.current=[]},[a]);let[gt,_t]=(0,S.useState)(!1),[yt,bt]=(0,S.useState)(!1),[xt,St]=(0,S.useState)({projectId:``,data:null,error:``}),Ct=(0,S.useRef)(0),wt=(0,S.useRef)(new Set),[Tt,Et]=(0,S.useState)(new Set),[Dt,Ot]=(0,S.useState)({projectId:``,status:null}),[kt,At]=(0,S.useState)(()=>Number(D.getItem(`papilot:chat-width`))||0),jt=ir(),{language:Mt}=ne(),[Nt,Pt]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let e=()=>Pt(`shortcuts`);return window.addEventListener(`papilot:open-shortcuts`,e),()=>window.removeEventListener(`papilot:open-shortcuts`,e)},[]);let Ft=(0,S.useRef)(r);Ft.current=r;let It=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(!Ie||!Ee)return;let e=document.activeElement,t=j.current;return(t?.querySelector(`[aria-current="page"]`)||t?.querySelector(`button`))?.focus(),()=>{e?.isConnected&&e.getClientRects().length&&e.focus()}},[Ie,Ee]),(0,S.useEffect)(()=>{De(!1)},[Ie]),(0,S.useEffect)(()=>{D.setItem(`papilot:sidebar`,je?`visible`:`hidden`)},[je]),(0,S.useEffect)(()=>{D.setItem(`papilot:layout`,Pe)},[Pe]),(0,S.useEffect)(()=>{kt?D.setItem(`papilot:chat-width`,String(kt)):D.removeItem(`papilot:chat-width`)},[kt]),(0,S.useEffect)(()=>{te?D.setItem(`papilot:new-task`,te):D.removeItem(`papilot:new-task`)},[te]),(0,S.useEffect)(()=>{let e=window.visualViewport,t=()=>{let t=document.documentElement.style;e&&window.matchMedia(`(max-width: 680px)`).matches&&e.scale===1?(t.setProperty(`--viewport-height`,`${e.height}px`),t.setProperty(`--viewport-top`,`${e.offsetTop}px`)):(t.removeProperty(`--viewport-height`),t.removeProperty(`--viewport-top`))};return t(),e?.addEventListener(`resize`,t),e?.addEventListener(`scroll`,t),window.addEventListener(`resize`,t),()=>{e?.removeEventListener(`resize`,t),e?.removeEventListener(`scroll`,t),window.removeEventListener(`resize`,t),document.documentElement.style.removeProperty(`--viewport-height`),document.documentElement.style.removeProperty(`--viewport-top`)}},[]);let Lt=(0,S.useCallback)(e=>O(e instanceof Error?e.message:String(e)),[]),Rt=(0,S.useCallback)(async e=>{Ft.current===e&&!g.current.has(e)&&u(!0);try{await b.run(e,t=>$(`/tasks/`+e+`/items`,void 0,t),t=>{g.current.delete(e),g.current.set(e,t.items),g.current.size>8&&g.current.delete(g.current.keys().next().value),Ft.current===e&&(c({taskId:e,items:t.items}),p({taskId:e,message:``}))})}catch(t){Ft.current===e&&p({taskId:e,message:t instanceof Error?t.message:String(t)})}finally{Ft.current===e&&u(!1)}},[b]),zt=(0,S.useCallback)(async(e=!1)=>{try{e&&y.cancel(),await y.run(`state`,e=>$(`/state`,void 0,e),e=>{let r=Ft.current,a=h.current,s=a?.tasks.find(t=>t.id===r&&!e.tasks.some(e=>e.id===r));if(s&&o(s.projectId),Gh=e.csrf,h.current=e,t(e),w(!0),A(``),a&&hr()&&(document.hidden||!document.hasFocus()))for(let t of br(a,e,mr().events))Sr(t,e=>{i(e),De(!1)});for(let t of _.current.keys())e.tasks.some(e=>e.id===t)||(_.current.delete(t),g.current.delete(t),D.removeItem(`papilot:draft:`+t));N(t=>t&&!e.tasks.some(e=>e.id===t.id)?null:t),Ze(t=>t&&!e.projects.some(e=>e.id===t.id)?null:t);for(let t of v.current.keys())e.requests.some(e=>e.id===t)||v.current.delete(t);r&&!e.tasks.some(e=>e.id===r)&&i(``),It.current||(It.current=!0,n===null&&!r&&i(e.tasks.filter(e=>!e.archivedAt).at(-1)?.id||``))});let r=Ft.current;!document.hidden&&r&&h.current?.tasks.some(e=>e.id===r)&&await Rt(r)}catch(e){w(!1),A(e instanceof Error?e.message:String(e))}},[y,Rt,n]);(0,S.useEffect)(()=>{let e=0,t,n,r=performance.getEntriesByType(`navigation`)[0]?.nextHopProtocol||``;function i(){let i=++e;if(clearTimeout(t),n?.close(),n=void 0,document.hidden&&!hr()||!navigator.onLine){y.cancel(),b.cancel(),navigator.onLine||(w(!1),A(R(`You are offline. Your draft is kept in this browser.`)));return}ft(r)&&(n=new EventSource(`/api/events`),n.addEventListener(`change`,()=>{i===e&&zt()}));async function a(){if(await zt(),i!==e)return;let r=h.current?.tasks.some(e=>[`running`,`waiting_input`,`queued`,`building`].includes(e.status));t=setTimeout(()=>void a(),n?.readyState===EventSource.OPEN?1e4:document.hidden?5e3:r?1e3:2500)}a()}i(),document.addEventListener(`visibilitychange`,i),window.addEventListener(`online`,i),window.addEventListener(`offline`,i);let a=gr(i);return()=>{e++,clearTimeout(t),n?.close(),y.cancel(),b.cancel(),a(),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`online`,i),window.removeEventListener(`offline`,i)}},[zt,y,b]),(0,S.useEffect)(()=>(D.setItem(`papilot:task`,r),c({taskId:r,items:g.current.get(r)||[]}),u(!(!r||g.current.has(r))),r&&h.current?.tasks.some(e=>e.id===r)&&Rt(r),()=>b.cancel()),[r,Rt,b]);let U=e?.tasks.find(e=>e.id===r);U&&!_.current.has(U.id)&&_.current.set(U.id,new xe(`papilot:draft:`+U.id,D,Kh));let Bt=U?.status!==`deleting`&&U?.review?.round?`/api/tasks/${U.id}/pdf?round=${U.review.round}`:``,W=e?.projects.find(e=>e.id===(U?.projectId||a))||e?.projects[0];(0,S.useEffect)(()=>{if(!e)return;let t=W?.id||``;o(t),D.setItem(`papilot:project`,t)},[W?.id,!!e]),(0,S.useEffect)(()=>{Ge(``),qe(!1)},[W?.id]),(0,S.useEffect)(()=>{U&&qe(!!U.archivedAt)},[U?.id,!!U?.archivedAt]);let Ht=e?.viewer,Ut=!Ht||Ht.role===`owner`,Wt=it(`papilot:files:${Ht?.id||`owner`}:new:${W?.id||a}`);async function Gt(){try{await $(`/auth/logout`,{})}catch(e){if(!Ah()){Lt(e);return}}Mh(),kh(!0)}let Kt=(e?.tasks.filter(e=>!W||e.projectId===W.id)||[]).filter(e=>!!e.archivedAt===Ke),qt=We.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean),Jt=Kt.filter(e=>{let t=`${e.title}\n${e.instructions}`.toLocaleLowerCase();return qt.every(e=>t.includes(e))}),Yt=e?.tasks.filter(e=>[`running`,`waiting_input`,`building`].includes(e.status)).length||0;function Xt(){F(`project`)}let Zt=e?.runtimes||(e?{codex:e.runtime}:{}),Qt=me.filter(e=>e===`codex`||!!(Zt[e]&&Zt[e].installed!==!1)),$t=Qt.includes(V)?V:`codex`,en=Zt[$t]?.models||[],tn=de[$t],nn=en.length&&!en.some(e=>e.id===tn.model)?``:tn.model,rn=en.find(e=>e.id===nn)||en.find(e=>e.isDefault),an={agent:$t,model:nn,effort:Vh(tn.effort,rn),serviceTier:$t===`codex`?tn.fast&&rn?.fastMode?rn.fastMode.serviceTier:`default`:void 0},on=e=>{pe(t=>({...t,[$t]:{...t[$t],...e}}));for(let[t,n]of Object.entries(e))D.setItem(`papilot:${t}:${$t}`,String(n))},sn=(e,t)=>{ue(e),D.setItem(`papilot:agent`,e),pe(n=>({...n,[e]:{...n[e],model:t}})),D.setItem(`papilot:model:${e}`,t)},cn=e=>(0,C.jsx)(zh,{disabled:e,agent:$t,model:an.model,effort:an.effort,fast:tn.fast,agents:Qt.map(e=>({value:e,label:Xh[e],runtime:Zt[e]})),reconnecting:ke.has(`/reconnect`),onReconnect:()=>void un(`/reconnect`),onSelect:sn,onChange:on});async function ln(){let e=te.trim(),n=W?.id||a,r=ie,i=r?.output===`annotations`,o=i?[]:Bn.selected,s=i?[]:Wt.draft.getSnapshot().files,c=Hn.forNotes(o);if(!e&&!r&&!s.length&&!o.some(e=>e.comment.trim())&&!Object.keys(c).length||!e&&!r&&m(o,c).length>0||!i&&Wt.draft.getSnapshot().blocked||H||ut||gt||yt||!n)return;let l=L.current,u=new Set(o.map(e=>e.id)),f=l?.closest(`form`)?.contains(document.activeElement);he(!0),ve(``);try{let a={projectId:n,title:r?(e?`${Je(r)}: ${Se(e)}`:Je(r)).slice(0,120):e?Se(e):o.length===1?Se(o[0].comment||o[0].group&&c[d(o[0].group)]||``):o.length?R(`Address {n} PDF notes`,{n:o.length}):s[0].name.slice(0,120),instructions:e,...r?{skill:r.id}:{},...o.length?{annotations:[...u]}:{},...Object.keys(c).length?{groupInstructions:c}:{},...s.length?{attachments:s.map(e=>e.id)}:{},agent:an.agent,model:an.model,effort:an.effort,serviceTier:an.serviceTier},p=JSON.stringify([n,e,r?.id||``,[...u],c,s.map(e=>e.id)]),m={};try{m=JSON.parse(D.getItem(`papilot:new-task-request`)||`{}`)}catch{}ee.current=m?.signature===p&&m.id?m.id:Kh(),D.setItem(`papilot:new-task-request`,JSON.stringify({signature:p,id:ee.current}));let g=await $(`/tasks`,{...a,id:ee.current},void 0,i?12e4:3e4),_=l?.getBoundingClientRect();if(D.removeItem(`papilot:new-task-request`),Wt.draft.clear(s),ee.current=Kh(),re(``),ae(null),Ge(``),qe(!1),y.cancel(),h.current){let e={...h.current,tasks:[...h.current.tasks.filter(e=>e.id!==g.id),g]};h.current=e,t(e)}be(null),_?.width?we({id:g.id,title:g.title,source:_}):be({id:g.id,title:g.title}),++Ct.current,St(e=>e.projectId===n&&e.data?{...e,data:{...e.data,annotations:(e.data.annotations||[]).filter(e=>!u.has(e.id))}}:e),i||Bn.reset(n),Hn.sent(n,o,zn),st(e=>u.has(e)?``:e),lt(null),mt.current=mt.current.filter(e=>!u.has(e.note.id)),f&&l?.isConnected&&(document.activeElement===document.body||l.closest(`form`)?.contains(document.activeElement))&&l.focus({preventScroll:!0}),zn.length&&Cn(n),await zt(!0)}catch(e){ve(e instanceof Error?e.message:String(e))}finally{he(!1)}}async function un(e,t={}){let n=e.startsWith(`/tasks/`)?e.split(`/`).slice(0,3).join(`/`):e;if(!Oe.current.has(n)){Oe.current.add(n),Ae(new Set(Oe.current));try{return await $(e,t),await zt(!0),!0}catch(e){Lt(e)}finally{Oe.current.delete(n),Ae(new Set(Oe.current))}}}let dn=!!(U&&ke.has(`/tasks/`+U.id));async function fn(e){let t=!e.archivedAt;await un(`/tasks/`+e.id+`/archive`,{archived:t})&&(t&&Ft.current===e.id&&(o(e.projectId),i(``)),t||qe(!1),requestAnimationFrame(()=>document.querySelector(`.task-search input`)?.focus()))}let pn=Ie?Ee:je;(0,S.useLayoutEffect)(()=>{ye&&pn&&j.current?.querySelector(`.task-list`)?.scrollTo({top:0})},[ye,pn]);function mn(e){let n=h.current?.tasks.find(t=>t.id===e);n&&o(n.projectId),D.removeItem(`papilot:draft:`+e),_.current.delete(e),g.current.delete(e),N(null),Ft.current===e&&i(``),t(t=>t&&{...t,tasks:t.tasks.filter(t=>t.id!==e),requests:t.requests.filter(t=>t.taskId!==e)}),zt(!0),requestAnimationFrame(()=>document.querySelector(pn?`.sidebar .manuscript-link`:`.main .sidebar-toggle`)?.focus())}function hn(){Ie?De(!1):(Me(!1),requestAnimationFrame(()=>document.querySelector(`.main .sidebar-toggle`)?.focus()))}async function gn(e,n){let r=n.trim().replace(/\s+/g,` `).slice(0,120);if(He(``),r&&r!==e.title){t(t=>t&&{...t,tasks:t.tasks.map(t=>t.id===e.id?{...t,title:r}:t)});try{await $(`/tasks/`+e.id+`/rename`,{title:r})}catch(e){Lt(e)}await zt(!0)}}function _n(e){if(e.button!==0)return;e.preventDefault();let t=e.currentTarget,n=t.parentElement.getBoundingClientRect();t.setPointerCapture(e.pointerId),document.body.classList.add(`resizing`);let r=e=>At(Math.round(Math.min(Math.max(n.right-e.clientX,300),n.width-360))),i=()=>{document.body.classList.remove(`resizing`),t.removeEventListener(`pointermove`,r),t.removeEventListener(`lostpointercapture`,i)};t.addEventListener(`pointermove`,r),t.addEventListener(`lostpointercapture`,i)}function yn(e){let t=e.currentTarget.parentElement.querySelector(`.activity-panel`)?.offsetWidth||400,n=e.currentTarget.parentElement.offsetWidth-360,r=e.key===`ArrowLeft`?t+24:e.key===`ArrowRight`?t-24:e.key===`Home`?n:e.key===`End`?300:null;e.key===`Enter`?(e.preventDefault(),At(0)):r!==null&&(e.preventDefault(),At(Math.min(Math.max(r,300),n)))}let bn=!U&&!!W&&tt===`manuscript`,xn=!U&&!!W&&tt===`references`,Cn=(0,S.useCallback)(async(e,t=!1)=>{if(wt.current.has(e))return;let n=++Ct.current;t&&(wt.current.add(e),Et(new Set(wt.current)));try{let r=await $(`/projects/${e}/manuscript`,t?{}:void 0);if(n!==Ct.current)return;St({projectId:e,data:r,error:``}),Ot({projectId:e,status:r.git})}catch(t){n===Ct.current&&St(n=>({projectId:e,data:n.projectId===e?n.data:null,error:t instanceof Error?t.message:String(t)}))}finally{t&&(wt.current.delete(e),Et(new Set(wt.current)))}},[]),wn=xt.projectId===W?.id&&xt.data?.build.status===`building`;(0,S.useEffect)(()=>{if(!bn||!W)return;Cn(W.id);let e=()=>void Cn(W.id);return window.addEventListener(`focus`,e),()=>{++Ct.current,window.removeEventListener(`focus`,e)}},[bn,W?.id,W?.path,Cn]),(0,S.useEffect)(()=>{if(!bn||!W)return;let e=wn?1500:15e3,t=!1,n,r=async()=>{await Cn(W.id),t||(n=setTimeout(()=>void r(),e))};return n=setTimeout(()=>void r(),e),()=>{t=!0,clearTimeout(n)}},[bn,W?.id,wn,Cn]);let Tn=(e?.tasks||[]).filter(e=>e.projectId===W?.id).map(e=>`${e.review?.files?.join()}:${e.review?.counts?.accepted}`).join(`|`);(0,S.useEffect)(()=>{if(!W||bn)return;let e=()=>void $(`/projects/${W.id}/git`).then(e=>Ot({projectId:W.id,status:e})).catch(()=>void 0);e();let t=setInterval(e,2e4);return()=>clearInterval(t)},[W?.id,W?.path,bn,Tn]),(0,S.useEffect)(()=>ae(null),[W?.id,W?.path]),(0,S.useEffect)(()=>{if(!W)return;let e=!0,t=()=>void $(`/projects/${W.id}/skills`).then(t=>{if(!e)return;let n=Array.isArray(t.skills)?t.skills:[];se({projectId:W.id,list:n}),ae(e=>e&&n.find(t=>t.id===e.id)||null)},()=>void 0);return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},[W?.id,W?.path,ce]);let En=Dt.projectId===W?.id?Dt.status:null,Dn=oe.projectId===W?.id?oe.list:[];function On(e){let t=Dn.find(e=>e.id===`latex-warnings`);t&&ae(t),re(t=>t.trim()?`${t.trimEnd()}\n\n${e}`:e),setTimeout(()=>L.current?.focus(),0)}let kn=(e,t)=>{Ot({projectId:e,status:t}),St(n=>n.projectId===e&&n.data?{...n,data:{...n.data,git:t}}:n)},An=xt.projectId===W?.id?xt:{data:null,error:``},Pn=$m(W?.id||``,JSON.stringify(En?.files?.map(e=>[e.path,e.lines])||[]),$,xn),In=rh(Pn.report),Ln=e=>{re(t=>t.trim()?t.trimEnd()+`
264
-
265
- `+e:e),i(``),nt(`manuscript`),$e(`task`),at(!1)},zn=An.data?.annotations||[],Bn=le(W?.id||``,zn),Hn=fe(W?.id||``),Wn=Hn.forNotes(Bn.selected),Gn=!te.trim()&&!ie&&m(Bn.selected,Wn).length>0,Kn=e=>{++Ct.current,St(t=>t.projectId===W?.id&&t.data?{...t,data:{...t.data,annotations:e(t.data.annotations||[])}}:t)},Yn={selection:Bn,instructions:Hn,group:ct,setGroup:lt,async add(e,t,n,r,i,a,o){if(!W||!An.data?.build.key)throw Error(R(`Wait for the PDF to compile.`));pt(e=>e+1);try{let s=await $(`/projects/${W.id}/annotations`,{key:An.data.build.key,page:e,rect:t,...n.length?{rects:n,quote:r}:{},comment:i,...a?{group:a}:{}});Kn(e=>[...e,s]),a?st(``):o?.reveal!==!1&&st(s.id),o?.quote&&Bn.set([s.id],!0),a?mt.current.push({kind:`add`,note:s}):at(!1)}finally{pt(e=>e-1)}},async edit(e,t){let n=await $(`/projects/${e.projectId}/annotations/${e.id}`,{comment:t});Kn(t=>t.map(t=>t.id===e.id?n:t))},async remove(e){await $(`/projects/${e.projectId}/annotations/${e.id}/delete`,{}),Bn.set([e.id],!1),Kn(t=>t.filter(t=>t.id!==e.id)),mt.current.push({kind:`remove`,note:e})},async restore(e){let t=await $(`/projects/${e.projectId}/annotations/${e.id}/restore`,{});Kn(()=>t.annotations),st(e.id)},onEditing:_t,onReviewBusy:bt,sending:H||yt};vt(()=>{let e=mt.current.at(-1);if(!bn||!e)return!1;if(H||ut||gt||yt||ht.current)return!0;ht.current=!0,O(``);let{note:t}=e;return(async()=>{try{e.kind===`add`?(await $(`/projects/${t.projectId}/annotations/${t.id}/delete`,{}),Kn(e=>e.filter(e=>e.id!==t.id))):(await Yn.restore(t),requestAnimationFrame(()=>document.querySelector(`[data-note="${t.id}"] .note-edit-trigger`)?.focus())),mt.current=mt.current.filter(t=>t!==e)}catch(e){Lt(e)}finally{ht.current=!1}})(),!0});let Xn=e?.tasks.filter(e=>e.status===`waiting_input`).length||0;(0,S.useEffect)(()=>{document.title=(Xn?`(${Xn}) `:``)+(U?`${U.title} · Papilot`:bn&&W?`${W.name} · Papilot`:`Papilot`)},[Xn,U?.title,bn,W?.name]);let Zn=!!(U&&e?.requests.some(e=>e.taskId===U.id)),Qn=U?.review?.counts?.pending||0,$n=!!(U&&eg.includes(U.status)),er=!!(U&&U.mode!==`review`&&(Qh(U)||$n&&U.review?.round===null)),tr=er?`conversation`:Pe,nr=er?`conversation`:Re,rr=Le?nr===`conversation`:tr!==`review`,ar=()=>{U&&un(`/tasks/`+U.id+`/interrupt`)},or=Le?nr===`conversation`:tr===`conversation`,sr=U?Tg(U,En):[],cr=U?Bm(U):null,lr=sr.length>0||U?.delivery?.pending,ur=U?JSON.stringify([U.id,U.deferred,U.review?.round,U.review?.counts,sr,U.delivery?.accepted,U.committed?.accepted,U.deferred?U.name:En?.branch]):``;lr&&!I.current.has(ur)&&I.current.set(ur,new zm);let dr=U&&(lr?(0,C.jsx)(Rm,{draft:I.current.get(ur),branch:U.deferred?`papilot/${U.name}`:En?.branch??null,isolated:!!U.deferred,remote:!U.deferred&&!!En?.remote,agent:Zh(U),disabled:dn,apply:U.deferred&&U.delivery?.mode!==`branch`?async()=>{let e=await $(`/tasks/${U.id}/apply`,{});return e.git&&kn(U.projectId,e.git),await zt(!0),R(`Applied to working directory`)}:void 0,generate:U.delivery?.mode===`workspace`?void 0:e=>$(U.deferred?`/tasks/${U.id}/commit-message`:`/projects/${U.projectId}/git/message`,{paths:sr,agent:U.agent||`codex`,fresh:e},void 0,13e4).then(e=>e.message),commit:async(e,t)=>{let n=await $(`/tasks/${U.id}/commit`,{message:e,push:t},void 0,13e4);kn(U.projectId,n.git);let r=t&&!n.pushError?R(`Committed {hash} and pushed.`,{hash:n.commit}):R(`Committed {hash}.`,{hash:n.commit});return n.pushError&&Lt(n.pushError),await zt(!0),r}},ur):cr?U.deferred&&U.delivery?(0,C.jsx)(`span`,{className:`commit-state`,children:U.delivery.mode===`workspace`?R(`Applied to working directory`):R(`Committed {hash} to {branch}`,{hash:U.delivery.commit?.slice(0,7)||``,branch:U.delivery.branch||``})}):U.committed?(0,C.jsx)(`span`,{className:`commit-state`,children:R(cr===`pushed`?`Committed {hash} and pushed.`:`Committed {hash}.`,{hash:U.committed.hash})}):null:null),fr=e=>U?.mode===`review`?e&&U.aiReview?.notes?(0,C.jsxs)(`button`,{type:`button`,className:`ai-review-link`,onClick:()=>{ze(`review`),Fe(e=>e===`conversation`?`split`:e)},children:[(0,C.jsx)(T,{name:`notes`,size:14}),z(U.aiReview.notes,`View {n} review suggestion`,`View {n} review suggestions`),(0,C.jsx)(T,{name:`arrowRight`,size:13})]}):null:U&&(0,C.jsx)(Eg,{card:e,task:U,composer:_.current.get(U.id),refresh:()=>void zt(!0),reportError:Lt,onSent:()=>{Ft.current===U.id&&(ze(`conversation`),Fe(e=>e===`review`?`split`:e))}},`review-feedback:`+U.id),pr=(Ie||!je)&&(0,C.jsxs)(`button`,{className:`icon-button sidebar-toggle`,"aria-label":R(`Show task list`),title:R(`Show task list`),"aria-expanded":pn,"aria-controls":`task-sidebar`,onClick:()=>Ie?De(!0):Me(!0),children:[(0,C.jsx)(T,{name:Ie?`menu`:`sidebar`,size:20}),ye&&!pn&&(0,C.jsx)(`span`,{className:`task-added-dot`,"aria-hidden":`true`},ye.id)]});function _r(e){if(e===(Le?Re:Pe)&&!Be.current)return;Be.current?.skipTransition(),Be.current=null;let t=()=>{(0,Ne.flushSync)(()=>{Le||Fe(e),e!==`split`&&ze(e)}),document.querySelector(`.workspace-view-selector [aria-pressed="true"]`)?.focus({preventScroll:!0})};if(!document.startViewTransition||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){document.documentElement.classList.remove(`switching-workspace`),t();return}document.documentElement.classList.add(`switching-workspace`);let n=document.startViewTransition(()=>{Be.current===n&&t()});Be.current=n;let r=()=>{Be.current===n&&(Be.current=null,document.documentElement.classList.remove(`switching-workspace`))};n.finished.then(r,r)}let vr=U&&(0,C.jsx)(`div`,{className:`task-state-actions`,children:U.status===`deleting`?(0,C.jsx)(`button`,{className:`button secondary compact`,onClick:()=>N(U),children:R(`Retry deletion`)}):U.status===`uncertain`?(0,C.jsxs)(`button`,{className:`button secondary compact`,disabled:dn,"aria-busy":dn,onClick:()=>void un(`/tasks/`+U.id+`/reconcile`),children:[(0,C.jsx)(T,{name:`refresh`,size:14}),R(`Check status`)]}):$n&&!rr?(0,C.jsxs)(`button`,{className:`button secondary compact`,"aria-label":R(`Pause task`),title:R(`Pause {agent}`,{agent:Zh(U)}),disabled:dn,"aria-busy":dn,onClick:ar,children:[(0,C.jsx)(T,{name:`pause`,size:14}),(0,C.jsx)(`span`,{className:`button-label`,children:R(`Pause`)})]}):U.error?(0,C.jsx)(`button`,{className:`button secondary compact`,onClick:()=>{ze(`conversation`),Fe(`conversation`)},children:R(`View details`)}):null}),yr=U&&(0,C.jsx)(`div`,{className:`view-selector workspace-view-selector`+(er?` single-view`:``),role:`group`,"aria-label":R(`Workspace view`),children:er?(0,C.jsxs)(`button`,{type:`button`,"aria-label":R(Zn?`Chat (reply needed)`:`Chat`),title:Qh(U)?R(`This conversation has no manuscript changes.`):R(`Chat only`),"aria-pressed":`true`,children:[(0,C.jsx)(T,{name:`chat`,size:16}),(0,C.jsx)(`span`,{children:R(`Chat`)}),Zn&&(0,C.jsx)(`i`,{className:`attention-dot`,"aria-hidden":`true`})]}):Le?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{"aria-label":Qn?R(`Review, {n} to decide`,{n:Qn}):R(`Review`),"aria-pressed":Re===`review`,onClick:()=>_r(`review`),children:[(0,C.jsx)(T,{name:`paper`,size:16}),(0,C.jsx)(`span`,{children:R(`Review`)}),Qn>0&&(0,C.jsx)(`b`,{className:`view-count`,"aria-hidden":`true`,children:Qn})]}),(0,C.jsxs)(`button`,{"aria-label":R(Zn?`Chat (reply needed)`:`Chat`),"aria-pressed":Re===`conversation`,onClick:()=>_r(`conversation`),children:[(0,C.jsx)(T,{name:`chat`,size:16}),(0,C.jsx)(`span`,{children:R(`Chat`)}),Zn&&(0,C.jsx)(`i`,{className:`attention-dot`,"aria-hidden":`true`})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{"aria-label":R(`Review`),title:R(`PDF review only`),"aria-pressed":Pe===`review`,onClick:()=>_r(`review`),children:[(0,C.jsx)(T,{name:`paper`,size:16}),(0,C.jsx)(`span`,{children:R(`Review`)})]}),(0,C.jsxs)(`button`,{"aria-label":R(`Split`),title:R(`Review and chat side by side`),"aria-pressed":Pe===`split`,onClick:()=>_r(`split`),children:[(0,C.jsx)(T,{name:`split`,size:16}),(0,C.jsx)(`span`,{children:R(`Split`)})]}),(0,C.jsxs)(`button`,{"aria-label":R(Zn?`Chat (reply needed)`:`Chat`),title:R(`Chat only`),"aria-pressed":Pe===`conversation`,onClick:()=>_r(`conversation`),children:[(0,C.jsx)(T,{name:`chat`,size:16}),(0,C.jsx)(`span`,{children:R(`Chat`)}),Zn&&(0,C.jsx)(`i`,{className:`attention-dot`,"aria-hidden":`true`})]})]})}),xr=U&&(0,C.jsxs)(C.Fragment,{children:[vr,yr]}),Cr=U&&Bt?(0,C.jsx)(`a`,{className:`icon-button review-open`,href:vn(U),target:`_blank`,rel:`noreferrer`,"aria-label":R(`Open review in new tab`),title:R(`Open review in new tab`),children:(0,C.jsx)(T,{name:`external`,size:16})}):null,wr=U&&Bt?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`a`,{className:`icon-button full-pdf-link`,href:Bt,target:`_blank`,rel:`noreferrer`,"aria-label":R(`Full PDF`),title:R(`Open the full PDF`),children:(0,C.jsx)(T,{name:`pdf`,size:16})}),(0,C.jsx)(Jn,{className:`review-rebuild`,label:R(`Regenerate PDF comparison`),status:U.status===`building`?`building`:U.review?.job?.status===`failed`||U.review?.state===`build_failed`?`failed`:`ready`,disabled:[`running`,`waiting_input`,`queued`,`building`,`uncertain`,`deleting`].includes(U.status)||dn,onCompile:()=>un(`/tasks/`+U.id+`/publish`)},U.id)]}):null,Tr=W&&An.data?.build.key&&(0,C.jsx)(`a`,{className:`icon-button`,"aria-label":R(`Open PDF`),title:R(`Open PDF`),href:`/api/projects/${W.id}/manuscript.pdf?key=${An.data.build.key}`,target:`_blank`,rel:`noreferrer`,children:(0,C.jsx)(T,{name:`external`,size:16})}),Er=W&&(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Jn,{label:R(`Recompile PDF`),status:Tt.has(W.id)?`building`:An.error?`unknown`:An.data?.build.status||`unknown`,disabled:!An.data&&!An.error,onCompile:()=>Cn(W.id,!0)},W.id)}),Dr=bn&&W&&(0,C.jsxs)(C.Fragment,{children:[Er,(0,C.jsxs)(`div`,{className:`view-selector`,role:`group`,"aria-label":R(`Manuscript view`),children:[(0,C.jsxs)(`button`,{"aria-label":`PDF`,"aria-pressed":Qe===`pdf`,onClick:()=>$e(`pdf`),children:[(0,C.jsx)(T,{name:`pdf`,size:16}),(0,C.jsx)(`span`,{children:`PDF`})]}),(0,C.jsxs)(`button`,{"aria-label":R(`New task`),"aria-pressed":Qe===`task`,onClick:()=>{$e(`task`),at(!1)},children:[(0,C.jsx)(T,{name:`compose`,size:16}),(0,C.jsx)(`span`,{children:R(`New task`)}),Bn.selected.length>0&&(0,C.jsx)(`b`,{className:`view-count`,"aria-hidden":`true`,children:Bn.selected.length})]}),(0,C.jsxs)(`button`,{"aria-label":R(`Contents`),"aria-pressed":Qe===`contents`,onClick:()=>{$e(`contents`),at(!1)},children:[(0,C.jsx)(T,{name:`list`,size:16}),(0,C.jsx)(`span`,{children:R(`Contents`)})]}),(0,C.jsxs)(`button`,{"aria-label":En?.files?.length?R(`Git, {n} changed`,{n:En.files.length}):`Git`,"aria-pressed":Qe===`git`,onClick:()=>{$e(`git`),at(!1)},children:[(0,C.jsx)(T,{name:`diff`,size:16}),(0,C.jsx)(`span`,{children:`Git`}),En?.files?.length?(0,C.jsx)(`b`,{className:`view-count`,"aria-hidden":`true`,children:En.files.length}):null]})]}),Tr]}),Or=e=>(0,C.jsx)(`section`,{className:`new-task-panel`+(Bn.selected.length?` has-notes`:``),"aria-label":R(`New task`),children:(0,C.jsxs)(`div`,{className:`new-task-start`,children:[!Bn.selected.length&&(0,C.jsxs)(`div`,{className:`new-task-welcome`,children:[(0,C.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20fill='none'%3e%3crect%20x='18'%20y='48'%20width='14'%20height='10'%20fill='%23F0F4F8'%20stroke='%23000000'%20stroke-width='2'/%3e%3crect%20x='32'%20y='48'%20width='14'%20height='10'%20fill='%23C6D5E5'%20stroke='%23000000'%20stroke-width='2'/%3e%3cpath%20d='M32%206L12%2034L18%2048H32V6Z'%20fill='%23FFFFFF'/%3e%3cpath%20d='M32%206L52%2034L46%2048H32V6Z'%20fill='%23356AA0'/%3e%3cpath%20d='M32%206L52%2034L46%2048H18L12%2034L32%206Z'%20stroke='%23000000'%20stroke-width='2'%20stroke-linejoin='miter'%20stroke-miterlimit='2'/%3e%3cpath%20d='M32%206V20'%20stroke='%23000000'%20stroke-width='2'/%3e%3cpath%20d='M32%2020Q35%2031%2046%2034Q35%2037%2032%2048Q29%2037%2018%2034Q29%2031%2032%2020Z'%20fill='%23FFFFFF'%20stroke='%23000000'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e`,alt:``}),(0,C.jsx)(`h2`,{children:R(`What are we revising next?`)})]}),ie?.output!==`annotations`&&e,(0,C.jsx)(sg,{attachments:ie?.output===`annotations`?void 0:Wt.draft,upload:(e,t)=>qh(W.id,e,t),imageHint:$t===`antigravity`&&Wt.files.some(e=>e.mime.startsWith(`image/`)),autoFocus:!0,inputRef:L,label:R(`Describe the revision`),value:te,onChange:re,readOnly:H,onSubmit:()=>void ln(),placeholder:Bn.selected.length?R(`Add overall instructions (optional)`):R(`Describe the revision`),skills:Dn,skill:ie,onSkill:ae,footer:e=>(0,C.jsxs)(`div`,{className:`composer-options`,children:[(0,C.jsx)(et,{onAttach:ie?.output===`annotations`?void 0:e,skills:Dn,selected:ie,disabled:H,onPick:e=>{ae(e),L.current?.focus()}}),cn(H)]}),action:(0,C.jsx)(`button`,{className:`send-button`,type:`submit`,"aria-label":R(`Start task`),title:R(Gn?`Add instructions to the selected color groups above.`:`Start task (Enter)`),disabled:H||yt||ie?.output!==`annotations`&&(Wt.blocked||ut>0||gt||Gn)||!te.trim()&&!ie&&!Wt.files.length&&!Bn.selected.some(e=>e.comment.trim())&&!Object.keys(Wn).length,"aria-busy":H,children:H?(0,C.jsx)(`span`,{className:`spinner light`}):(0,C.jsx)(T,{name:`arrowUp`,size:18})})}),_e&&(0,C.jsx)(`p`,{className:`inline-error`,role:`alert`,children:_e}),Zt[$t]?.usage&&(0,C.jsx)(Ur,{agent:Xh[$t],usage:Zt[$t].usage})]})});return(0,C.jsx)(mg.Provider,{value:Ht||null,children:(0,C.jsx)(Vt,{task:U,items:U?s.taskId===U.id?s.items:g.current.get(U.id)||[]:[],read:e=>$(`/tasks/${e}/note-results`),openReview:()=>{ze(`review`),Fe(e=>e===`conversation`?`split`:e)},openChat:()=>{ze(`conversation`),Fe(e=>e===`review`?`split`:e)},children:(0,C.jsxs)(`div`,{className:`app-shell`+(je?``:` sidebar-collapsed`),children:[(0,C.jsxs)(`aside`,{ref:j,role:Ie&&Ee?`dialog`:void 0,"aria-modal":Ie&&Ee?!0:void 0,onKeyDown:e=>{Ie&&Ee&&!P&&!Xe&&(e.key===`Escape`?(e.preventDefault(),De(!1)):Mn(e))},id:`task-sidebar`,className:`sidebar `+(Ee?`is-open`:``),"aria-label":R(`Papers and tasks`),children:[(0,C.jsxs)(`div`,{className:`sidebar-header`,children:[e?.projects.length&&W?(0,C.jsxs)(Ue,{label:R(`Paper: {name}`,{name:W.name}),className:`project-switcher`,menuClassName:`paper-menu`,align:`start`,actions:[...e.projects.map(e=>({id:e.id,label:e.name,detail:Dg(e.path),title:e.path,checked:e.id===W.id,select:e.id===W.id?void 0:()=>{o(e.id),i(``)},edit:{label:R(`Edit {name}`,{name:e.name}),select:()=>Ze(e)}})),...Ut?[{label:R(`Add paper…`),icon:`plus`,divider:!0,select:()=>Xt()}]:[]],children:[(0,C.jsx)(`span`,{className:`project-switcher-name`,children:W.name}),(0,C.jsx)(T,{name:`chevronDown`,size:13})]}):Ut&&(0,C.jsxs)(`button`,{className:`add-project`,disabled:!e,onClick:()=>Xt(),children:[(0,C.jsx)(T,{name:`plus`,size:16}),R(`Add paper`)]}),(0,C.jsx)(`button`,{className:`icon-button`,"aria-label":R(`Hide task list`),title:R(`Hide task list`),onClick:hn,children:(0,C.jsx)(T,{name:Ie?`close`:`sidebar`,size:18})})]}),(0,C.jsx)(`div`,{className:`sidebar-actions`,children:W&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{className:`nav-link manuscript-link`+(bn?` active`:``),"aria-current":bn?`page`:void 0,onClick:()=>{i(``),nt(`manuscript`),Le&&$e(`pdf`),De(!1)},children:[(0,C.jsx)(T,{name:`pdf`,size:16}),(0,C.jsx)(`span`,{className:`nav-label`,children:R(`Manuscript`)}),Og(En)&&(0,C.jsx)(`span`,{className:`nav-meta`,title:R(`Git status of the manuscript`),children:Og(En)})]}),(0,C.jsxs)(Ue,{label:R(`Paper tools`),className:`nav-link paper-tools`,menuClassName:`paper-tools-menu`,align:`side`,actions:[{id:`references`,label:R(`Reference check`),icon:`checklist`,detail:R(`Citations, entries and their records`),hint:In?String(In):void 0,checked:xn||void 0,select:()=>{i(``),nt(`references`),De(!1)}}],children:[(0,C.jsx)(T,{name:`tool`,size:16}),(0,C.jsx)(`span`,{className:`nav-label`,children:R(`Tools`)}),(0,C.jsx)(T,{name:`more`,size:16})]})]})}),(0,C.jsxs)(`div`,{className:`task-list-tools`,role:`group`,"aria-label":R(Ke?`Archived tasks`:`Tasks`),children:[(0,C.jsxs)(`div`,{className:`task-search`,children:[(0,C.jsx)(T,{name:`search`,size:14}),(0,C.jsx)(`input`,{type:`search`,"aria-label":R(`Search tasks`),placeholder:R(Ke?`Search archived tasks…`:`Search tasks…`),title:R(`Search task titles and instructions`),value:We,onChange:e=>Ge(e.target.value),onKeyDown:e=>{e.key===`Escape`&&We&&(e.preventDefault(),e.stopPropagation(),Ge(``))}}),We&&(0,C.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":R(`Clear task search`),onClick:()=>{Ge(``),document.querySelector(`.task-search input`)?.focus()},children:(0,C.jsx)(T,{name:`close`,size:13})})]}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button archive-toggle`,"aria-pressed":Ke,"aria-label":R(Ke?`Show current tasks`:`Show archived tasks`),title:R(Ke?`Show current tasks`:`Show archived tasks`),onClick:()=>qe(e=>!e),children:(0,C.jsx)(T,{name:`archive`,size:15})})]}),(0,C.jsx)(`nav`,{className:`task-list`,"aria-label":R(`Task list`),children:Jt.length?[...Jt].reverse().map(e=>(0,C.jsxs)(`div`,{"data-task":e.id,className:`task-row `+(e.id===r?`active`:``)+(e.id===Ce?.id?` task-arriving`:``)+(e.id===ye?.id?` task-added`:``),children:[Ve===e.id?(0,C.jsx)(`form`,{className:`task-rename`,onSubmit:t=>{t.preventDefault(),Ye.current=e.id,t.currentTarget.querySelector(`input`)?.blur()},children:(0,C.jsx)(`input`,{name:`title`,"aria-label":R(`Rename {name}`,{name:e.title}),defaultValue:e.title,maxLength:120,autoFocus:!0,onFocus:e=>e.currentTarget.select(),onBlur:t=>void gn(e,t.currentTarget.value),onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),Ye.current=e.id,t.currentTarget.value=e.title,t.currentTarget.blur())}})}):(0,C.jsxs)(`button`,{"aria-current":e.id===r?`page`:void 0,className:`task-link `+(e.id===r?`active`:``),onClick:()=>{i(e.id),De(!1)},onDoubleClick:()=>{e.status!==`deleting`&&He(e.id)},children:[(0,C.jsx)(`span`,{className:`task-title`,title:e.title,children:e.title}),(0,C.jsxs)(`span`,{className:`task-meta`,children:[(0,C.jsx)(tg,{task:e}),(0,C.jsx)(`span`,{className:`task-time`,children:rg(e.updatedAt)})]})]}),(0,C.jsxs)(`div`,{className:`task-row-actions`,children:[e.review?.counts?.pending?(0,C.jsx)(`span`,{className:`task-badge`,title:z(e.review.counts.pending,`{n} change to decide`,`{n} changes to decide`),children:e.review.counts.pending}):null,(0,C.jsx)(Ue,{label:R(`Task actions for {title}`,{title:e.title}),actions:[...e.status===`deleting`?[]:[{label:R(`Rename…`),icon:`pencil`,select:()=>He(e.id)}],...e.status===`deleting`?[]:[{label:e.titleGeneration===`pending`?R(`Generating task title…`):e.titleGeneration===`failed`?R(`Retry title generation`):R(`Generate task title`),icon:`spark`,disabled:e.titleGeneration===`pending`||ke.has(`/tasks/`+e.id),select:()=>void un(`/tasks/`+e.id+`/title`)}],...e.status===`deleting`?[]:[{label:e.archivedAt?R(`Restore task`):R(`Archive task`),icon:e.archivedAt?`restore`:`archive`,disabled:ke.has(`/tasks/`+e.id),select:()=>void fn(e)}],...eg.includes(e.status)?[{label:R(`Pause task`),icon:`pause`,disabled:ke.has(`/tasks/`+e.id),select:()=>void un(`/tasks/`+e.id+`/interrupt`)}]:[],...e.status===`uncertain`?[{label:R(`Check status`),icon:`refresh`,disabled:ke.has(`/tasks/`+e.id),select:()=>void un(`/tasks/`+e.id+`/reconcile`)}]:[],{label:e.status===`deleting`?R(`Retry deletion…`):R(`Delete task…`),icon:`trash`,danger:!0,select:()=>N(e)}]})]})]},e.id)):(0,C.jsx)(`div`,{className:`task-list-empty`,role:`status`,children:qt.length?R(`No matching tasks`):R(Ke?`No archived tasks`:`No tasks yet`)})}),(0,C.jsxs)(`div`,{className:`sidebar-footer`,children:[(0,C.jsx)(`div`,{className:`sidebar-status`,children:e&&(!x||Yt>0)&&(0,C.jsxs)(`div`,{className:`host-status`+(x?``:` reconnecting`),role:`status`,title:R(x?`Connected`:`Reconnecting`),children:[(0,C.jsx)(`span`,{className:`connection-dot`+(x?` connected`:``),"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`host-state`,children:x?z(Yt,`{n} active task`,`{n} active tasks`):R(`Reconnecting`)})]})}),(0,C.jsxs)(`div`,{className:`brand`,children:[(0,C.jsxs)(`a`,{href:`/`,className:`brand-home`,"aria-label":`Papilot`,onClick:e=>{e.preventDefault(),i(``),nt(`manuscript`),Le&&$e(`pdf`),De(!1)},children:[(0,C.jsx)(`img`,{className:`brand-mark`,src:Fn,alt:``}),(0,C.jsx)(`span`,{children:`Papilot`})]}),e&&(Ut?(0,C.jsx)(Vn,{api:$,version:e.version}):(0,C.jsxs)(`span`,{className:`brand-version`,title:R(`Papilot {version}`,{version:e.version}),children:[`v`,Rn(e.version)]}))]}),(0,C.jsx)(`button`,{type:`button`,className:`icon-button settings-link`,"aria-label":R(`Settings`),title:R(`Settings`),"aria-haspopup":`dialog`,onClick:()=>Pt(`general`),children:(0,C.jsx)(T,{name:`settings`,size:18})})]})]}),Ee&&Ie&&(0,C.jsx)(`button`,{tabIndex:-1,className:`sidebar-scrim`,"aria-label":R(`Close task list`),onClick:()=>De(!1)}),(0,C.jsxs)(`main`,{className:`main`,inert:Ie&&Ee,children:[(0,C.jsx)(`h1`,{className:`sr-only`,children:U?U.title:bn?R(`Manuscript`):xn?R(`Reference check`):`Papilot`}),Ce&&(0,C.jsx)(Hh,{task:Ce,sidebarShown:pn,onArrive:Te}),(0,C.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-atomic":`true`,children:ye?R(`Task added: {title}`,{title:ye.title}):``}),(Le||!U&&!bn)&&(pr||U||bn)&&(0,C.jsxs)(`div`,{className:`workspace-navigation`,children:[pr,xr,Dr,Cr]}),e&&!x&&(0,C.jsxs)(`div`,{className:`connection-banner`,role:`status`,children:[(0,C.jsx)(T,{name:`alert`,size:15}),(0,C.jsx)(`span`,{children:R(`Connection lost. Showing the last update; your draft is kept.`)}),(0,C.jsx)(`button`,{onClick:()=>void zt(!0),children:R(`Retry connection`)})]}),U?(0,C.jsxs)(`div`,{className:`task-grid layout-${tr} show-${nr}`,style:kt?{"--chat-width":`${kt}px`}:void 0,children:[!Le&&tr===`split`&&(0,C.jsx)(`div`,{className:`panel-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":R(`Resize chat panel`),"aria-valuenow":kt||void 0,"aria-valuemin":300,tabIndex:0,title:R(`Drag to resize · Double-click to reset`),onPointerDown:_n,onDoubleClick:()=>At(0),onKeyDown:yn}),(0,C.jsxs)(`section`,{id:`review-panel`,className:`review-panel`,"aria-label":R(`PDF review`),children:[!Le&&!or&&U.mode!==`review`&&(!U.review?.round||U.status===`deleting`)&&(pr||!rr)&&(0,C.jsxs)(`div`,{className:`review-placeholder-toolbar`,children:[pr,!rr&&yr,(0,C.jsx)(`div`,{className:`panel-tools`,children:!rr&&vr})]}),U.status===`failed`&&U.review?.job?.status===`failed`&&(0,C.jsxs)(`div`,{className:`review-build-error`,role:`status`,children:[(0,C.jsx)(T,{name:`alert`,size:15}),(0,C.jsx)(`span`,{children:R(`Could not generate the PDF comparison.`)}),(0,C.jsx)(`button`,{className:`button secondary compact`,disabled:dn,onClick:()=>void un(`/tasks/`+U.id+`/publish`),children:R(`Retry build`)})]}),U.status===`deleting`?(0,C.jsxs)(`div`,{className:`review-placeholder`,children:[(0,C.jsx)(`div`,{className:`placeholder-icon`,children:(0,C.jsx)(T,{name:`trash`,size:22})}),(0,C.jsx)(`h2`,{children:R(`Deletion is in progress`)}),(0,C.jsx)(`p`,{children:R(`This task is reserved until its worktree cleanup is confirmed. Use Retry deletion if the connection was interrupted.`)})]}):U.mode===`review`?(0,C.jsx)(jn,{task:U,api:$,onCopied:()=>void Cn(U.projectId),lead:!Le&&!or&&(pr||!rr)?(0,C.jsxs)(C.Fragment,{children:[pr,!rr&&yr]}):null,tools:!Le&&!rr?vr:null},U.id):U.review?.round?(0,C.jsx)(Sn,{task:U,lead:!Le&&!or&&(pr||!rr)?(0,C.jsxs)(C.Fragment,{children:[pr,!rr&&yr]}):null,tools:(0,C.jsxs)(C.Fragment,{children:[wr,!Le&&!rr&&(0,C.jsxs)(C.Fragment,{children:[vr,Cr]})]}),completion:or?null:dr,onSendNotes:async e=>{await $(`/tasks/`+U.id+`/messages`,e),zt(!0)}},U.id):(0,C.jsx)(Lg,{task:U,busy:dn,onBuild:()=>void un(`/tasks/`+U.id+`/publish`)}),!or&&fr(!1)]}),(0,C.jsx)(wg,{task:U,lead:!Le&&or?pr:null,tools:!Le&&rr?(0,C.jsxs)(C.Fragment,{children:[xr,Cr]}):null,connection:(0,C.jsx)(Ph,{name:Zh(U),runtime:Zt[U.agent||`codex`],reconnecting:ke.has(`/reconnect`),onReconnect:()=>void un(`/reconnect`)}),models:Zt[U.agent||`codex`]?.models||[],composer:_.current.get(U.id),answerDrafts:v.current,items:s.taskId===U.id?s.items:g.current.get(U.id)||[],loading:s.taskId===U.id?l:!g.current.has(U.id),loadError:f.taskId===U.id?f.message:``,retry:()=>void Rt(U.id),requests:e?.requests.filter(e=>e.taskId===U.id)||[],refresh:()=>void zt(!0),reportError:Lt,pause:ar,pausing:dn,skills:Dn,feedback:or?(0,C.jsxs)(C.Fragment,{children:[fr(!0),dr&&(0,C.jsx)(`div`,{className:`review-feedback card commit-card task-delivery`,children:dr})]}):null,openReview:or?()=>{ze(`review`),Fe(e=>e===`conversation`?`split`:e)}:void 0},U.id)]}):bn&&W?(0,C.jsx)(zg,{tasks:e?.tasks.filter(e=>e.projectId===W.id)||[],onOpenTask:e=>{i(e),De(!1)},navigation:Le?null:pr,project:W,data:An.data,error:An.error,view:Qe,setView:$e,region:rt,setRegion:at,active:ot,setActive:st,actions:Yn,newTask:Or,tools:Le?null:Er,openPdf:Le?null:Tr,onFixProblems:On,onGit:e=>kn(W.id,e),writer:{agent:an.agent,model:an.model},reportError:Lt},W.id+W.path):xn&&W?(0,C.jsxs)(`section`,{className:`references-page`,"aria-label":R(`Reference check`),children:[(0,C.jsxs)(`header`,{className:`references-page-head`,children:[(0,C.jsx)(`h2`,{children:R(`Reference check`)}),(0,C.jsx)(`span`,{children:W.name})]}),(0,C.jsx)(ih,{data:Pn,onInvestigate:Ln})]}):e?Ut?(0,C.jsx)(`div`,{className:`home`,children:(0,C.jsxs)(`div`,{className:`home-inner`,children:[(0,C.jsx)(`img`,{className:`home-logo`,src:Fn,alt:``}),(0,C.jsx)(`h1`,{children:R(`Add your first paper`)}),(0,C.jsxs)(`button`,{className:`button primary`,onClick:()=>Xt(),children:[(0,C.jsx)(T,{name:`plus`,size:16}),R(`Add paper`)]})]})}):(0,C.jsx)(`div`,{className:`home`,children:(0,C.jsxs)(`div`,{className:`home-inner`,children:[(0,C.jsx)(`img`,{className:`home-logo`,src:Fn,alt:``}),(0,C.jsx)(`h1`,{children:R(`No papers yet`)}),(0,C.jsx)(`p`,{className:`home-copy`,children:R(`No papers have been shared with you yet. Papers appear here as soon as {name} shares them.`,{name:Ht?.owner||``})})]})}):(0,C.jsx)(`div`,{className:`home`,children:(0,C.jsxs)(`div`,{className:`home-inner`,children:[(0,C.jsx)(`div`,{className:`home-mark`,children:(0,C.jsx)(`span`,{className:`spinner`})}),(0,C.jsx)(`h1`,{children:R(`Opening your workspace`)}),(0,C.jsx)(`p`,{className:`home-copy`,role:`status`,children:k||R(`Connecting to your papers and tasks…`)}),k&&(0,C.jsx)(`button`,{className:`button secondary`,onClick:()=>void zt(!0),children:R(`Retry connection`)})]})})]}),E&&!P&&(0,C.jsxs)(`div`,{role:`alert`,className:`toast`,children:[(0,C.jsx)(T,{name:`alert`,size:16}),(0,C.jsx)(`span`,{children:E}),(0,C.jsx)(`button`,{className:`icon-button`,"aria-label":R(`Dismiss error`),onClick:()=>O(``),children:(0,C.jsx)(T,{name:`close`,size:14})})]}),Nt&&(0,C.jsx)(Im,{modelDefaults:{agents:Qt.map(e=>({value:e,label:Xh[e],runtime:Zt[e]})),agent:$t,model:an.model,effort:an.effort,onSelect:sn,onEffort:e=>on({effort:e})},updates:Ut?$:void 0,initialPage:Nt,theme:jt.theme,onTheme:jt.setTheme,resolved:jt.resolved,appearance:jt.appearance,onAppearance:jt.setAppearance,onClose:()=>Pt(!1),people:Ut?{api:$,projects:e?.projects||[],ago:ig}:void 0,onSignOut:Ht?.listener===`account`?()=>{Pt(!1),Gt()}:void 0,accountName:Ht?.name,diagnostics:Ut?{online:x,runtimes:Zt,project:W,check:Yh,latex:Jh,reconnect:async()=>{await $(`/reconnect`,{}),await zt(!0)}}:void 0,skills:Ut?{project:W,api:$,onChanged:()=>B(e=>e+1)}:void 0}),M&&(0,C.jsx)(Nn,{task:e?.tasks.find(e=>e.id===M.id)||M,submit:()=>$(`/tasks/`+M.id+`/delete`,{confirm:!0}),onClose:()=>N(null),onDeleted:()=>mn(M.id),refresh:()=>void zt(!0)}),Xe&&(0,C.jsx)(Un,{paper:Xe,canManage:Ut,onClose:()=>Ze(null),save:async e=>{let t=Xe,n=Ut&&e.path!==t.path;await $(`/projects/${t.id}/${n?`path`:`rename`}`,n?e:{name:e.name}),n&&(++Ct.current,St({projectId:``,data:null,error:``}),Ot({projectId:``,status:null})),await zt(!0),n&&W?.id===t.id&&bn&&await Cn(t.id)},remove:async()=>{let e=Xe;await $(`/projects/${e.id}/remove`,{}),U?.projectId===e.id&&i(``),t(t=>t&&{...t,projects:t.projects.filter(t=>t.id!==e.id),tasks:t.tasks.filter(t=>t.projectId!==e.id)}),await zt(!0)}},Xe.id),P&&(0,C.jsx)(qn,{api:$,agent:$t,canRepair:Object.values(Zt).some(e=>e?.connected&&e.authenticated),onClose:()=>F(null),onDone:async e=>{o(e.id),i(``),F(null),De(!1),await zt(!0)}})]})})})}function Vg(){let e=jh(),[t,n]=(0,S.useState)(location.pathname===`/invite`),r=()=>{n(!1),kh(!1)};return t?(0,C.jsx)(Eh,{api:$,onDone:r}):e?(0,C.jsx)(Th,{api:$,onSignedIn:r}):(0,C.jsx)(Bg,{})}(0,Pe.createRoot)(document.getElementById(`root`)).render((0,C.jsx)(S.StrictMode,{children:(0,C.jsx)(Vg,{})}));export{D as C,y as E,R as S,x as T,Ee as _,J as a,re as b,Ui as c,ni as d,ti as f,Ae as g,mt as h,X as i,zi as l,_t as m,Rl as n,Wi as o,Pn as p,zl as r,Hi as s,Kd as t,pi as u,ae as v,T as w,ie as x,oe as y};