hermes-pilot 0.2.0 → 0.2.2

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.
@@ -0,0 +1,94 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TermPane-q4f5Zu0I.js","assets/TermPane-DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();const Py="modulepreload",Iy=function(e){return"/"+e},Hp={},_y=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),o=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=Iy(c),c in Hp)return;Hp[c]=!0;const d=c.endsWith(".css"),g=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":Py,d||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),d)return new Promise((h,x)=>{f.addEventListener("load",h),f.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(l){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=l,window.dispatchEvent(o),!o.defaultPrevented)throw l}return r.then(l=>{for(const o of l||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function My(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hm={exports:{}},yo={},zm={exports:{}},Ie={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Pi=Symbol.for("react.element"),Ly=Symbol.for("react.portal"),Oy=Symbol.for("react.fragment"),Dy=Symbol.for("react.strict_mode"),$y=Symbol.for("react.profiler"),Fy=Symbol.for("react.provider"),By=Symbol.for("react.context"),Uy=Symbol.for("react.forward_ref"),Hy=Symbol.for("react.suspense"),zy=Symbol.for("react.memo"),Wy=Symbol.for("react.lazy"),zp=Symbol.iterator;function Vy(e){return e===null||typeof e!="object"?null:(e=zp&&e[zp]||e["@@iterator"],typeof e=="function"?e:null)}var Wm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Vm=Object.assign,Km={};function xa(e,t,n){this.props=e,this.context=t,this.refs=Km,this.updater=n||Wm}xa.prototype.isReactComponent={};xa.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): 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")};xa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Qm(){}Qm.prototype=xa.prototype;function ed(e,t,n){this.props=e,this.context=t,this.refs=Km,this.updater=n||Wm}var td=ed.prototype=new Qm;td.constructor=ed;Vm(td,xa.prototype);td.isPureReactComponent=!0;var Wp=Array.isArray,Gm=Object.prototype.hasOwnProperty,nd={current:null},Ym={key:!0,ref:!0,__self:!0,__source:!0};function Jm(e,t,n){var s,r={},i=null,l=null;if(t!=null)for(s in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)Gm.call(t,s)&&!Ym.hasOwnProperty(s)&&(r[s]=t[s]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var c=Array(o),d=0;d<o;d++)c[d]=arguments[d+2];r.children=c}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return{$$typeof:Pi,type:e,key:i,ref:l,props:r,_owner:nd.current}}function Ky(e,t){return{$$typeof:Pi,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function sd(e){return typeof e=="object"&&e!==null&&e.$$typeof===Pi}function Qy(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Vp=/\/+/g;function Xo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Qy(""+e.key):t.toString(36)}function gl(e,t,n,s,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(i){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case Pi:case Ly:l=!0}}if(l)return l=e,r=r(l),e=s===""?"."+Xo(l,0):s,Wp(r)?(n="",e!=null&&(n=e.replace(Vp,"$&/")+"/"),gl(r,t,n,"",function(d){return d})):r!=null&&(sd(r)&&(r=Ky(r,n+(!r.key||l&&l.key===r.key?"":(""+r.key).replace(Vp,"$&/")+"/")+e)),t.push(r)),1;if(l=0,s=s===""?".":s+":",Wp(e))for(var o=0;o<e.length;o++){i=e[o];var c=s+Xo(i,o);l+=gl(i,t,n,c,r)}else if(c=Vy(e),typeof c=="function")for(e=c.call(e),o=0;!(i=e.next()).done;)i=i.value,c=s+Xo(i,o++),l+=gl(i,t,n,c,r);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function Qi(e,t,n){if(e==null)return e;var s=[],r=0;return gl(e,s,"","",function(i){return t.call(n,i,r++)}),s}function Gy(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Kt={current:null},vl={transition:null},Yy={ReactCurrentDispatcher:Kt,ReactCurrentBatchConfig:vl,ReactCurrentOwner:nd};function qm(){throw Error("act(...) is not supported in production builds of React.")}Ie.Children={map:Qi,forEach:function(e,t,n){Qi(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Qi(e,function(){t++}),t},toArray:function(e){return Qi(e,function(t){return t})||[]},only:function(e){if(!sd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ie.Component=xa;Ie.Fragment=Oy;Ie.Profiler=$y;Ie.PureComponent=ed;Ie.StrictMode=Dy;Ie.Suspense=Hy;Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yy;Ie.act=qm;Ie.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Vm({},e.props),r=e.key,i=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,l=nd.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(c in t)Gm.call(t,c)&&!Ym.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&o!==void 0?o[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){o=Array(c);for(var d=0;d<c;d++)o[d]=arguments[d+2];s.children=o}return{$$typeof:Pi,type:e.type,key:r,ref:i,props:s,_owner:l}};Ie.createContext=function(e){return e={$$typeof:By,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Fy,_context:e},e.Consumer=e};Ie.createElement=Jm;Ie.createFactory=function(e){var t=Jm.bind(null,e);return t.type=e,t};Ie.createRef=function(){return{current:null}};Ie.forwardRef=function(e){return{$$typeof:Uy,render:e}};Ie.isValidElement=sd;Ie.lazy=function(e){return{$$typeof:Wy,_payload:{_status:-1,_result:e},_init:Gy}};Ie.memo=function(e,t){return{$$typeof:zy,type:e,compare:t===void 0?null:t}};Ie.startTransition=function(e){var t=vl.transition;vl.transition={};try{e()}finally{vl.transition=t}};Ie.unstable_act=qm;Ie.useCallback=function(e,t){return Kt.current.useCallback(e,t)};Ie.useContext=function(e){return Kt.current.useContext(e)};Ie.useDebugValue=function(){};Ie.useDeferredValue=function(e){return Kt.current.useDeferredValue(e)};Ie.useEffect=function(e,t){return Kt.current.useEffect(e,t)};Ie.useId=function(){return Kt.current.useId()};Ie.useImperativeHandle=function(e,t,n){return Kt.current.useImperativeHandle(e,t,n)};Ie.useInsertionEffect=function(e,t){return Kt.current.useInsertionEffect(e,t)};Ie.useLayoutEffect=function(e,t){return Kt.current.useLayoutEffect(e,t)};Ie.useMemo=function(e,t){return Kt.current.useMemo(e,t)};Ie.useReducer=function(e,t,n){return Kt.current.useReducer(e,t,n)};Ie.useRef=function(e){return Kt.current.useRef(e)};Ie.useState=function(e){return Kt.current.useState(e)};Ie.useSyncExternalStore=function(e,t,n){return Kt.current.useSyncExternalStore(e,t,n)};Ie.useTransition=function(){return Kt.current.useTransition()};Ie.version="18.3.1";zm.exports=Ie;var u=zm.exports;const ze=My(u);/**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Jy=u,qy=Symbol.for("react.element"),Xy=Symbol.for("react.fragment"),Zy=Object.prototype.hasOwnProperty,ew=Jy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tw={key:!0,ref:!0,__self:!0,__source:!0};function Xm(e,t,n){var s,r={},i=null,l=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(l=t.ref);for(s in t)Zy.call(t,s)&&!tw.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)r[s]===void 0&&(r[s]=t[s]);return{$$typeof:qy,type:e,key:i,ref:l,props:r,_owner:ew.current}}yo.Fragment=Xy;yo.jsx=Xm;yo.jsxs=Xm;Hm.exports=yo;var a=Hm.exports,Zm={exports:{}},mn={},ef={exports:{}},tf={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */(function(e){function t(G,q){var ce=G.length;G.push(q);e:for(;0<ce;){var te=ce-1>>>1,pe=G[te];if(0<r(pe,q))G[te]=q,G[ce]=pe,ce=te;else break e}}function n(G){return G.length===0?null:G[0]}function s(G){if(G.length===0)return null;var q=G[0],ce=G.pop();if(ce!==q){G[0]=ce;e:for(var te=0,pe=G.length,ve=pe>>>1;te<ve;){var xe=2*(te+1)-1,Oe=G[xe],Ae=xe+1,et=G[Ae];if(0>r(Oe,ce))Ae<pe&&0>r(et,Oe)?(G[te]=et,G[Ae]=ce,te=Ae):(G[te]=Oe,G[xe]=ce,te=xe);else if(Ae<pe&&0>r(et,ce))G[te]=et,G[Ae]=ce,te=Ae;else break e}}return q}function r(G,q){var ce=G.sortIndex-q.sortIndex;return ce!==0?ce:G.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var c=[],d=[],g=1,f=null,h=3,x=!1,b=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(G){for(var q=n(d);q!==null;){if(q.callback===null)s(d);else if(q.startTime<=G)s(d),q.sortIndex=q.expirationTime,t(c,q);else break;q=n(d)}}function T(G){if(w=!1,v(G),!b)if(n(c)!==null)b=!0,ge(E);else{var q=n(d);q!==null&&Z(T,q.startTime-G)}}function E(G,q){b=!1,w&&(w=!1,k(A),A=-1),x=!0;var ce=h;try{for(v(q),f=n(c);f!==null&&(!(f.expirationTime>q)||G&&!K());){var te=f.callback;if(typeof te=="function"){f.callback=null,h=f.priorityLevel;var pe=te(f.expirationTime<=q);q=e.unstable_now(),typeof pe=="function"?f.callback=pe:f===n(c)&&s(c),v(q)}else s(c);f=n(c)}if(f!==null)var ve=!0;else{var xe=n(d);xe!==null&&Z(T,xe.startTime-q),ve=!1}return ve}finally{f=null,h=ce,x=!1}}var _=!1,I=null,A=-1,P=5,y=-1;function K(){return!(e.unstable_now()-y<P)}function $(){if(I!==null){var G=e.unstable_now();y=G;var q=!0;try{q=I(!0,G)}finally{q?V():(_=!1,I=null)}}else _=!1}var V;if(typeof m=="function")V=function(){m($)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,X=D.port2;D.port1.onmessage=$,V=function(){X.postMessage(null)}}else V=function(){S($,0)};function ge(G){I=G,_||(_=!0,V())}function Z(G,q){A=S(function(){G(e.unstable_now())},q)}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(G){G.callback=null},e.unstable_continueExecution=function(){b||x||(b=!0,ge(E))},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(G){switch(h){case 1:case 2:case 3:var q=3;break;default:q=h}var ce=h;h=q;try{return G()}finally{h=ce}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(G,q){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ce=h;h=G;try{return q()}finally{h=ce}},e.unstable_scheduleCallback=function(G,q,ce){var te=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?te+ce:te):ce=te,G){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=ce+pe,G={id:g++,callback:q,priorityLevel:G,startTime:ce,expirationTime:pe,sortIndex:-1},ce>te?(G.sortIndex=ce,t(d,G),n(c)===null&&G===n(d)&&(w?(k(A),A=-1):w=!0,Z(T,ce-te))):(G.sortIndex=pe,t(c,G),b||x||(b=!0,ge(E))),G},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(G){var q=h;return function(){var ce=h;h=q;try{return G.apply(this,arguments)}finally{h=ce}}}})(tf);ef.exports=tf;var nw=ef.exports;/**
27
+ * @license React
28
+ * react-dom.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var sw=u,pn=nw;function J(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var nf=new Set,di={};function Cr(e,t){da(e,t),da(e+"Capture",t)}function da(e,t){for(di[e]=t,e=0;e<t.length;e++)nf.add(t[e])}var ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bc=Object.prototype.hasOwnProperty,rw=/^[: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]*$/,Kp={},Qp={};function aw(e){return Bc.call(Qp,e)?!0:Bc.call(Kp,e)?!1:rw.test(e)?Qp[e]=!0:(Kp[e]=!0,!1)}function iw(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function lw(e,t,n,s){if(t===null||typeof t>"u"||iw(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Qt(e,t,n,s,r,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var Pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pt[e]=new Qt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pt[t]=new Qt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pt[e]=new Qt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pt[e]=new Qt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pt[e]=new Qt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pt[e]=new Qt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pt[e]=new Qt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pt[e]=new Qt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pt[e]=new Qt(e,5,!1,e.toLowerCase(),null,!1,!1)});var rd=/[\-:]([a-z])/g;function ad(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(rd,ad);Pt[t]=new Qt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(rd,ad);Pt[t]=new Qt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(rd,ad);Pt[t]=new Qt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pt[e]=new Qt(e,1,!1,e.toLowerCase(),null,!1,!1)});Pt.xlinkHref=new Qt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pt[e]=new Qt(e,1,!1,e.toLowerCase(),null,!0,!0)});function id(e,t,n,s){var r=Pt.hasOwnProperty(t)?Pt[t]:null;(r!==null?r.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(lw(t,n,r,s)&&(n=null),s||r===null?aw(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):r.mustUseProperty?e[r.propertyName]=n===null?r.type===3?!1:"":n:(t=r.attributeName,s=r.attributeNamespace,n===null?e.removeAttribute(t):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var Ss=sw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Gi=Symbol.for("react.element"),Wr=Symbol.for("react.portal"),Vr=Symbol.for("react.fragment"),ld=Symbol.for("react.strict_mode"),Uc=Symbol.for("react.profiler"),sf=Symbol.for("react.provider"),rf=Symbol.for("react.context"),od=Symbol.for("react.forward_ref"),Hc=Symbol.for("react.suspense"),zc=Symbol.for("react.suspense_list"),cd=Symbol.for("react.memo"),Ls=Symbol.for("react.lazy"),af=Symbol.for("react.offscreen"),Gp=Symbol.iterator;function La(e){return e===null||typeof e!="object"?null:(e=Gp&&e[Gp]||e["@@iterator"],typeof e=="function"?e:null)}var it=Object.assign,Zo;function Wa(e){if(Zo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Zo=t&&t[1]||""}return`
35
+ `+Zo+e}var ec=!1;function tc(e,t){if(!e||ec)return"";ec=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var r=d.stack.split(`
36
+ `),i=s.stack.split(`
37
+ `),l=r.length-1,o=i.length-1;1<=l&&0<=o&&r[l]!==i[o];)o--;for(;1<=l&&0<=o;l--,o--)if(r[l]!==i[o]){if(l!==1||o!==1)do if(l--,o--,0>o||r[l]!==i[o]){var c=`
38
+ `+r[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=l&&0<=o);break}}}finally{ec=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wa(e):""}function ow(e){switch(e.tag){case 5:return Wa(e.type);case 16:return Wa("Lazy");case 13:return Wa("Suspense");case 19:return Wa("SuspenseList");case 0:case 2:case 15:return e=tc(e.type,!1),e;case 11:return e=tc(e.type.render,!1),e;case 1:return e=tc(e.type,!0),e;default:return""}}function Wc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vr:return"Fragment";case Wr:return"Portal";case Uc:return"Profiler";case ld:return"StrictMode";case Hc:return"Suspense";case zc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rf:return(e.displayName||"Context")+".Consumer";case sf:return(e._context.displayName||"Context")+".Provider";case od:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cd:return t=e.displayName||null,t!==null?t:Wc(e.type)||"Memo";case Ls:t=e._payload,e=e._init;try{return Wc(e(t))}catch{}}return null}function cw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wc(t);case 8:return t===ld?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Js(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uw(e){var t=lf(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(l){s=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(l){s=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yi(e){e._valueTracker||(e._valueTracker=uw(e))}function of(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=lf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ll(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Vc(e,t){var n=t.checked;return it({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yp(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Js(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function cf(e,t){t=t.checked,t!=null&&id(e,"checked",t,!1)}function Kc(e,t){cf(e,t);var n=Js(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Qc(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qc(e,t.type,Js(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Jp(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Qc(e,t,n){(t!=="number"||Ll(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Va=Array.isArray;function na(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Js(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Gc(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(J(91));return it({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function qp(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(J(92));if(Va(n)){if(1<n.length)throw Error(J(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Js(n)}}function uf(e,t){var n=Js(t.value),s=Js(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Xp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function df(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Yc(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?df(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ji,pf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,r){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,r)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ji=Ji||document.createElement("div"),Ji.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ji.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function pi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ga={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dw=["Webkit","ms","Moz","O"];Object.keys(Ga).forEach(function(e){dw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ga[t]=Ga[e]})});function hf(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ga.hasOwnProperty(e)&&Ga[e]?(""+t).trim():t+"px"}function mf(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=hf(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,r):e[n]=r}}var pw=it({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Jc(e,t){if(t){if(pw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function qc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Xc=null;function ud(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zc=null,sa=null,ra=null;function Zp(e){if(e=Mi(e)){if(typeof Zc!="function")throw Error(J(280));var t=e.stateNode;t&&(t=So(t),Zc(e.stateNode,e.type,t))}}function ff(e){sa?ra?ra.push(e):ra=[e]:sa=e}function gf(){if(sa){var e=sa,t=ra;if(ra=sa=null,Zp(e),t)for(e=0;e<t.length;e++)Zp(t[e])}}function vf(e,t){return e(t)}function yf(){}var nc=!1;function wf(e,t,n){if(nc)return e(t,n);nc=!0;try{return vf(e,t,n)}finally{nc=!1,(sa!==null||ra!==null)&&(yf(),gf())}}function hi(e,t){var n=e.stateNode;if(n===null)return null;var s=So(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(J(231,t,typeof n));return n}var eu=!1;if(ys)try{var Oa={};Object.defineProperty(Oa,"passive",{get:function(){eu=!0}}),window.addEventListener("test",Oa,Oa),window.removeEventListener("test",Oa,Oa)}catch{eu=!1}function hw(e,t,n,s,r,i,l,o,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(g){this.onError(g)}}var Ya=!1,Ol=null,Dl=!1,tu=null,mw={onError:function(e){Ya=!0,Ol=e}};function fw(e,t,n,s,r,i,l,o,c){Ya=!1,Ol=null,hw.apply(mw,arguments)}function gw(e,t,n,s,r,i,l,o,c){if(fw.apply(this,arguments),Ya){if(Ya){var d=Ol;Ya=!1,Ol=null}else throw Error(J(198));Dl||(Dl=!0,tu=d)}}function Er(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function xf(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 eh(e){if(Er(e)!==e)throw Error(J(188))}function vw(e){var t=e.alternate;if(!t){if(t=Er(e),t===null)throw Error(J(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return eh(r),e;if(i===s)return eh(r),t;i=i.sibling}throw Error(J(188))}if(n.return!==s.return)n=r,s=i;else{for(var l=!1,o=r.child;o;){if(o===n){l=!0,n=r,s=i;break}if(o===s){l=!0,s=r,n=i;break}o=o.sibling}if(!l){for(o=i.child;o;){if(o===n){l=!0,n=i,s=r;break}if(o===s){l=!0,s=i,n=r;break}o=o.sibling}if(!l)throw Error(J(189))}}if(n.alternate!==s)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?e:t}function kf(e){return e=vw(e),e!==null?bf(e):null}function bf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=bf(e);if(t!==null)return t;e=e.sibling}return null}var Sf=pn.unstable_scheduleCallback,th=pn.unstable_cancelCallback,yw=pn.unstable_shouldYield,ww=pn.unstable_requestPaint,pt=pn.unstable_now,xw=pn.unstable_getCurrentPriorityLevel,dd=pn.unstable_ImmediatePriority,Nf=pn.unstable_UserBlockingPriority,$l=pn.unstable_NormalPriority,kw=pn.unstable_LowPriority,jf=pn.unstable_IdlePriority,wo=null,ts=null;function bw(e){if(ts&&typeof ts.onCommitFiberRoot=="function")try{ts.onCommitFiberRoot(wo,e,void 0,(e.current.flags&128)===128)}catch{}}var Hn=Math.clz32?Math.clz32:jw,Sw=Math.log,Nw=Math.LN2;function jw(e){return e>>>=0,e===0?32:31-(Sw(e)/Nw|0)|0}var qi=64,Xi=4194304;function Ka(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fl(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,r=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var o=l&~r;o!==0?s=Ka(o):(i&=l,i!==0&&(s=Ka(i)))}else l=n&~r,l!==0?s=Ka(l):i!==0&&(s=Ka(i));if(s===0)return 0;if(t!==0&&t!==s&&!(t&r)&&(r=s&-s,i=t&-t,r>=i||r===16&&(i&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Hn(t),r=1<<n,s|=e[n],t&=~r;return s}function Cw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ew(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes;0<i;){var l=31-Hn(i),o=1<<l,c=r[l];c===-1?(!(o&n)||o&s)&&(r[l]=Cw(o,t)):c<=t&&(e.expiredLanes|=o),i&=~o}}function nu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Cf(){var e=qi;return qi<<=1,!(qi&4194240)&&(qi=64),e}function sc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ii(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Hn(t),e[t]=n}function Tw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-Hn(n),i=1<<r;t[r]=0,s[r]=-1,e[r]=-1,n&=~i}}function pd(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Hn(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}var Ve=0;function Ef(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Tf,hd,Af,Rf,Pf,su=!1,Zi=[],Hs=null,zs=null,Ws=null,mi=new Map,fi=new Map,$s=[],Aw="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 submit".split(" ");function nh(e,t){switch(e){case"focusin":case"focusout":Hs=null;break;case"dragenter":case"dragleave":zs=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":mi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":fi.delete(t.pointerId)}}function Da(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Mi(t),t!==null&&hd(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Rw(e,t,n,s,r){switch(t){case"focusin":return Hs=Da(Hs,e,t,n,s,r),!0;case"dragenter":return zs=Da(zs,e,t,n,s,r),!0;case"mouseover":return Ws=Da(Ws,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return mi.set(i,Da(mi.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,fi.set(i,Da(fi.get(i)||null,e,t,n,s,r)),!0}return!1}function If(e){var t=fr(e.target);if(t!==null){var n=Er(t);if(n!==null){if(t=n.tag,t===13){if(t=xf(n),t!==null){e.blockedOn=t,Pf(e.priority,function(){Af(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 yl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ru(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Xc=s,n.target.dispatchEvent(s),Xc=null}else return t=Mi(n),t!==null&&hd(t),e.blockedOn=n,!1;t.shift()}return!0}function sh(e,t,n){yl(e)&&n.delete(t)}function Pw(){su=!1,Hs!==null&&yl(Hs)&&(Hs=null),zs!==null&&yl(zs)&&(zs=null),Ws!==null&&yl(Ws)&&(Ws=null),mi.forEach(sh),fi.forEach(sh)}function $a(e,t){e.blockedOn===t&&(e.blockedOn=null,su||(su=!0,pn.unstable_scheduleCallback(pn.unstable_NormalPriority,Pw)))}function gi(e){function t(r){return $a(r,e)}if(0<Zi.length){$a(Zi[0],e);for(var n=1;n<Zi.length;n++){var s=Zi[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Hs!==null&&$a(Hs,e),zs!==null&&$a(zs,e),Ws!==null&&$a(Ws,e),mi.forEach(t),fi.forEach(t),n=0;n<$s.length;n++)s=$s[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<$s.length&&(n=$s[0],n.blockedOn===null);)If(n),n.blockedOn===null&&$s.shift()}var aa=Ss.ReactCurrentBatchConfig,Bl=!0;function Iw(e,t,n,s){var r=Ve,i=aa.transition;aa.transition=null;try{Ve=1,md(e,t,n,s)}finally{Ve=r,aa.transition=i}}function _w(e,t,n,s){var r=Ve,i=aa.transition;aa.transition=null;try{Ve=4,md(e,t,n,s)}finally{Ve=r,aa.transition=i}}function md(e,t,n,s){if(Bl){var r=ru(e,t,n,s);if(r===null)hc(e,t,s,Ul,n),nh(e,s);else if(Rw(r,e,t,n,s))s.stopPropagation();else if(nh(e,s),t&4&&-1<Aw.indexOf(e)){for(;r!==null;){var i=Mi(r);if(i!==null&&Tf(i),i=ru(e,t,n,s),i===null&&hc(e,t,s,Ul,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else hc(e,t,s,null,n)}}var Ul=null;function ru(e,t,n,s){if(Ul=null,e=ud(s),e=fr(e),e!==null)if(t=Er(e),t===null)e=null;else if(n=t.tag,n===13){if(e=xf(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 Ul=e,null}function _f(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(xw()){case dd:return 1;case Nf:return 4;case $l:case kw:return 16;case jf:return 536870912;default:return 16}default:return 16}}var Bs=null,fd=null,wl=null;function Mf(){if(wl)return wl;var e,t=fd,n=t.length,s,r="value"in Bs?Bs.value:Bs.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var l=n-e;for(s=1;s<=l&&t[n-s]===r[i-s];s++);return wl=r.slice(e,1<s?1-s:void 0)}function xl(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 el(){return!0}function rh(){return!1}function fn(e){function t(n,s,r,i,l){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=l,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?el:rh,this.isPropagationStopped=rh,this}return it(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=el)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=el)},persist:function(){},isPersistent:el}),t}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gd=fn(ka),_i=it({},ka,{view:0,detail:0}),Mw=fn(_i),rc,ac,Fa,xo=it({},_i,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vd,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!==Fa&&(Fa&&e.type==="mousemove"?(rc=e.screenX-Fa.screenX,ac=e.screenY-Fa.screenY):ac=rc=0,Fa=e),rc)},movementY:function(e){return"movementY"in e?e.movementY:ac}}),ah=fn(xo),Lw=it({},xo,{dataTransfer:0}),Ow=fn(Lw),Dw=it({},_i,{relatedTarget:0}),ic=fn(Dw),$w=it({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),Fw=fn($w),Bw=it({},ka,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Uw=fn(Bw),Hw=it({},ka,{data:0}),ih=fn(Hw),zw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ww={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"},Vw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vw[e])?!!t[e]:!1}function vd(){return Kw}var Qw=it({},_i,{key:function(e){if(e.key){var t=zw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ww[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vd,charCode:function(e){return e.type==="keypress"?xl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gw=fn(Qw),Yw=it({},xo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lh=fn(Yw),Jw=it({},_i,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vd}),qw=fn(Jw),Xw=it({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zw=fn(Xw),ex=it({},xo,{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}),tx=fn(ex),nx=[9,13,27,32],yd=ys&&"CompositionEvent"in window,Ja=null;ys&&"documentMode"in document&&(Ja=document.documentMode);var sx=ys&&"TextEvent"in window&&!Ja,Lf=ys&&(!yd||Ja&&8<Ja&&11>=Ja),oh=" ",ch=!1;function Of(e,t){switch(e){case"keyup":return nx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Df(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Kr=!1;function rx(e,t){switch(e){case"compositionend":return Df(t);case"keypress":return t.which!==32?null:(ch=!0,oh);case"textInput":return e=t.data,e===oh&&ch?null:e;default:return null}}function ax(e,t){if(Kr)return e==="compositionend"||!yd&&Of(e,t)?(e=Mf(),wl=fd=Bs=null,Kr=!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 Lf&&t.locale!=="ko"?null:t.data;default:return null}}var ix={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 uh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ix[e.type]:t==="textarea"}function $f(e,t,n,s){ff(s),t=Hl(t,"onChange"),0<t.length&&(n=new gd("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var qa=null,vi=null;function lx(e){Yf(e,0)}function ko(e){var t=Yr(e);if(of(t))return e}function ox(e,t){if(e==="change")return t}var Ff=!1;if(ys){var lc;if(ys){var oc="oninput"in document;if(!oc){var dh=document.createElement("div");dh.setAttribute("oninput","return;"),oc=typeof dh.oninput=="function"}lc=oc}else lc=!1;Ff=lc&&(!document.documentMode||9<document.documentMode)}function ph(){qa&&(qa.detachEvent("onpropertychange",Bf),vi=qa=null)}function Bf(e){if(e.propertyName==="value"&&ko(vi)){var t=[];$f(t,vi,e,ud(e)),wf(lx,t)}}function cx(e,t,n){e==="focusin"?(ph(),qa=t,vi=n,qa.attachEvent("onpropertychange",Bf)):e==="focusout"&&ph()}function ux(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ko(vi)}function dx(e,t){if(e==="click")return ko(t)}function px(e,t){if(e==="input"||e==="change")return ko(t)}function hx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vn=typeof Object.is=="function"?Object.is:hx;function yi(e,t){if(Vn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!Bc.call(t,r)||!Vn(e[r],t[r]))return!1}return!0}function hh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mh(e,t){var n=hh(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=hh(n)}}function Uf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hf(){for(var e=window,t=Ll();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ll(e.document)}return t}function wd(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")}function mx(e){var t=Hf(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Uf(n.ownerDocument.documentElement,n)){if(s!==null&&wd(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var r=n.textContent.length,i=Math.min(s.start,r);s=s.end===void 0?i:Math.min(s.end,r),!e.extend&&i>s&&(r=s,s=i,i=r),r=mh(n,i);var l=mh(n,s);r&&l&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(r.node,r.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var fx=ys&&"documentMode"in document&&11>=document.documentMode,Qr=null,au=null,Xa=null,iu=!1;function fh(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;iu||Qr==null||Qr!==Ll(s)||(s=Qr,"selectionStart"in s&&wd(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Xa&&yi(Xa,s)||(Xa=s,s=Hl(au,"onSelect"),0<s.length&&(t=new gd("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Qr)))}function tl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Gr={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionend:tl("Transition","TransitionEnd")},cc={},zf={};ys&&(zf=document.createElement("div").style,"AnimationEvent"in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),"TransitionEvent"in window||delete Gr.transitionend.transition);function bo(e){if(cc[e])return cc[e];if(!Gr[e])return e;var t=Gr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zf)return cc[e]=t[n];return e}var Wf=bo("animationend"),Vf=bo("animationiteration"),Kf=bo("animationstart"),Qf=bo("transitionend"),Gf=new Map,gh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Zs(e,t){Gf.set(e,t),Cr(t,[e])}for(var uc=0;uc<gh.length;uc++){var dc=gh[uc],gx=dc.toLowerCase(),vx=dc[0].toUpperCase()+dc.slice(1);Zs(gx,"on"+vx)}Zs(Wf,"onAnimationEnd");Zs(Vf,"onAnimationIteration");Zs(Kf,"onAnimationStart");Zs("dblclick","onDoubleClick");Zs("focusin","onFocus");Zs("focusout","onBlur");Zs(Qf,"onTransitionEnd");da("onMouseEnter",["mouseout","mouseover"]);da("onMouseLeave",["mouseout","mouseover"]);da("onPointerEnter",["pointerout","pointerover"]);da("onPointerLeave",["pointerout","pointerover"]);Cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Cr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="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(" "),yx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qa));function vh(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,gw(s,t,void 0,e),e.currentTarget=null}function Yf(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var l=s.length-1;0<=l;l--){var o=s[l],c=o.instance,d=o.currentTarget;if(o=o.listener,c!==i&&r.isPropagationStopped())break e;vh(r,o,d),i=c}else for(l=0;l<s.length;l++){if(o=s[l],c=o.instance,d=o.currentTarget,o=o.listener,c!==i&&r.isPropagationStopped())break e;vh(r,o,d),i=c}}}if(Dl)throw e=tu,Dl=!1,tu=null,e}function Xe(e,t){var n=t[du];n===void 0&&(n=t[du]=new Set);var s=e+"__bubble";n.has(s)||(Jf(t,e,2,!1),n.add(s))}function pc(e,t,n){var s=0;t&&(s|=4),Jf(n,e,s,t)}var nl="_reactListening"+Math.random().toString(36).slice(2);function wi(e){if(!e[nl]){e[nl]=!0,nf.forEach(function(n){n!=="selectionchange"&&(yx.has(n)||pc(n,!1,e),pc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nl]||(t[nl]=!0,pc("selectionchange",!1,t))}}function Jf(e,t,n,s){switch(_f(t)){case 1:var r=Iw;break;case 4:r=_w;break;default:r=md}n=r.bind(null,t,n,e),r=void 0,!eu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function hc(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var l=s.tag;if(l===3||l===4){var o=s.stateNode.containerInfo;if(o===r||o.nodeType===8&&o.parentNode===r)break;if(l===4)for(l=s.return;l!==null;){var c=l.tag;if((c===3||c===4)&&(c=l.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;l=l.return}for(;o!==null;){if(l=fr(o),l===null)return;if(c=l.tag,c===5||c===6){s=i=l;continue e}o=o.parentNode}}s=s.return}wf(function(){var d=i,g=ud(n),f=[];e:{var h=Gf.get(e);if(h!==void 0){var x=gd,b=e;switch(e){case"keypress":if(xl(n)===0)break e;case"keydown":case"keyup":x=Gw;break;case"focusin":b="focus",x=ic;break;case"focusout":b="blur",x=ic;break;case"beforeblur":case"afterblur":x=ic;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":x=ah;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=Ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=qw;break;case Wf:case Vf:case Kf:x=Fw;break;case Qf:x=Zw;break;case"scroll":x=Mw;break;case"wheel":x=tx;break;case"copy":case"cut":case"paste":x=Uw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=lh}var w=(t&4)!==0,S=!w&&e==="scroll",k=w?h!==null?h+"Capture":null:h;w=[];for(var m=d,v;m!==null;){v=m;var T=v.stateNode;if(v.tag===5&&T!==null&&(v=T,k!==null&&(T=hi(m,k),T!=null&&w.push(xi(m,T,v)))),S)break;m=m.return}0<w.length&&(h=new x(h,b,null,n,g),f.push({event:h,listeners:w}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",h&&n!==Xc&&(b=n.relatedTarget||n.fromElement)&&(fr(b)||b[ws]))break e;if((x||h)&&(h=g.window===g?g:(h=g.ownerDocument)?h.defaultView||h.parentWindow:window,x?(b=n.relatedTarget||n.toElement,x=d,b=b?fr(b):null,b!==null&&(S=Er(b),b!==S||b.tag!==5&&b.tag!==6)&&(b=null)):(x=null,b=d),x!==b)){if(w=ah,T="onMouseLeave",k="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(w=lh,T="onPointerLeave",k="onPointerEnter",m="pointer"),S=x==null?h:Yr(x),v=b==null?h:Yr(b),h=new w(T,m+"leave",x,n,g),h.target=S,h.relatedTarget=v,T=null,fr(g)===d&&(w=new w(k,m+"enter",b,n,g),w.target=v,w.relatedTarget=S,T=w),S=T,x&&b)t:{for(w=x,k=b,m=0,v=w;v;v=Dr(v))m++;for(v=0,T=k;T;T=Dr(T))v++;for(;0<m-v;)w=Dr(w),m--;for(;0<v-m;)k=Dr(k),v--;for(;m--;){if(w===k||k!==null&&w===k.alternate)break t;w=Dr(w),k=Dr(k)}w=null}else w=null;x!==null&&yh(f,h,x,w,!1),b!==null&&S!==null&&yh(f,S,b,w,!0)}}e:{if(h=d?Yr(d):window,x=h.nodeName&&h.nodeName.toLowerCase(),x==="select"||x==="input"&&h.type==="file")var E=ox;else if(uh(h))if(Ff)E=px;else{E=ux;var _=cx}else(x=h.nodeName)&&x.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(E=dx);if(E&&(E=E(e,d))){$f(f,E,n,g);break e}_&&_(e,h,d),e==="focusout"&&(_=h._wrapperState)&&_.controlled&&h.type==="number"&&Qc(h,"number",h.value)}switch(_=d?Yr(d):window,e){case"focusin":(uh(_)||_.contentEditable==="true")&&(Qr=_,au=d,Xa=null);break;case"focusout":Xa=au=Qr=null;break;case"mousedown":iu=!0;break;case"contextmenu":case"mouseup":case"dragend":iu=!1,fh(f,n,g);break;case"selectionchange":if(fx)break;case"keydown":case"keyup":fh(f,n,g)}var I;if(yd)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Kr?Of(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Lf&&n.locale!=="ko"&&(Kr||A!=="onCompositionStart"?A==="onCompositionEnd"&&Kr&&(I=Mf()):(Bs=g,fd="value"in Bs?Bs.value:Bs.textContent,Kr=!0)),_=Hl(d,A),0<_.length&&(A=new ih(A,e,null,n,g),f.push({event:A,listeners:_}),I?A.data=I:(I=Df(n),I!==null&&(A.data=I)))),(I=sx?rx(e,n):ax(e,n))&&(d=Hl(d,"onBeforeInput"),0<d.length&&(g=new ih("onBeforeInput","beforeinput",null,n,g),f.push({event:g,listeners:d}),g.data=I))}Yf(f,t)})}function xi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Hl(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=hi(e,n),i!=null&&s.unshift(xi(e,i,r)),i=hi(e,t),i!=null&&s.push(xi(e,i,r))),e=e.return}return s}function Dr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yh(e,t,n,s,r){for(var i=t._reactName,l=[];n!==null&&n!==s;){var o=n,c=o.alternate,d=o.stateNode;if(c!==null&&c===s)break;o.tag===5&&d!==null&&(o=d,r?(c=hi(n,i),c!=null&&l.unshift(xi(n,c,o))):r||(c=hi(n,i),c!=null&&l.push(xi(n,c,o)))),n=n.return}l.length!==0&&e.push({event:t,listeners:l})}var wx=/\r\n?/g,xx=/\u0000|\uFFFD/g;function wh(e){return(typeof e=="string"?e:""+e).replace(wx,`
39
+ `).replace(xx,"")}function sl(e,t,n){if(t=wh(t),wh(e)!==t&&n)throw Error(J(425))}function zl(){}var lu=null,ou=null;function cu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var uu=typeof setTimeout=="function"?setTimeout:void 0,kx=typeof clearTimeout=="function"?clearTimeout:void 0,xh=typeof Promise=="function"?Promise:void 0,bx=typeof queueMicrotask=="function"?queueMicrotask:typeof xh<"u"?function(e){return xh.resolve(null).then(e).catch(Sx)}:uu;function Sx(e){setTimeout(function(){throw e})}function mc(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(s===0){e.removeChild(r),gi(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);gi(t)}function Vs(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==="$?")break;if(t==="/$")return null}}return e}function kh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ba=Math.random().toString(36).slice(2),es="__reactFiber$"+ba,ki="__reactProps$"+ba,ws="__reactContainer$"+ba,du="__reactEvents$"+ba,Nx="__reactListeners$"+ba,jx="__reactHandles$"+ba;function fr(e){var t=e[es];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ws]||n[es]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=kh(e);e!==null;){if(n=e[es])return n;e=kh(e)}return t}e=n,n=e.parentNode}return null}function Mi(e){return e=e[es]||e[ws],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Yr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(J(33))}function So(e){return e[ki]||null}var pu=[],Jr=-1;function er(e){return{current:e}}function Ze(e){0>Jr||(e.current=pu[Jr],pu[Jr]=null,Jr--)}function qe(e,t){Jr++,pu[Jr]=e.current,e.current=t}var qs={},Ot=er(qs),en=er(!1),kr=qs;function pa(e,t){var n=e.type.contextTypes;if(!n)return qs;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function tn(e){return e=e.childContextTypes,e!=null}function Wl(){Ze(en),Ze(Ot)}function bh(e,t,n){if(Ot.current!==qs)throw Error(J(168));qe(Ot,t),qe(en,n)}function qf(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var r in s)if(!(r in t))throw Error(J(108,cw(e)||"Unknown",r));return it({},n,s)}function Vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qs,kr=Ot.current,qe(Ot,e),qe(en,en.current),!0}function Sh(e,t,n){var s=e.stateNode;if(!s)throw Error(J(169));n?(e=qf(e,t,kr),s.__reactInternalMemoizedMergedChildContext=e,Ze(en),Ze(Ot),qe(Ot,e)):Ze(en),qe(en,n)}var hs=null,No=!1,fc=!1;function Xf(e){hs===null?hs=[e]:hs.push(e)}function Cx(e){No=!0,Xf(e)}function tr(){if(!fc&&hs!==null){fc=!0;var e=0,t=Ve;try{var n=hs;for(Ve=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}hs=null,No=!1}catch(r){throw hs!==null&&(hs=hs.slice(e+1)),Sf(dd,tr),r}finally{Ve=t,fc=!1}}return null}var qr=[],Xr=0,Kl=null,Ql=0,kn=[],bn=0,br=null,ms=1,fs="";function cr(e,t){qr[Xr++]=Ql,qr[Xr++]=Kl,Kl=e,Ql=t}function Zf(e,t,n){kn[bn++]=ms,kn[bn++]=fs,kn[bn++]=br,br=e;var s=ms;e=fs;var r=32-Hn(s)-1;s&=~(1<<r),n+=1;var i=32-Hn(t)+r;if(30<i){var l=r-r%5;i=(s&(1<<l)-1).toString(32),s>>=l,r-=l,ms=1<<32-Hn(t)+r|n<<r|s,fs=i+e}else ms=1<<i|n<<r|s,fs=e}function xd(e){e.return!==null&&(cr(e,1),Zf(e,1,0))}function kd(e){for(;e===Kl;)Kl=qr[--Xr],qr[Xr]=null,Ql=qr[--Xr],qr[Xr]=null;for(;e===br;)br=kn[--bn],kn[bn]=null,fs=kn[--bn],kn[bn]=null,ms=kn[--bn],kn[bn]=null}var dn=null,un=null,nt=!1,Un=null;function eg(e,t){var n=Sn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Nh(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,dn=e,un=Vs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,dn=e,un=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=br!==null?{id:ms,overflow:fs}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Sn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,dn=e,un=null,!0):!1;default:return!1}}function hu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function mu(e){if(nt){var t=un;if(t){var n=t;if(!Nh(e,t)){if(hu(e))throw Error(J(418));t=Vs(n.nextSibling);var s=dn;t&&Nh(e,t)?eg(s,n):(e.flags=e.flags&-4097|2,nt=!1,dn=e)}}else{if(hu(e))throw Error(J(418));e.flags=e.flags&-4097|2,nt=!1,dn=e}}}function jh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;dn=e}function rl(e){if(e!==dn)return!1;if(!nt)return jh(e),nt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!cu(e.type,e.memoizedProps)),t&&(t=un)){if(hu(e))throw tg(),Error(J(418));for(;t;)eg(e,t),t=Vs(t.nextSibling)}if(jh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(J(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){un=Vs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}un=null}}else un=dn?Vs(e.stateNode.nextSibling):null;return!0}function tg(){for(var e=un;e;)e=Vs(e.nextSibling)}function ha(){un=dn=null,nt=!1}function bd(e){Un===null?Un=[e]:Un.push(e)}var Ex=Ss.ReactCurrentBatchConfig;function Ba(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(J(309));var s=n.stateNode}if(!s)throw Error(J(147,e));var r=s,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(l){var o=r.refs;l===null?delete o[i]:o[i]=l},t._stringRef=i,t)}if(typeof e!="string")throw Error(J(284));if(!n._owner)throw Error(J(290,e))}return e}function al(e,t){throw e=Object.prototype.toString.call(t),Error(J(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ch(e){var t=e._init;return t(e._payload)}function ng(e){function t(k,m){if(e){var v=k.deletions;v===null?(k.deletions=[m],k.flags|=16):v.push(m)}}function n(k,m){if(!e)return null;for(;m!==null;)t(k,m),m=m.sibling;return null}function s(k,m){for(k=new Map;m!==null;)m.key!==null?k.set(m.key,m):k.set(m.index,m),m=m.sibling;return k}function r(k,m){return k=Ys(k,m),k.index=0,k.sibling=null,k}function i(k,m,v){return k.index=v,e?(v=k.alternate,v!==null?(v=v.index,v<m?(k.flags|=2,m):v):(k.flags|=2,m)):(k.flags|=1048576,m)}function l(k){return e&&k.alternate===null&&(k.flags|=2),k}function o(k,m,v,T){return m===null||m.tag!==6?(m=bc(v,k.mode,T),m.return=k,m):(m=r(m,v),m.return=k,m)}function c(k,m,v,T){var E=v.type;return E===Vr?g(k,m,v.props.children,T,v.key):m!==null&&(m.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ls&&Ch(E)===m.type)?(T=r(m,v.props),T.ref=Ba(k,m,v),T.return=k,T):(T=El(v.type,v.key,v.props,null,k.mode,T),T.ref=Ba(k,m,v),T.return=k,T)}function d(k,m,v,T){return m===null||m.tag!==4||m.stateNode.containerInfo!==v.containerInfo||m.stateNode.implementation!==v.implementation?(m=Sc(v,k.mode,T),m.return=k,m):(m=r(m,v.children||[]),m.return=k,m)}function g(k,m,v,T,E){return m===null||m.tag!==7?(m=xr(v,k.mode,T,E),m.return=k,m):(m=r(m,v),m.return=k,m)}function f(k,m,v){if(typeof m=="string"&&m!==""||typeof m=="number")return m=bc(""+m,k.mode,v),m.return=k,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Gi:return v=El(m.type,m.key,m.props,null,k.mode,v),v.ref=Ba(k,null,m),v.return=k,v;case Wr:return m=Sc(m,k.mode,v),m.return=k,m;case Ls:var T=m._init;return f(k,T(m._payload),v)}if(Va(m)||La(m))return m=xr(m,k.mode,v,null),m.return=k,m;al(k,m)}return null}function h(k,m,v,T){var E=m!==null?m.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return E!==null?null:o(k,m,""+v,T);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Gi:return v.key===E?c(k,m,v,T):null;case Wr:return v.key===E?d(k,m,v,T):null;case Ls:return E=v._init,h(k,m,E(v._payload),T)}if(Va(v)||La(v))return E!==null?null:g(k,m,v,T,null);al(k,v)}return null}function x(k,m,v,T,E){if(typeof T=="string"&&T!==""||typeof T=="number")return k=k.get(v)||null,o(m,k,""+T,E);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case Gi:return k=k.get(T.key===null?v:T.key)||null,c(m,k,T,E);case Wr:return k=k.get(T.key===null?v:T.key)||null,d(m,k,T,E);case Ls:var _=T._init;return x(k,m,v,_(T._payload),E)}if(Va(T)||La(T))return k=k.get(v)||null,g(m,k,T,E,null);al(m,T)}return null}function b(k,m,v,T){for(var E=null,_=null,I=m,A=m=0,P=null;I!==null&&A<v.length;A++){I.index>A?(P=I,I=null):P=I.sibling;var y=h(k,I,v[A],T);if(y===null){I===null&&(I=P);break}e&&I&&y.alternate===null&&t(k,I),m=i(y,m,A),_===null?E=y:_.sibling=y,_=y,I=P}if(A===v.length)return n(k,I),nt&&cr(k,A),E;if(I===null){for(;A<v.length;A++)I=f(k,v[A],T),I!==null&&(m=i(I,m,A),_===null?E=I:_.sibling=I,_=I);return nt&&cr(k,A),E}for(I=s(k,I);A<v.length;A++)P=x(I,k,A,v[A],T),P!==null&&(e&&P.alternate!==null&&I.delete(P.key===null?A:P.key),m=i(P,m,A),_===null?E=P:_.sibling=P,_=P);return e&&I.forEach(function(K){return t(k,K)}),nt&&cr(k,A),E}function w(k,m,v,T){var E=La(v);if(typeof E!="function")throw Error(J(150));if(v=E.call(v),v==null)throw Error(J(151));for(var _=E=null,I=m,A=m=0,P=null,y=v.next();I!==null&&!y.done;A++,y=v.next()){I.index>A?(P=I,I=null):P=I.sibling;var K=h(k,I,y.value,T);if(K===null){I===null&&(I=P);break}e&&I&&K.alternate===null&&t(k,I),m=i(K,m,A),_===null?E=K:_.sibling=K,_=K,I=P}if(y.done)return n(k,I),nt&&cr(k,A),E;if(I===null){for(;!y.done;A++,y=v.next())y=f(k,y.value,T),y!==null&&(m=i(y,m,A),_===null?E=y:_.sibling=y,_=y);return nt&&cr(k,A),E}for(I=s(k,I);!y.done;A++,y=v.next())y=x(I,k,A,y.value,T),y!==null&&(e&&y.alternate!==null&&I.delete(y.key===null?A:y.key),m=i(y,m,A),_===null?E=y:_.sibling=y,_=y);return e&&I.forEach(function($){return t(k,$)}),nt&&cr(k,A),E}function S(k,m,v,T){if(typeof v=="object"&&v!==null&&v.type===Vr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Gi:e:{for(var E=v.key,_=m;_!==null;){if(_.key===E){if(E=v.type,E===Vr){if(_.tag===7){n(k,_.sibling),m=r(_,v.props.children),m.return=k,k=m;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ls&&Ch(E)===_.type){n(k,_.sibling),m=r(_,v.props),m.ref=Ba(k,_,v),m.return=k,k=m;break e}n(k,_);break}else t(k,_);_=_.sibling}v.type===Vr?(m=xr(v.props.children,k.mode,T,v.key),m.return=k,k=m):(T=El(v.type,v.key,v.props,null,k.mode,T),T.ref=Ba(k,m,v),T.return=k,k=T)}return l(k);case Wr:e:{for(_=v.key;m!==null;){if(m.key===_)if(m.tag===4&&m.stateNode.containerInfo===v.containerInfo&&m.stateNode.implementation===v.implementation){n(k,m.sibling),m=r(m,v.children||[]),m.return=k,k=m;break e}else{n(k,m);break}else t(k,m);m=m.sibling}m=Sc(v,k.mode,T),m.return=k,k=m}return l(k);case Ls:return _=v._init,S(k,m,_(v._payload),T)}if(Va(v))return b(k,m,v,T);if(La(v))return w(k,m,v,T);al(k,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,m!==null&&m.tag===6?(n(k,m.sibling),m=r(m,v),m.return=k,k=m):(n(k,m),m=bc(v,k.mode,T),m.return=k,k=m),l(k)):n(k,m)}return S}var ma=ng(!0),sg=ng(!1),Gl=er(null),Yl=null,Zr=null,Sd=null;function Nd(){Sd=Zr=Yl=null}function jd(e){var t=Gl.current;Ze(Gl),e._currentValue=t}function fu(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function ia(e,t){Yl=e,Sd=Zr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Zt=!0),e.firstContext=null)}function En(e){var t=e._currentValue;if(Sd!==e)if(e={context:e,memoizedValue:t,next:null},Zr===null){if(Yl===null)throw Error(J(308));Zr=e,Yl.dependencies={lanes:0,firstContext:e}}else Zr=Zr.next=e;return t}var gr=null;function Cd(e){gr===null?gr=[e]:gr.push(e)}function rg(e,t,n,s){var r=t.interleaved;return r===null?(n.next=n,Cd(t)):(n.next=r.next,r.next=n),t.interleaved=n,xs(e,s)}function xs(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Os=!1;function Ed(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ag(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function vs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ks(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,Be&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,xs(e,n)}return r=s.interleaved,r===null?(t.next=t,Cd(s)):(t.next=r.next,r.next=t),s.interleaved=t,xs(e,n)}function kl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,pd(e,n)}}function Eh(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?r=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Jl(e,t,n,s){var r=e.updateQueue;Os=!1;var i=r.firstBaseUpdate,l=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,d=c.next;c.next=null,l===null?i=d:l.next=d,l=c;var g=e.alternate;g!==null&&(g=g.updateQueue,o=g.lastBaseUpdate,o!==l&&(o===null?g.firstBaseUpdate=d:o.next=d,g.lastBaseUpdate=c))}if(i!==null){var f=r.baseState;l=0,g=d=c=null,o=i;do{var h=o.lane,x=o.eventTime;if((s&h)===h){g!==null&&(g=g.next={eventTime:x,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var b=e,w=o;switch(h=t,x=n,w.tag){case 1:if(b=w.payload,typeof b=="function"){f=b.call(x,f,h);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=w.payload,h=typeof b=="function"?b.call(x,f,h):b,h==null)break e;f=it({},f,h);break e;case 2:Os=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=r.effects,h===null?r.effects=[o]:h.push(o))}else x={eventTime:x,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},g===null?(d=g=x,c=f):g=g.next=x,l|=h;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;h=o,o=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(g===null&&(c=f),r.baseState=c,r.firstBaseUpdate=d,r.lastBaseUpdate=g,t=r.shared.interleaved,t!==null){r=t;do l|=r.lane,r=r.next;while(r!==t)}else i===null&&(r.shared.lanes=0);Nr|=l,e.lanes=l,e.memoizedState=f}}function Th(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(r!==null){if(s.callback=null,s=n,typeof r!="function")throw Error(J(191,r));r.call(s)}}}var Li={},ns=er(Li),bi=er(Li),Si=er(Li);function vr(e){if(e===Li)throw Error(J(174));return e}function Td(e,t){switch(qe(Si,t),qe(bi,e),qe(ns,Li),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Yc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Yc(t,e)}Ze(ns),qe(ns,t)}function fa(){Ze(ns),Ze(bi),Ze(Si)}function ig(e){vr(Si.current);var t=vr(ns.current),n=Yc(t,e.type);t!==n&&(qe(bi,e),qe(ns,n))}function Ad(e){bi.current===e&&(Ze(ns),Ze(bi))}var rt=er(0);function ql(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 gc=[];function Rd(){for(var e=0;e<gc.length;e++)gc[e]._workInProgressVersionPrimary=null;gc.length=0}var bl=Ss.ReactCurrentDispatcher,vc=Ss.ReactCurrentBatchConfig,Sr=0,at=null,kt=null,Ct=null,Xl=!1,Za=!1,Ni=0,Tx=0;function _t(){throw Error(J(321))}function Pd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vn(e[n],t[n]))return!1;return!0}function Id(e,t,n,s,r,i){if(Sr=i,at=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bl.current=e===null||e.memoizedState===null?Ix:_x,e=n(s,r),Za){i=0;do{if(Za=!1,Ni=0,25<=i)throw Error(J(301));i+=1,Ct=kt=null,t.updateQueue=null,bl.current=Mx,e=n(s,r)}while(Za)}if(bl.current=Zl,t=kt!==null&&kt.next!==null,Sr=0,Ct=kt=at=null,Xl=!1,t)throw Error(J(300));return e}function _d(){var e=Ni!==0;return Ni=0,e}function qn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?at.memoizedState=Ct=e:Ct=Ct.next=e,Ct}function Tn(){if(kt===null){var e=at.alternate;e=e!==null?e.memoizedState:null}else e=kt.next;var t=Ct===null?at.memoizedState:Ct.next;if(t!==null)Ct=t,kt=e;else{if(e===null)throw Error(J(310));kt=e,e={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},Ct===null?at.memoizedState=Ct=e:Ct=Ct.next=e}return Ct}function ji(e,t){return typeof t=="function"?t(e):t}function yc(e){var t=Tn(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var s=kt,r=s.baseQueue,i=n.pending;if(i!==null){if(r!==null){var l=r.next;r.next=i.next,i.next=l}s.baseQueue=r=i,n.pending=null}if(r!==null){i=r.next,s=s.baseState;var o=l=null,c=null,d=i;do{var g=d.lane;if((Sr&g)===g)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var f={lane:g,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(o=c=f,l=s):c=c.next=f,at.lanes|=g,Nr|=g}d=d.next}while(d!==null&&d!==i);c===null?l=s:c.next=o,Vn(s,t.memoizedState)||(Zt=!0),t.memoizedState=s,t.baseState=l,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){r=e;do i=r.lane,at.lanes|=i,Nr|=i,r=r.next;while(r!==e)}else r===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function wc(e){var t=Tn(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var l=r=r.next;do i=e(i,l.action),l=l.next;while(l!==r);Vn(i,t.memoizedState)||(Zt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function lg(){}function og(e,t){var n=at,s=Tn(),r=t(),i=!Vn(s.memoizedState,r);if(i&&(s.memoizedState=r,Zt=!0),s=s.queue,Md(dg.bind(null,n,s,e),[e]),s.getSnapshot!==t||i||Ct!==null&&Ct.memoizedState.tag&1){if(n.flags|=2048,Ci(9,ug.bind(null,n,s,r,t),void 0,null),Et===null)throw Error(J(349));Sr&30||cg(n,t,r)}return r}function cg(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=at.updateQueue,t===null?(t={lastEffect:null,stores:null},at.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ug(e,t,n,s){t.value=n,t.getSnapshot=s,pg(t)&&hg(e)}function dg(e,t,n){return n(function(){pg(t)&&hg(e)})}function pg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vn(e,n)}catch{return!0}}function hg(e){var t=xs(e,1);t!==null&&zn(t,e,1,-1)}function Ah(e){var t=qn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ji,lastRenderedState:e},t.queue=e,e=e.dispatch=Px.bind(null,at,e),[t.memoizedState,e]}function Ci(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=at.updateQueue,t===null?(t={lastEffect:null,stores:null},at.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function mg(){return Tn().memoizedState}function Sl(e,t,n,s){var r=qn();at.flags|=e,r.memoizedState=Ci(1|t,n,void 0,s===void 0?null:s)}function jo(e,t,n,s){var r=Tn();s=s===void 0?null:s;var i=void 0;if(kt!==null){var l=kt.memoizedState;if(i=l.destroy,s!==null&&Pd(s,l.deps)){r.memoizedState=Ci(t,n,i,s);return}}at.flags|=e,r.memoizedState=Ci(1|t,n,i,s)}function Rh(e,t){return Sl(8390656,8,e,t)}function Md(e,t){return jo(2048,8,e,t)}function fg(e,t){return jo(4,2,e,t)}function gg(e,t){return jo(4,4,e,t)}function vg(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yg(e,t,n){return n=n!=null?n.concat([e]):null,jo(4,4,vg.bind(null,t,e),n)}function Ld(){}function wg(e,t){var n=Tn();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Pd(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function xg(e,t){var n=Tn();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Pd(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function kg(e,t,n){return Sr&21?(Vn(n,t)||(n=Cf(),at.lanes|=n,Nr|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Zt=!0),e.memoizedState=n)}function Ax(e,t){var n=Ve;Ve=n!==0&&4>n?n:4,e(!0);var s=vc.transition;vc.transition={};try{e(!1),t()}finally{Ve=n,vc.transition=s}}function bg(){return Tn().memoizedState}function Rx(e,t,n){var s=Gs(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Sg(e))Ng(t,n);else if(n=rg(e,t,n,s),n!==null){var r=Vt();zn(n,e,s,r),jg(n,t,s)}}function Px(e,t,n){var s=Gs(e),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Sg(e))Ng(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,o=i(l,n);if(r.hasEagerState=!0,r.eagerState=o,Vn(o,l)){var c=t.interleaved;c===null?(r.next=r,Cd(t)):(r.next=c.next,c.next=r),t.interleaved=r;return}}catch{}finally{}n=rg(e,t,r,s),n!==null&&(r=Vt(),zn(n,e,s,r),jg(n,t,s))}}function Sg(e){var t=e.alternate;return e===at||t!==null&&t===at}function Ng(e,t){Za=Xl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function jg(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,pd(e,n)}}var Zl={readContext:En,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},Ix={readContext:En,useCallback:function(e,t){return qn().memoizedState=[e,t===void 0?null:t],e},useContext:En,useEffect:Rh,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Sl(4194308,4,vg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sl(4,2,e,t)},useMemo:function(e,t){var n=qn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=qn();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Rx.bind(null,at,e),[s.memoizedState,e]},useRef:function(e){var t=qn();return e={current:e},t.memoizedState=e},useState:Ah,useDebugValue:Ld,useDeferredValue:function(e){return qn().memoizedState=e},useTransition:function(){var e=Ah(!1),t=e[0];return e=Ax.bind(null,e[1]),qn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=at,r=qn();if(nt){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),Et===null)throw Error(J(349));Sr&30||cg(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,Rh(dg.bind(null,s,i,e),[e]),s.flags|=2048,Ci(9,ug.bind(null,s,i,n,t),void 0,null),n},useId:function(){var e=qn(),t=Et.identifierPrefix;if(nt){var n=fs,s=ms;n=(s&~(1<<32-Hn(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ni++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Tx++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_x={readContext:En,useCallback:wg,useContext:En,useEffect:Md,useImperativeHandle:yg,useInsertionEffect:fg,useLayoutEffect:gg,useMemo:xg,useReducer:yc,useRef:mg,useState:function(){return yc(ji)},useDebugValue:Ld,useDeferredValue:function(e){var t=Tn();return kg(t,kt.memoizedState,e)},useTransition:function(){var e=yc(ji)[0],t=Tn().memoizedState;return[e,t]},useMutableSource:lg,useSyncExternalStore:og,useId:bg,unstable_isNewReconciler:!1},Mx={readContext:En,useCallback:wg,useContext:En,useEffect:Md,useImperativeHandle:yg,useInsertionEffect:fg,useLayoutEffect:gg,useMemo:xg,useReducer:wc,useRef:mg,useState:function(){return wc(ji)},useDebugValue:Ld,useDeferredValue:function(e){var t=Tn();return kt===null?t.memoizedState=e:kg(t,kt.memoizedState,e)},useTransition:function(){var e=wc(ji)[0],t=Tn().memoizedState;return[e,t]},useMutableSource:lg,useSyncExternalStore:og,useId:bg,unstable_isNewReconciler:!1};function Fn(e,t){if(e&&e.defaultProps){t=it({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gu(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:it({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Co={isMounted:function(e){return(e=e._reactInternals)?Er(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Vt(),r=Gs(e),i=vs(s,r);i.payload=t,n!=null&&(i.callback=n),t=Ks(e,i,r),t!==null&&(zn(t,e,r,s),kl(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Vt(),r=Gs(e),i=vs(s,r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ks(e,i,r),t!==null&&(zn(t,e,r,s),kl(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vt(),s=Gs(e),r=vs(n,s);r.tag=2,t!=null&&(r.callback=t),t=Ks(e,r,s),t!==null&&(zn(t,e,s,n),kl(t,e,s))}};function Ph(e,t,n,s,r,i,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,l):t.prototype&&t.prototype.isPureReactComponent?!yi(n,s)||!yi(r,i):!0}function Cg(e,t,n){var s=!1,r=qs,i=t.contextType;return typeof i=="object"&&i!==null?i=En(i):(r=tn(t)?kr:Ot.current,s=t.contextTypes,i=(s=s!=null)?pa(e,r):qs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Co,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ih(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Co.enqueueReplaceState(t,t.state,null)}function vu(e,t,n,s){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},Ed(e);var i=t.contextType;typeof i=="object"&&i!==null?r.context=En(i):(i=tn(t)?kr:Ot.current,r.context=pa(e,i)),r.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(gu(e,t,i,n),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&Co.enqueueReplaceState(r,r.state,null),Jl(e,n,r,s),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function ga(e,t){try{var n="",s=t;do n+=ow(s),s=s.return;while(s);var r=n}catch(i){r=`
40
+ Error generating stack: `+i.message+`
41
+ `+i.stack}return{value:e,source:t,stack:r,digest:null}}function xc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function yu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Lx=typeof WeakMap=="function"?WeakMap:Map;function Eg(e,t,n){n=vs(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){to||(to=!0,Tu=s),yu(e,t)},n}function Tg(e,t,n){n=vs(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var r=t.value;n.payload=function(){return s(r)},n.callback=function(){yu(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){yu(e,t),typeof s!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),n}function _h(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Lx;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(r.add(n),e=Yx.bind(null,e,t,n),t.then(e,e))}function Mh(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Lh(e,t,n,s,r){return e.mode&1?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=vs(-1,1),t.tag=2,Ks(n,t,1))),n.lanes|=1),e)}var Ox=Ss.ReactCurrentOwner,Zt=!1;function zt(e,t,n,s){t.child=e===null?sg(t,null,n,s):ma(t,e.child,n,s)}function Oh(e,t,n,s,r){n=n.render;var i=t.ref;return ia(t,r),s=Id(e,t,n,s,i,r),n=_d(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,ks(e,t,r)):(nt&&n&&xd(t),t.flags|=1,zt(e,t,s,r),t.child)}function Dh(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!zd(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ag(e,t,i,s,r)):(e=El(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&r)){var l=i.memoizedProps;if(n=n.compare,n=n!==null?n:yi,n(l,s)&&e.ref===t.ref)return ks(e,t,r)}return t.flags|=1,e=Ys(i,s),e.ref=t.ref,e.return=t,t.child=e}function Ag(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(yi(i,s)&&e.ref===t.ref)if(Zt=!1,t.pendingProps=s=i,(e.lanes&r)!==0)e.flags&131072&&(Zt=!0);else return t.lanes=e.lanes,ks(e,t,r)}return wu(e,t,n,s,r)}function Rg(e,t,n){var s=t.pendingProps,r=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(ta,cn),cn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,qe(ta,cn),cn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,qe(ta,cn),cn|=s}else i!==null?(s=i.baseLanes|n,t.memoizedState=null):s=n,qe(ta,cn),cn|=s;return zt(e,t,r,n),t.child}function Pg(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function wu(e,t,n,s,r){var i=tn(n)?kr:Ot.current;return i=pa(t,i),ia(t,r),n=Id(e,t,n,s,i,r),s=_d(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,ks(e,t,r)):(nt&&s&&xd(t),t.flags|=1,zt(e,t,n,r),t.child)}function $h(e,t,n,s,r){if(tn(n)){var i=!0;Vl(t)}else i=!1;if(ia(t,r),t.stateNode===null)Nl(e,t),Cg(t,n,s),vu(t,n,s,r),s=!0;else if(e===null){var l=t.stateNode,o=t.memoizedProps;l.props=o;var c=l.context,d=n.contextType;typeof d=="object"&&d!==null?d=En(d):(d=tn(n)?kr:Ot.current,d=pa(t,d));var g=n.getDerivedStateFromProps,f=typeof g=="function"||typeof l.getSnapshotBeforeUpdate=="function";f||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o!==s||c!==d)&&Ih(t,l,s,d),Os=!1;var h=t.memoizedState;l.state=h,Jl(t,s,l,r),c=t.memoizedState,o!==s||h!==c||en.current||Os?(typeof g=="function"&&(gu(t,n,g,s),c=t.memoizedState),(o=Os||Ph(t,n,o,s,h,c,d))?(f||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),l.props=s,l.state=c,l.context=d,s=o):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{l=t.stateNode,ag(e,t),o=t.memoizedProps,d=t.type===t.elementType?o:Fn(t.type,o),l.props=d,f=t.pendingProps,h=l.context,c=n.contextType,typeof c=="object"&&c!==null?c=En(c):(c=tn(n)?kr:Ot.current,c=pa(t,c));var x=n.getDerivedStateFromProps;(g=typeof x=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o!==f||h!==c)&&Ih(t,l,s,c),Os=!1,h=t.memoizedState,l.state=h,Jl(t,s,l,r);var b=t.memoizedState;o!==f||h!==b||en.current||Os?(typeof x=="function"&&(gu(t,n,x,s),b=t.memoizedState),(d=Os||Ph(t,n,d,s,h,b,c)||!1)?(g||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(s,b,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(s,b,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=b),l.props=s,l.state=b,l.context=c,s=d):(typeof l.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),s=!1)}return xu(e,t,n,s,i,r)}function xu(e,t,n,s,r,i){Pg(e,t);var l=(t.flags&128)!==0;if(!s&&!l)return r&&Sh(t,n,!1),ks(e,t,i);s=t.stateNode,Ox.current=t;var o=l&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&l?(t.child=ma(t,e.child,null,i),t.child=ma(t,null,o,i)):zt(e,t,o,i),t.memoizedState=s.state,r&&Sh(t,n,!0),t.child}function Ig(e){var t=e.stateNode;t.pendingContext?bh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&bh(e,t.context,!1),Td(e,t.containerInfo)}function Fh(e,t,n,s,r){return ha(),bd(r),t.flags|=256,zt(e,t,n,s),t.child}var ku={dehydrated:null,treeContext:null,retryLane:0};function bu(e){return{baseLanes:e,cachePool:null,transitions:null}}function _g(e,t,n){var s=t.pendingProps,r=rt.current,i=!1,l=(t.flags&128)!==0,o;if((o=l)||(o=e!==null&&e.memoizedState===null?!1:(r&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(r|=1),qe(rt,r&1),e===null)return mu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=s.children,e=s.fallback,i?(s=t.mode,i=t.child,l={mode:"hidden",children:l},!(s&1)&&i!==null?(i.childLanes=0,i.pendingProps=l):i=Ao(l,s,0,null),e=xr(e,s,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=bu(n),t.memoizedState=ku,e):Od(t,l));if(r=e.memoizedState,r!==null&&(o=r.dehydrated,o!==null))return Dx(e,t,l,s,o,r,n);if(i){i=s.fallback,l=t.mode,r=e.child,o=r.sibling;var c={mode:"hidden",children:s.children};return!(l&1)&&t.child!==r?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Ys(r,c),s.subtreeFlags=r.subtreeFlags&14680064),o!==null?i=Ys(o,i):(i=xr(i,l,n,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,l=e.child.memoizedState,l=l===null?bu(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=ku,s}return i=e.child,e=i.sibling,s=Ys(i,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Od(e,t){return t=Ao({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,n,s){return s!==null&&bd(s),ma(t,e.child,null,n),e=Od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dx(e,t,n,s,r,i,l){if(n)return t.flags&256?(t.flags&=-257,s=xc(Error(J(422))),il(e,t,l,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,r=t.mode,s=Ao({mode:"visible",children:s.children},r,0,null),i=xr(i,r,l,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,t.mode&1&&ma(t,e.child,null,l),t.child.memoizedState=bu(l),t.memoizedState=ku,i);if(!(t.mode&1))return il(e,t,l,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var o=s.dgst;return s=o,i=Error(J(419)),s=xc(i,s,void 0),il(e,t,l,s)}if(o=(l&e.childLanes)!==0,Zt||o){if(s=Et,s!==null){switch(l&-l){case 4:r=2;break;case 16:r=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(s.suspendedLanes|l)?0:r,r!==0&&r!==i.retryLane&&(i.retryLane=r,xs(e,r),zn(s,e,r,-1))}return Hd(),s=xc(Error(J(421))),il(e,t,l,s)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=Jx.bind(null,e),r._reactRetry=t,null):(e=i.treeContext,un=Vs(r.nextSibling),dn=t,nt=!0,Un=null,e!==null&&(kn[bn++]=ms,kn[bn++]=fs,kn[bn++]=br,ms=e.id,fs=e.overflow,br=t),t=Od(t,s.children),t.flags|=4096,t)}function Bh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),fu(e.return,t,n)}function kc(e,t,n,s,r){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=n,i.tailMode=r)}function Mg(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;if(zt(e,t,s.children,n),s=rt.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Bh(e,n,t);else if(e.tag===19)Bh(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(qe(rt,s),!(t.mode&1))t.memoizedState=null;else switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&ql(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),kc(t,!1,r,n,i);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&ql(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}kc(t,!0,n,null,i);break;case"together":kc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Nl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ks(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Nr|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(J(153));if(t.child!==null){for(e=t.child,n=Ys(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ys(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $x(e,t,n){switch(t.tag){case 3:Ig(t),ha();break;case 5:ig(t);break;case 1:tn(t.type)&&Vl(t);break;case 4:Td(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;qe(Gl,s._currentValue),s._currentValue=r;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(qe(rt,rt.current&1),t.flags|=128,null):n&t.child.childLanes?_g(e,t,n):(qe(rt,rt.current&1),e=ks(e,t,n),e!==null?e.sibling:null);qe(rt,rt.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Mg(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),qe(rt,rt.current),s)break;return null;case 22:case 23:return t.lanes=0,Rg(e,t,n)}return ks(e,t,n)}var Lg,Su,Og,Dg;Lg=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Su=function(){};Og=function(e,t,n,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,vr(ns.current);var i=null;switch(n){case"input":r=Vc(e,r),s=Vc(e,s),i=[];break;case"select":r=it({},r,{value:void 0}),s=it({},s,{value:void 0}),i=[];break;case"textarea":r=Gc(e,r),s=Gc(e,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=zl)}Jc(n,s);var l;n=null;for(d in r)if(!s.hasOwnProperty(d)&&r.hasOwnProperty(d)&&r[d]!=null)if(d==="style"){var o=r[d];for(l in o)o.hasOwnProperty(l)&&(n||(n={}),n[l]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(di.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in s){var c=s[d];if(o=r!=null?r[d]:void 0,s.hasOwnProperty(d)&&c!==o&&(c!=null||o!=null))if(d==="style")if(o){for(l in o)!o.hasOwnProperty(l)||c&&c.hasOwnProperty(l)||(n||(n={}),n[l]="");for(l in c)c.hasOwnProperty(l)&&o[l]!==c[l]&&(n||(n={}),n[l]=c[l])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(di.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Xe("scroll",e),i||o===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};Dg=function(e,t,n,s){n!==s&&(t.flags|=4)};function Ua(e,t){if(!nt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&14680064,s|=r.flags&14680064,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Fx(e,t,n){var s=t.pendingProps;switch(kd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(t),null;case 1:return tn(t.type)&&Wl(),Mt(t),null;case 3:return s=t.stateNode,fa(),Ze(en),Ze(Ot),Rd(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(rl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Un!==null&&(Pu(Un),Un=null))),Su(e,t),Mt(t),null;case 5:Ad(t);var r=vr(Si.current);if(n=t.type,e!==null&&t.stateNode!=null)Og(e,t,n,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(J(166));return Mt(t),null}if(e=vr(ns.current),rl(t)){s=t.stateNode,n=t.type;var i=t.memoizedProps;switch(s[es]=t,s[ki]=i,e=(t.mode&1)!==0,n){case"dialog":Xe("cancel",s),Xe("close",s);break;case"iframe":case"object":case"embed":Xe("load",s);break;case"video":case"audio":for(r=0;r<Qa.length;r++)Xe(Qa[r],s);break;case"source":Xe("error",s);break;case"img":case"image":case"link":Xe("error",s),Xe("load",s);break;case"details":Xe("toggle",s);break;case"input":Yp(s,i),Xe("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},Xe("invalid",s);break;case"textarea":qp(s,i),Xe("invalid",s)}Jc(n,i),r=null;for(var l in i)if(i.hasOwnProperty(l)){var o=i[l];l==="children"?typeof o=="string"?s.textContent!==o&&(i.suppressHydrationWarning!==!0&&sl(s.textContent,o,e),r=["children",o]):typeof o=="number"&&s.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&sl(s.textContent,o,e),r=["children",""+o]):di.hasOwnProperty(l)&&o!=null&&l==="onScroll"&&Xe("scroll",s)}switch(n){case"input":Yi(s),Jp(s,i,!0);break;case"textarea":Yi(s),Xp(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=zl)}s=r,t.updateQueue=s,s!==null&&(t.flags|=4)}else{l=r.nodeType===9?r:r.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=df(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=l.createElement(n,{is:s.is}):(e=l.createElement(n),n==="select"&&(l=e,s.multiple?l.multiple=!0:s.size&&(l.size=s.size))):e=l.createElementNS(e,n),e[es]=t,e[ki]=s,Lg(e,t,!1,!1),t.stateNode=e;e:{switch(l=qc(n,s),n){case"dialog":Xe("cancel",e),Xe("close",e),r=s;break;case"iframe":case"object":case"embed":Xe("load",e),r=s;break;case"video":case"audio":for(r=0;r<Qa.length;r++)Xe(Qa[r],e);r=s;break;case"source":Xe("error",e),r=s;break;case"img":case"image":case"link":Xe("error",e),Xe("load",e),r=s;break;case"details":Xe("toggle",e),r=s;break;case"input":Yp(e,s),r=Vc(e,s),Xe("invalid",e);break;case"option":r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=it({},s,{value:void 0}),Xe("invalid",e);break;case"textarea":qp(e,s),r=Gc(e,s),Xe("invalid",e);break;default:r=s}Jc(n,r),o=r;for(i in o)if(o.hasOwnProperty(i)){var c=o[i];i==="style"?mf(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&pf(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&pi(e,c):typeof c=="number"&&pi(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(di.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Xe("scroll",e):c!=null&&id(e,i,c,l))}switch(n){case"input":Yi(e),Jp(e,s,!1);break;case"textarea":Yi(e),Xp(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Js(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?na(e,!!s.multiple,i,!1):s.defaultValue!=null&&na(e,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=zl)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Mt(t),null;case 6:if(e&&t.stateNode!=null)Dg(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(J(166));if(n=vr(Si.current),vr(ns.current),rl(t)){if(s=t.stateNode,n=t.memoizedProps,s[es]=t,(i=s.nodeValue!==n)&&(e=dn,e!==null))switch(e.tag){case 3:sl(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&sl(s.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[es]=t,t.stateNode=s}return Mt(t),null;case 13:if(Ze(rt),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nt&&un!==null&&t.mode&1&&!(t.flags&128))tg(),ha(),t.flags|=98560,i=!1;else if(i=rl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(J(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(J(317));i[es]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mt(t),i=!1}else Un!==null&&(Pu(Un),Un=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||rt.current&1?St===0&&(St=3):Hd())),t.updateQueue!==null&&(t.flags|=4),Mt(t),null);case 4:return fa(),Su(e,t),e===null&&wi(t.stateNode.containerInfo),Mt(t),null;case 10:return jd(t.type._context),Mt(t),null;case 17:return tn(t.type)&&Wl(),Mt(t),null;case 19:if(Ze(rt),i=t.memoizedState,i===null)return Mt(t),null;if(s=(t.flags&128)!==0,l=i.rendering,l===null)if(s)Ua(i,!1);else{if(St!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=ql(e),l!==null){for(t.flags|=128,Ua(i,!1),s=l.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)i=n,e=s,i.flags&=14680066,l=i.alternate,l===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,e=l.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return qe(rt,rt.current&1|2),t.child}e=e.sibling}i.tail!==null&&pt()>va&&(t.flags|=128,s=!0,Ua(i,!1),t.lanes=4194304)}else{if(!s)if(e=ql(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ua(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!nt)return Mt(t),null}else 2*pt()-i.renderingStartTime>va&&n!==1073741824&&(t.flags|=128,s=!0,Ua(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=pt(),t.sibling=null,n=rt.current,qe(rt,s?n&1|2:n&1),t):(Mt(t),null);case 22:case 23:return Ud(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?cn&1073741824&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function Bx(e,t){switch(kd(t),t.tag){case 1:return tn(t.type)&&Wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(),Ze(en),Ze(Ot),Rd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ad(t),null;case 13:if(Ze(rt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(rt),null;case 4:return fa(),null;case 10:return jd(t.type._context),null;case 22:case 23:return Ud(),null;case 24:return null;default:return null}}var ll=!1,Lt=!1,Ux=typeof WeakSet=="function"?WeakSet:Set,he=null;function ea(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){ot(e,t,s)}else n.current=null}function Nu(e,t,n){try{n()}catch(s){ot(e,t,s)}}var Uh=!1;function Hx(e,t){if(lu=Bl,e=Hf(),wd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,o=-1,c=-1,d=0,g=0,f=e,h=null;t:for(;;){for(var x;f!==n||r!==0&&f.nodeType!==3||(o=l+r),f!==i||s!==0&&f.nodeType!==3||(c=l+s),f.nodeType===3&&(l+=f.nodeValue.length),(x=f.firstChild)!==null;)h=f,f=x;for(;;){if(f===e)break t;if(h===n&&++d===r&&(o=l),h===i&&++g===s&&(c=l),(x=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ou={focusedElem:e,selectionRange:n},Bl=!1,he=t;he!==null;)if(t=he,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,he=e;else for(;he!==null;){t=he;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var w=b.memoizedProps,S=b.memoizedState,k=t.stateNode,m=k.getSnapshotBeforeUpdate(t.elementType===t.type?w:Fn(t.type,w),S);k.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(T){ot(t,t.return,T)}if(e=t.sibling,e!==null){e.return=t.return,he=e;break}he=t.return}return b=Uh,Uh=!1,b}function ei(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&e)===e){var i=r.destroy;r.destroy=void 0,i!==void 0&&Nu(t,n,i)}r=r.next}while(r!==s)}}function Eo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function ju(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $g(e){var t=e.alternate;t!==null&&(e.alternate=null,$g(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[es],delete t[ki],delete t[du],delete t[Nx],delete t[jx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fg(e){return e.tag===5||e.tag===3||e.tag===4}function Hh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fg(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cu(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=zl));else if(s!==4&&(e=e.child,e!==null))for(Cu(e,t,n),e=e.sibling;e!==null;)Cu(e,t,n),e=e.sibling}function Eu(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Eu(e,t,n),e=e.sibling;e!==null;)Eu(e,t,n),e=e.sibling}var At=null,Bn=!1;function Ps(e,t,n){for(n=n.child;n!==null;)Bg(e,t,n),n=n.sibling}function Bg(e,t,n){if(ts&&typeof ts.onCommitFiberUnmount=="function")try{ts.onCommitFiberUnmount(wo,n)}catch{}switch(n.tag){case 5:Lt||ea(n,t);case 6:var s=At,r=Bn;At=null,Ps(e,t,n),At=s,Bn=r,At!==null&&(Bn?(e=At,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):At.removeChild(n.stateNode));break;case 18:At!==null&&(Bn?(e=At,n=n.stateNode,e.nodeType===8?mc(e.parentNode,n):e.nodeType===1&&mc(e,n),gi(e)):mc(At,n.stateNode));break;case 4:s=At,r=Bn,At=n.stateNode.containerInfo,Bn=!0,Ps(e,t,n),At=s,Bn=r;break;case 0:case 11:case 14:case 15:if(!Lt&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var i=r,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&Nu(n,t,l),r=r.next}while(r!==s)}Ps(e,t,n);break;case 1:if(!Lt&&(ea(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(o){ot(n,t,o)}Ps(e,t,n);break;case 21:Ps(e,t,n);break;case 22:n.mode&1?(Lt=(s=Lt)||n.memoizedState!==null,Ps(e,t,n),Lt=s):Ps(e,t,n);break;default:Ps(e,t,n)}}function zh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ux),t.forEach(function(s){var r=qx.bind(null,e,s);n.has(s)||(n.add(s),s.then(r,r))})}}function $n(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s];try{var i=e,l=t,o=l;e:for(;o!==null;){switch(o.tag){case 5:At=o.stateNode,Bn=!1;break e;case 3:At=o.stateNode.containerInfo,Bn=!0;break e;case 4:At=o.stateNode.containerInfo,Bn=!0;break e}o=o.return}if(At===null)throw Error(J(160));Bg(i,l,r),At=null,Bn=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(d){ot(r,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ug(t,e),t=t.sibling}function Ug(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if($n(t,e),Jn(e),s&4){try{ei(3,e,e.return),Eo(3,e)}catch(w){ot(e,e.return,w)}try{ei(5,e,e.return)}catch(w){ot(e,e.return,w)}}break;case 1:$n(t,e),Jn(e),s&512&&n!==null&&ea(n,n.return);break;case 5:if($n(t,e),Jn(e),s&512&&n!==null&&ea(n,n.return),e.flags&32){var r=e.stateNode;try{pi(r,"")}catch(w){ot(e,e.return,w)}}if(s&4&&(r=e.stateNode,r!=null)){var i=e.memoizedProps,l=n!==null?n.memoizedProps:i,o=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&cf(r,i),qc(o,l);var d=qc(o,i);for(l=0;l<c.length;l+=2){var g=c[l],f=c[l+1];g==="style"?mf(r,f):g==="dangerouslySetInnerHTML"?pf(r,f):g==="children"?pi(r,f):id(r,g,f,d)}switch(o){case"input":Kc(r,i);break;case"textarea":uf(r,i);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var x=i.value;x!=null?na(r,!!i.multiple,x,!1):h!==!!i.multiple&&(i.defaultValue!=null?na(r,!!i.multiple,i.defaultValue,!0):na(r,!!i.multiple,i.multiple?[]:"",!1))}r[ki]=i}catch(w){ot(e,e.return,w)}}break;case 6:if($n(t,e),Jn(e),s&4){if(e.stateNode===null)throw Error(J(162));r=e.stateNode,i=e.memoizedProps;try{r.nodeValue=i}catch(w){ot(e,e.return,w)}}break;case 3:if($n(t,e),Jn(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{gi(t.containerInfo)}catch(w){ot(e,e.return,w)}break;case 4:$n(t,e),Jn(e);break;case 13:$n(t,e),Jn(e),r=e.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(Fd=pt())),s&4&&zh(e);break;case 22:if(g=n!==null&&n.memoizedState!==null,e.mode&1?(Lt=(d=Lt)||g,$n(t,e),Lt=d):$n(t,e),Jn(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!g&&e.mode&1)for(he=e,g=e.child;g!==null;){for(f=he=g;he!==null;){switch(h=he,x=h.child,h.tag){case 0:case 11:case 14:case 15:ei(4,h,h.return);break;case 1:ea(h,h.return);var b=h.stateNode;if(typeof b.componentWillUnmount=="function"){s=h,n=h.return;try{t=s,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(w){ot(s,n,w)}}break;case 5:ea(h,h.return);break;case 22:if(h.memoizedState!==null){Vh(f);continue}}x!==null?(x.return=h,he=x):Vh(f)}g=g.sibling}e:for(g=null,f=e;;){if(f.tag===5){if(g===null){g=f;try{r=f.stateNode,d?(i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=f.stateNode,c=f.memoizedProps.style,l=c!=null&&c.hasOwnProperty("display")?c.display:null,o.style.display=hf("display",l))}catch(w){ot(e,e.return,w)}}}else if(f.tag===6){if(g===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(w){ot(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;g===f&&(g=null),f=f.return}g===f&&(g=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:$n(t,e),Jn(e),s&4&&zh(e);break;case 21:break;default:$n(t,e),Jn(e)}}function Jn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Fg(n)){var s=n;break e}n=n.return}throw Error(J(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(pi(r,""),s.flags&=-33);var i=Hh(e);Eu(e,i,r);break;case 3:case 4:var l=s.stateNode.containerInfo,o=Hh(e);Cu(e,o,l);break;default:throw Error(J(161))}}catch(c){ot(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zx(e,t,n){he=e,Hg(e)}function Hg(e,t,n){for(var s=(e.mode&1)!==0;he!==null;){var r=he,i=r.child;if(r.tag===22&&s){var l=r.memoizedState!==null||ll;if(!l){var o=r.alternate,c=o!==null&&o.memoizedState!==null||Lt;o=ll;var d=Lt;if(ll=l,(Lt=c)&&!d)for(he=r;he!==null;)l=he,c=l.child,l.tag===22&&l.memoizedState!==null?Kh(r):c!==null?(c.return=l,he=c):Kh(r);for(;i!==null;)he=i,Hg(i),i=i.sibling;he=r,ll=o,Lt=d}Wh(e)}else r.subtreeFlags&8772&&i!==null?(i.return=r,he=i):Wh(e)}}function Wh(e){for(;he!==null;){var t=he;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lt||Eo(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!Lt)if(n===null)s.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:Fn(t.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Th(t,i,s);break;case 3:var l=t.updateQueue;if(l!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Th(t,l,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var g=d.memoizedState;if(g!==null){var f=g.dehydrated;f!==null&&gi(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(J(163))}Lt||t.flags&512&&ju(t)}catch(h){ot(t,t.return,h)}}if(t===e){he=null;break}if(n=t.sibling,n!==null){n.return=t.return,he=n;break}he=t.return}}function Vh(e){for(;he!==null;){var t=he;if(t===e){he=null;break}var n=t.sibling;if(n!==null){n.return=t.return,he=n;break}he=t.return}}function Kh(e){for(;he!==null;){var t=he;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Eo(4,t)}catch(c){ot(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var r=t.return;try{s.componentDidMount()}catch(c){ot(t,r,c)}}var i=t.return;try{ju(t)}catch(c){ot(t,i,c)}break;case 5:var l=t.return;try{ju(t)}catch(c){ot(t,l,c)}}}catch(c){ot(t,t.return,c)}if(t===e){he=null;break}var o=t.sibling;if(o!==null){o.return=t.return,he=o;break}he=t.return}}var Wx=Math.ceil,eo=Ss.ReactCurrentDispatcher,Dd=Ss.ReactCurrentOwner,jn=Ss.ReactCurrentBatchConfig,Be=0,Et=null,vt=null,Rt=0,cn=0,ta=er(0),St=0,Ei=null,Nr=0,To=0,$d=0,ti=null,Xt=null,Fd=0,va=1/0,ds=null,to=!1,Tu=null,Qs=null,ol=!1,Us=null,no=0,ni=0,Au=null,jl=-1,Cl=0;function Vt(){return Be&6?pt():jl!==-1?jl:jl=pt()}function Gs(e){return e.mode&1?Be&2&&Rt!==0?Rt&-Rt:Ex.transition!==null?(Cl===0&&(Cl=Cf()),Cl):(e=Ve,e!==0||(e=window.event,e=e===void 0?16:_f(e.type)),e):1}function zn(e,t,n,s){if(50<ni)throw ni=0,Au=null,Error(J(185));Ii(e,n,s),(!(Be&2)||e!==Et)&&(e===Et&&(!(Be&2)&&(To|=n),St===4&&Fs(e,Rt)),nn(e,s),n===1&&Be===0&&!(t.mode&1)&&(va=pt()+500,No&&tr()))}function nn(e,t){var n=e.callbackNode;Ew(e,t);var s=Fl(e,e===Et?Rt:0);if(s===0)n!==null&&th(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&th(n),t===1)e.tag===0?Cx(Qh.bind(null,e)):Xf(Qh.bind(null,e)),bx(function(){!(Be&6)&&tr()}),n=null;else{switch(Ef(s)){case 1:n=dd;break;case 4:n=Nf;break;case 16:n=$l;break;case 536870912:n=jf;break;default:n=$l}n=Jg(n,zg.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function zg(e,t){if(jl=-1,Cl=0,Be&6)throw Error(J(327));var n=e.callbackNode;if(la()&&e.callbackNode!==n)return null;var s=Fl(e,e===Et?Rt:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=so(e,s);else{t=s;var r=Be;Be|=2;var i=Vg();(Et!==e||Rt!==t)&&(ds=null,va=pt()+500,wr(e,t));do try{Qx();break}catch(o){Wg(e,o)}while(!0);Nd(),eo.current=i,Be=r,vt!==null?t=0:(Et=null,Rt=0,t=St)}if(t!==0){if(t===2&&(r=nu(e),r!==0&&(s=r,t=Ru(e,r))),t===1)throw n=Ei,wr(e,0),Fs(e,s),nn(e,pt()),n;if(t===6)Fs(e,s);else{if(r=e.current.alternate,!(s&30)&&!Vx(r)&&(t=so(e,s),t===2&&(i=nu(e),i!==0&&(s=i,t=Ru(e,i))),t===1))throw n=Ei,wr(e,0),Fs(e,s),nn(e,pt()),n;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(J(345));case 2:ur(e,Xt,ds);break;case 3:if(Fs(e,s),(s&130023424)===s&&(t=Fd+500-pt(),10<t)){if(Fl(e,0)!==0)break;if(r=e.suspendedLanes,(r&s)!==s){Vt(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=uu(ur.bind(null,e,Xt,ds),t);break}ur(e,Xt,ds);break;case 4:if(Fs(e,s),(s&4194240)===s)break;for(t=e.eventTimes,r=-1;0<s;){var l=31-Hn(s);i=1<<l,l=t[l],l>r&&(r=l),s&=~i}if(s=r,s=pt()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Wx(s/1960))-s,10<s){e.timeoutHandle=uu(ur.bind(null,e,Xt,ds),s);break}ur(e,Xt,ds);break;case 5:ur(e,Xt,ds);break;default:throw Error(J(329))}}}return nn(e,pt()),e.callbackNode===n?zg.bind(null,e):null}function Ru(e,t){var n=ti;return e.current.memoizedState.isDehydrated&&(wr(e,t).flags|=256),e=so(e,t),e!==2&&(t=Xt,Xt=n,t!==null&&Pu(t)),e}function Pu(e){Xt===null?Xt=e:Xt.push.apply(Xt,e)}function Vx(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!Vn(i(),r))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 Fs(e,t){for(t&=~$d,t&=~To,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Hn(t),s=1<<n;e[n]=-1,t&=~s}}function Qh(e){if(Be&6)throw Error(J(327));la();var t=Fl(e,0);if(!(t&1))return nn(e,pt()),null;var n=so(e,t);if(e.tag!==0&&n===2){var s=nu(e);s!==0&&(t=s,n=Ru(e,s))}if(n===1)throw n=Ei,wr(e,0),Fs(e,t),nn(e,pt()),n;if(n===6)throw Error(J(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ur(e,Xt,ds),nn(e,pt()),null}function Bd(e,t){var n=Be;Be|=1;try{return e(t)}finally{Be=n,Be===0&&(va=pt()+500,No&&tr())}}function jr(e){Us!==null&&Us.tag===0&&!(Be&6)&&la();var t=Be;Be|=1;var n=jn.transition,s=Ve;try{if(jn.transition=null,Ve=1,e)return e()}finally{Ve=s,jn.transition=n,Be=t,!(Be&6)&&tr()}}function Ud(){cn=ta.current,Ze(ta)}function wr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,kx(n)),vt!==null)for(n=vt.return;n!==null;){var s=n;switch(kd(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Wl();break;case 3:fa(),Ze(en),Ze(Ot),Rd();break;case 5:Ad(s);break;case 4:fa();break;case 13:Ze(rt);break;case 19:Ze(rt);break;case 10:jd(s.type._context);break;case 22:case 23:Ud()}n=n.return}if(Et=e,vt=e=Ys(e.current,null),Rt=cn=t,St=0,Ei=null,$d=To=Nr=0,Xt=ti=null,gr!==null){for(t=0;t<gr.length;t++)if(n=gr[t],s=n.interleaved,s!==null){n.interleaved=null;var r=s.next,i=n.pending;if(i!==null){var l=i.next;i.next=r,s.next=l}n.pending=s}gr=null}return e}function Wg(e,t){do{var n=vt;try{if(Nd(),bl.current=Zl,Xl){for(var s=at.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Xl=!1}if(Sr=0,Ct=kt=at=null,Za=!1,Ni=0,Dd.current=null,n===null||n.return===null){St=1,Ei=t,vt=null;break}e:{var i=e,l=n.return,o=n,c=t;if(t=Rt,o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,g=o,f=g.tag;if(!(g.mode&1)&&(f===0||f===11||f===15)){var h=g.alternate;h?(g.updateQueue=h.updateQueue,g.memoizedState=h.memoizedState,g.lanes=h.lanes):(g.updateQueue=null,g.memoizedState=null)}var x=Mh(l);if(x!==null){x.flags&=-257,Lh(x,l,o,i,t),x.mode&1&&_h(i,d,t),t=x,c=d;var b=t.updateQueue;if(b===null){var w=new Set;w.add(c),t.updateQueue=w}else b.add(c);break e}else{if(!(t&1)){_h(i,d,t),Hd();break e}c=Error(J(426))}}else if(nt&&o.mode&1){var S=Mh(l);if(S!==null){!(S.flags&65536)&&(S.flags|=256),Lh(S,l,o,i,t),bd(ga(c,o));break e}}i=c=ga(c,o),St!==4&&(St=2),ti===null?ti=[i]:ti.push(i),i=l;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var k=Eg(i,c,t);Eh(i,k);break e;case 1:o=c;var m=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof m.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Qs===null||!Qs.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var T=Tg(i,o,t);Eh(i,T);break e}}i=i.return}while(i!==null)}Qg(n)}catch(E){t=E,vt===n&&n!==null&&(vt=n=n.return);continue}break}while(!0)}function Vg(){var e=eo.current;return eo.current=Zl,e===null?Zl:e}function Hd(){(St===0||St===3||St===2)&&(St=4),Et===null||!(Nr&268435455)&&!(To&268435455)||Fs(Et,Rt)}function so(e,t){var n=Be;Be|=2;var s=Vg();(Et!==e||Rt!==t)&&(ds=null,wr(e,t));do try{Kx();break}catch(r){Wg(e,r)}while(!0);if(Nd(),Be=n,eo.current=s,vt!==null)throw Error(J(261));return Et=null,Rt=0,St}function Kx(){for(;vt!==null;)Kg(vt)}function Qx(){for(;vt!==null&&!yw();)Kg(vt)}function Kg(e){var t=Yg(e.alternate,e,cn);e.memoizedProps=e.pendingProps,t===null?Qg(e):vt=t,Dd.current=null}function Qg(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Bx(n,t),n!==null){n.flags&=32767,vt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{St=6,vt=null;return}}else if(n=Fx(n,t,cn),n!==null){vt=n;return}if(t=t.sibling,t!==null){vt=t;return}vt=t=e}while(t!==null);St===0&&(St=5)}function ur(e,t,n){var s=Ve,r=jn.transition;try{jn.transition=null,Ve=1,Gx(e,t,n,s)}finally{jn.transition=r,Ve=s}return null}function Gx(e,t,n,s){do la();while(Us!==null);if(Be&6)throw Error(J(327));n=e.finishedWork;var r=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(J(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Tw(e,i),e===Et&&(vt=Et=null,Rt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Jg($l,function(){return la(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=jn.transition,jn.transition=null;var l=Ve;Ve=1;var o=Be;Be|=4,Dd.current=null,Hx(e,n),Ug(n,e),mx(ou),Bl=!!lu,ou=lu=null,e.current=n,zx(n),ww(),Be=o,Ve=l,jn.transition=i}else e.current=n;if(ol&&(ol=!1,Us=e,no=r),i=e.pendingLanes,i===0&&(Qs=null),bw(n.stateNode),nn(e,pt()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)r=t[n],s(r.value,{componentStack:r.stack,digest:r.digest});if(to)throw to=!1,e=Tu,Tu=null,e;return no&1&&e.tag!==0&&la(),i=e.pendingLanes,i&1?e===Au?ni++:(ni=0,Au=e):ni=0,tr(),null}function la(){if(Us!==null){var e=Ef(no),t=jn.transition,n=Ve;try{if(jn.transition=null,Ve=16>e?16:e,Us===null)var s=!1;else{if(e=Us,Us=null,no=0,Be&6)throw Error(J(331));var r=Be;for(Be|=4,he=e.current;he!==null;){var i=he,l=i.child;if(he.flags&16){var o=i.deletions;if(o!==null){for(var c=0;c<o.length;c++){var d=o[c];for(he=d;he!==null;){var g=he;switch(g.tag){case 0:case 11:case 15:ei(8,g,i)}var f=g.child;if(f!==null)f.return=g,he=f;else for(;he!==null;){g=he;var h=g.sibling,x=g.return;if($g(g),g===d){he=null;break}if(h!==null){h.return=x,he=h;break}he=x}}}var b=i.alternate;if(b!==null){var w=b.child;if(w!==null){b.child=null;do{var S=w.sibling;w.sibling=null,w=S}while(w!==null)}}he=i}}if(i.subtreeFlags&2064&&l!==null)l.return=i,he=l;else e:for(;he!==null;){if(i=he,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ei(9,i,i.return)}var k=i.sibling;if(k!==null){k.return=i.return,he=k;break e}he=i.return}}var m=e.current;for(he=m;he!==null;){l=he;var v=l.child;if(l.subtreeFlags&2064&&v!==null)v.return=l,he=v;else e:for(l=m;he!==null;){if(o=he,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Eo(9,o)}}catch(E){ot(o,o.return,E)}if(o===l){he=null;break e}var T=o.sibling;if(T!==null){T.return=o.return,he=T;break e}he=o.return}}if(Be=r,tr(),ts&&typeof ts.onPostCommitFiberRoot=="function")try{ts.onPostCommitFiberRoot(wo,e)}catch{}s=!0}return s}finally{Ve=n,jn.transition=t}}return!1}function Gh(e,t,n){t=ga(n,t),t=Eg(e,t,1),e=Ks(e,t,1),t=Vt(),e!==null&&(Ii(e,1,t),nn(e,t))}function ot(e,t,n){if(e.tag===3)Gh(e,e,n);else for(;t!==null;){if(t.tag===3){Gh(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Qs===null||!Qs.has(s))){e=ga(n,e),e=Tg(t,e,1),t=Ks(t,e,1),e=Vt(),t!==null&&(Ii(t,1,e),nn(t,e));break}}t=t.return}}function Yx(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=Vt(),e.pingedLanes|=e.suspendedLanes&n,Et===e&&(Rt&n)===n&&(St===4||St===3&&(Rt&130023424)===Rt&&500>pt()-Fd?wr(e,0):$d|=n),nn(e,t)}function Gg(e,t){t===0&&(e.mode&1?(t=Xi,Xi<<=1,!(Xi&130023424)&&(Xi=4194304)):t=1);var n=Vt();e=xs(e,t),e!==null&&(Ii(e,t,n),nn(e,n))}function Jx(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gg(e,n)}function qx(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(J(314))}s!==null&&s.delete(t),Gg(e,n)}var Yg;Yg=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||en.current)Zt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Zt=!1,$x(e,t,n);Zt=!!(e.flags&131072)}else Zt=!1,nt&&t.flags&1048576&&Zf(t,Ql,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Nl(e,t),e=t.pendingProps;var r=pa(t,Ot.current);ia(t,n),r=Id(null,t,s,e,r,n);var i=_d();return t.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tn(s)?(i=!0,Vl(t)):i=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Ed(t),r.updater=Co,t.stateNode=r,r._reactInternals=t,vu(t,s,e,n),t=xu(null,t,s,!0,i,n)):(t.tag=0,nt&&i&&xd(t),zt(null,t,r,n),t=t.child),t;case 16:s=t.elementType;e:{switch(Nl(e,t),e=t.pendingProps,r=s._init,s=r(s._payload),t.type=s,r=t.tag=Zx(s),e=Fn(s,e),r){case 0:t=wu(null,t,s,e,n);break e;case 1:t=$h(null,t,s,e,n);break e;case 11:t=Oh(null,t,s,e,n);break e;case 14:t=Dh(null,t,s,Fn(s.type,e),n);break e}throw Error(J(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Fn(s,r),wu(e,t,s,r,n);case 1:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Fn(s,r),$h(e,t,s,r,n);case 3:e:{if(Ig(t),e===null)throw Error(J(387));s=t.pendingProps,i=t.memoizedState,r=i.element,ag(e,t),Jl(t,s,null,n);var l=t.memoizedState;if(s=l.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){r=ga(Error(J(423)),t),t=Fh(e,t,s,n,r);break e}else if(s!==r){r=ga(Error(J(424)),t),t=Fh(e,t,s,n,r);break e}else for(un=Vs(t.stateNode.containerInfo.firstChild),dn=t,nt=!0,Un=null,n=sg(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ha(),s===r){t=ks(e,t,n);break e}zt(e,t,s,n)}t=t.child}return t;case 5:return ig(t),e===null&&mu(t),s=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,l=r.children,cu(s,r)?l=null:i!==null&&cu(s,i)&&(t.flags|=32),Pg(e,t),zt(e,t,l,n),t.child;case 6:return e===null&&mu(t),null;case 13:return _g(e,t,n);case 4:return Td(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=ma(t,null,s,n):zt(e,t,s,n),t.child;case 11:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Fn(s,r),Oh(e,t,s,r,n);case 7:return zt(e,t,t.pendingProps,n),t.child;case 8:return zt(e,t,t.pendingProps.children,n),t.child;case 12:return zt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,i=t.memoizedProps,l=r.value,qe(Gl,s._currentValue),s._currentValue=l,i!==null)if(Vn(i.value,l)){if(i.children===r.children&&!en.current){t=ks(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){l=i.child;for(var c=o.firstContext;c!==null;){if(c.context===s){if(i.tag===1){c=vs(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var g=d.pending;g===null?c.next=c:(c.next=g.next,g.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),fu(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(J(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),fu(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}zt(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,ia(t,n),r=En(r),s=s(r),t.flags|=1,zt(e,t,s,n),t.child;case 14:return s=t.type,r=Fn(s,t.pendingProps),r=Fn(s.type,r),Dh(e,t,s,r,n);case 15:return Ag(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Fn(s,r),Nl(e,t),t.tag=1,tn(s)?(e=!0,Vl(t)):e=!1,ia(t,n),Cg(t,s,r),vu(t,s,r,n),xu(null,t,s,!0,e,n);case 19:return Mg(e,t,n);case 22:return Rg(e,t,n)}throw Error(J(156,t.tag))};function Jg(e,t){return Sf(e,t)}function Xx(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(e,t,n,s){return new Xx(e,t,n,s)}function zd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zx(e){if(typeof e=="function")return zd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===od)return 11;if(e===cd)return 14}return 2}function Ys(e,t){var n=e.alternate;return n===null?(n=Sn(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&14680064,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}function El(e,t,n,s,r,i){var l=2;if(s=e,typeof e=="function")zd(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Vr:return xr(n.children,r,i,t);case ld:l=8,r|=8;break;case Uc:return e=Sn(12,n,t,r|2),e.elementType=Uc,e.lanes=i,e;case Hc:return e=Sn(13,n,t,r),e.elementType=Hc,e.lanes=i,e;case zc:return e=Sn(19,n,t,r),e.elementType=zc,e.lanes=i,e;case af:return Ao(n,r,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case sf:l=10;break e;case rf:l=9;break e;case od:l=11;break e;case cd:l=14;break e;case Ls:l=16,s=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=Sn(l,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function xr(e,t,n,s){return e=Sn(7,e,s,t),e.lanes=n,e}function Ao(e,t,n,s){return e=Sn(22,e,s,t),e.elementType=af,e.lanes=n,e.stateNode={isHidden:!1},e}function bc(e,t,n){return e=Sn(6,e,null,t),e.lanes=n,e}function Sc(e,t,n){return t=Sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ek(e,t,n,s,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sc(0),this.expirationTimes=sc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Wd(e,t,n,s,r,i,l,o,c){return e=new ek(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Sn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ed(i),e}function tk(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wr,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function qg(e){if(!e)return qs;e=e._reactInternals;e:{if(Er(e)!==e||e.tag!==1)throw Error(J(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(J(171))}if(e.tag===1){var n=e.type;if(tn(n))return qf(e,n,t)}return t}function Xg(e,t,n,s,r,i,l,o,c){return e=Wd(n,s,!0,e,r,i,l,o,c),e.context=qg(null),n=e.current,s=Vt(),r=Gs(n),i=vs(s,r),i.callback=t??null,Ks(n,i,r),e.current.lanes=r,Ii(e,r,s),nn(e,s),e}function Ro(e,t,n,s){var r=t.current,i=Vt(),l=Gs(r);return n=qg(n),t.context===null?t.context=n:t.pendingContext=n,t=vs(i,l),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Ks(r,t,l),e!==null&&(zn(e,r,l,i),kl(e,r,l)),l}function ro(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Yh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Vd(e,t){Yh(e,t),(e=e.alternate)&&Yh(e,t)}function nk(){return null}var Zg=typeof reportError=="function"?reportError:function(e){console.error(e)};function Kd(e){this._internalRoot=e}Po.prototype.render=Kd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));Ro(e,t,null,null)};Po.prototype.unmount=Kd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jr(function(){Ro(null,e,null,null)}),t[ws]=null}};function Po(e){this._internalRoot=e}Po.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<$s.length&&t!==0&&t<$s[n].priority;n++);$s.splice(n,0,e),n===0&&If(e)}};function Qd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Io(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Jh(){}function sk(e,t,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var d=ro(l);i.call(d)}}var l=Xg(t,s,e,0,null,!1,!1,"",Jh);return e._reactRootContainer=l,e[ws]=l.current,wi(e.nodeType===8?e.parentNode:e),jr(),l}for(;r=e.lastChild;)e.removeChild(r);if(typeof s=="function"){var o=s;s=function(){var d=ro(c);o.call(d)}}var c=Wd(e,0,!1,null,null,!1,!1,"",Jh);return e._reactRootContainer=c,e[ws]=c.current,wi(e.nodeType===8?e.parentNode:e),jr(function(){Ro(t,c,n,s)}),c}function _o(e,t,n,s,r){var i=n._reactRootContainer;if(i){var l=i;if(typeof r=="function"){var o=r;r=function(){var c=ro(l);o.call(c)}}Ro(t,l,e,r)}else l=sk(n,t,e,r,s);return ro(l)}Tf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ka(t.pendingLanes);n!==0&&(pd(t,n|1),nn(t,pt()),!(Be&6)&&(va=pt()+500,tr()))}break;case 13:jr(function(){var s=xs(e,1);if(s!==null){var r=Vt();zn(s,e,1,r)}}),Vd(e,1)}};hd=function(e){if(e.tag===13){var t=xs(e,134217728);if(t!==null){var n=Vt();zn(t,e,134217728,n)}Vd(e,134217728)}};Af=function(e){if(e.tag===13){var t=Gs(e),n=xs(e,t);if(n!==null){var s=Vt();zn(n,e,t,s)}Vd(e,t)}};Rf=function(){return Ve};Pf=function(e,t){var n=Ve;try{return Ve=e,t()}finally{Ve=n}};Zc=function(e,t,n){switch(t){case"input":if(Kc(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=So(s);if(!r)throw Error(J(90));of(s),Kc(s,r)}}}break;case"textarea":uf(e,n);break;case"select":t=n.value,t!=null&&na(e,!!n.multiple,t,!1)}};vf=Bd;yf=jr;var rk={usingClientEntryPoint:!1,Events:[Mi,Yr,So,ff,gf,Bd]},Ha={findFiberByHostInstance:fr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ak={bundleType:Ha.bundleType,version:Ha.version,rendererPackageName:Ha.rendererPackageName,rendererConfig:Ha.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ss.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=kf(e),e===null?null:e.stateNode},findFiberByHostInstance:Ha.findFiberByHostInstance||nk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cl.isDisabled&&cl.supportsFiber)try{wo=cl.inject(ak),ts=cl}catch{}}mn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rk;mn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qd(t))throw Error(J(200));return tk(e,t,null,n)};mn.createRoot=function(e,t){if(!Qd(e))throw Error(J(299));var n=!1,s="",r=Zg;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Wd(e,1,!1,null,null,n,!1,s,r),e[ws]=t.current,wi(e.nodeType===8?e.parentNode:e),new Kd(t)};mn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(J(188)):(e=Object.keys(e).join(","),Error(J(268,e)));return e=kf(t),e=e===null?null:e.stateNode,e};mn.flushSync=function(e){return jr(e)};mn.hydrate=function(e,t,n){if(!Io(t))throw Error(J(200));return _o(null,e,t,!0,n)};mn.hydrateRoot=function(e,t,n){if(!Qd(e))throw Error(J(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",l=Zg;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),t=Xg(t,null,e,1,n??null,r,!1,i,l),e[ws]=t.current,wi(e),s)for(e=0;e<s.length;e++)n=s[e],r=n._getVersion,r=r(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,r]:t.mutableSourceEagerHydrationData.push(n,r);return new Po(t)};mn.render=function(e,t,n){if(!Io(t))throw Error(J(200));return _o(null,e,t,!1,n)};mn.unmountComponentAtNode=function(e){if(!Io(e))throw Error(J(40));return e._reactRootContainer?(jr(function(){_o(null,null,e,!1,function(){e._reactRootContainer=null,e[ws]=null})}),!0):!1};mn.unstable_batchedUpdates=Bd;mn.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Io(n))throw Error(J(200));if(e==null||e._reactInternals===void 0)throw Error(J(38));return _o(e,t,n,!1,s)};mn.version="18.3.1-next-f1338f8080-20240426";function ev(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ev)}catch(e){console.error(e)}}ev(),Zm.exports=mn;var Gd=Zm.exports,tv,qh=Gd;tv=qh.createRoot,qh.hydrateRoot;function ik(){try{const e=new URLSearchParams(window.location.search),t=window.location.hash.replace(/^#/,""),[n,s]=t.split(":"),r=n==="inbox"||n==="chat"?n:null,i=window.location.pathname.replace(/\/+$/,""),o=r||(i==="/inbox"?"inbox":i==="/chat"?"chat":null)||e.get("open");if(!o)return null;const c={open:o,task:e.get("task")||s||null,board:e.get("board")||null};e.delete("open"),e.delete("task"),e.delete("board");const d=e.toString();return window.history.replaceState({},"",window.location.pathname+(d?`?${d}`:"")+window.location.hash),c}catch{return null}}const lk={"nav.tasks":"Tasks","nav.review":"Review","nav.chat":"Chat","nav.notes":"Notes","nav.term":"Terminal","nav.settings":"Settings","status.gw":"GW","status.workers":"Workers {n}","status.reviewWaiting":"Review {n}","status.running":"Running {n}","status.offline":"Offline","review.title":"Review","review.tab.waiting":"Waiting","review.tab.active":"Active","review.tab.done":"Done","review.newAnnotation":"+ Annotate","review.submitAnswer":"Submit Review","review.empty":"Nothing waiting for review","review.round":"Round {round}","review.answeredAt":"Answered {time}","review.completedAt":"Done {time}","review.doneEmpty":"No completed reviews yet","review.doneRecent":"Last {n}","review.status.review":"In review","review.status.ready":"Waiting to apply","review.status.running":"Generating","review.status.blocked":"Blocked","review.status.done":"Done","review.ago.seconds":"{n}s ago","review.ago.minutes":"{n}m ago","review.ago.hours":"{n}h ago","review.progress.reflecting":"Reflecting","review.progress.since":" (started {ago})","review.progress.beat":" · heartbeat {ago}","review.progress.ready":"Waiting to apply (queued for a worker)","review.progress.waiting":"Waiting for review","review.progress.presented":" · presented {ago}","review.progress.done":"Done","review.questionsCount":"{n} Q","review.workerProgress":"Worker progress","review.workerStatus":" ({status})","review.workerSteps":" · {n} steps","review.workerEmpty":"No output yet","review.loadFailed":"Could not load","review.sendFailed":"Could not send","review.sending":"Sending…","review.recommended":"Recommended","review.fastTrack":"⚡ Accept All Recommended ({summary}) & Resume","review.fastTrackHint":"Sends every recommended answer in one tap (questions without one are left to the agent).","review.fastTrackFailed":"Could not accept all recommended answers","review.waitPill":"{i} / {n} Waiting","review.allClear":"🎉 All Clear — every decision is sent, the agents are running","review.thumbZoomAria":"Enlarge the {head} thumbnail","review.thumbAlt":"{head} thumbnail","review.notePlaceholder":"Note (optional)","review.globalNo":"All","review.globalTitle":"Review of the whole sheet (optional)","review.globalPlaceholder":"Policy, priorities, anything that bothers you","review.formHint":"Unselected questions use the recommended option. Sending returns the task to ready and the agent applies it.","review.duplicate":"The same answer is already saved","review.receivedFromSheet":"Answer received from the sheet","review.sheetIframeTitle":"Review sheet","review.pasteSummary":"Paste answer text and send","review.pastePlaceholder":"Paste the review answer text as-is","review.submitPasted":"Send the pasted answer","review.openSheet":"Open the full sheet ↗","review.reopenReasonDefault":"Re-check requested from the PWA","review.reopenFailed":"Could not request a re-check","review.reopened":"Moved back to review","review.answeredAtLabel":"Answered {time}","review.completedLabel":"Done {time}","review.readonlyHint":"Only sheets waiting for review can be answered (this one is {label}).","review.imageAlt":"{title} image","review.annotationMeta":"Annotation: {n} strokes","review.annotationNote":" · note: {note}","review.answersSummary":"Review answers (history)","review.delegated":"Default option applied","review.globalNote":"Overall note: {text}","review.addAnnotation":"🖊 Mark up a screenshot to add instructions","review.openOriginChat":"💬 Open the chat that filed this","review.reopenSummary":"↩ If the result is not enough (request a re-check)","review.reopenPlaceholder":"What to re-check or fix (optional)","review.reopenSubmit":"Send back to review","review.zoomAria":"Enlarged annotation image","review.zoomAlt":"{title} enlarged image","review.imageLoadFailed":"Could not load the image","review.listFailed":"Could not load the list","review.createFailed":"Could not create","review.createdAnno":"Annotation task created ({image})","review.importFailed":"Could not import","review.newAnnoTitle":"Choose an annotation base","review.sourceDevice":"Import an image","review.sourceLibrary":"From library","review.pickFromDevice":"Image from this device (gallery / camera)","review.target":"Target","review.targetOption":"{label} ({id})","review.onlyRepo":"{id} only","review.all":"All","review.librarySub":"library and recent screenshots ({n})","review.repoEmpty":"No images for this repository yet (choose All to see everything)","review.libraryEmpty":"No images yet","review.newAnnoHint":"Images from this device are downscaled to a 1600px long edge at JPEG 0.85. Images pasted into chat appear here once the agent imports them into library/chat/.","review.waitingSub":"{n} waiting for your review","review.noneWaiting":"Nothing waiting for review","review.emptyNoSheets":"No sheets yet.","review.emptyNoSheetsHint":"Create a task on kanban board mobile and the agent generates a sheet.","review.emptyBody":"Send the next spec from chat.","review.emptyNewAnnotation":"+ Create an annotation","review.emptyNote":"You can also mark up a library image and send it","review.emptyMeta":"{active} in progress · {done} done","review.noActive":"Nothing in progress.","review.allDone":"All {n}","review.showAllDone":"Show all ({n} more)","review.showRecentOnly":"Show only the last {n}","review.openSheetDirectly":"{error} — open the sheet directly","review.closeReasonLabel":"Reason for clearing it (optional · kept in the record)","review.closeReasonPlaceholder":"e.g. no longer needed / tracked in another issue","review.feedNotice":"Review: {text}","review.answerSent":"Answer sent","review.nextOpened":"{head} — opened the next waiting review","review.noneLeft":"{head} — nothing else is waiting","review.sheetMissing":"sheet.json is missing","chat.working":"Working…","chat.toolsRan":"🔧 Ran {count} tools","chat.reviewWaitingTitle":"🖊 Waiting for Review","chat.openInReview":"Open Review ↗","chat.jumpBottom":"↓ Latest","chat.jumpBottomWorking":"↓ Working · Latest","chat.loadOlder":"↑ Load older messages","chat.loadingOlder":"Loading older messages…","chat.empty":"No messages yet","chat.send":"Send","chat.attachFailed":"Could not attach the file: {message}","chat.copy":"Copy","chat.copied":"Code copied","chat.copyFailed":"Could not copy","chat.copyUnsupported":"This browser cannot copy","chat.clipReadUnsupported":"This browser cannot read the clipboard","chat.clipNoImage":"No image in the clipboard","chat.readFailed":"Could not read the file","chat.attachImageFailed":"Could not attach the image: {message}","chat.maxAttachments":"Up to 6 attachments per message","chat.tooLarge":"{name} is too large (limit {mb}MB)","chat.fileFallback":"file","chat.checkAttachments":"Please check the attachments.","chat.attachmentsHeader":`
42
+
43
+ Attached files:
44
+ `,"chat.attachInstruction":`
45
+ Read them before answering if needed.`,"chat.sessionCreateFailed":"Could not create the session","chat.sendFailed":"Send failed: {message}","chat.interrupted":"Interrupted","chat.newChatWith":"{target} — new conversation","chat.cannotOpen":"This conversation cannot be opened","chat.openFailed":"Could not open: {message}","chat.resumeFailed":"Could not restore the session","chat.updateFailed":"Could not update: {message}","chat.updateChatFailed":"Could not update the conversation","chat.boardCreateFailed":"Could not create the board","chat.boardCreated":"Created board {slug}","chat.reconnected":"Reconnected","chat.previousChatFailed":"Could not open the previous conversation (please try again)","chat.sessionsAria":"Conversations ({n} unread completion reports)","chat.sessions":"Conversations","chat.title":"Chat","chat.profileTitle":"Profile for this conversation: {profile}","chat.repoTitle":"Repository for this conversation: {id} ({path})","chat.repoTitleShort":"Repository for this conversation: {id}","chat.repoRowTitle":"{label} ({path})","chat.discordAria":"Open the Discord thread","chat.refreshChatAria":"Refresh the conversation","chat.newChatAria":"New conversation (choose a profile and repository)","chat.recovering":"Restoring the connection…","chat.otherReport":"🖊 Completion report in another conversation: {label}","chat.open":"Open","chat.seen":"Read","chat.readonly":"Read-only","chat.readonlyProfileSuffix":" · conversation in the {profile} profile (showing the record because it cannot be resumed)","chat.readonlyBoardSuffix":" · kanban work logs cannot be resumed from this app (use the board)","chat.connecting":"Connecting…","chat.loadingChat":"Loading the conversation…","chat.sendToStart":"Send a message to start","chat.recentAria":"Recently opened conversations","chat.recentHead":"Recently opened conversations","chat.reviewAndAnnotate":"Review / annotate ↗","chat.pipelineReport":"Pipeline report","chat.reportDone":"Done","chat.reportHalted":"Halted","chat.discussNextSteps":"💬 Discuss next steps","chat.openBoard":"📋 Open board","chat.discussFallback":"Summarise the pipeline report above and propose the next steps we should take.","chat.attachedImage":"Attached image","chat.toolProgress":"Tools {n}","chat.lastTool":"Latest: {name}","chat.thinking":"Thinking / running tools","chat.reviewLabel":"🖊 Waiting for review: {title}","chat.linkedWaiting":"This needs your answer. Answering resumes the autonomous worker.","chat.workerRunning":"Working… autonomous worker active","chat.workerQueued":"Waiting for the autonomous worker to start","chat.watchProgress":"Watch progress ↗","chat.jumpLatest":"↓ Working · Latest","chat.jumpBottomPlain":"↓ Latest","chat.removeAttachment":"Remove the attachment","chat.snippetListAria":"Snippet list","chat.readonlyComposer":"Read-only · operate from the board to resume","chat.attachAria":"Attach an image or file","chat.composerPlaceholder":"Send to Hermes…","chat.interrupt":"Interrupt","chat.sendAria":"Send","chat.attachSheetTitle":"Attach","chat.pickImage":"Choose an image","chat.pickImageSub":"From the gallery (PNG / JPEG / WebP / GIF)","chat.takePhoto":"Take a photo","chat.takePhotoSub":"Capture it now and attach","chat.pickFile":"Choose a file","chat.pickFileSub":"PDF, CSV, code… (placed in the session workspace and passed as an @file reference)","chat.fromClipboard":"From the clipboard","chat.fromClipboardSub":"Paste a screenshot you copied (permission prompt)","chat.attachNote":"Up to 6 per message. Images are downscaled to a 1600px long edge. Pasting an image into the composer also attaches it.","chat.snippetsTitle":"Snippets","chat.bar":"bar","chat.mine":"mine","chat.snippetNote":"Tap inserts into the composer (no send). Long-press a bar chip to send immediately.","chat.snippetCustomNote":"Add your own snippets on the Settings tab.","chat.chooseBoard":"Choose a board","chat.createBoard":"Create a board","chat.allRepos":"All repositories","chat.newChat":"New conversation","chat.defaultChip":"default","chat.selectedChip":"selected","chat.usualWork":"Everyday work (same profile as Discord)","chat.thisDeviceDefault":"This device's default profile","chat.profileSuffix":"{p} profile","chat.repoSection":"Repository (working directory)","chat.lastChip":"last","chat.reposLoading":"Loading repositories… (you can still start with “no repository”)","chat.allReposRow":"All repositories","chat.reposHidden":"{n} more (of {total})","chat.noRepo":"No repository","chat.noRepoSub":"Start without picking a working directory","chat.pickProfileThenRepo":"Pick a profile, then tap a repository to start that conversation.","chat.boardBecomesDefault":"Repositories with a board also switch the Tasks tab and the new-task default to that board.","chat.allReposSection":"All repositories ({n})","chat.repoBoards":"Boards in {repo}","chat.currentBoard":" · current board","chat.boardPickNote":"The board you tap becomes the destination for new tasks ({n} boards in this repository).","chat.noBoardsSection":"No boards","chat.noBoardsBody":"{repo} has no boards. Create one and new tasks from this conversation land on it.","chat.createBoardRow":"Create a board for {id}","chat.creating":"Creating…","chat.dontCreate":"Do not create","chat.dontCreateSub":"Back to repository selection (no board is added)","chat.drawerTitle":"Conversations","chat.drawerRefresh":"Refresh","chat.markAllRead":"Mark all read","chat.newChatRowSub":"Choose a profile and repository","chat.unreadReportTitle":"A review completion report has arrived","chat.runningSuffix":" · running","chat.reportAria":"Review completion report","chat.runningTitle":"Running now","chat.newReplyTitle":"New replies since you last looked","chat.readonlyShort":"RO","chat.readonlyTitle":"Read-only (cannot resume or send new instructions)","chat.resumableShort":"Reply","chat.resumableTitle":"Open this conversation to continue instructing","settings.language":"Language","settings.theme":"Theme","settings.languageAuto":"Auto","settings.languageEn":"English","settings.languageJa":"日本語","settings.themeDark":"Dark","settings.themeLight":"Light","settings.themeSystem":"System","settings.model":"Model","settings.memory":"Memory","settings.memoryValue":"{used} / {total} ({percent}%)","settings.disk":"Disk","settings.diskValue":"{free} free ({percent}% used)","settings.bridge":"Bridge","settings.bridgeOk":"OK ({uptime}s)","settings.disconnected":"Disconnected","settings.reviewWaiting":"Review waiting","settings.kanbanValue":"{waiting} waiting / {running} running","settings.lastChecked":"Last checked","settings.launchSource":"Launch source","settings.standalone":"standalone","settings.browser":"browser","settings.installability":"Installability","settings.installPossible":"available (use the button)","settings.installDone":"installed","settings.installNo":"not available (requirements unmet)","settings.haptics":"Vibrate on tap","settings.vibe":"Vibe mode","settings.vibeDopamine":"⚡ Dopamine","settings.vibeSerotonin":"🧘 Serotonin","settings.vibeHint":"Dopamine adds particles, combos and sound to approvals and batch launches. Serotonin keeps the calm V4 look and still vibrates on tap.","settings.vibeSwitched":"Vibe switched to {mode}","settings.sound":"Sound effects","settings.soundHint":"Played in Dopamine mode only (synthesised with Web Audio, nothing to download).","settings.bars":"Visible bars","settings.barChat":"Chat snippet bar","settings.barAnnotation":"Annotation stamp bar","settings.barTerm":"Terminal snippet bar","settings.barsHint":"Hide a bar you never use. Snippets and stamps stay reachable from the chat + menu, the annotation tools row, and the terminal header.","chat.snippetsFromPlus":"Snippets","chat.snippetsFromPlusSub":"Insert a saved phrase","annot.stampTool":"Stamps","fx.combo":"🔥 {n}x COMBO","fx.allClear":"All Clear!","fx.vibeWarp":"DOPAMINE ON!","fx.sfx.fastTrack":"BAM!","fx.sfx.approve":"SNAP!","fx.sfx.stamp":"THWACK!","fx.sfx.launch":"GO!","fx.sfx.vibeWarp":"WARP!","fx.sfx.allClear":"BOOM!","fx.sfx.toggle":"CLICK!","fx.sfx.tick":"TICK!","fx.sfx.tapImpact":"POP!","fx.sfx.send":"ZIP!","settings.diagRunning":"Diagnosing…","settings.diagRun":"Run PWA diagnostics","settings.installPromptAccepted":"Install started","settings.installPromptCancelled":"Cancelled","settings.installApp":"Install as an app","settings.refresh":"Refresh","settings.refreshAria":"Refresh status","settings.recentSessions":"Recent sessions","settings.none":"None","settings.repos":"Repositories ({count})","settings.rescan":"Rescan","settings.rescanned":"Rescanned","settings.manual":"manual","settings.repoLine":"{path} · {source} · {count} boards","settings.hide":"Hide","settings.hidden":"Removed from the list","settings.reposEmpty":"Nothing found (add one below)","settings.scanDirs":"Auto-scan folders (one level deep)","settings.removed":"Removed","settings.delete":"Delete","settings.scanDirsEmpty":"Not set (add one below)","settings.scanDirPlaceholder":"Scan folder (e.g. ~/Projects)","settings.addScanDir":"Add scan folder","settings.scanDirAdded":"Scan folder added","settings.repoPathPlaceholder":"Repository path (e.g. ~/work/my-repo)","settings.addRepo":"Add repository","settings.repoAdded":"Repository added","settings.logs":"Logs","settings.sections":"Settings sections","settings.secAppearance":"Appearance & device","settings.secPairing":"Pairing","settings.secSnippets":"Snippets","settings.secRepos":"Repositories","settings.secAudit":"Audit & logs","settings.secStatus":"Status & diagnostics","settings.audit":"Audit log (emergency ops, device)","settings.auditFailed":"failed","settings.auditEmpty":"Nothing yet","settings.auditShowMore":"▼ Show {count} more audit entries","settings.auditCollapse":"▲ Collapse older entries","settings.customSnippets":"My snippets ({count}/{max})","settings.bar":"bar","settings.snippetsEmpty":"Nothing yet (add one below)","settings.snippetNamePlaceholder":"Name (e.g. Meeting notes)","settings.snippetTextPlaceholder":"Text inserted into the composer (the marker selects it)","settings.showInBar":"Also show in the chat bar","settings.saving":"Saving…","settings.addAndSave":"Add and save","settings.saved":"Saved","settings.needNameAndText":"Enter a name and text","settings.snippetLimit":"You can have up to {max} custom snippets","settings.snippets":"Snippets","settings.snippetChat":"Chat","settings.snippetTerm":"Terminal","settings.snippetBuiltin":"Built-in","settings.snippetHot":"Hot","settings.snippetHide":"Hide","settings.snippetShow":"Show","settings.snippetHiddenPill":"hidden","settings.snippetReset":"Reset to defaults","settings.snippetResetDone":"Snippets reset to defaults","settings.snippetAddTitle":"Add a snippet","settings.snippetAdd":"Add","settings.snippetEditTitle":"Edit snippet","settings.snippetEdit":"Edit","settings.snippetSave":"Save","settings.snippetCancel":"Cancel","settings.snippetRun":"Run on long-press","settings.snippetCommandPlaceholder":"Command (e.g. hermes gateway status)","settings.snippetHint":"Built-in chips can be pinned to the bar or hidden. Your own snippets appear in both the sheet and the bar.","settings.about":"Hermes Pilot v{version} · the existing dashboard (9119) is untouched. Token:","common.ok":"OK","common.cancel":"Cancel","common.save":"Save","common.close":"Close","common.retry":"Retry","common.loading":"Loading…","common.none":"None","common.refresh":"Refresh","common.delete":"Delete","common.add":"Add","common.unknown":"Unknown","common.refreshing":"Updating…","common.refreshed":"Updated","close.title":"Clear this waiting review","close.menuClose":"Close the cleanup menu","close.help":"Removes it from the list. A reason in the field above is kept in the record. Press and hold to confirm.","close.doneLabel":"Mark done","close.doneSub":"done — record the result and drop it from the list","close.cancelLabel":"Cancel (archive)","close.cancelSub":"Remove from the list — history stays on the board","close.alreadyDone":"Already done","close.done":"Marked as done","close.alreadyCancelled":"Already cancelled","close.cancelled":"Cancelled (archived)","usage.title":"Usage ({hours}h)","usage.failed":"Could not load usage","usage.cost":"Cost","usage.input":"Input","usage.output":"Output","usage.cacheRead":"Cache read","usage.apiCalls":"API calls","usage.sessions":"Sessions","usage.sessionSummary":"{sessions} sessions · {messages} msg · tool {tools}","usage.byModel":"By model","usage.byModelNote":"Aggregated from API call records. Can differ slightly from session estimates.","usage.modelLine":"in {input} · out {output} · cache {cache} · {calls} calls","usage.sessionLine":"{source}{profile} · in {input} · out {output} · {at}","usage.none":"No records","usage.topSessions":"Top sessions by cost","usage.footnote":"Read-only aggregation of sessions / session_model_usage in ~/.hermes/state.db (30s cache). The cache rate is the share of cache reads in input + cache read.","err.AUTH_REQUIRED":"Sign-in required","err.BAD_REQUEST":"The request could not be processed","err.CONFLICT":"The state changed. Reload and try again","err.CONFIRM_MISMATCH":"Confirmation text does not match ({expected})","err.INTERNAL":"Internal error","err.NOT_FOUND":"Not found","err.NOT_WAITING":"Task is not waiting for review (status: {status})","err.NO_SESSION":"This task has no worker session","err.OFFLINE":"Cannot reach the bridge","err.QUERY_REQUIRED":"A query is required","err.RATE_LIMITED":"Too many requests. Wait a moment and retry","err.SESSION_REQUIRED":"session_id is required","err.UNKNOWN_ENDPOINT":"Unknown endpoint: {path}","err.REPO_PATH_REQUIRED":"A repository path is required","err.REPO_PATH_INVALID":"The repository path must be an absolute path","err.REPO_PATH_FORBIDDEN":"The home directory cannot be added as a repository","err.REPO_NOT_GIT":"Not a Git repository (.git is missing)","err.REPO_NOT_FOUND":"The repository is not registered","err.REPO_ID_REQUIRED":"A repository id is required","err.SCAN_DIRS_INVALID":"scanDirs must be an array","err.SCAN_DIR_NOT_ABSOLUTE":"Not an absolute path: {path}","err.SCAN_DIR_FORBIDDEN":"Cannot scan directly under the home directory. Specify a subdirectory","err.SCAN_DIR_NOT_DIRECTORY":"Not a directory: {path}","err.SCAN_DIR_MISSING":"Does not exist: {path}","err.BOARD_NAME_INVALID":"The board name contains characters that cannot be used","err.BOARD_NOT_FOUND":"Board {board} was not found","err.TASK_ID_INVALID":"The task id is invalid","err.TASK_ID_MISSING":"Could not get the task id","err.TASK_NOT_FOUND":"Task {id} was not found","err.TASK_STATE_LOCKED":"The task is not in a state that allows this action (status: {status})","err.TASK_TITLE_REQUIRED":"A title is required","err.TASK_TITLE_TOO_LONG":"The title must be {max} characters or fewer","err.COMMENT_REQUIRED":"A comment is required","err.COMMENT_FAILED":"Could not post the comment","err.ACTION_INVALID":"Unknown action: {action}","err.CLI_FAILED":"The Hermes command failed","err.HERMES_REJECTED":"Hermes rejected the operation (HTTP {status})","err.CREATE_FAILED":"Creating the task failed","err.UNKNOWN_TARGET":"Unknown target. Choose a registered repository","err.SPEC_PATH_REQUIRED":"A spec path is required","err.SPEC_PATH_NOT_RELATIVE":"The spec path must be relative to the repository","err.SPEC_PATH_OUTSIDE":"The spec path points outside the repository","err.SPEC_READ_FAILED":"Could not read the spec: {path}","err.SPEC_BATCH_HEADING_MISSING":"No batch heading (### Batch <ID>: <Title>) was found","err.SPEC_BATCH_NOT_FOUND":"The selected batch is not in the spec","err.SPEC_NOT_MARKDOWN":"Only Markdown (.md) specs can be previewed: {path}","err.NO_SHEET":"This task has no sheet","err.SHEET_MISSING":"Sheet not found","err.DATA_MISSING":"sheet.json is missing","err.REVIEW_ALREADY_ANSWERED":"The same answer is already saved","err.APPROVAL_ALREADY_RECORDED":"Approval is already recorded","err.NO_IMAGE":"This task has no base image","err.IMAGE_MISSING":"Base image not found","err.NO_COMPARE":"No previous image to compare against","err.NO_ANNOTATION":"No annotations yet","err.BAD_IMAGE":"image must be data:image/(png|jpeg);base64,…","err.TOO_LARGE":"The image is too large","err.THUMB_MISSING":"Illustration not found","err.BAD_THUMB":"The illustration path is invalid","err.BAD_PATH":"The path is invalid","err.OUTSIDE":"Only files under library / shots are served","err.BAD_EXT":"Not an image file","err.PROFILE_UNKNOWN":"Unknown profile: {profile}","err.HERMES_TOKEN_MISSING":"Could not get the Hermes session token (is the dashboard running?)","err.INVALID_RUNNER":"Only the Hermes Native runner is supported","err.INVALID_SEED":"A seed text is required","err.INVALID_BOARD":"The board name is invalid","err.INVALID_REPO":"The repository path is invalid","err.INVALID_JOB_ID":"A job id is required","err.JOB_NOT_FOUND":"The architect job was not found","err.WRITE_FAILED":"Could not write the output","err.MEMO_EMPTY":"Note text or checklist is required","err.MEMO_NOT_FOUND":"Note not found","repo.noBoard":"No boards","repo.boardMore":" +{rest} more","repo.boardCount":"{count} boards: {names}{tail}","install.swUnsupported":"unsupported","install.swControlled":"controlling","install.swWaiting":"not controlling (reload to activate)","socket.notConnected":"Not connected (reconnecting)","socket.disconnected":"Connection lost (reconnecting)","term.title":"Terminal","term.snippets":"Snippets","term.snippetsTitle":"Terminal snippets","term.connected":"── connected ──","term.notConnected":"Terminal is not connected. Switch tabs to reconnect.","term.insertOnly":"This command is insert-only","term.ran":"Ran: {label}","term.inserted":"Inserted: {label}","term.hint":"Tap to insert / long-press to run. Login shell (full shell); actions are written to the audit log.","term.bar":"bar","term.run":"Run","term.sheetNote":"Tap inserts into the prompt (no Enter). Long-press, or the Run button on the right, also sends Enter. Restart commands run in their own process (ai.hermes.hermes-mobile), so this screen stays connected.","term.state.connecting":"connecting","term.state.open":"connected","term.state.closed":"closed","term.state.error":"error","search.title":"Search (all sessions)","search.placeholder":"e.g. drain / PWA / kanban","search.searching":"Searching…","search.resultCount":"{count} hits · {ms}ms","search.hint":"Type 2 or more characters to narrow down","search.emptySnippet":"(empty)","search.you":"You","search.none":"No matches","search.note":"Covers Discord, CLI and kanban messages (read-only from ~/.hermes/state.db). Tap a row to open that conversation.","live.title":"Live (updates every 5s)","live.turns":"Running turns","live.tasks":"Running tasks","live.turn":"Turns","live.task":"Tasks","live.noTurns":"No turns running","live.noTasks":"No tasks running","live.lastTool":"Last tool {time}","live.lease":"lease {time} left","live.openInDiscord":"Open in Discord","live.abortReason":"Aborted from mobile","live.aborted":"Aborted: {id}","live.abortAll":"Abort {count} running tasks","live.abortAllSub":"long-press · reclaim → block","live.note":"Combines state.db turn leases with kanban running tasks (read-only). Abort a turn with the chat stop button; abort tasks with the long-press above.","live.architect":"Architect (spec)","live.architectShort":"Spec","live.architectNone":"No spec job is running","live.architectStalled":"⚠️ No progress for 3+ minutes","live.architectQuickReview":"🔍 Quick review","live.architectOpenTask":"📋 Task","live.architectDismiss":"✕ End","live.architectDismissed":"Ended the spec job: {id}","live.architectPhaseSpawning":"Starting","live.architectPhaseRound1Sheet":"Round 1 sheet","live.architectPhaseAwaitingReview":"Waiting for review","live.architectPhaseRound2Spec":"Round 2 SPEC","live.architectPhaseSpecReady":"SPEC ready","live.architectPhaseLaunched":"Launched","live.architectPhaseFailed":"Failed","inbox.kind.needsInput":"Needs input","inbox.kind.dependency":"Waiting on dependency","inbox.kind.failure":"Failed","inbox.kind.untyped":"Stopped","inbox.needComment":"Write a comment first","inbox.commented":"Comment added","inbox.reopened":"Reopened: {id}","inbox.title":"Waiting for you (unanswered {pending})","inbox.titleWithAnswered":"Waiting for you (unanswered {pending} / answered {answered})","inbox.recurrences":"recurrence {n}","inbox.answeredWaiting":"answered (waiting to resume)","inbox.lastComment":"Previous comment ({author} · {at})","inbox.placeholderAnswered":"Add more instructions (recorded as a comment)","inbox.placeholder":"Write an answer or instruction (recorded as a comment)","inbox.sending":"Sending…","inbox.sendComment":"Send as comment","inbox.answerResume":"Answer and resume (ready)","inbox.resume":"Resume (ready)","inbox.failed":"Could not load","inbox.empty":"Nothing waiting for you","inbox.focused":"Showing the task opened from the widget first","inbox.allAnswered":"Nothing unanswered ({n} answered)","inbox.hideAnswered":"Hide answered","inbox.showAnswered":"Show {n} answered","inbox.note":"Comments are recorded with hermes kanban comment. Items you no longer need can be removed with Clear (done / cancel) — either way the history stays on the board. Refreshes every 15s.","capture.title":"New task","capture.needTitle":"Enter a title","capture.needBoard":"Choose a board","capture.boardAria":"Change the board this task is filed on","capture.board":"Board","capture.boardPick":"tap to change","capture.failed":"Could not create the task","capture.created":"Created: {id}","capture.already":"Already created: {id}","capture.placeholder":"What needs doing? (one line)","capture.voiceHint":"Dictate with your keyboard's mic (press and hold to start).","capture.moreClose":"Hide details","capture.moreOpen":"Details (body, priority, assignee)","capture.bodyPlaceholder":"Body (optional)","capture.priorityNone":"Priority: none","capture.priorityLow":"Low","capture.priorityMid":"Medium","capture.priorityHigh":"High","capture.assigneePlaceholder":"Assignee (optional · profile name)","capture.submitting":"Creating…","capture.submit":"Create task","capture.note":"Runs `hermes kanban create` (never writes the DB directly). Repeated taps with the same content collapse into one task for 10 minutes. Dictate with your keyboard's mic.","annot.tool.pen":"Pen","annot.tool.arrow":"Arrow","annot.tool.rect":"Box","annot.undo":"↩ Undo","annot.loadFailed":"Could not load the base image","annot.needMarks":"Add some red first (pen, arrow, box)","annot.duplicate":"The same annotation is already saved","annot.sent":"Annotation sent","annot.sendFailed":"Could not send (the image may be too large)","annot.instruction":"Mark it in red, then Send","annot.sending":"Sending…","annot.submit":"Send","annot.notePlaceholder":"Note (optional)","annot.compareAfter":"🔀 After (latest)","annot.compareBefore":"🔀 Before (previous red pen)","annot.compareAria":"Switch between the before and after image","annot.looksGood":"✅ Looks Good (Mark Done)","annot.doneShort":"✅ Done","annot.archiveShort":"📂 Archive","annot.holdHint":"hold","annot.stampsMore":"Open the full list of stamps","annot.stampSheetTitle":"🏷️ Instruction stamps","annot.stampsHint":"A stamp attaches to the last red mark. With no mark yet, a box is placed in the middle.","annot.approved":"Visual check passed — marked done","annot.approvedResume":"Visual check passed — the worker resumes","annot.approveFailed":"Could not mark it as done","annot.stampsTitle":"🏷️ 1-Tap stamps","annot.stampsAria":"Attach a fix instruction to the last mark without typing","annot.stamp.overlap":"Overlap","annot.stamp.spacing":"Spacing","annot.stamp.overflow":"Overflow","annot.stamp.contrast":"Contrast","annot.stamp.shift_up":"Shift Up","annot.stamp.remove":"Remove","diag.manifestLink":"manifest link","diag.linkMissing":"no link tag","diag.manifestFetch":"fetch manifest","diag.manifestJson":"manifest JSON","diag.entries":"{count} entries","diag.none":"none","diag.idUnset":"(unset = same as start_url)","diag.startInScope":"start_url inside scope","diag.idSameOrigin":"id is same-origin","diag.iconCount":"icons count","diag.iconCountValue":"{count} icons","diag.iconLine":"{w}x{h} {bytes}B {purpose} (declared {declared})","diag.any192":"any icon 192px or larger","diag.any512":"any icon 512px or larger","diag.maskable":"maskable icon","diag.present":"present","diag.missingInstall":"missing → cannot install","diag.maskableMissing":"missing (causes the white border)","diag.swControl":"Service Worker controlling","diag.swNone":"not controlling","diag.swCovering":"SW covering scope","diag.viewMode":"Current display mode","diag.unknown":"(unknown)","diag.empty":"(none)","diag.decodeError":"cannot decode","app.tabError":"Something went wrong in this tab","app.tabErrorLog":"The report is written to ~/.hermes/plugin-data/hermes-pilot/client-errors.log","app.reviewDone":"Review done","app.reviewDoneLabel":"Review done: {label}","app.loginPrompt":"Enter the app token","app.loginButton":"Sign in","app.loginHint":"The token is in ~/.hermes/plugin-data/hermes-pilot/token (0600).","app.search":"Search","app.connected":"Connected","app.disconnected":"Cannot connect","app.bridgeOffline":"Cannot reach the bridge","app.termLoading":"Loading the terminal…","app.navWaiting":"{label} ({n} waiting for review)","app.navApproval":"{label} ({n} waiting for approval)","app.navDone":"{label} (completion report)","app.navReflecting":"{label} (reflecting)","app.navRunning":"{label} (running)","tasks.status.running":"Running","tasks.status.ready":"Queued","tasks.status.done":"Done","tasks.status.blocked":"Blocked","tasks.status.failed":"Failed","tasks.status.archived":"Archived","tasks.status.todo":"To do","tasks.abortReason":"Aborted from mobile","tasks.aborted":"Aborted (reclaim={reclaim} / block={block})","tasks.actionRan":"{action} executed","tasks.pausedDone":"Paused (new work only)","tasks.resumed":"Resumed","tasks.pausedBanner":"Paused (new work is not being accepted{reason})","tasks.resume":"Resume","tasks.inboxBar":"Waiting for approval: {n}","tasks.inboxBarGo":"Answer ›","tasks.bridge":"Bridge","tasks.ok":"OK","tasks.disconnected":"Offline","tasks.usageAria":"Usage breakdown","tasks.memory":"Memory","tasks.disk":"Disk","tasks.liveAria":"What is running now","tasks.runningLabel":"Live","tasks.turnTitle":"{n} turns","tasks.boardOpenAria":"Open the board list","tasks.boardList":"Board list","tasks.board":"Board","tasks.boardRunning":"running {n}","tasks.boardBlocked":"blocked {n}","tasks.boardArchived":"archived","tasks.boardCount":"{n} boards","tasks.tasks":"Tasks","tasks.newTask":"+ New","tasks.empty":"No tasks","tasks.selectPlaceholder":"Select a task","tasks.selectHint":"Details, events and the diff show up here.","review.selectPlaceholder":"Select a review","review.selectHint":"The sheet or the annotation editor shows up here.","tasks.elapsedMin":"{n} min","tasks.failures":"failed {n}","tasks.noMessage":"(no message)","tasks.uncommitted":"uncommitted","tasks.openInDiscord":"Open in Discord","tasks.emergency":"Emergency","tasks.emergencyTitle":"Emergency actions (hold to run)","tasks.emergencyNote":"{n} running. restart waits for running turns to finish first (up to 30 min).","tasks.pausedNow":"Paused since {at}. Running turns have finished.","tasks.unknownTime":"an unknown time","tasks.pauseHelp":"Pause stops only new work. Running turns finish, and resuming is one tap.","tasks.resumeEstop":"Resume (clear ESTOP)","tasks.pauseLabel":"Pause (new work only)","tasks.pauseSub":"hold · hermes pause","tasks.drainLabel":"Stop accepting work","tasks.drainSub":"drain (running turns finish)","tasks.restartLabel":"Restart the gateway","tasks.restartSub":"restart (the bot drops for a few seconds)","tasks.stopLabel":"Force stop","tasks.stopSub":"stop (kills running turns too)","tasks.startLabel":"Accept work again","tasks.startSub":"start (accept new work)","tasks.auditNote":"The result is recorded in the audit log on the Settings tab.","tasks.detailLoading":"Loading details…","tasks.status":"Status","tasks.started":"Started","tasks.branch":"Branch","tasks.commit":"Commit","tasks.message":"Message","tasks.changedFiles":"Changed files","tasks.noDiff":"No diff","tasks.diffLimit":"(showing up to 100 files)","tasks.dirtyNote":"There are uncommitted changes (only committed work is shown)","tasks.openThread":"Open in the Discord thread","tasks.abortTask":"Abort this task","tasks.abortSub":"reclaim → block (stops re-runs)","tasks.events":"Events","tasks.noEvents":"No events","tasks.heartbeatCount":"heartbeat ×{n}","tasks.heartbeatRange":"({first} – {last})","settings.pairing":"Pair a device","settings.pairingHint":"Show a QR code for a second phone or tablet. Opening it signs that device in, so the long token never has to be typed.","settings.showPairingQr":"Show Pairing QR","settings.pairingLoading":"Loading…","settings.pairingTitle":"Pairing QR","settings.pairingScanHint":"Scan this with the camera of the device you want to pair.","settings.pairingEmpty":"No reachable address was found. Connect Tailscale or join the same LAN, then reopen this sheet.","settings.pairingCopy":"Copy","settings.pairingCopied":"URL copied","settings.pairingNote":"The QR embeds the app token. Anyone who scans it can control this Hermes — do not share screenshots of it.","app.gwOkAria":"Gateway is healthy. Tap to re-check.","app.gwDownAria":"Gateway is not reachable. Tap to retry.","app.gwError":"error","app.jumpWaitingAria":"Jump to the first of {n} items waiting for you","app.jumpRunningAria":"Show what the {n} running workers are doing","app.cacheAria":"Cache hit rate {pct}% — open the usage breakdown","tasks.specLaunchpad":"Spec Launchpad","tasks.specBarAria":"Open the batch launcher for {name}","tasks.specBatchCount":"{n} batches","tasks.specSheetTitle":"Launch batches","tasks.specAlready":"filed","tasks.specFiledDone":"done","tasks.specLaunchBtn":"File {n} batches and start","tasks.specLaunching":"Filing…","tasks.specLaunched":"Filed {created} (skipped {skipped})","tasks.pipelineSummary":"Latest pipeline run","tasks.discussReport":"💬 Discuss next steps in chat","tasks.pipelineDismiss":"Dismiss","tasks.specNote":"Each batch becomes a kanban task titled [ID] Title with the spec path, target and Verify criteria. Batches already filed on this board are skipped.","tasks.modeZeroStop":"⚡ Zero-Stop","tasks.modeFastTrack":"⚡ Fast-Track","tasks.modeVisualGate":"🖊 Visual Gate","tasks.specUpdated":"updated {when}","tasks.specAllDone":"All batches done","tasks.specHistoryTitle":"Batch history","tasks.specHistoryAria":"Open the finished batch history for {name}","tasks.specHistoryNote":"Filed tasks stay on the board. This history shows which batch finished and when.","tasks.specOpenLaunch":"Open the batch launcher","tasks.specNotFiled":"not filed","tasks.specDoneBadge":"done","tasks.specNowAria":"Switch spec (current: {name})","tasks.specCountOf":"{n} total","tasks.specDetailToggle":"Spec / Verify","tasks.specObjective":"Objective","tasks.specResult":"Result","tasks.specOpenTask":"Open task details and diff","tasks.specSection":"Acceptance criteria (excerpt)","tasks.specStartedAt":"started {when}","tasks.specMdPreview":"Preview spec (MD)","tasks.specBatchesHead":"Batches ({n})","tasks.specMdTitle":"Spec document","tasks.specMdLoading":"Loading the spec…","tasks.specMdFailed":"Could not load the spec","tasks.specMdTruncated":"Too long — showing the first 256 KB only","tasks.specMdCopy":"📋 Copy text","tasks.specMdCopied":"✅ Copied","tasks.specMdCopyCode":"Copy","tasks.specMdBack":"Back","chat.reportNoSession":"No chat linked (opens the matching workspace)","receipt.title":"Completion receipt","receipt.open":"🏆 Completion receipt","receipt.create":"🏆 Create completion receipt","receipt.loading":"Building the receipt…","receipt.failed":"Could not build the receipt","receipt.partial":"Some sources are unavailable: {sources}","receipt.savePng":"📸 Save PNG","receipt.saving":"Rendering…","receipt.copyShare":"📋 Copy share text","receipt.copied":"Share text copied","receipt.copyFailed":"Could not copy the text","receipt.shareNote":"1200×630 PNG · share text is ready for X","receipt.savedNote":"Estimated savings are derived from the cache discount (about {pct}%) already applied to the cost above.","receipt.kpi.cost":"Cost","receipt.kpi.cache":"Cache hit","receipt.kpi.saved":"Estimated savings","receipt.kpi.zeroTyping":"Zero-typing","receipt.kpi.tests":"Tests passed","receipt.kpi.duration":"Duration","receipt.kpi.savedNote":"≈{pct}% cache discount (est.)","receipt.kpi.durationNote":"no completions in the last {hours}h","receipt.kpi.testsNote":"no test count found","receipt.kpi.zeroTypingNote":"taps vs. typed chars","receipt.kpi.apiCalls":"API calls","receipt.kpi.totalTokens":"Tokens","receipt.kpi.apiCallsNote":"no API call records","receipt.kpi.apiCallsScope":"spec-scoped sessions","receipt.kpi.totalTokensNote":"no token records","receipt.kpi.totalTokensScope":"input + output + cache","receipt.kpi.wallNote":"wall {wall}","receipt.scope.usage":"Spec scope: {sessions} sessions · {tasks} tasks","receipt.scope.fallback":"no session id — summed by the run time window","receipt.value.calls":"{n} calls","receipt.value.na":"—","receipt.value.min":"{min} min","receipt.value.hours":"{h}h {m}m","receipt.value.over":"{h}h+","receipt.badge.audit":"AUDIT","receipt.canvas.titleDopamine":"AUTONOMOUS EXECUTION","receipt.canvas.titleSerotonin":"AUTONOMOUS EXECUTION SUMMARY","receipt.canvas.window":"last {hours}h","receipt.canvas.batches":"{batches} tasks done","receipt.canvas.footer":"hermes-pilot · A2B pipeline · zero-typing cockpit","receipt.canvas.size":"1200×630","receipt.share.title":"Autonomous execution summary","receipt.share.batches":"{batches} tasks done ({done}/{total})","receipt.share.testsSuffix":"tests","receipt.share.cacheSuffix":"cache hit","receipt.share.savedSuffix":"saved (est.)","receipt.share.tapsSuffix":"taps","receipt.share.redlinesSuffix":"redlines","receipt.share.typedSuffix":"typed chars","receipt.share.zeroSuffix":"zero-typing","receipt.share.wall":"wall {wall}","receipt.share.tokensSuffix":"tokens","receipt.share.footer":"— Hermes Pilot · A2B pipeline","demo.badge":"Interactive demo","demo.barAria":"Demo controls","demo.viewAria":"Device frame","demo.envAria":"Demo environment","demo.view.phone":"Phone 390×844","demo.view.tablet":"Tablet 820×1180","demo.view.full":"Full window","demo.vibe.dopamine":"Dopamine","demo.vibe.serotonin":"Serotonin","demo.sound.on":"Sound on","demo.sound.off":"Sound off","demo.theme.dark":"Dark","demo.theme.light":"Light","demo.restart":"Restart tour","demo.bannerAria":"Guided tour","demo.stepOf":"Step {n}/{total}","demo.takeMe":"Take me","demo.steps.1.title":"Architect review","demo.steps.1.hint":"Open Review and tap “Accept All Recommended” on the decision sheet.","demo.steps.2.title":"A2B batch launch","demo.steps.2.hint":"On Tasks, tap “File batches & start” for the generated spec.","demo.steps.3.title":"Visual gate","demo.steps.3.hint":"Compare Before ↔ After, then stamp a redline or tap “Looks Good”.","demo.steps.4.title":"Summary & receipt","demo.steps.4.hint":"Open the completion summary on Tasks and share the receipt.","seed.title":"Spec Seed","seed.lead":"One line is enough. The Architect turns it into a 1-tap design interview, then into a spec.","seed.placeholder":"What should we spec out?","seed.voiceHint":"Dictate with your keyboard's mic — the input is focused for you.","seed.policy":"Execution policy","seed.policyAria":"Choose how the spec's batches run","seed.policyDefault":"default","seed.policyZeroStop":"Zero-stop","seed.policyVisualGate":"Visual-gate","seed.policyZeroStopHint":"Every batch runs autonomously to the end, without waiting for approval.","seed.policyVisualGateHint":"Pauses at checkpoints for a live visual check before moving on.","seed.tpl.feature":"New feature","seed.tpl.featureText":"Spec out a new feature: ","seed.tpl.ux":"UI/UX polish","seed.tpl.uxText":"Spec out a UI/UX improvement: ","seed.tpl.bug":"Bug fix / stability","seed.tpl.bugText":"Spec out a bug fix and stability work: ","seed.autoStart":"File the batches automatically after approval and start running","seed.autoStartHint":"Off keeps the safe hybrid: you tap once when the spec is ready.","seed.runner":"Runner","seed.runnerHermes":"Hermes Native","seed.submit":"Start the interview","seed.submitting":"Starting…","seed.toast":"The interview sheet will reach Review shortly.","seed.failed":"Could not start the interview","seed.openAria":"Start a spec interview from a one-line note","seed.statusRunning":"Architect is working…","seed.statusAwaiting":"Writing the spec…","seed.statusReady":"Spec ready","seed.statusLaunched":"Batches filed — running","seed.statusFailed":"Architect stopped","seed.statusUnknown":"Unknown state","seed.statusAwaitingReview":"The interview sheet reached Review","seed.statusQueued":"Queued — waiting to start","seed.queueQueued":"Queued","seed.queueRunning":"Running","seed.jobAria":"Architect job status","seed.jobTask":"Task {id}","seed.jobDismiss":"Hide this status","seed.openReview":"Open Review","seed.inspect":"Progress details","seed.inspectAria":"Open the Architect job's progress details","seed.phaseAria":"Current phase","seed.phaseSpawning":"Starting…","seed.phaseRound1Sheet":"Writing the Round 1 sheet","seed.phaseRound2Spec":"Writing the spec (Round 2)","seed.sheetLabel":"Sheet {name}","seed.stalled":"⚠️ No progress for 3 minutes (the agent may be stopped or waiting)","seed.retryHermes":"Retry with Hermes Native","seed.retrying":"Retrying…","seed.retried":"Retrying the Architect with Hermes Native.","seed.retryFailed":"Could not retry the Architect","seed.elapsed":"{m}m {s}s","seed.elapsedHour":"{h}h {m}m","seed.elapsedWaiting":"queued {m}m {s}s","seed.elapsedWaitingHour":"queued {h}h {m}m","seed.bannerTitle":"The spec is ready — file {n} batches and start","seed.bannerPending":"{n} batches of this spec are not filed yet","seed.bannerAction":"File batches & start","seed.bannerPreview":"Read the spec","seed.bannerLater":"Later","seed.bannerFiled":"Filed {n} batches","seed.bannerAria":"Spec ready to file","settings.secPipeline":"Pipeline & Architect","settings.pipelineLead":"Two safe A2B routes, one tap each: drop a docs/SPEC-*.md in your own terminal, or build the spec from the phone with Hermes Native.","settings.pipelineRunner":"Architect runner","settings.pipelineRunnerHint":"Hermes Native only — no external AI CLI is spawned. Specs arrive as files or from the Spec Seed sheet.","settings.pipelineOptimize":"Optimize SOUL.md & skills now","settings.pipelineOptimizing":"Optimizing…","settings.pipelineOptimized":"Applied","settings.pipelineUnavailable":"The pipeline API is unavailable on this bridge","settings.pipelineSoul":"SOUL.md","settings.pipelineSkills":"Skills","settings.pipelineApplied":"applied","settings.pipelineMissing":"not applied","settings.pipelineJobs":"Architect jobs","settings.pipelinePending":"Unfiled specs","tasks.pipelineCollapse":"Collapse","notes.title":"Notes & Triage","notes.subtitle":"Sparks, checklists & scheduled reports","notes.searchPlaceholder":"Search notes, tags, reports…","notes.quickPlaceholder":"Jot down a quick idea…","notes.newBtn":"+ New note","notes.filterAll":"All","notes.filterPinned":"📌 Pinned","notes.filterReports":"📬 Reports","notes.inboxHead":"Scheduled & pipeline reports ({n})","notes.inboxSave":"Save to notes","notes.inboxSaved":"Saved to notes","notes.empty":"No matching notes yet.","notes.editTitle":"Edit note","notes.createTitle":"New note","notes.fieldTitle":"Title","notes.fieldTitlePh":"Short title…","notes.fieldBody":"Note","notes.fieldBodyPh":"Write thoughts, context, or paste…","notes.fieldTags":"Tags (comma separated)","notes.fieldTagsPh":"idea, ux, refactor","notes.fieldChecklist":"Checklist","notes.addChecklistPh":"Add checklist item…","notes.addChecklistBtn":"Add","notes.colorLabel":"Card color","notes.pin":"Pin","notes.unpin":"Unpin","notes.save":"Save","notes.delete":"Delete","notes.unsavedTitle":"You have unsaved changes","notes.unsavedSub":"What should happen before closing?","notes.saveAndClose":"Save","notes.discard":"Discard","notes.keepEditing":"Back","notes.saved":"Note saved","notes.deleted":"Note deleted","notes.brainstorm":"🧠 Brainstorm","notes.toSeed":"📝 Spec Seed","notes.openChat":"💬 Source chat","notes.sourceMeta":"From {meta}","notes.more":"⋯ More actions","notes.menuTitle":"Note actions","notes.viewOne":"One column","notes.viewTwo":"Two columns","notes.viewList":"List","notes.viewGroupAria":"Change layout","notes.moreItems":"{n} more","chat.bubbleMenuAria":"Message actions","chat.bubbleMenuTitle":"Message actions","chat.bubbleCopy":"📋 Copy full text","chat.bubbleCopied":"Copied to clipboard","chat.bubbleSaveMemo":"💡 Save to Notes","chat.bubbleSavedMemo":"Saved to Notes","chat.bubbleContinueHead":"Continue in this chat","chat.bubbleSummarize":"📝 Summarize in 3 points","chat.bubbleSummarizePrompt":`Please summarize the message above into 3 concise bullet points:
46
+
47
+ > {quote}`,"chat.bubbleBrainstorm":"🧠 Expand & checklist","chat.bubbleBrainstormPrompt":`Expand on the message above with concrete ideas and organize them into an actionable checklist:
48
+
49
+ > {quote}`,"chat.bubbleDig":"🔍 Locate files & root cause","chat.bubbleDigPrompt":`Investigate the message above and identify the exact file paths, symbols, and root cause:
50
+
51
+ > {quote}`,"chat.bubbleQuote":"↩️ Quote into composer","chat.bubbleToSeed":"📝 Send to Spec Seed","brainstorm.title":"Brainstorm","brainstorm.lead":"Turn a single-line spark into structured ideas and save as a checklist in Notes.","brainstorm.placeholder":"One-line idea or problem to expand…","brainstorm.angles":"Angles","brainstorm.angleFeature":"✨ Features","brainstorm.angleUx":"🎨 UI / UX","brainstorm.angleEdge":"🛡 Risks & edge cases","brainstorm.generate":"✨ Expand into checklist","brainstorm.saveMemo":"💡 Save checklist to Notes","brainstorm.sendChat":"💬 Discuss in Chat","brainstorm.saved":"Checklist saved to Notes","brainstorm.tpl.feature1":"Define core value for: {topic}","brainstorm.tpl.feature2":"Narrow MVP flow down to 3 taps/steps","brainstorm.tpl.ux1":"Verify 390px mobile layout & Dark/Light contrast","brainstorm.tpl.ux2":"Align Dopamine / Serotonin feedback tiers","brainstorm.tpl.edge1":"Define empty, error, and offline fallbacks","brainstorm.tpl.edge2":"Check impact on existing data, tests, and i18n rules","refactor.title":"Refactor & Audit","refactor.lead":"Check alignment with project rules/concepts and clean up local duplication or bloat.","refactor.scope":"Focus area","refactor.scopeCss":"🎨 CSS / style deduplication","refactor.scopeCode":"🧹 Redundant logic & helpers","refactor.scopeRules":"📏 Concept, i18n & boundary audit","refactor.scopePerf":"⚡ Render & bundle performance","refactor.targetPh":"Optional target path or module (e.g. apps/web/src/styles.css)…","refactor.launch":"🛠 Start audit / refactor task","refactor.launched":"Refactor task filed","refactor.failed":"Could not file refactor task"},ok={"nav.tasks":"タスク","nav.review":"レビュー","nav.chat":"チャット","nav.notes":"メモ","nav.term":"ターミナル","nav.settings":"設定","status.gw":"GW","status.workers":"稼働 {n}","status.reviewWaiting":"判断待ち {n}","status.running":"実行中 {n}","status.offline":"オフライン","review.title":"レビュー","review.tab.waiting":"判断待ち","review.tab.active":"進行中","review.tab.done":"完了","review.newAnnotation":"+ 注釈","review.submitAnswer":"回答を送信","review.empty":"判断待ちはありません","review.round":"第{round}回","review.answeredAt":"{time} に回答","review.completedAt":"完了 {time}","review.doneEmpty":"完了はまだありません","review.doneRecent":"直近 {n} 件","review.status.review":"レビュー中","review.status.ready":"反映待ち","review.status.running":"生成中","review.status.blocked":"停止","review.status.done":"完了","review.ago.seconds":"{n}秒前","review.ago.minutes":"{n}分前","review.ago.hours":"{n}時間前","review.progress.reflecting":"反映中","review.progress.since":"(開始 {ago})","review.progress.beat":" ・ 心拍 {ago}","review.progress.ready":"反映待ち(worker の起動待ち)","review.progress.waiting":"レビュー待ち","review.progress.presented":" ・ 提示 {ago}","review.progress.done":"完了","review.questionsCount":"{n}問","review.workerProgress":"worker の進行","review.workerStatus":"({status})","review.workerSteps":" ・ {n} ステップ","review.workerEmpty":"まだ出力がありません","review.loadFailed":"取得できません","review.sendFailed":"送信できませんでした","review.sending":"送信中…","review.recommended":"推奨","review.fastTrack":"⚡ 推奨案({summary})で一括承認して再開","review.fastTrackHint":"推奨案をまとめて送信します(推奨の無い問はお任せ)。","review.fastTrackFailed":"一括承認に失敗しました","review.waitPill":"{i} / {n} 判断待ち","review.allClear":"🎉 All Clear — 全件の判断が完了し、ワーカーが自走中です","review.thumbZoomAria":"{head} の挿絵を拡大","review.thumbAlt":"{head} の挿絵","review.notePlaceholder":"補足(任意)","review.globalNo":"全","review.globalTitle":"全体へのレビュー(任意)","review.globalPlaceholder":"方針・優先度・気になる点を自由に","review.formHint":"未選択は推奨案で確定します。送信するとカンバンが ready に戻り、agent が反映します。","review.duplicate":"同じ回答が既に保存されています","review.receivedFromSheet":"シートから回答を受け取りました","review.sheetIframeTitle":"レビューシート","review.pasteSummary":"回答テキストを貼り付けて送る","review.pastePlaceholder":"【レビュー回答】… をそのまま貼り付け","review.submitPasted":"貼り付けた回答を送る","review.openSheet":"シート全体を開く ↗","review.reopenReasonDefault":"PWA から再確認を依頼","review.reopenFailed":"再確認依頼に失敗しました","review.reopened":"再確認(review)へ戻しました","review.answeredAtLabel":"回答 {time}","review.completedLabel":"完了 {time}","review.readonlyHint":"レビューを送れるのは「レビュー待ち」のシートだけです(このシートは{label})。","review.imageAlt":"{title} の画像","review.annotationMeta":"注釈 {n} ストローク","review.annotationNote":" ・ メモ: {note}","review.answersSummary":"レビュー回答(履歴)","review.delegated":"お任せ(既定の案で反映)","review.globalNote":"全体メモ: {text}","review.addAnnotation":"🖊 スクショに赤入れして追加指示","review.openOriginChat":"💬 起票元のチャットを開く","review.reopenSummary":"↩ 反映が不十分なとき(再確認を依頼)","review.reopenPlaceholder":"再確認したい理由・修正点(任意)","review.reopenSubmit":"review へ差し戻す","review.zoomAria":"注釈画像の拡大","review.zoomAlt":"{title} の拡大画像","review.imageLoadFailed":"画像を読み込めませんでした","review.listFailed":"一覧を取得できません","review.createFailed":"作成できませんでした","review.createdAnno":"注釈タスクを作りました({image})","review.importFailed":"取り込めませんでした","review.newAnnoTitle":"注釈の下地を選ぶ","review.sourceDevice":"画像を取り込む","review.sourceLibrary":"ライブラリから選ぶ","review.pickFromDevice":"端末の画像(ギャラリー / カメラ)","review.target":"対象","review.targetOption":"{label}({id})","review.onlyRepo":"{id} のみ","review.all":"すべて","review.librarySub":"library と直近のスクショ({n} 件)","review.repoEmpty":"このリポジトリの画像はまだありません(「すべて」から選べます)","review.libraryEmpty":"まだ画像がありません","review.newAnnoHint":"端末の画像は長辺1600px / JPEG 0.85 に縮小して送ります。チャットに貼った画像は agent が library/chat/ へ取り込んだものがここに出ます。","review.waitingSub":"{n} 件の判断待ち","review.noneWaiting":"判断待ちはありません","review.emptyNoSheets":"まだシートがありません。","review.emptyNoSheetsHint":"カンバン board mobile にタスクを作ると、agent がシートを生成します。","review.emptyBody":"次の仕様はチャットから投げてください。","review.emptyNewAnnotation":"+ 注釈を作る","review.emptyNote":"ライブラリの画像に赤を入れて送ることもできます","review.emptyMeta":"進行中 {active} 件 ・ 完了 {done} 件","review.noActive":"進行中はありません。","review.allDone":"全 {n} 件","review.showAllDone":"すべて表示(残り {n} 件)","review.showRecentOnly":"直近 {n} 件のみ表示","review.openSheetDirectly":"{error} — シートを直接開いてください","review.closeReasonLabel":"片付ける理由(任意・記録に残ります)","review.closeReasonPlaceholder":"例: 不要になった / 別の Issue で扱う","review.feedNotice":"レビュー: {text}","review.answerSent":"回答を送信しました","review.nextOpened":"{head} — 次の判断待ちを開きました","review.noneLeft":"{head} — 判断待ちは残っていません","review.sheetMissing":"sheet.json がありません","chat.working":"実行中…","chat.toolsRan":"🔧 ツール {count} 件を実行","chat.reviewWaitingTitle":"🖊 レビュー判断待ち","chat.openInReview":"レビューで回答 ↗","chat.jumpBottom":"↓ 最新へ","chat.jumpBottomWorking":"↓ Working・最新へ","chat.loadOlder":"↑ 過去の履歴を読み込む","chat.loadingOlder":"過去の履歴を読み込み中…","chat.empty":"まだメッセージはありません","chat.send":"送信","chat.attachFailed":"ファイルを添付できません: {message}","chat.copy":"コピー","chat.copied":"コードをコピーしました","chat.copyFailed":"コピーできませんでした","chat.copyUnsupported":"このブラウザはコピーに未対応です","chat.clipReadUnsupported":"このブラウザはクリップボード読み取りに未対応です","chat.clipNoImage":"クリップボードに画像がありません","chat.readFailed":"読み込みに失敗しました","chat.attachImageFailed":"画像を添付できません: {message}","chat.maxAttachments":"添付は1メッセージ6個までです","chat.tooLarge":"{name} は大きすぎます(上限 {mb}MB)","chat.fileFallback":"ファイル","chat.checkAttachments":"添付を確認して。","chat.attachmentsHeader":`
52
+
53
+ 添付ファイル:
54
+ `,"chat.attachInstruction":`
55
+ 必要なら読んでから答えて。`,"chat.sessionCreateFailed":"セッションを作成できませんでした","chat.sendFailed":"送信に失敗: {message}","chat.interrupted":"中断しました","chat.newChatWith":"{target} で新しい会話","chat.cannotOpen":"この会話は開けません","chat.openFailed":"開けませんでした: {message}","chat.resumeFailed":"セッションを復元できませんでした","chat.updateFailed":"更新できませんでした: {message}","chat.updateChatFailed":"会話を更新できませんでした","chat.boardCreateFailed":"ボードを作成できませんでした","chat.boardCreated":"ボード {slug} を作りました","chat.reconnected":"再接続しました","chat.previousChatFailed":"直前の会話を開けませんでした(もう一度お試しください)","chat.sessionsAria":"会話一覧(未読の完了報告 {n} 件)","chat.sessions":"会話一覧","chat.title":"チャット","chat.profileTitle":"この会話のプロファイル: {profile}","chat.repoTitle":"この会話のリポジトリ: {id}({path})","chat.repoTitleShort":"この会話のリポジトリ: {id}","chat.repoRowTitle":"{label}({path})","chat.discordAria":"Discord のスレッドを開く","chat.refreshChatAria":"会話を更新","chat.newChatAria":"新しい会話(プロファイルとリポジトリを選ぶ)","chat.recovering":"接続を回復しています…","chat.otherReport":"🖊 別の会話に完了報告: {label}","chat.open":"開く","chat.seen":"既読","chat.readonly":"読み取り専用","chat.readonlyProfileSuffix":" ・ {profile} プロファイルの会話(resume できないため記録を表示中)","chat.readonlyBoardSuffix":" ・ カンバンの作業ログはこのアプリから再開できません(ボードで操作)","chat.connecting":"接続中…","chat.loadingChat":"会話を読み込み中…","chat.sendToStart":"メッセージを送って開始","chat.recentAria":"直前に開いていた会話","chat.recentHead":"直前に開いていた会話","chat.reviewAndAnnotate":"確認・赤入れ ↗","chat.pipelineReport":"統合レポート","chat.reportDone":"完了","chat.reportHalted":"停止","chat.discussNextSteps":"💬 次の一手を相談","chat.openBoard":"📋 ボードを見る","chat.discussFallback":"上の統合レポートを要約して、次にやるべきことを提案して。","chat.attachedImage":"添付画像","chat.toolProgress":"ツール {n} 件","chat.lastTool":"直近: {name}","chat.thinking":"思考・ツール実行中","chat.reviewLabel":"🖊 レビュー判断待ち: {title}","chat.linkedWaiting":"あなたの回答待ちです。回答すると自律ワーカーが作業を再開します。","chat.workerRunning":"Working… 自律ワーカー稼働中","chat.workerQueued":"自律ワーカー起動待ち","chat.watchProgress":"進行を見る ↗","chat.jumpLatest":"↓ Working・最新へ","chat.jumpBottomPlain":"↓ 最下部へ","chat.removeAttachment":"添付を外す","chat.snippetListAria":"定型スニペット一覧","chat.readonlyComposer":"読み取り専用 ・ 再開するにはボードで操作してください","chat.attachAria":"画像・ファイルを添付","chat.composerPlaceholder":"Hermes に送る…","chat.interrupt":"中断","chat.sendAria":"送信","chat.attachSheetTitle":"添付","chat.pickImage":"画像を選ぶ","chat.pickImageSub":"ギャラリーから(PNG / JPEG / WebP / GIF)","chat.takePhoto":"カメラで撮る","chat.takePhotoSub":"その場で撮影して添付","chat.pickFile":"ファイルを選ぶ","chat.pickFileSub":"PDF・CSV・コードなど(セッションのワークスペースに置いて @file 参照を渡す)","chat.fromClipboard":"クリップボードから","chat.fromClipboardSub":"コピー中のスクショを貼る(許可ダイアログあり)","chat.attachNote":"1メッセージ 6 個まで。画像は長辺1600pxに縮小して送ります。入力欄へのペーストでも画像を取り込めます。","chat.snippetsTitle":"定型スニペット","chat.bar":"バー","chat.mine":"マイ","chat.snippetNote":"タップで入力欄に挿入(送信はしない)。バーのチップは長押しで即送信。","chat.snippetCustomNote":"マイスニペットは設定タブで追加できます。","chat.chooseBoard":"ボードを選ぶ","chat.createBoard":"ボードを作る","chat.allRepos":"すべてのリポジトリ","chat.newChat":"新しい会話","chat.defaultChip":"既定","chat.selectedChip":"選択","chat.usualWork":"普段の作業(Discord と同じプロファイル)","chat.thisDeviceDefault":"この端末の既定プロファイル","chat.profileSuffix":"{p} プロファイル","chat.repoSection":"リポジトリ(作業ディレクトリ)","chat.lastChip":"前回","chat.reposLoading":"リポジトリ一覧を取得中…(取れないときは「リポジトリを選ばない」で始められます)","chat.allReposRow":"すべてのリポジトリ","chat.reposHidden":"残り {n} 件(全 {total} 件)","chat.noRepo":"リポジトリを選ばない","chat.noRepoSub":"作業ディレクトリを決めずに始める","chat.pickProfileThenRepo":"プロファイルを選んでからリポジトリを押すと、その会話が始まります。","chat.boardBecomesDefault":"板があるリポジトリは、タスクタブと起票の既定ボードもその板に切り替わります。","chat.allReposSection":"すべてのリポジトリ({n} 件)","chat.repoBoards":"{repo} のボード","chat.currentBoard":" ・ 現在のボード","chat.boardPickNote":"押した板が起票の宛先になります(このリポジトリには板が {n} つあります)。","chat.noBoardsSection":"ボードがありません","chat.noBoardsBody":"{repo} にはボードがありません。ボードを作ると、この会話からの起票がその板に載ります。","chat.createBoardRow":"ボード {id} を作る","chat.creating":"作成中…","chat.dontCreate":"作らない","chat.dontCreateSub":"リポジトリの選択に戻る(板は増えません)","chat.drawerTitle":"会話","chat.drawerRefresh":"更新","chat.markAllRead":"すべて既読","chat.newChatRowSub":"プロファイルとリポジトリを選んで作る","chat.unreadReportTitle":"レビューの完了報告が届いています","chat.runningSuffix":" ・ 稼働中","chat.reportAria":"レビューの完了報告あり","chat.runningTitle":"いま実行中","chat.newReplyTitle":"前回見てから返信が増えています","chat.readonlyShort":"閲覧専用","chat.readonlyTitle":"読み取り専用(カンバン作業ログ等のため継続指示不可)","chat.resumableShort":"継続可","chat.resumableTitle":"この会話を開いて継続して指示を送れます","settings.language":"表示言語","settings.theme":"テーマ","settings.languageAuto":"自動","settings.languageEn":"English","settings.languageJa":"日本語","settings.themeDark":"ダーク","settings.themeLight":"ライト","settings.themeSystem":"端末に合わせる","settings.model":"モデル","settings.memory":"メモリ","settings.memoryValue":"{used} / {total}({percent}%)","settings.disk":"ディスク","settings.diskValue":"{free} 空き({percent}% 使用)","settings.bridge":"稼働状態","settings.bridgeOk":"正常({uptime}s)","settings.disconnected":"切断","settings.reviewWaiting":"判断待ち","settings.kanbanValue":"{waiting} 件 / 稼働 {running}","settings.lastChecked":"最終確認","settings.launchSource":"起動元","settings.standalone":"スタンドアロン","settings.browser":"ブラウザ","settings.installability":"インストール可否","settings.installPossible":"可能(ボタンで実行)","settings.installDone":"インストール済み","settings.installNo":"不可(要件未達)","settings.haptics":"タップ時の振動","settings.vibe":"Vibe モード","settings.vibeDopamine":"⚡ ドーパミン","settings.vibeSerotonin":"🧘 セロトニン","settings.vibeHint":"ドーパミンは承認・一括起票のたびにパーティクル・コンボ・効果音を出します。セロトニンは V4 と同じ落ち着いた外観のまま、タップの基本バイブは残します。","settings.vibeSwitched":"Vibe を {mode} に切り替えました","settings.sound":"効果音","settings.soundHint":"ドーパミンのときだけ鳴ります(Web Audio の合成音で、ダウンロードはありません)。","settings.bars":"表示する帯","settings.barChat":"チャットの定型チップ","settings.barAnnotation":"赤入れのスタンプ帯","settings.barTerm":"ターミナルの定型チップ","settings.barsHint":"使わない帯は隠せます。定型文とスタンプは、チャットの +・赤入れのツール列・ターミナルのヘッダから開けます。","chat.snippetsFromPlus":"定型文(スニペット)","chat.snippetsFromPlusSub":"保存した文面を差し込む","annot.stampTool":"スタンプ","fx.combo":"🔥 {n}連コンボ","fx.allClear":"全件完了!","fx.vibeWarp":"ドーパミン起動!","fx.sfx.fastTrack":"ドン!","fx.sfx.approve":"ビシッ!","fx.sfx.stamp":"バシッ!","fx.sfx.launch":"ゴゴゴ…","fx.sfx.vibeWarp":"ギュンッ!","fx.sfx.allClear":"ドドン!","fx.sfx.toggle":"カチッ","fx.sfx.tick":"ポチッ","fx.sfx.tapImpact":"ポン!","fx.sfx.send":"シュッ!","settings.diagRunning":"診断中…","settings.diagRun":"PWA 診断を実行","settings.installPromptAccepted":"インストールを開始しました","settings.installPromptCancelled":"キャンセルしました","settings.installApp":"アプリとしてインストール","settings.refresh":"再取得","settings.refreshAria":"状態を再取得","settings.recentSessions":"直近のセッション","settings.none":"なし","settings.repos":"リポジトリ({count})","settings.rescan":"再スキャン","settings.rescanned":"再スキャンしました","settings.manual":"手動","settings.repoLine":"{path} ・ {source} ・ ボード {count}","settings.hide":"非表示","settings.hidden":"一覧から外しました","settings.reposEmpty":"見つかりません(下の欄で追加)","settings.scanDirs":"自動スキャン先(直下 1 階層)","settings.removed":"外しました","settings.delete":"削除","settings.scanDirsEmpty":"未設定(下の欄で追加)","settings.scanDirPlaceholder":"走査先(例: ~/Projects)","settings.addScanDir":"走査先に追加","settings.scanDirAdded":"走査先を追加しました","settings.repoPathPlaceholder":"リポジトリのパス(例: ~/work/my-repo)","settings.addRepo":"リポジトリを追加","settings.repoAdded":"リポジトリを追加しました","settings.logs":"ログ","settings.sections":"設定のセクション","settings.secAppearance":"外観・操作","settings.secPairing":"ペアリング","settings.secSnippets":"スニペット","settings.secRepos":"リポジトリ","settings.secAudit":"監査&ログ","settings.secStatus":"システム状態・診断","settings.audit":"監査ログ(緊急操作・ターミナル)","settings.auditFailed":"失敗","settings.auditEmpty":"まだありません","settings.auditShowMore":"▼ 他 {count} 件の監査ログを表示","settings.auditCollapse":"▲ 9件目以降を折りたたむ","settings.customSnippets":"マイスニペット({count}/{max})","settings.bar":"バー","settings.snippetsEmpty":"まだありません(下の欄から追加)","settings.snippetNamePlaceholder":"名前(例: 議事録)","settings.snippetTextPlaceholder":"入力欄に挿入する文言({{ここ}} は選択状態で挿入)","settings.showInBar":"チャットのバーにも出す","settings.saving":"保存中…","settings.addAndSave":"追加して保存","settings.saved":"保存しました","settings.needNameAndText":"名前と文言を入れてください","settings.snippetLimit":"マイスニペットは{max}個までです","settings.snippets":"スニペット","settings.snippetChat":"チャット","settings.snippetTerm":"ターミナル","settings.snippetBuiltin":"組み込み","settings.snippetHot":"ピン留め","settings.snippetHide":"隠す","settings.snippetShow":"表示","settings.snippetHiddenPill":"非表示","settings.snippetReset":"既定に戻す","settings.snippetResetDone":"スニペットを既定に戻しました","settings.snippetAddTitle":"スニペットを追加","settings.snippetAdd":"追加","settings.snippetEditTitle":"スニペットを編集","settings.snippetEdit":"編集","settings.snippetSave":"保存","settings.snippetCancel":"やめる","settings.snippetRun":"長押しで実行を許可","settings.snippetCommandPlaceholder":"コマンド(例: hermes gateway status)","settings.snippetHint":"組み込みはバーへの固定・非表示を切り替えられます。マイスニペットはシートとバーの両方に出ます。","settings.about":"Hermes Pilot v{version} ・ 既存ダッシュボード(9119)は変更していません。トークンは","common.ok":"OK","common.cancel":"キャンセル","common.save":"保存","common.close":"閉じる","common.retry":"再試行","common.loading":"読み込み中…","common.none":"なし","common.refresh":"再読み込み","common.delete":"削除","common.add":"追加","common.unknown":"不明","common.refreshing":"更新中","common.refreshed":"更新済","close.title":"この判断待ちを片付ける","close.menuClose":"片付けメニューを閉じる","close.help":"一覧から外します。上の欄に理由を書いておくと記録に残ります。押しっぱなしで確定します。","close.doneLabel":"完了にする","close.doneSub":"done — 結果として記録して一覧から外す","close.cancelLabel":"取消(アーカイブ)","close.cancelSub":"一覧から消す — 履歴はボードに残る","close.alreadyDone":"すでに完了です","close.done":"完了にしました","close.alreadyCancelled":"すでに取消済みです","close.cancelled":"取消(アーカイブ)しました","usage.title":"使用量({hours}h)","usage.failed":"取得できませんでした","usage.cost":"コスト","usage.input":"入力","usage.output":"出力","usage.cacheRead":"キャッシュ読取","usage.apiCalls":"API呼び出し","usage.sessions":"セッション","usage.sessionSummary":"{sessions} 件 · {messages} msg · tool {tools}","usage.byModel":"モデル別","usage.byModelNote":"API呼び出し記録からの集計。セッションの見積りとは端数がずれることがあります。","usage.modelLine":"入力 {input} · 出力 {output} · キャッシュ {cache} · {calls} 回","usage.sessionLine":"{source}{profile} · 入力 {input} · 出力 {output} · {at}","usage.none":"記録なし","usage.topSessions":"コスト上位","usage.footnote":"~/.hermes/state.db の sessions / session_model_usage を読み取り専用で集計(30秒キャッシュ)。キャッシュ率は「入力+キャッシュ読取」に占めるキャッシュ読取の割合です。","err.AUTH_REQUIRED":"認証が必要です","err.BAD_REQUEST":"リクエストを処理できませんでした","err.CONFLICT":"状態が変わりました。再読み込みしてやり直してください","err.CONFIRM_MISMATCH":"確認語が一致しません({expected})","err.INTERNAL":"内部エラー","err.NOT_FOUND":"見つかりません","err.NOT_WAITING":"レビュー待ちではありません(現在: {status})","err.NO_SESSION":"このタスクに worker セッションがありません","err.OFFLINE":"ブリッジに接続できません","err.QUERY_REQUIRED":"検索語(q)が必要です","err.RATE_LIMITED":"操作が多すぎます。少し待ってから再試行してください","err.SESSION_REQUIRED":"session_id が必要です","err.UNKNOWN_ENDPOINT":"不明なエンドポイント: {path}","err.REPO_PATH_REQUIRED":"リポジトリのパスを入力してください","err.REPO_PATH_INVALID":"リポジトリのパスは絶対パスで指定してください","err.REPO_PATH_FORBIDDEN":"ホームディレクトリはリポジトリとして追加できません","err.REPO_NOT_GIT":"Git リポジトリではありません(.git がありません)","err.REPO_NOT_FOUND":"未登録のリポジトリです","err.REPO_ID_REQUIRED":"リポジトリの id が必要です","err.SCAN_DIRS_INVALID":"scanDirs は配列で指定してください","err.SCAN_DIR_NOT_ABSOLUTE":"絶対パスではありません: {path}","err.SCAN_DIR_FORBIDDEN":"ホームディレクトリ直下は走査できません(サブディレクトリを指定してください)","err.SCAN_DIR_NOT_DIRECTORY":"ディレクトリではありません: {path}","err.SCAN_DIR_MISSING":"存在しません: {path}","err.BOARD_NAME_INVALID":"ボード名に使えない文字が含まれています","err.BOARD_NOT_FOUND":"ボード {board} が見つかりません","err.TASK_ID_INVALID":"タスクIDが不正です","err.TASK_ID_MISSING":"タスクIDを取得できませんでした","err.TASK_NOT_FOUND":"タスク {id} が見つかりません","err.TASK_STATE_LOCKED":"この操作はできない状態です(現在: {status})","err.TASK_TITLE_REQUIRED":"タイトルを入力してください","err.TASK_TITLE_TOO_LONG":"タイトルは {max} 文字までです","err.COMMENT_REQUIRED":"コメントを入力してください","err.COMMENT_FAILED":"コメントを投稿できませんでした","err.ACTION_INVALID":"不明な操作です: {action}","err.CLI_FAILED":"Hermes のコマンドに失敗しました","err.HERMES_REJECTED":"Hermes が操作を拒否しました(HTTP {status})","err.CREATE_FAILED":"タスクの作成に失敗しました","err.UNKNOWN_TARGET":"対象が不明です。登録済みのリポジトリから選んでください","err.SPEC_PATH_REQUIRED":"spec のパスが必要です","err.SPEC_PATH_NOT_RELATIVE":"spec はリポジトリからの相対パスで指定してください","err.SPEC_PATH_OUTSIDE":"spec がリポジトリの外を指しています","err.SPEC_READ_FAILED":"spec を読めません: {path}","err.SPEC_BATCH_HEADING_MISSING":"バッチ見出し(### Batch <ID>: <Title>)が見つかりません","err.SPEC_BATCH_NOT_FOUND":"選択したバッチが spec にありません","err.SPEC_NOT_MARKDOWN":"プレビューできるのは Markdown(.md)の spec だけです: {path}","err.NO_SHEET":"このタスクにはシートがありません","err.SHEET_MISSING":"シートが見つかりません","err.DATA_MISSING":"sheet.json がありません","err.REVIEW_ALREADY_ANSWERED":"同じ回答が既に保存されています","err.APPROVAL_ALREADY_RECORDED":"検収は既に記録されています","err.NO_IMAGE":"このタスクには下地画像がありません","err.IMAGE_MISSING":"下地画像が見つかりません","err.NO_COMPARE":"比較できる前回の画像がありません","err.NO_ANNOTATION":"まだ注釈はありません","err.BAD_IMAGE":"image は data:image/(png|jpeg);base64,… の形式で送ってください","err.TOO_LARGE":"画像が大きすぎます","err.THUMB_MISSING":"挿絵が見つかりません","err.BAD_THUMB":"挿絵のパスが不正です","err.BAD_PATH":"パスが不正です","err.OUTSIDE":"library / shots 配下のみ配信します","err.BAD_EXT":"画像ファイルではありません","err.PROFILE_UNKNOWN":"不明なプロファイルです: {profile}","err.HERMES_TOKEN_MISSING":"Hermes のセッショントークンを取得できません(ダッシュボードは動作中ですか?)","err.INVALID_RUNNER":"ランナーは Hermes Native のみ対応しています","err.INVALID_SEED":"seed テキストが必要です","err.INVALID_BOARD":"ボード名が不正です","err.INVALID_REPO":"リポジトリのパスが不正です","err.INVALID_JOB_ID":"ジョブ ID が必要です","err.JOB_NOT_FOUND":"仕様策定ジョブが見つかりません","err.WRITE_FAILED":"出力を書き込めませんでした","err.MEMO_EMPTY":"メモ本文またはチェックリストが必要です","err.MEMO_NOT_FOUND":"メモが見つかりません","repo.noBoard":"ボードなし","repo.boardMore":" ほか {rest}","repo.boardCount":"ボード {count} つ: {names}{tail}","install.swUnsupported":"非対応","install.swControlled":"制御中","install.swWaiting":"未制御(再読込で有効化)","socket.notConnected":"未接続(再接続中)","socket.disconnected":"切断されました(再接続中)","term.title":"ターミナル","term.snippets":"定型","term.snippetsTitle":"ターミナルの定型コマンド","term.connected":"── 接続しました ──","term.notConnected":"ターミナルが未接続です。タブを切り替えて再接続してください","term.insertOnly":"このコマンドは挿入のみです","term.ran":"実行: {label}","term.inserted":"挿入: {label}","term.hint":"タップで挿入 / 長押しで実行。ログインシェル(フルシェル)、操作は監査ログに残ります。","term.bar":"バー","term.run":"実行","term.sheetNote":"タップで入力欄に挿入(Enter は送らない)。長押し、または右の「実行」で Enter まで送ります。再起動系はターミナル(ai.hermes.hermes-mobile)と別プロセスなので、この画面は切れません。","term.state.connecting":"接続中","term.state.open":"接続済","term.state.closed":"切断","term.state.error":"エラー","search.title":"検索(全セッション)","search.placeholder":"例: ドレイン / PWA / カンバン","search.searching":"検索中…","search.resultCount":"{count} 件 · {ms}ms","search.hint":"2文字以上で絞り込まれます","search.emptySnippet":"(空)","search.you":"あなた","search.none":"該当なし","search.note":"Discord・CLI・カンバンすべての発言が対象(~/.hermes/state.db を読み取り専用で参照)。行をタップするとその会話を開きます。","live.title":"ライブ(5秒更新)","live.turns":"実行中ターン","live.tasks":"実行中タスク","live.turn":"ターン","live.task":"タスク","live.noTurns":"動いているターンはありません","live.noTasks":"実行中のタスクはありません","live.lastTool":"最終ツール {time}","live.lease":"リース残 {time}","live.openInDiscord":"Discord で開く","live.abortReason":"モバイルから中断","live.aborted":"中断しました: {id}","live.abortAll":"実行中タスク {count} 件を中断","live.abortAllSub":"長押し ・ reclaim → block","live.note":"state.db のターンリースとカンバンの running を合成しています(読み取り専用)。ターンの中断はチャットの停止ボタン、タスクは上の長押しで中断します。","live.architect":"Architect(仕様策定)","live.architectShort":"仕様策定","live.architectNone":"動いている仕様策定ジョブはありません","live.architectStalled":"⚠️ 3分以上進捗がありません","live.architectQuickReview":"🔍 Quick Review","live.architectOpenTask":"📋 タスク","live.architectDismiss":"✕ 終了","live.architectDismissed":"仕様策定ジョブを終了しました: {id}","live.architectPhaseSpawning":"起動中","live.architectPhaseRound1Sheet":"Round 1 シート","live.architectPhaseAwaitingReview":"赤ペン待ち","live.architectPhaseRound2Spec":"Round 2 SPEC 作成","live.architectPhaseSpecReady":"SPEC 完成","live.architectPhaseLaunched":"起票済み","live.architectPhaseFailed":"失敗","inbox.kind.needsInput":"回答待ち","inbox.kind.dependency":"依存待ち","inbox.kind.failure":"失敗","inbox.kind.untyped":"停止","inbox.needComment":"コメントを入力してください","inbox.commented":"コメントしました","inbox.reopened":"再開しました: {id}","inbox.title":"承認待ち(未回答 {pending})","inbox.titleWithAnswered":"承認待ち(未回答 {pending}/回答済み {answered})","inbox.recurrences":"再発 {n}","inbox.answeredWaiting":"回答済み(再開待ち)","inbox.lastComment":"直前のコメント({author} ・ {at})","inbox.placeholderAnswered":"追加の指示があれば書く(コメントとして記録)","inbox.placeholder":"回答・指示を書く(コメントとして記録)","inbox.sending":"送信中…","inbox.sendComment":"コメントして送る","inbox.answerResume":"回答して再開(ready)","inbox.resume":"再開する(ready)","inbox.failed":"取得できませんでした","inbox.empty":"承認待ちはありません","inbox.focused":"ウィジェットから開いたタスクを先頭に表示しています","inbox.allAnswered":"未回答はありません(回答済み {n} 件)","inbox.hideAnswered":"回答済みを隠す","inbox.showAnswered":"回答済み {n} 件を表示","inbox.note":"コメントは hermes kanban comment で記録します。不要になった項目は「片付ける」から完了・取消で一覧から外せます(どちらも履歴はボードに残ります)。15秒ごとに更新します。","capture.title":"起票","capture.needTitle":"タイトルを入れてください","capture.needBoard":"ボードを選んでください","capture.boardAria":"起票先のボードを変更","capture.board":"ボード","capture.boardPick":"タップで変更","capture.failed":"起票できませんでした","capture.created":"起票しました: {id}","capture.already":"起票済みです: {id}","capture.placeholder":"何をやる?(1行)","capture.voiceHint":"音声入力はキーボードのマイクでできます(長押しで開始)。","capture.moreClose":"詳細を閉じる","capture.moreOpen":"詳細(本文・優先度・担当)","capture.bodyPlaceholder":"本文(任意)","capture.priorityNone":"優先度 なし","capture.priorityLow":"低","capture.priorityMid":"中","capture.priorityHigh":"高","capture.assigneePlaceholder":"担当(任意・profile 名)","capture.submitting":"起票中…","capture.submit":"起票する","capture.note":"`hermes kanban create` を実行します(DB 直接書き込みはしません)。同じ内容の連打は10分間まとめて1件になります。音声はキーボードのマイクで入力できます。","annot.tool.pen":"ペン","annot.tool.arrow":"矢印","annot.tool.rect":"矩形","annot.undo":"↩ 戻す","annot.loadFailed":"下地画像を読み込めませんでした","annot.needMarks":"まず赤を入れてください(ペン・矢印・矩形)","annot.duplicate":"同じ注釈が既に保存されています","annot.sent":"注釈を送信しました","annot.sendFailed":"送信できませんでした(画像が大きい可能性があります)","annot.instruction":"赤を入れて「送信」","annot.sending":"送信中…","annot.submit":"送信","annot.notePlaceholder":"ひとこと(任意)","annot.compareAfter":"🔀 After(最新)","annot.compareBefore":"🔀 Before(前回の赤入れ)","annot.compareAria":"比較する画像(前回 / 最新)を切り替える","annot.looksGood":"✅ 検収 OK(完了にする)","annot.doneShort":"✅ 完了","annot.archiveShort":"📂 アーカイブ","annot.holdHint":"長押し","annot.stampsMore":"指示スタンプの一覧を開く","annot.stampSheetTitle":"🏷️ 指示スタンプ","annot.stampsHint":"スタンプは最後の赤入れに付きます。赤がまだ無いときは中央に枠を作って付けます。","annot.approved":"検収 OK(完了にしました)","annot.approvedResume":"検収 OK(ワーカーを再開しました)","annot.approveFailed":"検収を送れませんでした","annot.stampsTitle":"🏷️ 1タップ指示","annot.stampsAria":"文字入力なしで最後の赤入れに修正指示を付ける","annot.stamp.overlap":"重なり","annot.stamp.spacing":"余白","annot.stamp.overflow":"文字切れ","annot.stamp.contrast":"視認性","annot.stamp.shift_up":"上へ移動","annot.stamp.remove":"削除","diag.manifestLink":"manifest の link","diag.linkMissing":"link タグが無い","diag.manifestFetch":"manifest 取得","diag.manifestJson":"manifest の JSON","diag.entries":"{count} 項目","diag.none":"なし","diag.idUnset":"(未指定=start_url と同じ)","diag.startInScope":"start_url が scope 内","diag.idSameOrigin":"id が同一オリジン","diag.iconCount":"icons 件数","diag.iconCountValue":"{count} 件","diag.iconLine":"{w}x{h} {bytes}B {purpose}(宣言 {declared})","diag.any192":"192px 以上の any アイコン","diag.any512":"512px 以上の any アイコン","diag.maskable":"maskable アイコン","diag.present":"あり","diag.missingInstall":"なし → インストール不可","diag.maskableMissing":"なし(白枠の原因になる)","diag.swControl":"Service Worker 制御","diag.swNone":"未制御","diag.swCovering":"scope をカバーする SW","diag.viewMode":"今の表示モード","diag.unknown":"(不明)","diag.empty":"(なし)","diag.decodeError":"デコード不能","app.tabError":"このタブでエラーが発生しました","app.tabErrorLog":"記録は ~/.hermes/plugin-data/hermes-pilot/client-errors.log","app.reviewDone":"レビュー完了","app.reviewDoneLabel":"レビュー完了: {label}","app.loginPrompt":"アプリトークンを入力してください","app.loginButton":"入る","app.loginHint":"トークンは ~/.hermes/plugin-data/hermes-pilot/token(0600)にあります。","app.search":"検索","app.connected":"接続中","app.disconnected":"接続できません","app.bridgeOffline":"ブリッジに接続できません","app.termLoading":"ターミナルを読み込み中…","app.navWaiting":"{label}(判断待ち {n} 件)","app.navApproval":"{label}(承認待ち {n} 件)","app.navDone":"{label}(完了の報告あり)","app.navReflecting":"{label}(反映中)","app.navRunning":"{label}(稼働中)","tasks.status.running":"実行中","tasks.status.ready":"待機","tasks.status.done":"完了","tasks.status.blocked":"停止","tasks.status.failed":"失敗","tasks.status.archived":"保管","tasks.status.todo":"未着手","tasks.abortReason":"モバイルから中断","tasks.aborted":"中断しました(reclaim={reclaim} / block={block})","tasks.actionRan":"{action} を実行しました","tasks.pausedDone":"一時停止しました(新規のみ)","tasks.resumed":"再開しました","tasks.pausedBanner":"一時停止中(新規の受付を止めています{reason})","tasks.resume":"再開","tasks.inboxBar":"承認待ち {n} 件","tasks.inboxBarGo":"回答する ›","tasks.bridge":"ブリッジ","tasks.ok":"正常","tasks.disconnected":"切断","tasks.usageAria":"使用量の内訳","tasks.memory":"メモリ","tasks.disk":"ディスク","tasks.liveAria":"いま動いているもの","tasks.runningLabel":"稼働","tasks.turnTitle":"ターン {n} 件","tasks.boardOpenAria":"ボード一覧を開く","tasks.boardList":"ボード一覧","tasks.board":"ボード","tasks.boardRunning":"実行中 {n}","tasks.boardBlocked":"停止 {n}","tasks.boardArchived":"保管","tasks.boardCount":"{n} ボード","tasks.tasks":"タスク","tasks.newTask":"+ 起票","tasks.empty":"タスクがありません","tasks.selectPlaceholder":"タスクを選んでください","tasks.selectHint":"詳細・イベント・Diff がここに出ます。","review.selectPlaceholder":"レビューを選んでください","review.selectHint":"シートまたは注釈エディタがここに出ます。","tasks.elapsedMin":"{n}分","tasks.failures":"失敗{n}","tasks.noMessage":"(メッセージなし)","tasks.uncommitted":"未コミット","tasks.openInDiscord":"Discord で開く","tasks.emergency":"緊急操作","tasks.emergencyTitle":"緊急操作(長押しで実行)","tasks.emergencyNote":"実行中 {n} 件。restart は実行中ターンの完了を待ってから再起動します(最大30分)。","tasks.pausedNow":"{at} から一時停止中です。実行中のターンは完走しています。","tasks.unknownTime":"時刻不明","tasks.pauseHelp":"「一時停止」は新しい仕事だけを止めます。実行中のターンは完走し、再開は1タップです。","tasks.resumeEstop":"再開する(ESTOP 解除)","tasks.pauseLabel":"一時停止(新規のみ)","tasks.pauseSub":"長押し ・ hermes pause","tasks.drainLabel":"新規受付を停止","tasks.drainSub":"drain(実行中は完走)","tasks.restartLabel":"ゲートウェイ再起動","tasks.restartSub":"restart(Bot が数秒落ちる)","tasks.stopLabel":"強制停止","tasks.stopSub":"stop(実行中も切る)","tasks.startLabel":"受付を再開","tasks.startSub":"start(受付を再開)","tasks.auditNote":"実行結果は設定タブの監査ログに残ります。","tasks.detailLoading":"詳細を読み込み中…","tasks.status":"状態","tasks.started":"開始","tasks.branch":"ブランチ","tasks.commit":"コミット","tasks.message":"メッセージ","tasks.changedFiles":"変更ファイル","tasks.noDiff":"差分なし","tasks.diffLimit":"(100ファイルまで表示)","tasks.dirtyNote":"未コミットの変更があります(表示はコミット分のみ)","tasks.openThread":"Discord スレッドで開く","tasks.abortTask":"このタスクを中断","tasks.abortSub":"reclaim → block(再実行を止める)","tasks.events":"イベント","tasks.noEvents":"イベントなし","tasks.heartbeatCount":"heartbeat {n} 回","tasks.heartbeatRange":"({first} 〜 {last})","settings.pairing":"端末を追加","settings.pairingHint":"2 台目のスマホ/タブレット用の QR を表示します。読み取るだけでログインできるので、長いトークンを打ち直す必要はありません。","settings.showPairingQr":"ペアリング QR を表示","settings.pairingLoading":"読み込み中…","settings.pairingTitle":"ペアリング QR","settings.pairingScanHint":"追加したい端末のカメラで読み取ってください。","settings.pairingEmpty":"到達可能なアドレスが見つかりません。Tailscale に接続するか同じ LAN に入ってから開き直してください。","settings.pairingCopy":"コピー","settings.pairingCopied":"URL をコピーしました","settings.pairingNote":"QR にはアプリトークンが入っています。読み取った人はこの Hermes を操作できます。スクショの共有は避けてください。","app.gwOkAria":"ゲートウェイは正常です。タップで再確認。","app.gwDownAria":"ゲートウェイに繋がりません。タップで再試行。","app.gwError":"異常","app.jumpWaitingAria":"判断待ち {n} 件の最初の 1 件へ移動","app.jumpRunningAria":"稼働中 {n} 件の内容を表示","app.cacheAria":"キャッシュ率 {pct}% — 使用量の内訳を開く","tasks.specLaunchpad":"仕様ランチャー","tasks.specBarAria":"{name} のバッチ起票を開く","tasks.specBatchCount":"{n} バッチ","tasks.specSheetTitle":"バッチを起票","tasks.specAlready":"起票済み","tasks.specFiledDone":"完了済み","tasks.specLaunchBtn":"{n} バッチを起票して自走開始","tasks.specLaunching":"起票中…","tasks.specLaunched":"{created} 件起票(スキップ {skipped})","tasks.pipelineSummary":"直近のパイプライン完走","tasks.discussReport":"💬 チャットで次の一手を相談","tasks.pipelineDismiss":"閉じる","tasks.specNote":"各バッチは「[ID] タイトル」のカンバンタスクになり、本文に spec パス・target・抜粋(Verify 受入条件)が入ります。このボードで起票済みのバッチはスキップします。","tasks.modeZeroStop":"⚡ 自走完走","tasks.modeFastTrack":"⚡ 要承認","tasks.modeVisualGate":"🖊 視覚検収","tasks.specUpdated":"更新 {when}","tasks.specAllDone":"全バッチ完了","tasks.specHistoryTitle":"バッチ履歴","tasks.specHistoryAria":"{name} の完了バッチ履歴を開く","tasks.specHistoryNote":"起票済みのタスクはボードに残ります。どのバッチがいつ完了したかは、この履歴からいつでも確認できます。","tasks.specOpenLaunch":"バッチ起票を開く","tasks.specNotFiled":"未起票","tasks.specDoneBadge":"完了","tasks.specNowAria":"仕様を切り替え(現在: {name})","tasks.specCountOf":"全{n}件","tasks.specDetailToggle":"仕様・Verify","tasks.specObjective":"目的","tasks.specResult":"実行結果","tasks.specOpenTask":"タスク詳細・差分を見る","tasks.specSection":"受入条件・仕様抜粋","tasks.specStartedAt":"開始 {when}","tasks.specMdPreview":"仕様書(MD)をプレビュー","tasks.specBatchesHead":"配下のバッチ({n}件)","tasks.specMdTitle":"仕様書","tasks.specMdLoading":"仕様書を読み込み中…","tasks.specMdFailed":"仕様書を読めませんでした","tasks.specMdTruncated":"長いため先頭 256KB のみ表示しています","tasks.specMdCopy":"📋 本文コピー","tasks.specMdCopied":"✅ コピーしました","tasks.specMdCopyCode":"コピー","tasks.specMdBack":"戻る","chat.reportNoSession":"会話なし(対応する作業場所で開く)","receipt.title":"完了レシート","receipt.open":"🏆 完了レシート","receipt.create":"🏆 完了レシートカードを作成","receipt.loading":"レシートを集計中…","receipt.failed":"レシートを作成できませんでした","receipt.partial":"一部の集計元が読めません: {sources}","receipt.savePng":"📸 PNG画像を保存","receipt.saving":"画像を生成中…","receipt.copyShare":"📋 シェア文をコピー","receipt.copied":"シェア用テキストをコピーしました","receipt.copyFailed":"テキストをコピーできませんでした","receipt.shareNote":"1200×630 の PNG ・ シェア文は X 投稿用","receipt.savedNote":"節約見込額は、上のコストに既に反映されているキャッシュ割引(約 {pct}%)から逆算した概算です。","receipt.kpi.cost":"コスト","receipt.kpi.cache":"キャッシュ率","receipt.kpi.saved":"推定節約額","receipt.kpi.zeroTyping":"ゼロタイピング度","receipt.kpi.tests":"テスト合格","receipt.kpi.duration":"所要時間","receipt.kpi.savedNote":"概算(キャッシュ割引 {pct}%)","receipt.kpi.durationNote":"直近 {hours} 時間に完了なし","receipt.kpi.testsNote":"テスト件数が見つかりません","receipt.kpi.zeroTypingNote":"タップと入力文字の比率","receipt.kpi.apiCalls":"API コール","receipt.kpi.totalTokens":"トークン","receipt.kpi.apiCallsNote":"API コールの記録なし","receipt.kpi.apiCallsScope":"Spec スコープのセッション","receipt.kpi.totalTokensNote":"トークンの記録なし","receipt.kpi.totalTokensScope":"入力+出力+キャッシュ","receipt.kpi.wallNote":"経過 {wall}","receipt.scope.usage":"Spec スコープ: セッション {sessions} 件 · タスク {tasks} 件","receipt.scope.fallback":"セッション ID が取れないため Run の時間窓で合算","receipt.value.calls":"{n} 回","receipt.value.na":"—","receipt.value.min":"{min} 分","receipt.value.hours":"{h} 時間 {m} 分","receipt.value.over":"{h} 時間以上","receipt.badge.audit":"監査サマリ","receipt.canvas.titleDopamine":"自律実行サマリ","receipt.canvas.titleSerotonin":"AUTONOMOUS EXECUTION SUMMARY","receipt.canvas.window":"直近 {hours} 時間","receipt.canvas.batches":"{batches} タスク完了","receipt.canvas.footer":"hermes-pilot ・ A2B パイプライン ・ ゼロタイピング操作","receipt.canvas.size":"1200×630","receipt.share.title":"完了レシート","receipt.share.batches":"{batches} タスク完了({done}/{total})","receipt.share.testsSuffix":"件のテスト合格","receipt.share.cacheSuffix":"キャッシュヒット","receipt.share.savedSuffix":"節約見込(概算)","receipt.share.tapsSuffix":"タップ","receipt.share.redlinesSuffix":"赤入れ","receipt.share.typedSuffix":"文字入力","receipt.share.zeroSuffix":"ゼロタイピング","receipt.share.wall":"経過 {wall}","receipt.share.tokensSuffix":"トークン","receipt.share.footer":"— Hermes Pilot ・ A2B パイプライン","demo.badge":"インタラクティブデモ","demo.barAria":"デモの操作","demo.viewAria":"デバイス筐体","demo.envAria":"デモ環境","demo.view.phone":"Phone 390×844","demo.view.tablet":"Tablet 820×1180","demo.view.full":"全画面","demo.vibe.dopamine":"Dopamine","demo.vibe.serotonin":"Serotonin","demo.sound.on":"音 ON","demo.sound.off":"音 OFF","demo.theme.dark":"Dark","demo.theme.light":"Light","demo.restart":"ツアーを最初から","demo.bannerAria":"体験ツアー","demo.stepOf":"ステップ {n}/{total}","demo.takeMe":"このステップへ","demo.steps.1.title":"仕様の承認","demo.steps.1.hint":"🔔 Review を開き、判断シートで「⚡ 推奨を一括承認」をタップします。","demo.steps.2.title":"バッチの一括起票","demo.steps.2.hint":"Tasks で生成された仕様書の「🚀 バッチを起票して自走開始」をタップします。","demo.steps.3.title":"視覚検収","demo.steps.3.hint":"Before ↔ After を比べ、赤入れスタンプを押すか「👍 これで OK」で検収します。","demo.steps.4.title":"実行サマリとレシート","demo.steps.4.hint":"Tasks の統合完了サマリを開き、完了レシートをシェアします。","seed.title":"仕様策定","seed.lead":"一行で十分です。Architect が 1タップの設計インタビューにして、仕様書まで仕上げます。","seed.placeholder":"何を仕様化しますか?","seed.voiceHint":"音声はキーボードのマイクで。入力欄は自動でフォーカスされます。","seed.policy":"実行方針","seed.policyAria":"仕様書の実行方針を選ぶ","seed.policyDefault":"既定","seed.policyZeroStop":"Zero-stop","seed.policyVisualGate":"Visual-gate","seed.policyZeroStopHint":"生成した各バッチを、承認なしで最後まで自律で走らせます。","seed.policyVisualGateHint":"要所で実機の画面確認(Visual Gate)を挟み、見てから次へ進みます。","seed.tpl.feature":"新機能の仕様化","seed.tpl.featureText":"新機能を仕様化したい: ","seed.tpl.ux":"UI/UX 改善の仕様化","seed.tpl.uxText":"UI/UX を改善したい: ","seed.tpl.bug":"バグ修正・安定化","seed.tpl.bugText":"バグ修正と安定化を仕様化したい: ","seed.autoStart":"承認後に自動でバッチを起票して自走開始する","seed.autoStartHint":"OFF なら安全なハイブリッド: 仕様書ができたときに 1 タップだけ押します。","seed.runner":"実行ランナー","seed.runnerHermes":"Hermes Native(既定)","seed.submit":"インタビューを開始","seed.submitting":"開始中…","seed.toast":"インタビューシートがまもなく Review に届きます。","seed.failed":"インタビューを開始できませんでした","seed.openAria":"一行メモから仕様策定インタビューを開始","seed.statusRunning":"Architect が作業中…","seed.statusAwaiting":"仕様書を書いています…","seed.statusReady":"仕様書の準備完了","seed.statusLaunched":"バッチ起票済み — 自走中","seed.statusFailed":"Architect が停止しました","seed.statusUnknown":"状態不明","seed.statusAwaitingReview":"インタビューシートが Review に届きました","seed.statusQueued":"キュー待ち(開始待ち)","seed.queueQueued":"待機中","seed.queueRunning":"実行中","seed.jobAria":"Architect ジョブの進行状況","seed.jobTask":"タスク {id}","seed.jobDismiss":"この表示を閉じる","seed.openReview":"Review を開く","seed.inspect":"進捗詳細","seed.inspectAria":"Architect ジョブの進捗詳細を開く","seed.phaseAria":"現在のフェーズ","seed.phaseSpawning":"起動中…","seed.phaseRound1Sheet":"Round 1 シートを生成中","seed.phaseRound2Spec":"仕様書を執筆中(Round 2)","seed.sheetLabel":"シート {name}","seed.stalled":"⚠️ 3分以上進捗がありません(Agent が停止・待機中の可能性)","seed.retryHermes":"Hermes Native で再試行","seed.retrying":"再試行中…","seed.retried":"Hermes Native で再試行を開始しました。","seed.retryFailed":"Architect を再試行できませんでした","seed.elapsed":"{m}分{s}秒","seed.elapsedHour":"{h}時間{m}分","seed.elapsedWaiting":"待機 {m}分{s}秒","seed.elapsedWaitingHour":"待機 {h}時間{m}分","seed.bannerTitle":"仕様書の準備が完了しました — {n} バッチを起票して自走開始","seed.bannerPending":"この仕様書の {n} バッチが未起票です","seed.bannerAction":"一括起票して開始","seed.bannerPreview":"仕様書を読む","seed.bannerLater":"あとで","seed.bannerFiled":"{n} バッチを起票しました","seed.bannerAria":"起票できる仕様書があります","settings.secPipeline":"パイプライン&Architect","settings.pipelineLead":"安全な A2B は 2 ルート: 自分のターミナル等で docs/SPEC-*.md を置くか、スマホの Hermes Native で仕様書まで作るか。どちらも 1 タップで自走します。","settings.pipelineRunner":"Architect のランナー","settings.pipelineRunnerHint":"Hermes Native 固定 — 外部 AI CLI は起動しません。仕様書はファイル配置か Spec Seed から届きます。","settings.pipelineOptimize":"SOUL.md とスキルを今すぐ最適化","settings.pipelineOptimizing":"適用中…","settings.pipelineOptimized":"適用しました","settings.pipelineUnavailable":"このブリッジではパイプライン API が使えません","settings.pipelineSoul":"SOUL.md の行動規範","settings.pipelineSkills":"スキル","settings.pipelineApplied":"適用済み","settings.pipelineMissing":"未適用","settings.pipelineJobs":"Architect ジョブ","settings.pipelinePending":"未起票の仕様書","tasks.pipelineCollapse":"折りたたむ","notes.title":"ひらめき & レポート受信箱","notes.subtitle":"メモ・チェックリスト・定期実行レポート","notes.searchPlaceholder":"メモ・タグ・レポートを検索…","notes.quickPlaceholder":"思いつきを1行でメモ…","notes.newBtn":"+ 新規メモ","notes.filterAll":"すべて","notes.filterPinned":"📌 ピン留め","notes.filterReports":"📬 定期レポート","notes.inboxHead":"定期・完了レポート受信箱({n}件)","notes.inboxSave":"メモへ保存","notes.inboxSaved":"メモへ保存しました","notes.empty":"該当するメモはまだありません。","notes.editTitle":"メモを編集","notes.createTitle":"新規メモ","notes.fieldTitle":"タイトル","notes.fieldTitlePh":"短い見出し…","notes.fieldBody":"本文","notes.fieldBodyPh":"ひらめきや背景を書き留める…","notes.fieldTags":"タグ(カンマ区切り)","notes.fieldTagsPh":"ひらめき, ux, 整理","notes.fieldChecklist":"チェックリスト","notes.addChecklistPh":"項目を追加…","notes.addChecklistBtn":"追加","notes.colorLabel":"カード色","notes.pin":"ピン留め","notes.unpin":"ピン解除","notes.save":"保存","notes.delete":"削除","notes.unsavedTitle":"保存していない変更があります","notes.unsavedSub":"閉じる前にどうしますか?","notes.saveAndClose":"保存する","notes.discard":"破棄する","notes.keepEditing":"戻る","notes.saved":"メモを保存しました","notes.deleted":"メモを削除しました","notes.brainstorm":"🧠 ブレスト","notes.toSeed":"📝 仕様策定","notes.openChat":"💬 元チャット","notes.sourceMeta":"出典: {meta}","notes.more":"⋯ その他の操作","notes.menuTitle":"メモの操作","notes.viewOne":"1 列","notes.viewTwo":"2 列","notes.viewList":"リスト","notes.viewGroupAria":"表示の切り替え","notes.moreItems":"残り {n} 件","chat.bubbleMenuAria":"メッセージ操作メニュー","chat.bubbleMenuTitle":"メッセージ操作","chat.bubbleCopy":"📋 全文をコピー","chat.bubbleCopied":"クリップボードにコピーしました","chat.bubbleSaveMemo":"💡 メモタブに追加","chat.bubbleSavedMemo":"メモタブに追加しました","chat.bubbleContinueHead":"このチャットに継続して指示","chat.bubbleSummarize":"📝 3点で要約する","chat.bubbleSummarizePrompt":`以下の内容を 3 点で簡潔に要約してください。
56
+
57
+ > {quote}`,"chat.bubbleBrainstorm":"🧠 ブレストで広げてチェックリスト化","chat.bubbleBrainstormPrompt":`以下の内容を元にアイデアを膨らませ、実行可能なチェックリストに整理してください。
58
+
59
+ > {quote}`,"chat.bubbleDig":"🔍 該当ファイルと原因を深掘り","chat.bubbleDigPrompt":`以下の内容について、該当するファイル・シンボル・原因を詳しく調査してください。
60
+
61
+ > {quote}`,"chat.bubbleQuote":"↩️ 引用して入力欄へ挿入","chat.bubbleToSeed":"📝 仕様策定へ送る","brainstorm.title":"ブレスト","brainstorm.lead":"1行の思いつきから観点を広げ、チェックリスト化してメモタブへ格納します。","brainstorm.placeholder":"膨らませたい1行のアイデアや課題…","brainstorm.angles":"広げる観点","brainstorm.angleFeature":"✨ 機能アイデア","brainstorm.angleUx":"🎨 UI / UX 改善","brainstorm.angleEdge":"🛡 リスク・例外","brainstorm.generate":"✨ チェックリストに展開","brainstorm.saveMemo":"💡 チェックリストをメモへ格納","brainstorm.sendChat":"💬 チャットでさらに詰める","brainstorm.saved":"チェックリストをメモタブへ格納しました","brainstorm.tpl.feature1":"コア価値を1行で定義する: {topic}","brainstorm.tpl.feature2":"最小構成(MVP)の操作フローを3ステップに絞る","brainstorm.tpl.ux1":"390px モバイル幅・Dark/Light 両テーマでの視認性を設計","brainstorm.tpl.ux2":"Dopamine / Serotonin モード別のフィードバック整理","brainstorm.tpl.edge1":"空状態・エラー時・オフライン時のフォールバックを決める","brainstorm.tpl.edge2":"既存データ・テスト・i18n 規約への影響範囲を確認","refactor.title":"リファクタリング","refactor.lead":"プロジェクトのコンセプト・規約に沿っているかの監査や、局所的な重複・冗長の改善を起票します。","refactor.scope":"監査・改善の観点","refactor.scopeCss":"🎨 CSS・スタイルの重複整理","refactor.scopeCode":"🧹 冗長ロジック・共通化","refactor.scopeRules":"📏 コンセプト・i18n・境界監査","refactor.scopePerf":"⚡ 描画・パフォーマンス改善","refactor.targetPh":"対象パスやモジュール(任意・例: apps/web/src/styles.css)…","refactor.launch":"🛠 監査・リファクタタスクを起票","refactor.launched":"リファクタリングタスクを起票しました","refactor.failed":"起票できませんでした"},Xh={en:"en-US",ja:"ja-JP"};let Iu="en";function ck(e){return Iu=e==="ja"?"ja":"en",Iu}function Mo(e){return Xh[Iu]??Xh.en}function oa(e){const t=Number(e??0);return!Number.isFinite(t)||t<=0?"$0":t<.01?`$${t.toPrecision(2)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}function Is(e){const t=Number(e??0);return!Number.isFinite(t)||t<=0?"0":t>=1e9?`${(t/1e9).toFixed(2)}B`:t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function uk(e){if(e==null||!Number.isFinite(e))return"—";const t=e*100;return t>=99.95?"100%":`${t.toFixed(1)}%`}function Wt(e,t={}){const n=Number(e??0);return Number.isFinite(n)?new Intl.NumberFormat(Mo(),t).format(n):"—"}function Tl(e,t){if(!Number.isFinite(e)||e<=0)return"—";const n=(s,r)=>new Intl.NumberFormat(Mo(),{maximumFractionDigits:r}).format(s);return e<1024?`${n(e,0)}B`:e<1048576?`${n(e/1024,0)}KB`:e<1073741824?`${n(e/1048576,1)}MB`:`${n(e/1073741824,1)}GB`}function tt(e,t){if(!e)return"—";const n=Math.max(0,Math.round((Date.now()-Number(e))/1e3)),s=new Intl.RelativeTimeFormat(Mo(),{numeric:"always",style:"short"});return n<60?s.format(-n,"second"):n<3600?s.format(-Math.round(n/60),"minute"):n<86400?s.format(-Math.round(n/3600),"hour"):s.format(-Math.round(n/86400),"day")}function Lo(e,t={},n){const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?"—":new Intl.DateTimeFormat(Mo(),{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",...t}).format(s)}function nv(e,t){return Lo(e,{year:void 0,month:void 0,day:void 0,hour:"2-digit",minute:"2-digit"})}const dk=["en","ja"],Yd="en",sv="hm.lang",Nc={en:lk,ja:ok};function ya(e){if(e==null)return null;const t=String(e).trim().toLowerCase();return t?t==="auto"?"auto":t.startsWith("ja")?"ja":t.startsWith("en")?"en":null:null}function Zh(e){return String(e??"").trim().toLowerCase().startsWith("ja")?"ja":"en"}function em({stored:e,languages:t,language:n}={}){const s=ya(e);if(s==="en"||s==="ja")return s;const r=Array.isArray(t)?t.filter(Boolean):[];return r.length?Zh(r[0]):n?Zh(n):Yd}function _u(e){return em(typeof navigator>"u"?{stored:e}:{stored:e,languages:navigator.languages,language:navigator.language})}function pk(e,t){const n=String(e??"");return t?n.replace(/\{(\w+)\}/g,(s,r)=>Object.prototype.hasOwnProperty.call(t,r)&&t[r]!=null?String(t[r]):s):n}function Oo(e,t,n){const s=ya(e)==="ja"?"ja":Yd,i=(Nc[s]??Nc.en)[t]??Nc.en[t];return i==null?String(t):pk(i,n)}let si=_u(rv());const Mu=new Set;function rv(){try{return ya(localStorage.getItem(sv))}catch{return null}}function ao(){return si}function tm(e){const t=ya(e),n=t==="en"||t==="ja"?t:si,s=n!==si;if(si=n,ck(n),s)for(const r of[...Mu])try{r(n)}catch{}try{typeof window<"u"&&typeof window.dispatchEvent=="function"&&window.dispatchEvent(new CustomEvent("hm:lang",{detail:{lang:n}}))}catch{}return n}function hk(e){return Mu.add(e),()=>Mu.delete(e)}function C(e,t){return Oo(si,e,t)}const mk="",fk=()=>globalThis.__hmDemoFetch??null,gk=()=>globalThis.__hmDemoSocket??null;function nm(e,t,n){if(!e)return t;const s=`err.${e}`,r=Oo(ao(),s,n);return r===s?t:r}async function Y(e,{method:t="GET",body:n}={}){const s=fk();if(s)return s(e,{method:t,body:n});let r;try{r=await fetch(`${mk}${e}`,{method:t,credentials:"same-origin",headers:{...n!==void 0?{"content-type":"application/json"}:{},"accept-language":ao(),"x-client":"mobile"},body:n!==void 0?JSON.stringify(n):void 0})}catch{const o=new Error(nm("OFFLINE","Cannot reach the bridge"));throw o.code="OFFLINE",o}const i=await r.text();let l=null;try{l=i?JSON.parse(i):null}catch{l=i}if(!r.ok){const o=l!=null&&l.error&&typeof l.error=="object"?l.error:null,c=(l==null?void 0:l.code)??(o==null?void 0:o.code)??null,d=(l==null?void 0:l.params)??(o==null?void 0:o.params)??null,g=(typeof(l==null?void 0:l.error)=="string"?l.error:null)??(o==null?void 0:o.message)??(l==null?void 0:l.detail)??`HTTP ${r.status}`,f=new Error(nm(c,g,d));throw f.status=r.status,f.code=c,f.params=d,f}return l}function vk(e){const t=gk();if(t)return t(e);const n=location.protocol==="https:"?"wss":"ws";return new WebSocket(`${n}://${location.host}${e}`)}const ri=8;function qt(e){var t;return(e==null?void 0:e.status)==="blocked"&&!!((t=e==null?void 0:e.review)!=null&&t.label)}const yk=new Set(["review","ready","running","blocked"]);function wk(e,t=ri){const n=Array.isArray(e)?e.filter(Boolean):[],s=n.filter(qt),r=n.filter(l=>!qt(l)&&l.status!=="done"&&yk.has(l.status)),i=n.filter(l=>l.status==="done");return{waiting:s,active:r,done:i.slice(0,t),doneTotal:i.length}}function xk(e,t){return(Array.isArray(e)?e:[]).find(s=>qt(s)&&s.id!==t)||null}function sm(e){return(Array.isArray(e)?e.filter(Boolean):[]).filter(qt).length}function Lu(e){const t=e==null?void 0:e.lastComment;return!!(t&&t.author==="mobile"&&(t.at??0)>=((e==null?void 0:e.blockedAt)??0))}function Ou(e){return(Array.isArray(e)?e.filter(Boolean):[]).filter(n=>!Lu(n)).length}function jc(e){return(Array.isArray(e)?e:[]).filter(n=>n&&(n.status==="running"||n.status==="ready")).length}function kk(e,t){const n=Array.isArray(e)?e:[],s=Number(t)||0;return n.filter(r=>r&&Number.isFinite(Number(r.at))&&Number(r.at)>s)}function Cc({waiting:e=0,unseen:t=0,running:n=0}={}){return Number(e)>0?"waiting":Number(t)>0?"done":Number(n)>0?"running":null}function bk({reviewWaiting:e=0,inboxPending:t=0}={}){const n=s=>{const r=Number(s);return Number.isFinite(r)&&r>0?Math.floor(r):0};return n(e)+n(t)}function Sk(e){const t=Number(e)||0;return t?C("review.doneRecent",{n:Math.min(t,ri)}):C("review.doneEmpty")}function av(e,t,n){const s=String(e??"").trim(),r=String((t==null?void 0:t.id)??"").trim(),i=String((t==null?void 0:t.label)??"").trim(),l=[r&&`${r}.`,i].filter(Boolean).join(" "),o=[s,l].filter(Boolean).join(" ").trim(),c=String(n??"").trim();return{head:o,sub:c}}function Nk(e,t){const n=Array.isArray(e==null?void 0:e.questions)?e.questions:[],s=Array.isArray(t==null?void 0:t.answers)?t.answers:[];return{rows:n.map(i=>{const l=s.find(d=>String((d==null?void 0:d.id)??"")===String((i==null?void 0:i.id)??""))||null,o=Array.isArray(i==null?void 0:i.options)?i.options:[],c=l!=null&&l.choice?o.find(d=>String((d==null?void 0:d.id)??"")===String(l.choice)):null;return{id:String((i==null?void 0:i.id)??""),question:String((i==null?void 0:i.text)??""),choice:l!=null&&l.choice?String(l.choice):null,label:c?String(c.label??""):"",note:String((l==null?void 0:l.note)??"")}}),global:String((t==null?void 0:t.global)??"")}}function jk(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return"—";const n=new Date(t),s=r=>String(r).padStart(2,"0");return`${s(n.getMonth()+1)}/${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}`}function Du(e){return(typeof e=="string"?e:String((e==null?void 0:e.id)??(e==null?void 0:e.label)??"")).trim()||"—"}function Ck(e){return(e==null?void 0:e.mode)!=="annotation"}function Ek(e){return!!e&&e!=="standard"&&e!=="sheet"}const Tk=/recommend|\u63a8\u5968/i,Ak=/not\s+recommended|no\s+recommend|\u975e\u63a8\u5968/i;function Rk(e){if(!e)return!1;const t=e.recommended;if(t===!0||t==="true")return!0;const n=`${e.label??""} ${e.detail??""}`;return Ak.test(n)?!1:Tk.test(n)}function Pk(e){const t=Array.isArray(e==null?void 0:e.questions)?e.questions:[],n=[],s=[];return t.forEach((r,i)=>{const o=(Array.isArray(r==null?void 0:r.options)?r.options:[]).find(g=>Rk(g))||null,c=String((r==null?void 0:r.id)??`q${i+1}`),d=o&&o.id!=null&&o.id!==""?String(o.id):null;n.push({id:c,choice:d,note:""}),d&&s.push(`Q${i+1}:${d}`)}),{canFastTrack:s.length>0,summary:s.join(" · "),answers:n}}function Ik(e){if(e==null)return null;const t=Number(e);return Number.isFinite(t)?Math.round(Math.min(1,Math.max(0,t))*100):null}function _k(e){var s,r;const t=Array.isArray(e)?e.filter(Boolean):[];let n=null;for(const i of t){const l=(s=i.lastTool)==null?void 0:s.name;if(!l)continue;const o=Number(((r=i.lastTool)==null?void 0:r.at)??0);(!n||o>n.at)&&(n={name:String(l),at:o})}return n?n.name:null}function Mk({tasksRunning:e=0,turns:t=0,architectRunning:n=0}={}){const s=Number(e)||0,r=Number(t)||0,i=Number(n)||0;return Math.max(0,s)+Math.max(0,r)+Math.max(0,i)}function Lk({conn:e="ok",bridge:t=null}={}){return e==="offline"?"offline":e!=="ok"||t&&t.ok===!1?"error":"ok"}function Ok({reviewItems:e=[],inboxPending:t=0}={}){const n=(Array.isArray(e)?e:[]).find(s=>qt(s));return n!=null&&n.id?{kind:"review",taskId:String(n.id)}:Number(t)>0?{kind:"inbox"}:null}const rm="hm.chatReportSeenAt",ca="hm.chatReportSeen",am=3,Dk="hm.storedSid",iv="hm.lastStoredSid",yr="__latest__",$k=["kind","status","board","spec","repoPath","markdown","followUpPrompt","counts"];function Jd(e){return String((e==null?void 0:e.kind)??"")==="pipeline"}function Do(e){const t={};for(const n of $k){const s=e==null?void 0:e[n];s!=null&&(t[n]=s)}return t}function $u(e,t={},n=[]){const s=new Set((Array.isArray(n)?n:[n]).map(i=>String(i??""))),r=new Map;for(const i of Array.isArray(e)?e:[]){if(!Jd(i))continue;const l=String((i==null?void 0:i.sessionId)??"").trim(),o=Number(i==null?void 0:i.at);if(!l||s.has(l)||!Number.isFinite(o)||o<=(Number(t==null?void 0:t[l])||0))continue;const c=r.get(l);(!c||o>=c.at)&&r.set(l,{sessionId:l,at:o,taskId:String((i==null?void 0:i.taskId)??""),label:(i==null?void 0:i.label)??null,text:String((i==null?void 0:i.text)??""),...Do(i)})}return[...r.values()].sort((i,l)=>l.at-i.at)}function Fk(e,{now:t=Date.now(),maxAgeMs:n=24*60*60*1e3}={}){const s=Number(t)-Number(n),r=new Map;for(const i of Array.isArray(e)?e:[]){if(!Jd(i))continue;const l=String((i==null?void 0:i.sessionId)??"").trim(),o=Number(i==null?void 0:i.at);if(!l||!Number.isFinite(o)||o<s)continue;const c=r.get(l);(!c||o>=c.at)&&r.set(l,{sessionId:l,at:o,taskId:String((i==null?void 0:i.taskId)??""),label:(i==null?void 0:i.label)??null,text:String((i==null?void 0:i.text)??""),...Do(i)})}return[...r.values()].sort((i,l)=>l.at-i.at)}function Bk(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(s=>String(s??"")));return(Array.isArray(e)?e:[]).filter(s=>s&&!n.has(String(s.sessionId??"")))}function Nn(e=globalThis.localStorage){try{return String((e==null?void 0:e.getItem(Dk))||(e==null?void 0:e.getItem(iv))||"").trim()}catch{return""}}function Uk(e,t){const n=Array.isArray(e)?e:[],s=Number(t)||0;return n.filter(r=>r&&Number.isFinite(Number(r.at))&&Number(r.at)>s)}function Hk(e,t){const n=t&&typeof t=="object"?t:{},s=[],r=new Set;for(const i of Array.isArray(e)?e:[]){const l=String((i==null?void 0:i.sessionId)??"");if(!l||r.has(l))continue;const o=Number(i.at);Number.isFinite(o)&&(o<=(Number(n[l])||0)||(r.add(l),s.push(l)))}return s}function zk(e,t,n=am){const s=new Set((Array.isArray(t)?t:[t]).map(i=>String(i??"").trim()).filter(Boolean));if(!s.size)return[];const r=Math.max(1,Number(n)||am);return(Array.isArray(e)?e:[]).filter(i=>i&&s.has(String(i.sessionId??""))&&Number.isFinite(Number(i.at))).slice(-r).map(i=>({key:`${i.taskId??""}:${i.at}`,at:Number(i.at),text:String(i.text??""),taskId:String(i.taskId??""),label:i.label??null,...Do(i)}))}function lv(e,t,n=[]){const s=t&&typeof t=="object"?t:{},r=new Set((Array.isArray(n)?n:[n]).map(l=>String(l??"").trim()).filter(Boolean)),i=new Map;for(const l of Array.isArray(e)?e:[]){const o=String((l==null?void 0:l.sessionId)??"").trim(),c=Number(l==null?void 0:l.at);if(!o||r.has(o)||!Number.isFinite(c)||c<=(Number(s[o])||0))continue;const d=i.get(o);(!d||c>=d.at)&&i.set(o,{sessionId:o,at:c,taskId:String((l==null?void 0:l.taskId)??""),label:(l==null?void 0:l.label)??null,text:String((l==null?void 0:l.text)??""),...Do(l)})}return[...i.values()].sort((l,o)=>o.at-l.at)}function io(e){if(e&&typeof e=="object")return{...e};const t=String(e??"").trim();if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const s={};for(const[r,i]of Object.entries(n)){const l=Number(i);r&&Number.isFinite(l)&&l>0&&(s[r]=l)}return s}catch{return{}}}function ov(e,t,n){const s=String(t??""),r=e&&typeof e=="object"?{...e}:{},i=Number(n);if(!s||!Number.isFinite(i)||i<=0)return r;r[s]=i;const o=Object.entries(r).sort((d,g)=>d[1]-g[1]).slice(-50),c={};for(const[d,g]of o)c[d]=g;return c}function Wk(e,t){const n=new Set((Array.isArray(t)?t:[t]).map(r=>String(r??"").trim()).filter(Boolean));if(!n.size)return 0;let s=0;for(const r of Array.isArray(e)?e:[]){if(!n.has(String((r==null?void 0:r.sessionId)??"").trim()))continue;const i=Number(r==null?void 0:r.at);Number.isFinite(i)&&i>s&&(s=i)}return s}function Vk(e,t,n){const s=Number(n)>0?Math.floor(Number(n)):Date.now();let r=io(e);const i=new Map;for(const l of Array.isArray(t)?t:[]){const o=String((l==null?void 0:l.sessionId)??"").trim(),c=Number(l==null?void 0:l.at);!o||!Number.isFinite(c)||c>(i.get(o)??0)&&i.set(o,c)}for(const[l,o]of i)r=ov(r,l,Math.max(s,o));return r}function dr(e){if(e==null||e==="")return null;if(typeof e=="number")return!Number.isFinite(e)||e<=0?null:e<1e12?Math.round(e*1e3):Math.round(e);const t=String(e).trim();if(!t)return null;if(/^\d+(\.\d+)?$/.test(t)){const s=Number(t);return!Number.isFinite(s)||s<=0?null:s<1e12?Math.round(s*1e3):Math.round(s)}const n=Date.parse(t);return Number.isFinite(n)&&n>0?n:null}function Kk(e,t,n=""){const s=(Array.isArray(e)?e:[e]).map(l=>String(l??"").trim()).filter(Boolean),r=String(n??"").trim().toLowerCase();return!r||s.includes(yr)?s:(Array.isArray(t)?t:[]).some(l=>String((l==null?void 0:l.sessionId)??"").trim()===yr&&String((l==null?void 0:l.repoPath)??"").trim().toLowerCase()===r)?[...s,yr]:s}function qd(e,t=96){const n=String((e==null?void 0:e.summary)??(e==null?void 0:e.markdown)??(e==null?void 0:e.text)??""),s=Math.max(8,Number(t)||96);for(const r of n.split(`
62
+ `)){const i=r.replace(/^\s*(?:[>#]+|[-*+]|\d+\.)\s*/,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").replace(/\s+/g," ").trim();if(i)return i.length>s?`${i.slice(0,s-1)}…`:i}return""}function zr(e,t=""){return String((e==null?void 0:e.followUpPrompt)??"").trim()||String(t??"").trim()}function Qk(e,t){const n=Array.isArray(e)?e:[],s=Array.isArray(t)?t:[];if(!s.length)return n.map((l,o)=>({kind:"block",block:l,index:o}));const r=[];let i=0;for(let l=0;l<n.length;l+=1){const o=n[l],c=Number(o==null?void 0:o.at);if(Number.isFinite(c)&&c>0)for(;i<s.length&&s[i].at<=c;)r.push({kind:"report",report:s[i]}),i+=1;r.push({kind:"block",block:o,index:l})}for(;i<s.length;)r.push({kind:"report",report:s[i]}),i+=1;return r}const cv="hm.haptic",im={tap:16,action:22,heavy:32,success:[8,35,10],error:[14,35,14]};function Xd(e=globalThis.localStorage){try{return(e==null?void 0:e.getItem(cv))!=="0"}catch{return!0}}function Gk(e,t=globalThis.localStorage){const n=!!e;try{t==null||t.setItem(cv,n?"1":"0")}catch{}return n}function Yk(e,t=globalThis.navigator,n=globalThis.localStorage){if(!Array.isArray(e)&&typeof e!="number"||!Xd(n)||typeof(t==null?void 0:t.vibrate)!="function")return!1;try{return!!t.vibrate(Array.isArray(e)?e.slice():e)}catch{return!1}}function H(e="tap",t=globalThis.navigator,n=globalThis.localStorage){if(!Xd(n)||typeof(t==null?void 0:t.vibrate)!="function")return!1;const s=im[e]??im.tap;try{return!!t.vibrate(s)}catch{return!1}}const uv=u.createContext(null);function Jk(e){try{localStorage.setItem(sv,e)}catch{}}function qk({children:e,initial:t}){const[n,s]=u.useState(()=>ya(t)??rv()??"auto"),r=u.useMemo(()=>n==="en"||n==="ja"?n:_u("auto"),[n]);u.useEffect(()=>{tm(r),typeof document<"u"&&document.documentElement.setAttribute("lang",r)},[r]),u.useEffect(()=>hk(o=>{o!==r&&s(o)}),[r]);const i=u.useCallback(o=>{const c=ya(o)??"auto";s(c),Jk(c),tm(c==="auto"?_u("auto"):c);try{typeof window<"u"&&typeof window.dispatchEvent=="function"&&(window.dispatchEvent(new Event("hm:snippets")),window.dispatchEvent(new Event("hm:term-snippets")))}catch{}},[]),l=u.useMemo(()=>({lang:r,pref:n,locale:r==="ja"?"ja-JP":"en-US",setPref:i,t:(o,c)=>Oo(r,o,c)}),[r,n,i]);return u.createElement(uv.Provider,{value:l},e)}function Fe(){return u.useContext(uv)??{lang:ao()??Yd,pref:"auto",locale:ao()==="ja"?"ja-JP":"en-US",setPref:()=>{},t:C}}function Me({name:e,size:t=20}){const n={width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"},s={grid:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),a.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),a.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),a.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),chat:a.jsx("path",{d:"M21 12a8 8 0 0 1-8 8H8l-5 3 1.6-4.6A8 8 0 1 1 21 12Z"}),term:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("path",{d:"m7 9 3 3-3 3"}),a.jsx("path",{d:"M13 15h4"})]}),gear:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),a.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2 2 2 0 1 1-4 0 1.7 1.7 0 0 0-2.9-1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 3 15a2 2 0 1 1 0-4 1.7 1.7 0 0 0 1.5-2.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 10 4a2 2 0 1 1 4 0 1.7 1.7 0 0 0 2.9 1.4l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1A1.7 1.7 0 0 0 21 11a2 2 0 1 1 0 4Z"})]}),send:a.jsx("path",{d:"M4 12 20 4l-6 16-3.2-6.8L4 12Z"}),search:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"11",cy:"11",r:"7"}),a.jsx("path",{d:"m20 20-3.6-3.6"})]}),stop:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),chevron:a.jsx("path",{d:"m9 6 6 6-6 6"}),close:a.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),plus:a.jsx("path",{d:"M12 5v14M5 12h14"}),bolt:a.jsx("path",{d:"M13 2 4 14h6l-1 8 9-12h-6l1-8Z"}),check:a.jsx("path",{d:"m4 12 5 5L20 6"}),pen:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 20h4l10.5-10.5a2.1 2.1 0 0 0-3-3L5 17v3Z"}),a.jsx("path",{d:"m14 6 4 4"})]}),refresh:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}),a.jsx("path",{d:"M21 3v6h-6"})]}),memo:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M9 18h6"}),a.jsx("path",{d:"M10 22h4"}),a.jsx("path",{d:"M12 2a7 7 0 0 0-4 12.7c.7.6 1 1.3 1 2.3h6c0-1 .3-1.7 1-2.3A7 7 0 0 0 12 2Z"})]}),more:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"5",cy:"12",r:"1.6"}),a.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),a.jsx("circle",{cx:"19",cy:"12",r:"1.6"})]})};return a.jsx("svg",{...n,children:s[e]??s.grid})}function hn({size:e=16,className:t=""}){return a.jsxs("svg",{className:`hm-spin ${t}`.trim(),width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.24",strokeWidth:"2.4"}),a.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})]})}function Wn({label:e,size:t=18}){const{t:n}=Fe(),s=e??n("common.loading");return a.jsxs("div",{className:"hm-loader",role:"status","aria-live":"polite",children:[a.jsx(hn,{size:t}),s?a.jsx("span",{children:s}):null]})}function Xs({onRefresh:e,variant:t="btn",label:n,ariaLabel:s,busy:r=!1,disabled:i=!1,className:l=""}){const{t:o}=Fe(),c=n??o("common.refresh"),d=s??o("common.refresh"),[g,f]=u.useState(!1),[h,x]=u.useState(!1),b=u.useRef(null),w=u.useRef(!0);u.useEffect(()=>(w.current=!0,()=>{w.current=!1,clearTimeout(b.current)}),[]);const S=g||r,k=async()=>{if(S||i||!e)return;H("tap"),clearTimeout(b.current),x(!1),f(!0);const T=Date.now();let E=!0;try{await e()===!1&&(E=!1)}catch{E=!1}const _=Math.max(0,260-(Date.now()-T));_&&await new Promise(I=>setTimeout(I,_)),w.current&&(f(!1),E?(x(!0),b.current=setTimeout(()=>{w.current&&x(!1)},1100)):H("error"))},m=t==="icon"?"icon-btn":t==="link"?"link":"btn",v=t==="icon"?18:14;return a.jsxs("button",{type:"button",className:`${m} hm-refresh-btn${h?" is-done":""} ${l}`.trim(),onClick:k,disabled:S||i,"aria-busy":S,"aria-label":d,title:d,children:[a.jsx("span",{className:`hm-refresh-ico${S?" hm-spin":""}`,"aria-hidden":"true",children:a.jsx(Me,{name:h?"check":"refresh",size:v})}),t!=="icon"&&c?a.jsx("span",{children:S?o("common.refreshing"):h?o("common.refreshed"):c}):null]})}let Xk=0;const Xn=[];let pr=!1,$r=null,lo=!1,lm=!1;function Zk(){var t;if(lo){lo=!1;return}if(!Xn.length){pr=!1;return}const e=Xn.pop();Xn.length||(pr=!1),(t=e==null?void 0:e.close)==null||t.call(e)}function Qe({title:e,onClose:t,children:n,historyKey:s}){const{t:r}=Fe(),i=u.useRef(t);i.current=t,u.useEffect(()=>{var d,g;if(typeof window>"u"||!((d=window.history)!=null&&d.pushState)||((g=window.history.state)==null?void 0:g.hmSheet)==="inbox"||window.location.hash.startsWith("#inbox"))return;lm||(window.addEventListener("popstate",Zk),lm=!0),$r!==null&&(clearTimeout($r),$r=null);const o=`s-${++Xk}`,c={token:o,close:()=>{var f;return(f=i.current)==null?void 0:f.call(i)}};if(Xn.push(c),!pr)try{window.history.pushState({...window.history.state??{},hmSheetId:o},"",window.location.href),pr=!0}catch{const f=Xn.indexOf(c);f!==-1&&Xn.splice(f,1);return}return()=>{const f=Xn.indexOf(c);f!==-1&&Xn.splice(f,1),Xn.length===0&&pr&&$r===null&&($r=setTimeout(()=>{if($r=null,Xn.length===0&&pr){pr=!1,lo=!0;try{window.history.back()}catch{lo=!1}}},0))}},[s]);const l=()=>{H("tap"),t==null||t()};return a.jsx("div",{className:"sheet-wrap",onClick:l,children:a.jsxs("div",{className:"sheet",onClick:o=>o.stopPropagation(),children:[a.jsxs("div",{className:"sheet-head",children:[a.jsx("span",{children:e}),a.jsx("button",{className:"icon-btn",onClick:l,"aria-label":r("common.close"),children:a.jsx(Me,{name:"close",size:18})})]}),a.jsx("div",{className:"sheet-body",children:n})]})})}function Zn({onFire:e,ms:t=1500,label:n,sub:s,hint:r,tone:i="danger",disabled:l}){const[o,c]=u.useState(0),d=u.useRef(null),g=u.useRef(null),f=u.useRef(0),h=u.useCallback(()=>{clearTimeout(d.current),cancelAnimationFrame(g.current),c(0)},[]),x=u.useCallback(()=>{if(l)return;f.current=performance.now();const b=()=>{const w=Math.min(1,(performance.now()-f.current)/t);c(w),w<1&&(g.current=requestAnimationFrame(b))};g.current=requestAnimationFrame(b),d.current=setTimeout(()=>{h(),H("heavy"),e()},t)},[l,t,e,h]);return u.useEffect(()=>h,[h]),a.jsxs("button",{className:`hold ${i}`,disabled:l,onPointerDown:x,onPointerUp:h,onPointerLeave:h,onPointerCancel:h,children:[a.jsx("span",{className:"hold-fill",style:{transform:`scaleX(${o})`}}),a.jsx("span",{className:"hold-label",children:n}),r?a.jsx("span",{className:"hold-hint",children:r}):null,s?a.jsx("span",{className:"hold-sub",children:s}):null]})}const dv="hm.sound",om=.14,Ut={C5:523.25,E5:659.25,G5:783.99,C6:1046.5};function Zd(){try{return globalThis.localStorage??null}catch{return null}}function ep(e=Zd()){try{return(e==null?void 0:e.getItem(dv))!=="0"}catch{return!0}}function eb(e,t=Zd()){const n=!!e;try{t==null||t.setItem(dv,n?"1":"0")}catch{}return n}function tb(e){return 2**((Math.max(1,Math.min(7,Math.floor(Number(e)||1)))-1)*2/12)}function nb(e="tap",t=1){const n=(l,o,c,d="triangle",g=.1)=>({freq:Number(l.toFixed(2)),at:Number(o.toFixed(3)),dur:c,type:d,gain:Math.min(om,g)});let s;switch(e){case"send":s=[n(Ut.E5,0,.045,"sine",.065),n(Ut.G5,.03,.05,"sine",.055)];break;case"approve":case"stamp":s=[n(Ut.C5,0,.08,"triangle",.1),n(Ut.G5,.05,.08,"sine",.1)];break;case"launch":s=[n(Ut.C5,0,.08,"triangle",.1),n(Ut.E5,.045,.08,"triangle",.1),n(Ut.G5,.09,.1,"sine",.1)];break;case"combo":{const l=tb(t);s=[n(Ut.C5*l,0,.07,"sine",.09),n(Ut.E5*l,.045,.07,"sine",.09),n(Ut.G5*l,.09,.08,"sine",.09)];break}case"allClear":case"receipt":s=[n(Ut.C5,0,.16,"triangle",.11),n(Ut.E5,.05,.16,"sine",.11),n(Ut.G5,.1,.16,"sine",.11),n(Ut.C6,.15,.18,"sine",.1)];break;default:s=[n(Ut.C5,0,.05,"triangle",.06)]}const r=s.reduce((l,o)=>Math.max(l,o.at+o.dur),0),i=s.reduce((l,o)=>Math.max(l,o.gain),0);return{notes:s,total:Number(r.toFixed(3)),gain:Math.min(om,i)}}let Ec=null;function tp(e,t={}){if(!ep(t.storage??Zd()))return!1;const n=t.AudioContext??globalThis.AudioContext??globalThis.webkitAudioContext;if(typeof n!="function")return!1;try{Ec||(Ec=new n);const s=Ec;let r=null;if(typeof s.resume=="function")try{const o=s.resume();o&&typeof o.then=="function"&&(r=o,typeof o.catch=="function"&&o.catch(()=>{}))}catch{}const i=nb(e,t.combo),l=()=>{const o=Number(s.currentTime)||0;for(const c of i.notes){const d=s.createOscillator(),g=s.createGain();d.type=c.type,d.frequency.setValueAtTime(c.freq,o+c.at),g.gain.setValueAtTime(1e-4,o+c.at),g.gain.exponentialRampToValueAtTime(Math.max(2e-4,c.gain),o+c.at+.012),g.gain.exponentialRampToValueAtTime(1e-4,o+c.at+c.dur),d.connect(g),g.connect(s.destination),d.start(o+c.at),d.stop(o+c.at+c.dur+.02)}};return s.state==="suspended"&&r?r.then(l,()=>{}):l(),!0}catch{return!1}}const oo="hm.vibe",ss="dopamine",np="(prefers-reduced-motion: reduce)",$o=2e4,sb=99,rb="hm:vibe",Fu="hm:fx-burst",cm=["approve","stamp","fastTrack","launch"],ab={allClear:[10,30,16,30,40],receipt:[10,30,16,30,40],approve:"success",stamp:"success",fastTrack:"success",launch:"success",combo:"action",tap:"tap"},ib={allClear:"success",receipt:"success",approve:"success",stamp:"success",fastTrack:"success",launch:"success",combo:"action",tap:"tap"};function Ti(){try{return globalThis.localStorage??null}catch{return null}}function lb(e){if(e)return e;try{return globalThis.document??null}catch{return null}}function sp(e){if(e)return e;try{return globalThis.window??null}catch{return null}}function ob(){try{const e=globalThis.window;if(typeof(e==null?void 0:e.matchMedia)=="function")return t=>e.matchMedia(t)}catch{}return null}function bs(e){if(e==null)return null;const t=String(e).trim().toLowerCase();return t==="dopamine"||t==="dopa"?"dopamine":t==="serotonin"||t==="sero"||t==="calm"?"serotonin":null}function Fo(e){try{let t=e??ob();if(typeof t=="function"&&(t=t(np)),t&&typeof t.matches=="boolean")return t.matches}catch{}return!1}function cb(e=Ti(),t){let n=null;try{n=bs(e==null?void 0:e.getItem(oo))}catch{n=null}return n||(Fo(t)?"serotonin":ss)}function Bu(e,t){const n=bs(e)??ss,s=lb(t);try{const r=s==null?void 0:s.documentElement;r&&r.dataset&&r.dataset.vibe!==n&&(r.dataset.vibe=n)}catch{}return n}let ua=null;const Uu=new Set;let _s=null;function pv(e){for(const t of[...Uu])try{t(e)}catch{}}function hv(e){return Uu.add(e),()=>Uu.delete(e)}function gs(){return ua||(ua=cb()),ua}function um(e,t=Ti(),n,s){const r=bs(e)??ss;Bu(r,n),ua=r;try{t==null||t.setItem(oo,r)}catch{}pv(r);const i=sp(s);try{typeof(i==null?void 0:i.dispatchEvent)=="function"&&typeof globalThis.CustomEvent=="function"&&i.dispatchEvent(new globalThis.CustomEvent(rb,{detail:{vibe:r}}))}catch{}return r}function ub(e={}){const t=e.storage??Ti();let n=null;try{n=bs(t==null?void 0:t.getItem(oo))}catch{n=null}const s=n??(Fo(e.matchMedia)?"serotonin":ss);if(Bu(s,e.doc),ua=s,_s||n)return s;const r=sp(e.win);if(typeof(r==null?void 0:r.matchMedia)!="function")return s;try{_s=r.matchMedia(np);const i=()=>{var o;if(bs((o=Ti())==null?void 0:o.getItem(oo)))return;const l=Bu(_s.matches?"serotonin":ss,e.doc);ua=l,pv(l)};typeof _s.addEventListener=="function"?_s.addEventListener("change",i):typeof _s.addListener=="function"&&_s.addListener(i)}catch{_s=null}return s}function db(e,t={}){const n=bs(t.vibe)??ss,s=Number(t.now)||0,r=Number(t.windowMs)||$o;if(n!=="dopamine")return{combo:0,at:0};const i=Number(e==null?void 0:e.combo)||0,l=Number(e==null?void 0:e.at)||0;return{combo:i>0&&s>=l&&s-l<=r?Math.min(i+1,sb):1,at:s}}function pb(e,t={}){if((bs(t.vibe)??ss)!=="dopamine")return 0;const s=Number(e==null?void 0:e.combo)||0,r=Number(e==null?void 0:e.at)||0;if(s<=0)return 0;const i=Number(t.now)||0,l=Number(t.windowMs)||$o;return i<r||i-r<=l?s:0}class hb{constructor(t={}){this.vibe=t.vibe??ss,this.now=typeof t.now=="function"?t.now:()=>Date.now(),this.windowMs=Number(t.windowMs)||$o,this.state={combo:0,at:0},this.lastKind=null}get mode(){return bs(typeof this.vibe=="function"?this.vibe():this.vibe)??ss}get combo(){return pb(this.state,{vibe:this.mode,now:this.now(),windowMs:this.windowMs})}bump(t="tap"){return this.lastKind=t,this.state=db(this.state,{vibe:this.mode,now:this.now(),windowMs:this.windowMs}),this.state.combo}reset(){return this.state={combo:0,at:0},this.lastKind=null,0}}const dm=new hb({vibe:()=>gs()});function mb(e){const t=sp(e==null?void 0:e.target);try{if(typeof(t==null?void 0:t.dispatchEvent)!="function"||typeof globalThis.CustomEvent!="function")return!1;const n={kind:e.kind,combo:Number(e.combo)||0,x:Number.isFinite(e.x)?e.x:null,y:Number.isFinite(e.y)?e.y:null};return Number.isFinite(e.width)&&(n.width=e.width),Number.isFinite(e.height)&&(n.height=e.height),typeof e.sfx=="string"&&e.sfx&&(n.sfx=e.sfx),t.dispatchEvent(new globalThis.CustomEvent(Fu,{detail:n})),!0}catch{return!1}}function fb(e,t={}){const n=bs(t.vibe)??ss,s=Number(t.combo)||0,r={kind:e,vibe:n,combo:s,haptic:null,fx:!1,sound:!1};if(n==="serotonin"){const l=ib[e]??"tap";return typeof t.hapticFn=="function"&&t.hapticFn(l),r.haptic=l,r}const i=ab[e]??"success";return Array.isArray(i)?(typeof t.vibrateFn=="function"?t.vibrateFn(i):typeof t.hapticFn=="function"&&t.hapticFn("success"),r.haptic=i):(typeof t.hapticFn=="function"&&t.hapticFn(i),r.haptic=i),r.fx=mb({kind:e,combo:s,x:t.x,y:t.y,width:t.width,height:t.height,sfx:t.sfx,target:t.target}),typeof t.soundFn=="function"&&(r.sound=!!t.soundFn(e,{combo:s})),r}function bt(e,t={}){var g,f,h;const n=gs(),s=t.storage??Ti(),r=cm.includes(e)?dm.bump(e):dm.combo,i=r>1&&cm.includes(e)?"combo":e;let{x:l,y:o,width:c,height:d}=t;if(!Number.isFinite(l)&&!Number.isFinite(o))try{const x=(h=(f=(g=globalThis.document)==null?void 0:g.activeElement)==null?void 0:f.getBoundingClientRect)==null?void 0:h.call(f);x&&x.width>0&&x.height>0&&(l=Math.round(x.left+x.width/2),o=Math.round(x.top+x.height/2),c=Math.round(x.width),d=Math.round(x.height))}catch{}return fb(e,{vibe:n,combo:r,x:l,y:o,width:c,height:d,sfx:t.sfx,hapticFn:x=>H(x,void 0,s),vibrateFn:x=>Yk(x,void 0,s),soundFn:(x,b)=>t.sound===!1||!ep(s)?!1:tp(i??x,{combo:b==null?void 0:b.combo,storage:s})})}function gb({board:e,boards:t,defaultBoard:n,onClose:s,onCreated:r,notify:i}){var y,K;const{t:l}=Fe(),[o,c]=u.useState(e??n??null),[d,g]=u.useState(""),[f,h]=u.useState(""),[x,b]=u.useState(!1),[w,S]=u.useState(0),[k,m]=u.useState(""),[v,T]=u.useState(!1),[E,_]=u.useState(!1),I=u.useRef(`${Date.now()}-${Math.random().toString(36).slice(2,10)}`),A=u.useRef(null);u.useEffect(()=>{const $=setTimeout(()=>{var V;return(V=A.current)==null?void 0:V.focus()},150);return()=>clearTimeout($)},[]);const P=async()=>{const $=d.trim();if(!$){i==null||i(l("capture.needTitle"));return}if(!o){i==null||i(l("capture.needBoard"));return}T(!0);try{const V=await Y(`/api/boards/${encodeURIComponent(o)}/tasks`,{method:"POST",body:{title:$,body:f.trim(),priority:w,assignee:k.trim()||null,idempotencyKey:I.current}});if(!(V!=null&&V.ok)){i==null||i((V==null?void 0:V.error)||l("capture.failed"));return}i==null||i(V.created?l("capture.created",{id:V.task.id}):l("capture.already",{id:V.task.id})),H("action"),r==null||r(V.task),s==null||s()}catch(V){i==null||i(V.message)}finally{T(!1)}};return a.jsxs(Qe,{title:l("capture.title"),onClose:s,children:[a.jsxs("button",{className:"pick-item board-now",onClick:()=>{H("tap"),_($=>!$)},"aria-expanded":E,"aria-label":l("capture.boardAria"),children:[a.jsx("span",{"aria-hidden":"true",children:((y=(t??[]).find($=>$.slug===o))==null?void 0:y.icon)??"🗂"}),a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:((K=(t??[]).find($=>$.slug===o))==null?void 0:K.name)??l("capture.board")}),a.jsx("span",{className:"pick-sub",children:l("capture.boardPick")})]}),a.jsx("span",{className:"pick-meta",children:E?"▴":"▾"})]}),E?a.jsx("div",{className:"pick-list",style:{marginBottom:8},children:(t??[]).map($=>a.jsxs("button",{className:`pick-item${o===$.slug?" on":""}`,onClick:()=>{c($.slug),_(!1)},children:[a.jsx("span",{"aria-hidden":"true",children:$.icon}),a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:$.name})}),a.jsx("span",{className:"pick-meta",children:o===$.slug?"✓":""})]},$.slug))}):null,a.jsx("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:a.jsx("input",{ref:A,className:"inp",value:d,onChange:$=>g($.target.value.slice(0,200)),onKeyDown:$=>{$.key==="Enter"&&!$.nativeEvent.isComposing&&($.preventDefault(),P())},placeholder:l("capture.placeholder"),enterKeyHint:"done",autoCapitalize:"sentences"})}),a.jsx("p",{className:"capture-hint",children:l("capture.voiceHint")}),a.jsx("button",{className:"link",style:{marginTop:6},onClick:()=>b($=>!$),children:l(x?"capture.moreClose":"capture.moreOpen")}),x?a.jsxs("div",{style:{marginTop:6},children:[a.jsx("textarea",{className:"inp",rows:3,value:f,onChange:$=>h($.target.value.slice(0,4e3)),placeholder:l("capture.bodyPlaceholder"),style:{resize:"vertical",fontFamily:"inherit"}}),a.jsx("div",{style:{display:"flex",gap:6,marginTop:10},children:[{v:0,key:"capture.priorityNone"},{v:1,key:"capture.priorityLow"},{v:5,key:"capture.priorityMid"},{v:8,key:"capture.priorityHigh"}].map($=>a.jsx("button",{className:`chip${w===$.v?" on":""}`,onClick:()=>S($.v),children:l($.key)},$.v))}),a.jsx("input",{className:"inp",style:{marginTop:10},value:k,onChange:$=>m($.target.value.slice(0,64)),placeholder:l("capture.assigneePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1})]}):null,a.jsxs("button",{className:"btn hm-btn-inner",onClick:P,disabled:v||!d.trim(),"aria-busy":v,style:{marginTop:14},children:[v?a.jsx(hn,{size:14}):null,a.jsx("span",{children:l(v?"capture.submitting":"capture.submit")})]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 2px 18px",lineHeight:1.7},children:l("capture.note")})]})}const mv=280;function fv(e){return e<=4351||e>=8192&&e<=8205||e>=8208&&e<=8223||e>=8242&&e<=8247?1:2}function ai(e){if(!e)return 0;let t=0;for(const n of String(e))t+=fv(n.codePointAt(0));return t}function vb(e,t,n="…"){const s=String(e??""),r=Number(t);if(!Number.isFinite(r)||r<=0)return"";if(ai(s)<=r)return s;const i=String(n??""),l=ai(i);if(l>r)return"";const o=r-l;let c=0,d="";for(const g of s){const f=fv(g.codePointAt(0));if(c+f>o)break;c+=f,d+=g}return`${d}${i}`}function yb(e,{limit:t=mv,joiner:n=`
63
+ `,steps:s=[]}={}){const r=(Array.isArray(e)?e:[]).map(d=>String(d??"")),i=String(n??""),l=Number(t),o=d=>d.filter(Boolean).join(i),c=[];for(let d=0;d<s.length&&!(ai(o(r))<=l);d+=1){const g=s[d];if(!(!g||typeof g!="object")){if(Number.isInteger(g.drop)){g.drop>=0&&g.drop<r.length&&(r[g.drop]=""),c.push(d);continue}if(Array.isArray(g.set)&&g.set.length===2){const f=Number(g.set[0]);Number.isInteger(f)&&f>=0&&f<r.length&&(r[f]=String(g.set[1]??"")),c.push(d);continue}if(Number.isInteger(g.truncate)){const f=g.truncate;if(f>=0&&f<r.length&&r[f]){const h=r.filter((w,S)=>S!==f&&w),x=h.join(i),b=l-ai(x)-(h.length?ai(i):0);r[f]=vb(r[f],b)}c.push(d);continue}if(Array.isArray(g.cutAt)&&g.cutAt.length===2){const f=Number(g.cutAt[0]),h=String(g.cutAt[1]??"");Number.isInteger(f)&&f>=0&&f<r.length&&h&&r[f].includes(h)&&(r[f]=r[f].slice(0,r[f].lastIndexOf(h)).trimEnd()),c.push(d)}}}return{text:o(r),applied:c}}const ii=1200,li=630,ul=2,wb=["cost","cache","saved","zeroTyping","tests","duration","apiCalls","totalTokens"],xb=4;function kb(e){const t=Number(e);if(!Number.isFinite(t)||t<0)return"0";if(t>=1e6){const n=t/1e6;return`${n>=100?Math.round(n):Math.round(n*10)/10}M`}return t>=1e3?`${Math.round(t/1e3)}K`:String(Math.round(t))}function Le(e,t,n){return Oo(e,t,n)}function us(e,t,n){const s=(t==null?void 0:t.kpi)??{},r=Le(n,"receipt.value.na");switch(e){case"cost":return s.costUsd===null||s.costUsd===void 0?r:oa(s.costUsd);case"cache":return s.cachePct===null||s.cachePct===void 0?r:`${Wt(s.cachePct,{maximumFractionDigits:1})}%`;case"saved":return s.savedUsd===null||s.savedUsd===void 0?r:`~${oa(s.savedUsd)}`;case"zeroTyping":return s.zeroTypingScore===null||s.zeroTypingScore===void 0?r:`${Wt(s.zeroTypingScore,{maximumFractionDigits:0})}%`;case"tests":return s.tests===null||s.tests===void 0?r:Wt(s.tests,{maximumFractionDigits:0});case"duration":return s.durationMin===null||s.durationMin===void 0?r:s.durationCapped?Le(n,"receipt.value.over",{h:Wt((t==null?void 0:t.windowHours)??24,{maximumFractionDigits:0})}):Number(s.durationMin)>=60?Le(n,"receipt.value.hours",{h:Wt(Math.floor(Number(s.durationMin)/60),{maximumFractionDigits:0}),m:Wt(Math.round(Number(s.durationMin)%60),{maximumFractionDigits:0})}):Le(n,"receipt.value.min",{min:Wt(s.durationMin,{maximumFractionDigits:0})});case"apiCalls":return s.apiCalls===null||s.apiCalls===void 0?r:Le(n,"receipt.value.calls",{n:Wt(s.apiCalls,{maximumFractionDigits:0})});case"totalTokens":return s.totalTokens===null||s.totalTokens===void 0?r:kb(s.totalTokens);default:return r}}function Hu(e,t){if(e==null)return null;const n=Number(e);return!Number.isFinite(n)||n<=0?null:n>=60?Le(t,"receipt.value.hours",{h:Wt(Math.floor(n/60),{maximumFractionDigits:0}),m:Wt(Math.round(n%60),{maximumFractionDigits:0})}):Le(t,"receipt.value.min",{min:Wt(n,{maximumFractionDigits:0})})}function gv(e,t){const n=(e==null?void 0:e.kpi)??{};return wb.map(s=>({key:s,label:Le(t,`receipt.kpi.${s}`),value:us(s,e,t),note:s==="saved"&&n.savedUsd!==null&&n.savedUsd!==void 0?Le(t,"receipt.kpi.savedNote",{pct:Math.round((n.savedRatio??.9)*100)}):s==="zeroTyping"&&n.zeroTypingScore!==null&&n.zeroTypingScore!==void 0?Le(t,"receipt.kpi.zeroTypingNote"):s==="duration"&&(n.durationMin===null||n.durationMin===void 0)?Le(t,"receipt.kpi.durationNote",{hours:(e==null?void 0:e.windowHours)??24}):s==="duration"&&Hu(n.wallDurationMin,t)?Le(t,"receipt.kpi.wallNote",{wall:Hu(n.wallDurationMin,t)}):s==="tests"&&(n.tests===null||n.tests===void 0)?Le(t,"receipt.kpi.testsNote"):s==="apiCalls"&&(n.apiCalls===null||n.apiCalls===void 0)?Le(t,"receipt.kpi.apiCallsNote"):s==="apiCalls"?Le(t,"receipt.kpi.apiCallsScope"):s==="totalTokens"&&(n.totalTokens===null||n.totalTokens===void 0)?Le(t,"receipt.kpi.totalTokensNote"):s==="totalTokens"?Le(t,"receipt.kpi.totalTokensScope"):""}))}function rp(e){const t=String((e==null?void 0:e.label)??"").trim();if(t)return t;const n=String((e==null?void 0:e.board)??"").trim();return n||String((e==null?void 0:e.spec)??"").trim()||"—"}function co(e){const t=(e==null?void 0:e.kpi)??{},n=Number(t.batchesTotal),s=Number(t.batchesDone);return!Number.isFinite(s)||s<=0?null:!Number.isFinite(n)||n<=0?String(s):`${s}/${n}`}function bb(e,t={}){return Sb(e,t).text}function Sb(e,t={}){const n=t.lang,s=(e==null?void 0:e.kpi)??{},r=Number(s.batchesDone)||0,i=Number(s.batchesTotal)||r,l=co(e)??"—",o=Le(n,"receipt.share.batches",{batches:l,done:r,total:i}),c=`🏆 ${Le(n,"receipt.share.title")} — ${rp(e)}`,d=Hu(s.wallDurationMin,n),g=d?` (${Le(n,"receipt.share.wall",{wall:d})})`:"",f=v=>[`✅ ${o}`,`⏱ ${us("duration",e,n)}${v?g:""}`,`🧪 ${us("tests",e,n)} ${Le(n,"receipt.share.testsSuffix")}`,`🔌 ${us("apiCalls",e,n)}`,`🪙 ${us("totalTokens",e,n)} ${Le(n,"receipt.share.tokensSuffix")}`].join(" · "),h=f(!0),x=f(!1),b=`💰 ${us("cost",e,n)} · 💎 ${us("cache",e,n)} ${Le(n,"receipt.share.cacheSuffix")} · ✨ ${us("saved",e,n)} ${Le(n,"receipt.share.savedSuffix")}`,w=`👆 ${Wt(s.humanTaps??0)} ${Le(n,"receipt.share.tapsSuffix")} · 🖊 ${Wt(s.redlines??0)} ${Le(n,"receipt.share.redlinesSuffix")} · ⌨️ ${Wt(s.typedChars??0)} ${Le(n,"receipt.share.typedSuffix")} · ${us("zeroTyping",e,n)} ${Le(n,"receipt.share.zeroSuffix")}`,S=Le(n,"receipt.share.footer"),k=[{drop:4},{drop:3},{drop:2},{set:[1,x]},{truncate:0},{cutAt:[0," — "]}],m=Number.isFinite(Number(t.limit))?Number(t.limit):mv;return yb([c,h,b,w,S],{limit:m,steps:k})}function Nb(e,t){const n=new Date(Number(e==null?void 0:e.generatedAt)||Number(t)||Date.now()),s=l=>String(l).padStart(2,"0"),r=`${n.getFullYear()}${s(n.getMonth()+1)}${s(n.getDate())}-${s(n.getHours())}${s(n.getMinutes())}`;return`hermes-pilot-receipt-${String((e==null?void 0:e.board)??"pilot").replace(/[^a-z0-9-]/gi,"").slice(0,24)||"pilot"}-${r}.png`}function Tc(e,t,n,s,r,i){const l=Math.max(0,Math.min(i,s/2,r/2));e.beginPath(),e.moveTo(t+l,n),e.lineTo(t+s-l,n),e.arcTo(t+s,n,t+s,n+l,l),e.lineTo(t+s,n+r-l),e.arcTo(t+s,n+r,t+s-l,n+r,l),e.lineTo(t+l,n+r),e.arcTo(t,n+r,t,n+r-l,l),e.lineTo(t,n+l),e.arcTo(t,n,t+l,n,l),e.closePath()}function jb(e,t,n){const s=String(t??"");if(!s)return"";const r=typeof e.measureText=="function"?o=>{var c;return Number(((c=e.measureText(o))==null?void 0:c.width)??0)}:null;if(!r)return s.length*8<=n?s:`${s.slice(0,Math.max(1,Math.floor(n/8)-1))}…`;if(r(s)<=n)return s;let i=1,l=s.length;for(;i<l;){const o=Math.ceil((i+l)/2);r(`${s.slice(0,o)}…`)<=n?i=o:l=o-1}return`${s.slice(0,i)}…`}function Cb(e,t,n={}){const s=n.lang,i=(n.vibe==="serotonin"?"serotonin":"dopamine")==="dopamine",l=ii,o=li,c=gv(t,s),d=i?"#06202a":"#14161c",g=i?"#0b3440":"#1b1e26";let f=g;if(typeof e.createLinearGradient=="function"){const I=e.createLinearGradient(0,0,l,o);I.addColorStop(0,d),I.addColorStop(1,g),f=I}e.fillStyle=f,e.fillRect(0,0,l,o),e.lineWidth=3,e.strokeStyle=i?"#e8c47a":"#3a3f4b",Tc(e,24,24,l-48,o-48,26),e.stroke();const h=(I,A,P,{font:y,color:K,align:$="left",maxWidth:V}={})=>{e.font=y,e.fillStyle=K,e.textAlign=$,e.fillText(V?jb(e,I,V):String(I??""),A,P)},x="ui-monospace, SFMono-Regular, Menlo, monospace",b='-apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif',w=i?b:x,S=i?"SSR":Le(s,"receipt.badge.audit");Tc(e,60,62,i?92:168,34,17),e.fillStyle=i?"rgba(232,196,122,0.18)":"rgba(255,255,255,0.08)",e.fill(),h(S,60+(i?46:84),86,{font:`600 17px ${x}`,color:i?"#e8c47a":"#c9ced8",align:"center"}),h(i?Le(s,"receipt.canvas.titleDopamine"):Le(s,"receipt.canvas.titleSerotonin"),60,158,{font:`700 42px ${w}`,color:"#ffffff",maxWidth:l-120}),h(rp(t),60,200,{font:`500 24px ${b}`,color:i?"#8fe3d6":"#aab2c0",maxWidth:l-120});const k=[t!=null&&t.spec?String(t.spec):null,Le(s,"receipt.canvas.window",{hours:(t==null?void 0:t.windowHours)??24}),co(t)?Le(s,"receipt.canvas.batches",{batches:co(t)}):null].filter(Boolean).join(" · ");h(k,60,236,{font:`400 18px ${x}`,color:"#8b95a5",maxWidth:l-120});const m=20,v=xb,T=(l-120-m*(v-1))/v,E=128,_=272;return c.forEach((I,A)=>{const P=A%v,y=Math.floor(A/v),K=60+P*(T+m),$=_+y*(E+m);Tc(e,K,$,T,E,18),e.fillStyle=i?"rgba(255,255,255,0.06)":"rgba(255,255,255,0.04)",e.fill(),e.strokeStyle=i?"rgba(232,196,122,0.32)":"rgba(255,255,255,0.14)",e.lineWidth=1.5,e.stroke(),h(I.label,K+18,$+34,{font:`500 15px ${b}`,color:"#93a0b1",maxWidth:T-36}),h(I.value,K+18,$+86,{font:`700 32px ${i?b:x}`,color:i?"#ffd98a":"#f2f5fa",maxWidth:T-36})}),h(Le(s,"receipt.canvas.footer"),60,o-54,{font:`400 18px ${x}`,color:"#7d8798",maxWidth:l-120}),h(Le(s,"receipt.canvas.size"),l-60,o-54,{font:`400 16px ${x}`,color:"#5f6a7b",align:"right"}),{width:l,height:o,kpis:c}}function pm(){var e,t;try{return((t=(e=document.documentElement)==null?void 0:e.dataset)==null?void 0:t.vibe)==="serotonin"?"serotonin":"dopamine"}catch{return"dopamine"}}async function hm(e,t){if(typeof document>"u")return null;const n=document.createElement("canvas");n.width=ii*ul,n.height=li*ul;const s=n.getContext("2d");if(!s)return null;s.scale(ul,ul),Cb(s,e,t);const r=document.createElement("canvas");r.width=ii,r.height=li;const i=r.getContext("2d");return i?(i.drawImage(n,0,0,ii,li),new Promise(l=>{try{r.toBlob(o=>l(o??null),"image/png")}catch{l(null)}})):null}function ap({board:e=null,spec:t=null,hours:n=24,onClose:s,notify:r}){var y,K,$,V;const{t:i,lang:l}=Fe(),[o,c]=u.useState(null),[d,g]=u.useState(null),[f,h]=u.useState(!0),[x,b]=u.useState(!1),[w,S]=u.useState(pm),[k,m]=u.useState(null);u.useEffect(()=>{const D=()=>S(pm());return window.addEventListener("hm:vibe",D),()=>window.removeEventListener("hm:vibe",D)},[]),u.useEffect(()=>{let D=!0;const X=new URLSearchParams({hours:String(n)});return e&&X.set("board",e),t&&X.set("spec",t),h(!0),Y(`/api/telemetry/receipt?${X}`).then(ge=>{D&&(c(ge),g(null))}).catch(ge=>{D&&g((ge==null?void 0:ge.message)??i("receipt.failed"))}).finally(()=>{D&&h(!1)}),()=>{D=!1}},[e,t,n]),u.useEffect(()=>{if(!o)return;let D=!0,X=null;return hm(o,{lang:l,vibe:w}).then(ge=>{!D||!ge||(X=URL.createObjectURL(ge),m(X))}).catch(()=>{}),()=>{D=!1,X&&URL.revokeObjectURL(X)}},[o,l,w]);const v=o?gv(o,l):[],T=o?bb(o,{lang:l}):"",E=Array.isArray(o==null?void 0:o.missing)?o.missing:[],_=(o==null?void 0:o.scope)??null,I=_?[i("receipt.scope.usage",{sessions:Number(((y=_.usage)==null?void 0:y.sessionIds)??((K=o==null?void 0:o.kpi)==null?void 0:K.sessions)??0),tasks:Number(_.tasks??0)}),($=_.usage)!=null&&$.fallback?i("receipt.scope.fallback"):null].filter(Boolean).join(" · "):"",A=u.useCallback(async()=>{var D;if(!(!o||x)){H("tap"),b(!0);try{const X=await hm(o,{lang:l,vibe:w});if(!X)throw new Error(i("receipt.failed"));const ge=Nb(o),Z=typeof File=="function"?new File([X],ge,{type:"image/png"}):null;if(Z&&((D=navigator.canShare)!=null&&D.call(navigator,{files:[Z]})))try{await navigator.share({files:[Z],title:i("receipt.title"),text:T}),H("success");return}catch{}const G=URL.createObjectURL(X),q=document.createElement("a");q.href=G,q.download=ge,document.body.appendChild(q),q.click(),q.remove(),setTimeout(()=>URL.revokeObjectURL(G),4e3),H("success"),r==null||r(ge)}catch(X){H("error"),r==null||r((X==null?void 0:X.message)??i("receipt.failed"))}finally{b(!1)}}},[o,x,l,w,T,r,i]),P=u.useCallback(async()=>{var D;if(T){H("tap");try{if((D=navigator.clipboard)!=null&&D.writeText)await navigator.clipboard.writeText(T);else{const X=document.createElement("textarea");X.value=T,X.setAttribute("readonly",""),X.style.position="fixed",X.style.opacity="0",document.body.appendChild(X),X.select(),document.execCommand("copy"),X.remove()}H("success"),r==null||r(i("receipt.copied"))}catch{H("error"),r==null||r(i("receipt.copyFailed"))}}},[T,r,i]);return a.jsx(Qe,{title:i("receipt.title"),onClose:s,children:a.jsx("div",{className:`receipt-sheet is-${w}`,children:f?a.jsx(Wn,{label:i("receipt.loading")}):d?a.jsx("div",{className:"empty",children:d}):o?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"receipt-head",children:[a.jsx("span",{className:"receipt-head-icon","aria-hidden":"true",children:"🏆"}),a.jsxs("span",{className:"receipt-head-main",children:[a.jsx("span",{className:"receipt-head-title",children:rp(o)}),a.jsx("span",{className:"receipt-head-sub",children:[co(o),o.spec,i("receipt.canvas.window",{hours:o.windowHours??n}),tt(o.generatedAt)].filter(Boolean).join(" · ")})]})]}),k?a.jsx("img",{className:"receipt-preview",src:k,width:ii,height:li,alt:i("receipt.title")}):a.jsx("div",{className:"receipt-preview receipt-preview-empty","aria-hidden":"true"}),a.jsx("div",{className:"receipt-kpis",children:v.map(D=>a.jsxs("div",{className:"receipt-kpi",children:[a.jsx("span",{className:"receipt-kpi-label",children:D.label}),a.jsx("span",{className:"receipt-kpi-value",children:D.value}),D.note?a.jsx("span",{className:"receipt-kpi-note",children:D.note}):null]},D.key))}),I?a.jsx("div",{className:"receipt-note receipt-scope",children:I}):null,a.jsxs("div",{className:"receipt-actions",children:[a.jsx("button",{type:"button",className:"receipt-btn primary",onClick:A,disabled:x,children:i(x?"receipt.saving":"receipt.savePng")}),a.jsx("button",{type:"button",className:"receipt-btn",onClick:P,children:i("receipt.copyShare")})]}),a.jsx("div",{className:"receipt-note",children:i("receipt.shareNote")}),E.length?a.jsx("div",{className:"receipt-note warn",children:i("receipt.partial",{sources:E.join(", ")})}):null,a.jsx("div",{className:"receipt-note",children:i("receipt.savedNote",{pct:Math.round((((V=o==null?void 0:o.kpi)==null?void 0:V.savedRatio)??.9)*100)})})]}):a.jsx("div",{className:"empty",children:i("receipt.failed")})})})}function vv({data:e,hours:t=24,onClose:n,board:s=null,spec:r=null}){const{t:i}=Fe(),l=e==null?void 0:e.totals,o=!!(e!=null&&e.ok),[c,d]=u.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx(Qe,{title:i("usage.title",{hours:t}),onClose:n,children:o?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"report-card-btn primary receipt-open-btn",onClick:()=>{H("tap"),d(!0)},children:i("receipt.create")}),a.jsxs("div",{className:"card",style:{marginBottom:10},children:[a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.cost")}),a.jsx("b",{children:oa(l.cost)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.input")}),a.jsx("b",{children:Is(l.input)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.output")}),a.jsx("b",{children:Is(l.output)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.cacheRead")}),a.jsxs("b",{children:[Is(l.cacheRead)," (",uk(e.cacheHitRate),")"]})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.apiCalls")}),a.jsx("b",{children:Wt(l.calls)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.sessions")}),a.jsx("b",{children:i("usage.sessionSummary",{sessions:l.sessions,messages:l.messages,tools:l.tools})})]})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:i("usage.byModel")})}),a.jsx("div",{className:"row-sub",style:{padding:"0 2px 6px",lineHeight:1.6},children:i("usage.byModelNote")}),a.jsxs("div",{className:"list",children:[(e.models??[]).map(g=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:g.model}),a.jsx("span",{className:"row-sub",children:i("usage.modelLine",{input:Is(g.input),output:Is(g.output),cache:Is(g.cacheRead),calls:g.calls})})]}),a.jsx("span",{className:"mono",style:{fontSize:12},children:oa(g.cost)})]},g.model)),(e.models??[]).length?null:a.jsx("div",{className:"empty",children:i("usage.none")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:i("usage.topSessions")})}),a.jsxs("div",{className:"list",children:[(e.topSessions??[]).map(g=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:g.title}),a.jsx("span",{className:"row-sub",children:i("usage.sessionLine",{source:g.source||"—",profile:g.profile&&g.profile!=="default"?` ・ ${g.profile}`:"",input:Is(g.input),output:Is(g.output),at:tt(g.at)})})]}),a.jsx("span",{className:"mono",style:{fontSize:12},children:oa(g.cost)})]},`${g.profile??"default"}:${g.id}`)),(e.topSessions??[]).length?null:a.jsx("div",{className:"empty",children:i("usage.none")})]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 4px 18px",lineHeight:1.7},children:i("usage.footnote")})]}):a.jsx("div",{className:"empty",children:(e==null?void 0:e.reason)??i("usage.failed")})}),c?a.jsx(ap,{board:s,spec:r,hours:t,onClose:()=>d(!1)}):null]})}const oi=4e3,Eb=["feature","ux","bug"],yv=Object.freeze(["zero-stop","visual-gate"]),uo="zero-stop";function ip(e){const t=String(e??"").trim().toLowerCase();return yv.includes(t)?t:uo}function Tb(e){return ip(e)==="visual-gate"?"seed.policyVisualGate":"seed.policyZeroStop"}function Ab(e){return ip(e)==="visual-gate"?"seed.policyVisualGateHint":"seed.policyZeroStopHint"}function mm(e){const t=String(e??"").trim();return t.length>0&&t.length<=oi}function wv({seedText:e,autoStart:t=!1,executionPolicy:n=uo,board:s,repo:r=null,chat:i=null,lang:l="ja"}){const o={seedText:String(e??"").trim().slice(0,oi),autoStart:!!t,executionPolicy:ip(n),runner:"hermes",lang:l==="en"?"en":"ja"};return s&&(o.board=String(s)),r&&(o.repo=String(r)),i&&(o.chat=String(i)),o}function Rb(e){switch(e){case"running":return"seed.statusRunning";case"awaiting_review":return"seed.statusAwaitingReview";case"awaiting_spec":return"seed.statusAwaiting";case"spec_ready":return"seed.statusReady";case"launched":return"seed.statusLaunched";case"failed":return"seed.statusFailed";default:return"seed.statusUnknown"}}const Pb=Object.freeze(["running","awaiting_review","awaiting_spec","failed"]);function Ib(e){const t=String((e==null?void 0:e.queueState)??"");return t==="queued"?"seed.queueQueued":t==="running"?"seed.queueRunning":null}function lp(e){return String((e==null?void 0:e.queueState)??"")==="queued"}function _b(e){return lp(e)?"seed.statusQueued":Rb(e==null?void 0:e.status)}function fm(e){return`/api/architect/jobs/${encodeURIComponent(String(e??""))}/dismiss`}const gm=4e3,Mb=2e4;function xv(e,t=[],n=""){const s=(Array.isArray(e)?e:[]).filter(c=>c&&Pb.includes(String(c.status))&&!c.dismissed),r=new Set((Array.isArray(t)?t:[]).map(c=>String(c))),i=s.filter(c=>!r.has(String(c.id)));if(!i.length)return null;const l=String(n??"").trim(),o=c=>l&&String(c.board??"")===l?0:1;return i.sort((c,d)=>{const g=l?o(c)-o(d):0;if(g)return g;const f=(Number(d.createdAt)||0)-(Number(c.createdAt)||0);return f||(c.status==="failed"?0:1)-(d.status==="failed"?0:1)})[0]}function Lb(e){switch(String((e==null?void 0:e.phase)??"")){case"spawning":return"seed.phaseSpawning";case"round1_sheet":return"seed.phaseRound1Sheet";case"awaiting_review":return"seed.statusAwaitingReview";case"round2_spec":return"seed.phaseRound2Spec";case"spec_ready":return"seed.statusReady";case"launched":return"seed.statusLaunched";case"failed":return"seed.statusFailed";default:return null}}function Ob(e){const t=String((e==null?void 0:e.sheetPath)??"").trim();if(!t)return"";const n=t.split(/[\\/]/);return String(n[n.length-1]??"").trim()}function Db(e){return e?String(e.status)==="failed"?!0:!!e.stalled:!1}function $b(e){return(Array.isArray(e)?e:[]).filter(t=>t&&!t.dismissed&&["running","awaiting_spec"].includes(String(t.status))).length}function kv(e){const t=String((e==null?void 0:e.status)??"");return lp(e)||t==="running"||t==="awaiting_spec"?gm:Mb}function Fb(){return"seed.runnerHermes"}function Bb(e){const t=Math.max(0,Math.floor((Number(e)||0)/1e3));return{h:Math.floor(t/3600),m:Math.floor(t%3600/60),s:t%60}}function bv({specReady:e=[],pending:t=[]}={}){const n=(Array.isArray(e)?e:[]).find(r=>r&&!r.launched&&Number(r.batchCount)>0);if(n){const r=(Array.isArray(n.batches)?n.batches:[]).map(i=>String((i==null?void 0:i.id)??"")).filter(Boolean);return{kind:"ready",path:String(n.spec),title:String(n.title??n.spec),count:Number(n.batchCount)||r.length,ids:r,jobId:n.jobId??null,autoStart:!!n.autoStart,board:n.board??null}}const s=(Array.isArray(t)?t:[]).find(r=>r&&Number(r.pendingCount)>0);return s?{kind:"pending",path:String(s.path),title:String(s.title??s.path),count:Number(s.pendingCount)||0,ids:(Array.isArray(s.pending)?s.pending:[]).map(r=>String(r??"")).filter(Boolean),jobId:null,autoStart:!1,board:s.board??null}:null}function Sv({board:e="",repo:t=null,chat:n=null,initialText:s="",onClose:r,onSeeded:i,notify:l}){const{t:o,lang:c}=Fe(),[d,g]=u.useState(s),[f,h]=u.useState(!1),[x,b]=u.useState(uo),[w,S]=u.useState(!1),[k,m]=u.useState(null),v=u.useRef(null);u.useEffect(()=>{const _=setTimeout(()=>{var I;return(I=v.current)==null?void 0:I.focus()},150);return()=>clearTimeout(_)},[]);const T=u.useCallback(_=>{var A;const I=o(`seed.tpl.${_}Text`);g(P=>{const y=String(P??"");return y.startsWith(I)?y:`${I}${y}`.slice(0,oi)}),(A=v.current)==null||A.focus()},[o]),E=u.useCallback(async()=>{if(!(w||!mm(d))){S(!0),m(null);try{const _=await Y("/api/architect/seed",{method:"POST",body:wv({seedText:d,autoStart:f,executionPolicy:x,board:e,repo:t,chat:n,lang:c})});try{bt("launch")}catch{}l==null||l(o("seed.toast")),i==null||i(_),r==null||r()}catch(_){m((_==null?void 0:_.message)??o("seed.failed")),S(!1)}}},[f,e,w,n,x,c,l,r,i,t,o,d]);return a.jsxs(Qe,{title:`📝 ${o("seed.title")}`,onClose:()=>!w&&(r==null?void 0:r()),children:[a.jsx("p",{className:"seed-lead",children:o("seed.lead")}),a.jsxs("div",{className:"seed-row",children:[a.jsx("span",{className:"seed-label",children:o("seed.runner")}),a.jsx("span",{className:"pill on",children:o("seed.runnerHermes")})]}),a.jsx("textarea",{ref:v,className:"seed-input",value:d,maxLength:oi,placeholder:o("seed.placeholder"),onChange:_=>g(_.target.value),rows:4,"aria-label":o("seed.placeholder"),enterKeyHint:"done"}),a.jsxs("div",{className:"seed-actions",children:[a.jsx("span",{className:"seed-hint seed-hint-inline",children:o("seed.voiceHint")}),a.jsxs("span",{className:"seed-count",children:[d.length,"/",oi]})]}),a.jsx("div",{className:"chips seed-templates",children:Eb.map(_=>a.jsx("button",{type:"button",className:"chip",onClick:()=>T(_),children:o(`seed.tpl.${_}`)},_))}),a.jsx("div",{className:"seed-row seed-policy-head",children:a.jsx("span",{className:"seed-label",children:o("seed.policy")})}),a.jsx("div",{className:"seed-seg",role:"group","aria-label":o("seed.policyAria"),children:yv.map(_=>a.jsxs("button",{type:"button",className:`seed-seg-btn${x===_?" on":""}`,"aria-pressed":x===_,onClick:()=>b(_),children:[a.jsx("span",{className:"seed-seg-name",children:o(Tb(_))}),_===uo?a.jsx("span",{className:"seed-seg-tag",children:o("seed.policyDefault")}):null]},_))}),a.jsx("p",{className:"seed-hint seed-policy-hint",children:o(Ab(x))}),a.jsxs("label",{className:"seed-toggle",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:_=>{h(_.target.checked),_.target.checked&&bt("approve")}}),a.jsxs("span",{children:[o("seed.autoStart"),a.jsx("br",{}),a.jsx("span",{className:"seed-hint",children:o("seed.autoStartHint")})]})]}),k?a.jsx("div",{className:"seed-error",children:k}):null,a.jsx("button",{type:"button",className:"seed-submit",disabled:w||!mm(d),onClick:E,children:w?o("seed.submitting"):`✨ ${o("seed.submit")}`})]})}const Ub=[{id:"feature",key:"brainstorm.angleFeature"},{id:"ux",key:"brainstorm.angleUx"},{id:"edge",key:"brainstorm.angleEdge"}],Hb=[{id:"css",key:"refactor.scopeCss"},{id:"code",key:"refactor.scopeCode"},{id:"rules",key:"refactor.scopeRules"},{id:"perf",key:"refactor.scopePerf"}];function Ac(e,t,n){const s=String(e??"").trim(),r=[];return t.includes("feature")&&r.push(n("brainstorm.tpl.feature1",{topic:s}),n("brainstorm.tpl.feature2")),t.includes("ux")&&r.push(n("brainstorm.tpl.ux1"),n("brainstorm.tpl.ux2")),t.includes("edge")&&r.push(n("brainstorm.tpl.edge1"),n("brainstorm.tpl.edge2")),r.map((i,l)=>({id:`bs_${Date.now()}_${l}`,text:i,done:!1}))}function zb({initialSeed:e="",board:t="",repo:n=null,onClose:s,notify:r}){const{t:i}=Fe(),[l,o]=u.useState(e),[c,d]=u.useState(["feature","ux"]),[g,f]=u.useState(()=>e?Ac(e,["feature","ux"],i):[]),[h,x]=u.useState(!1),b=m=>{d(v=>v.includes(m)?v.length>1?v.filter(T=>T!==m):v:[...v,m])},w=()=>{l.trim()&&(f(Ac(l,c,i)),bt("approve"))},S=async()=>{if(!(!l.trim()&&!g.length)){x(!0);try{const m=g.length?g:Ac(l,c,i);await Y("/api/memos",{method:"POST",body:{title:l.trim().split(`
64
+ `)[0].slice(0,60)||i("brainstorm.title"),body:l.trim(),tags:["brainstorm",...c],kind:"note",color:"violet",checklist:m,source:{board:t||void 0,repo:n||void 0}}}),window.dispatchEvent(new CustomEvent("hm:memos-changed")),bt("launch"),r==null||r(i("brainstorm.saved")),s==null||s()}catch(m){r==null||r((m==null?void 0:m.message)||"Error")}finally{x(!1)}}},k=()=>{const m=g.map(T=>`- [ ] ${T.text}`).join(`
65
+ `),v=[l.trim(),m].filter(Boolean).join(`
66
+
67
+ `);window.dispatchEvent(new CustomEvent("hm:discuss-pipeline",{detail:{prompt:v,board:t||void 0,repoPath:n||void 0}})),s==null||s()};return a.jsxs(Qe,{title:`🧠 ${i("brainstorm.title")}`,onClose:s,children:[a.jsx("p",{className:"seed-lead",children:i("brainstorm.lead")}),a.jsx("textarea",{rows:3,className:"seed-input",value:l,placeholder:i("brainstorm.placeholder"),onChange:m=>o(m.target.value)}),a.jsx("div",{className:"list-head",style:{marginTop:10},children:i("brainstorm.angles")}),a.jsx("div",{className:"chips",style:{padding:0,flexWrap:"wrap"},children:Ub.map(m=>a.jsx("button",{type:"button",className:`chip${c.includes(m.id)?" on":""}`,onClick:()=>b(m.id),children:i(m.key)},m.id))}),a.jsx("button",{type:"button",className:"btn",style:{width:"100%",marginTop:10},disabled:!l.trim(),onClick:w,children:i("brainstorm.generate")}),g.length?a.jsx("div",{className:"memo-checklist",style:{marginTop:10},children:g.map(m=>a.jsxs("button",{type:"button",className:`memo-check-row${m.done?" done":""}`,onClick:()=>f(v=>v.map(T=>T.id===m.id?{...T,done:!T.done}:T)),children:[a.jsx("span",{"aria-hidden":"true",children:m.done?"☑":"☐"}),a.jsx("span",{children:m.text})]},m.id))}):null,a.jsxs("div",{className:"memo-editor-actions",style:{marginTop:12},children:[a.jsx("button",{type:"button",className:"btn primary",disabled:h||!l.trim()&&!g.length,onClick:S,children:i("brainstorm.saveMemo")}),a.jsx("button",{type:"button",className:"btn",disabled:!l.trim()&&!g.length,onClick:k,children:i("brainstorm.sendChat")})]})]})}function Wb({board:e="",onClose:t,notify:n}){const{t:s}=Fe(),[r,i]=u.useState(["css","code","rules"]),[l,o]=u.useState(""),[c,d]=u.useState(!1),[g,f]=u.useState(null),h=b=>{i(w=>w.includes(b)?w.length>1?w.filter(S=>S!==b):w:[...w,b])},x=async()=>{if(!(c||!e)){d(!0),f(null);try{const b=r.map(S=>s(`refactor.scope${S.charAt(0).toUpperCase()}${S.slice(1)}`)),w=[`Scopes: ${b.join(", ")}`,l.trim()?`Target: ${l.trim()}`:"Target: full repository","Check alignment with project rules (SOUL.md, OAuth boundary, i18n, 390px responsive) and remove local duplication/bloat."].join(`
68
+ `);await Y(`/api/boards/${encodeURIComponent(e)}/tasks`,{method:"POST",body:{title:`[REFACTOR] ${b[0]}${l.trim()?` (${l.trim()})`:""}`,body:w,priority:1}}),bt("launch"),n==null||n(s("refactor.launched")),t==null||t()}catch(b){f((b==null?void 0:b.message)||s("refactor.failed")),d(!1)}}};return a.jsxs(Qe,{title:`🛠 ${s("refactor.title")}`,onClose:()=>!c&&(t==null?void 0:t()),children:[a.jsx("p",{className:"seed-lead",children:s("refactor.lead")}),a.jsx("div",{className:"list-head",children:s("refactor.scope")}),a.jsx("div",{className:"chips",style:{padding:0,flexWrap:"wrap"},children:Hb.map(b=>a.jsx("button",{type:"button",className:`chip${r.includes(b.id)?" on":""}`,onClick:()=>h(b.id),children:s(b.key)},b.id))}),a.jsx("input",{type:"text",className:"memo-input",style:{marginTop:10},value:l,placeholder:s("refactor.targetPh"),onChange:b=>o(b.target.value)}),g?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:g}):null,a.jsx("button",{type:"button",className:"btn primary",style:{width:"100%",marginTop:12},disabled:c||!e,onClick:x,children:s("refactor.launch")})]})}function Nv({banner:e,onFile:t,busy:n=!1,onDismiss:s,onPreview:r}){const{t:i}=Fe();if(!e)return null;const l=e.kind==="ready";return a.jsxs("div",{className:"spec-banner",role:"region","aria-label":i("seed.bannerAria"),children:[a.jsxs("div",{className:"spec-banner-main",children:[a.jsx("span",{className:"spec-banner-title",children:l?i("seed.bannerTitle",{n:e.count}):i("seed.bannerPending",{n:e.count})}),a.jsx("span",{className:"spec-banner-sub",children:e.title})]}),a.jsxs("div",{className:"spec-banner-actions",children:[a.jsx("button",{type:"button",className:"spec-banner-btn",disabled:n,onClick:()=>{H("action"),t==null||t(e)},children:n?i("seed.submitting"):`🚀 ${i("seed.bannerAction")}`}),r?a.jsx("button",{type:"button",className:"spec-banner-btn ghost",onClick:()=>{H("tap"),r(e)},children:`📄 ${i("seed.bannerPreview")}`}):null]}),s?a.jsx("button",{type:"button",className:"attach-x","aria-label":i("seed.bannerLater"),onClick:()=>{H("tap"),s(e)},children:"×"}):null]})}const Vb=["http:","https:","mailto:"],Kb=/[\u0000-\u0020\u00a0\u1680\u2000-\u200f\u2028\u2029\u202f\u205f\u3000\ufeff]/g;function Qb(e){const t=String(e??"").trim();if(!t)return null;const n=t.replace(Kb,"");if(!n)return null;const s=/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(n);if(!s)return null;const r=`${s[1].toLowerCase()}:`;return Vb.includes(r)?n:null}const zu="`",vm=new RegExp(`^\\s{0,3}(${zu}{3,}|~{3,})\\s*([A-Za-z0-9_+#.-]*)\\s*$`),ym=/^\s{0,3}(#{1,6})\s+(.*)$/,Rc=/^\s{0,3}>\s?(.*)$/,dl=/^\s{0,3}[-*+]\s+(.*)$/,Pc=/^\s{0,3}(\d{1,9})[.)]\s+(.*)$/,Gb=new RegExp('^\\[([^\\][\\n]*)\\]\\(([^)\\s]+)(?:\\s+"[^"]*")?\\)'),Al=/^\s{0,3}\|.*\|\s*$/,Yb=/^\s*:?-{2,}:?\s*$/;function Rl(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function Ic(e){if(!Al.test(e))return!1;const t=Rl(e);return t.length>0&&t.every(n=>Yb.test(n))}function hr(e){const t=String(e??""),n=[];let s="";const r=()=>{if(!s)return;const l=n[n.length-1];l&&l.type==="text"?l.value+=s:n.push({type:"text",value:s}),s=""};let i=0;for(;i<t.length;){const l=t[i];if(l===zu){const o=t.indexOf(zu,i+1);if(o>i+1){r(),n.push({type:"code",value:t.slice(i+1,o)}),i=o+1;continue}}else if(l==="*"&&t[i+1]==="*"){const o=t.indexOf("**",i+2);if(o>i+2){r(),n.push({type:"strong",children:hr(t.slice(i+2,o))}),i=o+2;continue}}else if(l==="["){const o=Gb.exec(t.slice(i));if(o){r();const c=Qb(o[2]);n.push({type:"link",href:c,bare:c?null:o[2],children:hr(o[1])}),i+=o[0].length;continue}}s+=l,i+=1}return r(),n}function jv(e){const t=String(e??"").replace(/\r\n?/g,`
69
+ `).split(`
70
+ `),n=[];let s=0;for(;s<t.length;){const r=t[s];if(!r.trim()){s+=1;continue}const i=vm.exec(r);if(i){const d=i[1],g=[];for(s+=1;s<t.length;){if(t[s].trim().startsWith(d)){s+=1;break}g.push(t[s]),s+=1}n.push({type:"code",lang:i[2]||"code",value:g.join(`
71
+ `)});continue}const l=ym.exec(r);if(l){n.push({type:"heading",level:Math.min(l[1].length,3),children:hr(l[2].replace(/\s+#+\s*$/,""))}),s+=1;continue}if(Al.test(r)&&Ic(t[s+1]??"")){const d=Rl(r).map(h=>hr(h)),g=Rl(t[s+1]).map(h=>h.startsWith(":")&&h.endsWith(":")?"center":h.endsWith(":")?"right":h.startsWith(":")?"left":null);s+=2;const f=[];for(;s<t.length&&Al.test(t[s])&&!Ic(t[s]);){const h=Rl(t[s]),x=d.map((b,w)=>hr(h[w]??""));f.push(x),s+=1}n.push({type:"table",head:d,aligns:g,rows:f});continue}if(Rc.test(r)){const d=[];for(;s<t.length;){const g=Rc.exec(t[s]);if(!g)break;d.push(g[1]),s+=1}n.push({type:"quote",blocks:jv(d.join(`
72
+ `))});continue}if(dl.test(r)||Pc.test(r)){const d=!dl.test(r),g=d?Pc:dl,f=[];for(;s<t.length;){const h=g.exec(t[s]);if(!h)break;f.push({children:hr(d?h[2]:h[1])}),s+=1}n.push({type:"list",ordered:d,items:f});continue}const o=[];for(;s<t.length;){const d=t[s];if(!d.trim()||vm.test(d)||ym.test(d)||Al.test(d)&&Ic(t[s+1]??"")||Rc.test(d)||dl.test(d)||Pc.test(d))break;o.push(d),s+=1}o.length||(o.push(r),s+=1);const c=[];o.forEach((d,g)=>{g&&c.push({type:"br"}),c.push(...hr(d.trim()))}),n.push({type:"paragraph",children:c})}return n}function mr(e,t="i"){return(e??[]).map((n,s)=>{const r=`${t}-${s}`;if(n.type==="code")return ze.createElement("code",{key:r,className:"md-code"},n.value);if(n.type==="strong")return ze.createElement("strong",{key:r},mr(n.children,r));if(n.type==="br")return ze.createElement("br",{key:r});if(n.type==="link"){const i=mr(n.children,r);return n.href?ze.createElement("a",{key:r,className:"md-link",href:n.href,target:"_blank",rel:"noopener noreferrer"},...i):ze.createElement("span",{key:r,className:"md-link-bare"},...i,n.bare?` (${n.bare})`:"")}return n.value})}function Cv(e,t,n){const s=`b-${t}`,{onCopyCode:r,copyLabel:i}=n;if(e.type==="code"){const l=ze.createElement("div",{className:"code-head"},ze.createElement("span",null,e.lang),r?ze.createElement("button",{type:"button",className:"code-copy",onClick:o=>{o.stopPropagation(),r(e.value)}},i):null);return ze.createElement("div",{key:s,className:"code-block"},l,ze.createElement("pre",null,ze.createElement("code",null,e.value)))}if(e.type==="heading"){const l=`h${e.level}`;return ze.createElement(l,{key:s,className:`md-h${e.level}`},mr(e.children,s))}if(e.type==="table"){const l=o=>{var c;return(c=e.aligns)!=null&&c[o]?{textAlign:e.aligns[o]}:void 0};return ze.createElement("div",{key:s,className:"md-table-wrap"},ze.createElement("table",{className:"md-table",style:{"--md-cols":e.head.length}},ze.createElement("thead",null,ze.createElement("tr",null,e.head.map((o,c)=>ze.createElement("th",{key:`${s}-h-${c}`,style:l(c)},mr(o,`${s}-h-${c}`))))),ze.createElement("tbody",null,e.rows.map((o,c)=>ze.createElement("tr",{key:`${s}-r-${c}`},o.map((d,g)=>ze.createElement("td",{key:`${s}-r-${c}-${g}`,style:l(g)},mr(d,`${s}-r-${c}-${g}`))))))))}if(e.type==="quote")return ze.createElement("blockquote",{key:s,className:"md-quote"},e.blocks.map((l,o)=>Cv(l,o,n)));if(e.type==="list"){const l=e.ordered?"ol":"ul";return ze.createElement(l,{key:s,className:"md-list"},e.items.map((o,c)=>ze.createElement("li",{key:`${s}-${c}`},mr(o.children,`${s}-${c}`))))}return ze.createElement("p",{key:s,className:"md-p"},mr(e.children,s))}function ci(e,t={}){const n=jv(e),s={onCopyCode:t.onCopyCode??null,copyLabel:t.copyLabel??"Copy"};return ze.createElement("div",{className:"md-body"},n.map((r,i)=>Cv(r,i,s)))}function Jb({board:e=null,repo:t=null,path:n,title:s=null,onClose:r}){const{t:i}=Fe(),[l,o]=u.useState({loading:!0,data:null,error:null}),[c,d]=u.useState(!1);u.useEffect(()=>{let h=!0;o({loading:!0,data:null,error:null});const x=new URLSearchParams;return e&&x.set("board",e),t&&x.set("repo",t),n&&x.set("path",n),Y(`/api/specs/content?${x.toString()}`).then(b=>{h&&o({loading:!1,data:b,error:null})}).catch(b=>{h&&o({loading:!1,data:null,error:(b==null?void 0:b.message)??i("tasks.specMdFailed")})}),()=>{h=!1}},[e,t,n,i]);const g=u.useCallback(async h=>{var x,b,w;try{await((w=(b=(x=globalThis.navigator)==null?void 0:x.clipboard)==null?void 0:b.writeText)==null?void 0:w.call(b,h)),H("tap"),d(!0),setTimeout(()=>d(!1),1600)}catch{}},[]),f=l.data;return a.jsxs(Qe,{title:i("tasks.specMdTitle"),onClose:r,children:[a.jsxs("div",{className:"spec-md-meta",children:[a.jsx("span",{className:"spec-md-path mono",title:(f==null?void 0:f.path)??n,children:(f==null?void 0:f.path)??n}),a.jsx("span",{className:"spec-md-sub",children:[f!=null&&f.batchCount?i("tasks.specBatchCount",{n:f.batchCount}):null,f!=null&&f.mtime?i("tasks.specUpdated",{when:tt(f.mtime)}):null].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:"spec-md-actions",children:[a.jsx("button",{type:"button",className:"btn spec-md-copy",disabled:!(f!=null&&f.markdown),onClick:()=>{H("action"),g((f==null?void 0:f.markdown)??"")},children:i(c?"tasks.specMdCopied":"tasks.specMdCopy")}),a.jsx("button",{type:"button",className:"btn spec-md-close",onClick:()=>{H("tap"),r==null||r()},children:i("tasks.specMdBack")})]}),f!=null&&f.truncated?a.jsx("div",{className:"spec-md-warn",children:i("tasks.specMdTruncated")}):null,a.jsxs("div",{className:"spec-md-body",children:[l.loading?a.jsx(Wn,{label:i("tasks.specMdLoading")}):null,l.error?a.jsx("div",{className:"spec-md-error",children:l.error}):null,f!=null&&f.markdown?ci(f.markdown,{onCopyCode:g,copyLabel:i("tasks.specMdCopyCode")}):null]})]})}function qb(e){const t=String(e??"").trim();return t.length>40?`${t.slice(0,40)}…`:t}function Ev({job:e,board:t="",repo:n=null,chat:s=null,onRetried:r,onDismiss:i,onInspect:l,notify:o}){const{t:c,lang:d}=Fe(),[g,f]=u.useState(()=>Date.now()),[h,x]=u.useState(!1),[b,w]=u.useState(null),S=String((e==null?void 0:e.status)??""),k=S==="running"||S==="awaiting_spec",m=lp(e),v=Ib(e),T=Lb(e),E=Ob(e),_=!!(e!=null&&e.stalled),I=Db(e);u.useEffect(()=>{if(!k)return;f(Date.now());const V=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(V)},[k,e==null?void 0:e.id]),u.useEffect(()=>{w(null)},[e==null?void 0:e.id]);const A=u.useMemo(()=>{const V=Number((e==null?void 0:e.startedAt)??(e==null?void 0:e.createdAt)??0);if(!k||!V)return null;const D=Bb(g-V);return m?D.h>0?c("seed.elapsedWaitingHour",D):c("seed.elapsedWaiting",D):D.h>0?c("seed.elapsedHour",D):c("seed.elapsed",D)},[k,m,e==null?void 0:e.startedAt,e==null?void 0:e.createdAt,g,c]),P=u.useCallback(()=>{H("tap");try{window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:(e==null?void 0:e.reviewTaskId)??null,jobId:(e==null?void 0:e.id)??null}}))}catch{}},[e==null?void 0:e.reviewTaskId,e==null?void 0:e.id]),y=u.useCallback(()=>{if(e){if(H("tap"),l){l(e);return}try{const V=e.taskId?"hm:open-task":"hm:open-live";window.dispatchEvent(new CustomEvent(V,{detail:{taskId:e.taskId??null,board:e.board??t??null,jobId:e.id??null}}))}catch{}}},[e,t,l]),K=u.useCallback(async()=>{if(!e)return;H("tap");const V=String(e.id);try{await Y(fm(V),{method:"POST"})}catch{}i==null||i(V)},[e,i]),$=u.useCallback(async()=>{if(!(h||!e)){H("action"),x(!0),w(null);try{await Y("/api/architect/seed",{method:"POST",body:wv({seedText:e.seed,autoStart:!!e.autoStart,executionPolicy:e.executionPolicy,board:t||e.board,repo:n,chat:s??e.chat??null,lang:d})});try{await Y(fm(String(e.id)),{method:"POST"})}catch{}i==null||i(String(e.id)),o==null||o(c("seed.retried")),await(r==null?void 0:r(e))}catch(V){w((V==null?void 0:V.message)??c("seed.retryFailed"))}finally{x(!1)}}},[h,e,t,n,s,d,o,r,i,c]);return e?k?a.jsxs("div",{className:`job-bar${m?" queued":""}${_?" stalled":""}`,role:"status","aria-live":"polite","aria-label":c("seed.jobAria"),children:[a.jsxs("div",{className:"job-bar-row",children:[m?a.jsx("span",{className:"job-bar-wait","aria-hidden":"true",children:"⏳"}):a.jsx(hn,{size:14}),a.jsx("span",{className:"job-bar-title",children:c(_b(e))}),v?a.jsx("span",{className:`job-bar-state${m?" queued":" running"}`,children:c(v)}):null,A?a.jsx("span",{className:"job-bar-elapsed",children:A}):null,a.jsx("span",{className:"job-bar-runner",children:c(Fb())})]}),T||E?a.jsxs("div",{className:"job-bar-row job-bar-meta",children:[T?a.jsx("span",{className:"job-bar-phase","aria-label":c("seed.phaseAria"),children:c(T)}):null,E?a.jsx("span",{className:"job-bar-file",title:String(e.sheetPath??""),children:c("seed.sheetLabel",{name:E})}):null]}):null,e.seed?a.jsx("div",{className:"job-bar-sub",children:qb(e.seed)}):null,_?a.jsx("div",{className:"job-bar-sub job-bar-warn",children:c("seed.stalled")}):null,a.jsxs("div",{className:"job-bar-actions",children:[a.jsxs("button",{type:"button",className:"job-bar-btn",onClick:y,"aria-label":c("seed.inspectAria"),children:["🔍 ",c("seed.inspect")]}),I?a.jsx("button",{type:"button",className:"job-bar-btn",disabled:h,onClick:$,children:h?`⏳ ${c("seed.retrying")}`:`🔄 ${c("seed.retryHermes")}`}):null,i?a.jsx("button",{type:"button",className:"job-bar-x","aria-label":c("seed.jobDismiss"),onClick:K,children:"×"}):null]}),b?a.jsx("div",{className:"job-bar-sub job-bar-error",children:b}):null]}):S==="awaiting_review"?a.jsxs("div",{className:"job-bar review",role:"status","aria-live":"polite","aria-label":c("seed.jobAria"),children:[a.jsxs("div",{className:"job-bar-row",children:[a.jsxs("span",{className:"job-bar-title",children:["📝 ",c("seed.statusAwaitingReview")]}),e.taskId?a.jsx("span",{className:"job-bar-runner",children:c("seed.jobTask",{id:e.taskId})}):null]}),a.jsx("div",{className:"job-bar-sub",children:e.reviewTitle||e.seed}),a.jsxs("div",{className:"job-bar-actions",children:[a.jsxs("button",{type:"button",className:"job-bar-btn",onClick:P,children:["🔍 ",c("seed.openReview")]}),a.jsx("button",{type:"button",className:"job-bar-btn",onClick:y,"aria-label":c("seed.inspectAria"),children:c("seed.inspect")})]})]}):a.jsxs("div",{className:`job-bar failed${_?" stalled":""}`,role:"alert","aria-label":c("seed.jobAria"),children:[a.jsxs("div",{className:"job-bar-row",children:[a.jsxs("span",{className:"job-bar-title",children:["⚠️ ",c("seed.statusFailed")]}),T?a.jsx("span",{className:"job-bar-phase",children:c(T)}):null]}),a.jsx("div",{className:"job-bar-sub job-bar-error",children:b??e.error??c("seed.statusFailed")}),a.jsxs("div",{className:"job-bar-actions",children:[a.jsx("button",{type:"button",className:"job-bar-btn",disabled:h,onClick:$,children:h?`⏳ ${c("seed.retrying")}`:`🔄 ${c("seed.retryHermes")}`}),a.jsx("button",{type:"button",className:"job-bar-btn",onClick:y,"aria-label":c("seed.inspectAria"),children:c("seed.inspect")}),i?a.jsx("button",{type:"button",className:"job-bar-x","aria-label":c("seed.jobDismiss"),onClick:K,children:"×"}):null]})]}):null}function pl(e){if(e==null)return"—";const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,"0")}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,"0")}m`}const Xb={spawning:"live.architectPhaseSpawning",round1_sheet:"live.architectPhaseRound1Sheet",awaiting_review:"live.architectPhaseAwaitingReview",round2_spec:"live.architectPhaseRound2Spec",spec_ready:"live.architectPhaseSpecReady",launched:"live.architectPhaseLaunched",failed:"live.architectPhaseFailed"};function Zb(e,t){const n=Xb[String(t??"")];return n?e(n):String(t??"—")}function eS(e){const t=String(e??"").split(`
73
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,72):""}function tS(e){return e.stalled?"blocked":e.status==="awaiting_review"?"ready":e.status==="failed"?"failed":"running"}function Tv({onClose:e,notify:t,onAbortTask:n}){const{t:s}=Fe(),[r,i]=u.useState(null),[l,o]=u.useState(!1),c=u.useCallback(async()=>{try{const S=await Y("/api/live");i(S)}catch(S){i({ok:!1,reason:S.message,turns:[],tasks:[]})}},[]);u.useEffect(()=>{c();const S=setInterval(()=>document.visibilityState==="visible"&&c(),5e3);return()=>clearInterval(S)},[c]);const d=async S=>{o(!0);try{await Y(`/api/boards/${encodeURIComponent(S.board)}/tasks/${encodeURIComponent(S.id)}/abort`,{method:"POST",body:{reason:s("live.abortReason")}}),t==null||t(s("live.aborted",{id:S.id})),await c(),n==null||n()}catch(k){t==null||t(k.message)}finally{o(!1)}},g=(r==null?void 0:r.turns)??[],f=(r==null?void 0:r.tasks)??[],h=(r==null?void 0:r.architect)??[],x=S=>{window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:S.reviewTaskId??null,board:S.reviewBoard??S.board??null}})),e==null||e()},b=S=>{window.dispatchEvent(new CustomEvent("hm:open-task",{detail:{board:S.board??null,taskId:S.taskId}})),e==null||e()},w=async S=>{if(S!=null&&S.id){o(!0);try{await Y(`/api/architect/jobs/${encodeURIComponent(S.id)}/dismiss`,{method:"POST"}),t==null||t(s("live.architectDismissed",{id:S.id})),await c()}catch(k){t==null||t(k.message)}finally{o(!1)}}};return a.jsxs(Qe,{title:s("live.title"),onClose:e,children:[r&&!r.ok?a.jsx("div",{className:"empty",children:r.reason}):null,a.jsxs("div",{className:"strip",style:{gridTemplateColumns:h.length?"repeat(3, 1fr)":"repeat(2, 1fr)"},children:[a.jsxs("div",{className:`stat ${g.length?"warn":""}`,children:[a.jsx("span",{className:"stat-k",children:s("live.turns")}),a.jsx("span",{className:"stat-v",children:g.length})]}),a.jsxs("div",{className:`stat ${f.length?"warn":""}`,children:[a.jsx("span",{className:"stat-k",children:s("live.tasks")}),a.jsx("span",{className:"stat-v",children:f.length})]}),h.length?a.jsxs("div",{className:`stat ${h.some(S=>S.stalled)?"bad":"warn"}`,children:[a.jsx("span",{className:"stat-k",children:s("live.architectShort")}),a.jsx("span",{className:"stat-v",children:h.length})]}):null]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:s("live.architect")})}),a.jsxs("div",{className:"list",children:[h.map(S=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${tS(S)}`}),a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:eS(S.seed)||S.runnerLabel||S.board||S.id}),a.jsx("span",{className:"row-sub",children:[S.runnerLabel,S.board,Zb(s,S.phase),pl(S.elapsedSec)].filter(Boolean).join(" ・ ")}),S.stalled?a.jsx("span",{className:"row-sub",style:{color:"var(--bad)"},children:s("live.architectStalled")}):null,a.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap",marginTop:6},children:[S.status==="awaiting_review"?a.jsx("button",{className:"chip on",onClick:()=>x(S),children:s("live.architectQuickReview")}):null,S.taskId?a.jsx("button",{className:"chip",onClick:()=>b(S),children:s("live.architectOpenTask")}):null,a.jsx("button",{className:"chip",disabled:l,onClick:()=>w(S),children:s("live.architectDismiss")})]})]})]},S.id??`${S.board}:${S.startedAt}`)),h.length?null:a.jsx("div",{className:"empty",children:s("live.architectNone")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:s("live.turn")})}),a.jsxs("div",{className:"list",children:[g.map(S=>{var k;return a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:"dot running"}),a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:S.title}),a.jsxs("span",{className:"row-sub",children:[S.platform||S.source||"—",S.profile&&S.profile!=="default"?` ・ ${S.profile}`:""," ・ ",pl(S.elapsedSec),S.lastTool?` ・ tool: ${S.lastTool.name}`:S.lastActivity?` ・ ${S.lastActivity}`:""]}),(k=S.lastTool)!=null&&k.at?a.jsxs("span",{className:"row-sub",style:{opacity:.75},children:[s("live.lastTool",{time:tt(S.lastTool.at)}),S.expiresInSec!=null?` ・ ${s("live.lease",{time:pl(S.expiresInSec)})}`:""]}):null]}),S.discordUrl?a.jsx("button",{className:"link",onClick:()=>window.open(S.discordUrl,"_blank","noopener"),"aria-label":s("live.openInDiscord"),children:"#"}):null]},`${S.profile??"default"}:${S.sessionId}`)}),g.length?null:a.jsx("div",{className:"empty",children:s("live.noTurns")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:s("live.task")})}),a.jsxs("div",{className:"list",children:[f.map(S=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:"dot running"}),a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:S.title}),a.jsxs("span",{className:"row-sub",children:[S.boardName||S.board," ・ ",pl(S.elapsedSec),S.workerPid?` ・ pid ${S.workerPid}`:""]})]})]},`${S.board}:${S.id}`)),f.length?null:a.jsx("div",{className:"empty",children:s("live.noTasks")})]}),f.length?a.jsx("div",{style:{marginTop:12},children:a.jsx(Zn,{label:s("live.abortAll",{count:f.length}),sub:s("live.abortAllSub"),tone:"danger",disabled:l,onFire:async()=>{for(const S of f)await d(S)}})}):null,a.jsx("div",{className:"row-sub",style:{padding:"12px 2px 18px",lineHeight:1.7},children:s("live.note")})]})}function Av({board:e,taskId:t,note:n="",notify:s,onClosed:r,label:i}){const{t:l}=Fe(),[o,c]=u.useState(!1),[d,g]=u.useState(null),f=async h=>{g(h);try{const x=await Y(`/api/boards/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/close`,{method:"POST",body:{action:h,note:String(n??"").slice(0,400)}}),b=x!=null&&x.noop?l("close.alreadyDone"):l("close.done"),w=x!=null&&x.noop?l("close.alreadyCancelled"):l("close.cancelled");s==null||s(h==="done"?b:w),c(!1),r==null||r(x)}catch(x){s==null||s(x.message)}finally{g(null)}};return a.jsxs("div",{className:"close-actions",children:[a.jsx("button",{className:"btn",type:"button",onClick:()=>c(h=>!h),children:o?l("close.menuClose"):i??l("close.title")}),o?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row-sub",style:{marginTop:8,lineHeight:1.6},children:l("close.help")}),a.jsxs("div",{style:{display:"grid",gap:8,marginTop:8},children:[a.jsx(Zn,{tone:"safe",label:l("close.doneLabel"),sub:l("close.doneSub"),disabled:!!d,onFire:()=>f("done")}),a.jsx(Zn,{tone:"danger",label:l("close.cancelLabel"),sub:l("close.cancelSub"),disabled:!!d,onFire:()=>f("cancel")})]})]}):null]})}const wm={needs_input:"inbox.kind.needsInput",dependency:"inbox.kind.dependency",failure:"inbox.kind.failure",untyped:"inbox.kind.untyped"};function nS({onClose:e,notify:t,onChanged:n,focusTaskId:s=null}){const{t:r}=Fe(),[i,l]=u.useState(null),[o,c]=u.useState({}),[d,g]=u.useState(null),[f,h]=u.useState(!1),x=u.useCallback(async()=>{try{l(await Y("/api/inbox"))}catch(y){l({ok:!1,items:[],reason:y.message})}},[]);u.useEffect(()=>{x();const y=setInterval(()=>document.visibilityState==="visible"&&x(),15e3);return()=>clearInterval(y)},[x]);const b=async y=>{const K=(o[y.id]??"").trim();if(!K){t==null||t(r("inbox.needComment"));return}g(y.id);try{await Y(`/api/boards/${encodeURIComponent(y.board)}/tasks/${encodeURIComponent(y.id)}/comment`,{method:"POST",body:{body:K}}),c($=>({...$,[y.id]:""})),t==null||t(r("inbox.commented")),await x(),n==null||n()}catch($){t==null||t($.message)}finally{g(null)}},w=async y=>{const K=(o[y.id]??"").trim();g(y.id);try{await Y(`/api/boards/${encodeURIComponent(y.board)}/tasks/${encodeURIComponent(y.id)}/unblock`,{method:"POST",body:{note:K}}),c($=>({...$,[y.id]:""})),t==null||t(r("inbox.reopened",{id:y.id})),await x(),n==null||n()}catch($){t==null||t($.message)}finally{g(null)}},S=(i==null?void 0:i.items)??[],k=S.filter(Lu),m=S.filter(y=>!Lu(y)),v=y=>s?[...y].sort((K,$)=>K.id===s?-1:$.id===s?1:0):y,T=v(m),E=v(k),_=!!s&&S.some(y=>y.id===s),I=f||_&&E.some(y=>y.id===s),A=k.length?r("inbox.titleWithAnswered",{pending:T.length,answered:k.length}):r("inbox.title",{pending:T.length}),P=(y,K)=>a.jsxs("div",{className:"card",style:{marginBottom:10,opacity:K?.75:1},children:[a.jsx("div",{className:"row-title",style:{fontSize:13},children:y.title}),a.jsxs("div",{className:"row-sub",style:{marginTop:4},children:[y.boardName," ・ ",wm[y.blockKind??"untyped"]?r(wm[y.blockKind??"untyped"]):y.blockKind,y.recurrences?` ・ ${r("inbox.recurrences",{n:y.recurrences})}`:"",y.blockedAt?` ・ ${tt(y.blockedAt)}`:"",K?` ・ ${r("inbox.answeredWaiting")}`:""]}),y.reason?a.jsx("div",{className:"body-text",style:{marginTop:8},children:y.reason}):null,y.lastComment?a.jsxs("div",{className:"row-sub",style:{marginTop:8,lineHeight:1.6},children:[r("inbox.lastComment",{author:y.lastComment.author||"—",at:tt(y.lastComment.at)}),a.jsx("br",{}),y.lastComment.body]}):null,a.jsx("textarea",{className:"inp",rows:2,style:{marginTop:10,resize:"vertical",fontFamily:"inherit"},placeholder:r(K?"inbox.placeholderAnswered":"inbox.placeholder"),value:o[y.id]??"",onChange:$=>c(V=>({...V,[y.id]:$.target.value.slice(0,2e3)}))}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8,width:"100%"},disabled:d===y.id||!(o[y.id]??"").trim(),"aria-busy":d===y.id,onClick:()=>{H("action"),b(y)},children:[d===y.id?a.jsx(hn,{size:14}):null,a.jsx("span",{children:d===y.id?r("inbox.sending"):r("inbox.sendComment")})]}),a.jsxs("button",{className:"btn primary hm-btn-inner",style:{marginTop:6,width:"100%"},disabled:d===y.id,"aria-busy":d===y.id,onClick:()=>{H("action"),w(y)},children:[d===y.id?a.jsx(hn,{size:14}):null,a.jsx("span",{children:(o[y.id]??"").trim()?r("inbox.answerResume"):r("inbox.resume")})]}),a.jsx(Av,{board:y.board,taskId:y.id,note:o[y.id]??"",notify:t,onClosed:async()=>{c($=>({...$,[y.id]:""})),await x(),n==null||n()}})]},`${y.board}:${y.id}`);return a.jsxs(Qe,{title:A,onClose:e,children:[i&&!i.ok?a.jsx("div",{className:"empty",children:i.reason??r("inbox.failed")}):null,!S.length&&(i!=null&&i.ok)?a.jsx("div",{className:"empty",children:r("inbox.empty")}):null,_?a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:r("inbox.focused")}):null,T.map(y=>P(y,!1)),!T.length&&k.length&&(i!=null&&i.ok)?a.jsx("div",{className:"empty",children:r("inbox.allAnswered",{n:k.length})}):null,k.length?a.jsx("button",{className:"btn",style:{width:"100%",marginBottom:10},onClick:()=>h(y=>!y),children:I?r("inbox.hideAnswered"):r("inbox.showAnswered",{n:k.length})}):null,I?E.map(y=>P(y,!0)):null,a.jsx("div",{className:"row-sub",style:{padding:"6px 2px 18px",lineHeight:1.7},children:r("inbox.note")})]})}const sS=/^\[([^\]]+)\]/;function Rv(e){var t;return((t=sS.exec(String(e??"")))==null?void 0:t[1])??null}const rS=new Set(["done","archived"]);function xm(e,t){const n=new Map;for(const l of Array.isArray(t)?t:[]){const o=Rv(l==null?void 0:l.title);!o||n.has(o)||n.set(o,l)}const s=(Array.isArray(e)?e:[]).map(l=>String((l==null?void 0:l.id)??"")).filter(Boolean),r=s.length>0&&s.every(l=>n.has(l)),i=r&&s.every(l=>{var o;return rS.has(String(((o=n.get(l))==null?void 0:o.status)??""))});return{byId:n,allFiled:r,allDone:i}}const aS=680,iS=820;function Pv(e){return"(min-width: "+e+"px)"}const Wu=Pv(aS),Vu=Pv(iS);function po(e){try{return typeof window>"u"||typeof window.matchMedia!="function"?!1:!!window.matchMedia(e).matches}catch{return!1}}function lS(){return po(Wu)}function oS(){return po(Vu)}function op(){const[e,t]=u.useState(()=>({split:lS(),wide:oS()}));return u.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=[];for(const i of[Wu,Vu])try{n.push(window.matchMedia(i))}catch{}const s=()=>t(i=>{const l={split:po(Wu),wide:po(Vu)};return i.split===l.split&&i.wide===l.wide?i:l}),r=()=>s();s();for(const i of n)typeof i.addEventListener=="function"?i.addEventListener("change",r):typeof i.addListener=="function"&&i.addListener(r);return()=>{for(const i of n)try{typeof i.removeEventListener=="function"?i.removeEventListener("change",r):typeof i.removeListener=="function"&&i.removeListener(r)}catch{}}},[]),e}function cS(e){return String((e==null?void 0:e.kind)??"")}function uS(e=[]){const t=[];let n=null;for(const s of e??[]){if(!s)continue;const r=Number(s.at??0);if(cS(s)!=="heartbeat"){t.push(s),n=null;continue}if(n&&t[t.length-1]===n){n.count+=1,n.firstAt=r;continue}n={kind:"heartbeat",count:1,at:r,firstAt:r},t.push(n)}return t}const cp="hm.repo",Iv="hm.repoRecent",_v="hm.board",Ku="hm.pendingRepo",Mv="hm.reviewRepo",Lv=6,dS=4;function km(e){const t=Array.isArray(e)?e.filter(Boolean):[];if(!t.length)return C("repo.noBoard");const n=t.map(l=>String(l.slug??l.name??"")).filter(Boolean);if(!n.length)return C("repo.noBoard");const s=n.slice(0,3),r=n.length-s.length,i=r>0?C("repo.boardMore",{rest:r}):"";return C("repo.boardCount",{count:n.length,names:s.join(" / "),tail:i})}function pS(e){const t=Array.isArray(e)?e.filter(n=>n&&n.slug):[];return t.length?t.find(n=>n.current)??t[0]:null}function Ov(e=globalThis.localStorage){try{const t=e==null?void 0:e.getItem(Iv),n=JSON.parse(t??"[]");return Array.isArray(n)?n.filter(s=>typeof s=="string"&&s).slice(0,Lv):[]}catch{return[]}}function hS(e=globalThis.localStorage){try{return(e==null?void 0:e.getItem(cp))||null}catch{return null}}function mS(e=[],t=[],n=dS){const s=Array.isArray(e)?e.filter(o=>o&&o.id):[],r=new Map(s.map(o=>[o.id,o])),i=[],l=new Set;for(const o of t){const c=r.get(o);if(!(!c||l.has(o))&&(i.push(c),l.add(o),i.length>=n))break}for(const o of s){if(i.length>=n)break;l.has(o.id)||(i.push(o),l.add(o.id))}return{rows:i,total:s.length,hidden:Math.max(0,s.length-i.length)}}function za(e){return String((e==null?void 0:e.label)??(e==null?void 0:e.id)??"")}function bm(e=globalThis.localStorage){try{const t=e==null?void 0:e.getItem(Mv);if(t)return String(t);const n=e==null?void 0:e.getItem(cp);return n?String(n):""}catch{return""}}function fS(e=globalThis.localStorage,t=""){const n=String(t??"");if(!e||!n)return"";try{return e.setItem(Mv,n),n}catch{return""}}function gS(e=globalThis.localStorage,t={}){var r;const n=String((t==null?void 0:t.id)??""),s=String(((r=t==null?void 0:t.board)==null?void 0:r.slug)??"");if(!e)return{repo:null,board:null};try{if(n&&e.setItem(cp,n),s&&e.setItem(_v,s),n){const i=[n,...Ov(e).filter(l=>l!==n)].slice(0,Lv);e.setItem(Iv,JSON.stringify(i))}return{repo:n||null,board:s||null}}catch{return{repo:n||null,board:s||null}}}function vS(e=[],t=""){const n=r=>String(r??"").trim().replace(/\/+$/,"").toLowerCase(),s=n(t);return!s||!Array.isArray(e)?null:e.find(r=>(r==null?void 0:r.path)&&n(r.path)===s)??null}function Sm(e=globalThis.localStorage){try{const t=e==null?void 0:e.getItem(Ku);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.repoId!="string"||!n.repoId?null:{repoId:n.repoId,profile:typeof n.profile=="string"&&n.profile?n.profile:""}}catch{return null}}function hl(e=globalThis.localStorage,t=null){var n;if(e)try{t!=null&&t.repoId?e.setItem(Ku,JSON.stringify({repoId:t.repoId,profile:t.profile||""})):(n=e.removeItem)==null||n.call(e,Ku)}catch{}}const Qu=[{id:"overlap",emoji:"💥",key:"annot.stamp.overlap",instruction:"Fix element overlap around this marked area."},{id:"spacing",emoji:"📏",key:"annot.stamp.spacing",instruction:"Adjust padding and spacing balance here."},{id:"overflow",emoji:"✂️",key:"annot.stamp.overflow",instruction:"Fix horizontal overflow or truncated text here."},{id:"contrast",emoji:"🎨",key:"annot.stamp.contrast",instruction:"Improve text/background contrast ratio here."},{id:"shift_up",emoji:"🔼",key:"annot.stamp.shift_up",instruction:"Shift this element up to clear the bottom bar."},{id:"remove",emoji:"🗑️",key:"annot.stamp.remove",instruction:"Remove or hide this element."}],ml={x0:.35,y0:.35,x1:.65,y1:.65},Nm=1e3,yS=new Map(Qu.map(e=>[e.id,e]));function Dv(e){return yS.get(String(e??""))||null}function wS(e){const t=Dv(e);return t?{id:t.id,label:t.key,instruction:t.instruction}:null}function jm(e){var n,s;const t=Array.isArray(e)?e:[];return t.length?((s=(n=t[t.length-1])==null?void 0:n.stamp)==null?void 0:s.id)??null:null}function xS(e,t,n){const s=Array.isArray(e)?e:[],r=wS(t);if(!r)return{strokes:s,stroke:null,stamp:null,created:!1};const i=s[s.length-1];if(i){const g={...i,stamp:r};return{strokes:[...s.slice(0,-1),g],stroke:g,stamp:r,created:!1}}const l=Number(n==null?void 0:n.w)>0?Number(n.w):Nm,o=Number(n==null?void 0:n.h)>0?Number(n.h):Nm,c=g=>Math.round(g*10)/10,d={tool:"rect",auto:!0,points:[[c(ml.x0*l),c(ml.y0*o)],[c(ml.x1*l),c(ml.y1*o)]],stamp:r};return{strokes:[...s,d],stroke:d,stamp:r,created:!0}}function kS(e,t){const n=Number(t==null?void 0:t.width)||0,s=Number(t==null?void 0:t.height)||0,r=(i,l)=>l>0?Math.round(i/l*1e3)/1e3:0;return(Array.isArray(e)?e:[]).map(i=>{const l={tool:String((i==null?void 0:i.tool)||"pen"),points:(Array.isArray(i==null?void 0:i.points)?i.points:[]).map(o=>[r(Number(o==null?void 0:o[0])||0,n),r(Number(o==null?void 0:o[1])||0,s)])};return i!=null&&i.stamp&&(l.stamp={id:i.stamp.id,label:i.stamp.label,instruction:i.stamp.instruction}),i!=null&&i.auto&&(l.auto=!0),l})}function $v(e){var n;const t=[];for(const s of Array.isArray(e)?e:[]){const r=s==null?void 0:s.stamp;r&&t.push({index:t.length+1,stroke:s,stamp:r,emoji:((n=Dv(r.id))==null?void 0:n.emoji)??"🏷️"})}return t}function bS(e){return $v(e).map(t=>`#${t.index} ${t.emoji} ${t.stamp.instruction}`)}const SS="[Stamps]";function NS(e,t){const n=String(e??"").trim(),s=bS(t);if(!s.length)return n;const r=[SS,...s].join(`
74
+ `);return n?`${n}
75
+ ${r}`:r}const up="hm.snippetBars.v1",Fv=Object.freeze(["chat","annotation","term"]),Pl=Object.freeze({chat:!0,annotation:!0,term:!0}),ho="hm:snippet-bars";function Bv(e){if(e)return e;try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function dp(e){const t={...Pl};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const n of Fv){const s=e[n];typeof s=="boolean"?t[n]=s:s==="true"?t[n]=!0:s==="false"?t[n]=!1:s===1?t[n]=!0:s===0&&(t[n]=!1)}return t}function Sa(e){const t=Bv(e);if(!t)return{...Pl};try{const n=t.getItem(up);return n?dp(JSON.parse(n)):{...Pl}}catch{return{...Pl}}}function jS(e,t){const n=Bv(t),s=Sa(n),r=e&&typeof e=="object"&&!Array.isArray(e)?{...s,...e}:s,i=dp(r);try{n==null||n.setItem(up,JSON.stringify(i))}catch{}return i}function CS(e,t,n={}){if(!Fv.includes(e))return Sa(n.storage);const s=jS({[e]:t!==!1},n.storage);return ES(s,n.target),s}function ES(e,t){const n=t??(typeof window<"u"?window:null);if(!n||typeof n.dispatchEvent!="function")return;let s;try{s=new CustomEvent(ho,{detail:e})}catch{s={type:ho,detail:e}}n.dispatchEvent(s)}function Uv(e,t){const n=typeof window<"u"?window:null;if(!n||typeof n.addEventListener!="function")return()=>{};const s=i=>e(dp(i==null?void 0:i.detail)),r=i=>{i&&i.key&&i.key!==up||e(Sa())};return n.addEventListener(ho,s),n.addEventListener("storage",r),()=>{n.removeEventListener(ho,s),n.removeEventListener("storage",r)}}const TS=[{id:"pen",key:"annot.tool.pen",icon:"✏️"},{id:"arrow",key:"annot.tool.arrow",icon:"↗"},{id:"rect",key:"annot.tool.rect",icon:"▭"}],Cm="#e11d48",AS="#f59e0b",RS="#231603",PS=560;function Em({item:e,onClose:t,onSubmitted:n,notify:s}){var M,W;const{t:r}=Fe(),i=u.useRef(null),l=u.useRef(null),o=u.useRef(null),c=u.useRef([]),[d,g]=u.useState("pen"),[f,h]=u.useState(!1),[x,b]=u.useState(!1),[w,S]=u.useState(null),[k,m]=u.useState(""),[v,T]=u.useState(0),[E,_]=u.useState(null),[I,A]=u.useState(!1),[P,y]=u.useState(!1),[K,$]=u.useState(!1),[V,D]=u.useState(()=>Sa());u.useEffect(()=>Uv(D),[]);const[X,ge]=u.useState(!1),[Z,G]=u.useState(!1),q=u.useRef(null),ce=`/api/review/${e.id}/image`,te=I?`${ce}?compare=1`:ce,pe=u.useCallback(()=>{const L=l.current,se=i.current;if(!L||!se||!L.naturalWidth)return null;const ue=se.parentElement.clientWidth,U=se.parentElement.clientHeight,ee=Math.min(ue/L.naturalWidth,U/L.naturalHeight);return{w:Math.round(L.naturalWidth*ee),h:Math.round(L.naturalHeight*ee),ratio:ee}},[]),ve=u.useCallback(()=>{const L=i.current,se=l.current,ue=pe();if(!L||!se||!ue)return;const U=window.devicePixelRatio||1;L.style.width=`${ue.w}px`,L.style.height=`${ue.h}px`,L.width=Math.round(ue.w*U),L.height=Math.round(ue.h*U);const ee=L.getContext("2d");ee.setTransform(1,0,0,1,0,0),ee.clearRect(0,0,L.width,L.height),ee.scale(U,U),ee.drawImage(se,0,0,ue.w,ue.h);for(const we of c.current)_S(ee,we);IS(ee,c.current,ue.w,ue.h)},[pe]);u.useRef(0);const xe=u.useCallback((L=0)=>{const se=i.current,ue=se==null?void 0:se.parentElement;if(!pe()||!ue||ue.clientWidth===0||ue.clientHeight===0){L<20&&requestAnimationFrame(()=>xe(L+1));return}ve()},[pe]);u.useEffect(()=>{var ee;const L=new Image;l.current=L,h(!1),L.onload=()=>{h(!0),requestAnimationFrame(()=>xe())},L.onerror=()=>{h(!1),S(r("annot.loadFailed"))},L.src=te;const se=()=>xe();window.addEventListener("resize",se);const ue=(ee=i.current)==null?void 0:ee.parentElement,U=ue&&typeof ResizeObserver<"u"?new ResizeObserver(()=>xe()):null;return U&&ue&&U.observe(ue),()=>{window.removeEventListener("resize",se),U&&U.disconnect()}},[te,xe]),u.useEffect(()=>{const L=q.current;if(!L)return;const se=()=>ge(L.clientWidth>=PS);if(se(),typeof ResizeObserver>"u")return;const ue=new ResizeObserver(se);return ue.observe(L),()=>ue.disconnect()},[]);function Oe(L){const ue=i.current.getBoundingClientRect();return[L.clientX-ue.left,L.clientY-ue.top]}function Ae(L){var se,ue;if(!(!f||x)){L.preventDefault();try{(ue=(se=i.current)==null?void 0:se.setPointerCapture)==null||ue.call(se,L.pointerId)}catch{}o.current={tool:d,points:[Oe(L)]},c.current.push(o.current),ve()}}function et(L){const se=o.current;se&&(L.preventDefault(),se.points.push(Oe(L)),ve())}function We(L){const se=o.current;se&&(L.preventDefault(),o.current=null,se.points.length<2?c.current.pop():(se.points=se.points.filter((ue,U)=>U%2===0||U===se.points.length-1),T(c.current.length)),_(jm(c.current)),ve())}function Dt(){c.current.pop(),T(c.current.length),_(jm(c.current)),ve()}function ht(L){if(!f||x)return;H("tap");const se=pe(),ue=xS(c.current,L,se?{w:se.w,h:se.h}:null);ue.stamp&&(c.current=ue.strokes,T(ue.strokes.length),_(ue.stamp.id),S(null),ve())}function ct(){const L=i.current,se=Math.max(L.width,L.height),ue=Math.min(1,1600/se),U=document.createElement("canvas");U.width=Math.round(L.width*ue),U.height=Math.round(L.height*ue);const ee=U.getContext("2d");return ee.fillStyle="#000",ee.fillRect(0,0,U.width,U.height),ee.drawImage(L,0,0,U.width,U.height),U.toDataURL("image/jpeg",.85)}async function yt(){if(!c.current.length){S(r("annot.needMarks"));return}b(!0),S(null);try{const L=i.current,se=window.devicePixelRatio||1,ue=kS(c.current,{width:L.width/se,height:L.height/se}),U=await Y(`/api/review/${e.id}/annotation`,{method:"POST",body:{annotated_image:ct(),note:NS(k,c.current),marks:ue,by:"mobile",chat:Nn()}});s==null||s(U!=null&&U.duplicate?r("annot.duplicate"):r("annot.sent")),n==null||n(U)}catch(L){S((L==null?void 0:L.message)||r("annot.sendFailed"))}finally{b(!1)}}async function Ge(){if(!P){y(!0),S(null);try{H("success");const L=await Y(`/api/review/${e.id}/approve`,{method:"POST",body:{by:"mobile",note:k,chat:Nn()}});s==null||s((L==null?void 0:L.moved)==="done"?r("annot.approved"):r("annot.approvedResume")),n==null||n(L)}catch(L){S((L==null?void 0:L.message)||r("annot.approveFailed"))}finally{y(!1)}}}async function $e(){if(!Z){G(!0),S(null);try{const L=e.board||"mobile",se=await Y(`/api/boards/${encodeURIComponent(L)}/tasks/${encodeURIComponent(e.id)}/close`,{method:"POST",body:{action:"cancel",note:String(k??"").slice(0,400)}});s==null||s(se!=null&&se.noop?r("close.alreadyCancelled"):r("close.cancelled")),n==null||n({closed:!0})}catch(L){S((L==null?void 0:L.message)||r("annot.approveFailed"))}finally{G(!1)}}}return a.jsxs("div",{ref:q,className:`ak-anno${X?" wide":""}`,children:[a.jsxs("header",{className:"ak-anno-head",children:[a.jsx("button",{className:"ak-anno-close",type:"button",onClick:()=>{H("tap"),t()},"aria-label":r("common.close"),children:"✕"}),a.jsxs("div",{className:"ak-anno-title",children:[((M=e.review)==null?void 0:M.title)||e.title,a.jsx("span",{children:r("annot.instruction")})]}),a.jsx("button",{className:"ak-anno-send",type:"button",disabled:x,onClick:()=>{H("action"),yt()},children:r(x?"annot.sending":"annot.submit")})]}),a.jsxs("div",{className:"ak-anno-body",children:[a.jsxs("div",{className:"ak-anno-canvas-wrap",children:[(W=e.review)!=null&&W.hasCompare?a.jsx("button",{className:`ak-compare-pill${I?" on":""}`,type:"button","aria-pressed":I,title:r("annot.compareAria"),onClick:()=>{H("tap"),A(L=>!L)},children:r(I?"annot.compareBefore":"annot.compareAfter")}):null,a.jsx("div",{className:"ak-anno-stage",children:a.jsx("canvas",{ref:i,className:"ak-anno-canvas",onPointerDown:Ae,onPointerMove:et,onPointerUp:We,onPointerCancel:We})})]}),a.jsxs("div",{className:"ak-anno-side",children:[V.annotation?a.jsxs("div",{className:"ak-anno-bar",children:[a.jsx("span",{className:"ak-anno-bar-title",children:r("annot.stampsTitle")}),a.jsx("div",{className:"ak-anno-stamps-scroll",role:"group","aria-label":r("annot.stampsAria"),children:Qu.map(L=>a.jsxs("button",{type:"button",className:`ak-anno-stamp${E===L.id?" on":""}`,"aria-pressed":E===L.id,"aria-label":r(L.key),title:`${r(L.key)} — ${L.instruction}`,disabled:!f||x,onClick:()=>ht(L.id),children:[a.jsx("span",{"aria-hidden":"true",children:L.emoji}),r(L.key)]},L.id))}),a.jsx("button",{className:"ak-anno-more",type:"button",onClick:()=>{H("tap"),$(!0)},"aria-label":r("annot.stampsMore"),children:"+"})]}):null,w?a.jsx("div",{className:"ak-error ak-anno-error",children:w}):null,a.jsxs("div",{className:"ak-anno-tools",children:[TS.map(L=>a.jsx("button",{type:"button",className:`ak-anno-tool${d===L.id?" on":""}`,onClick:()=>{H("tap"),g(L.id)},"aria-pressed":d===L.id,"aria-label":r(L.key),title:r(L.key),children:a.jsx("span",{"aria-hidden":"true",children:L.icon})},L.id)),a.jsx("button",{type:"button",className:"ak-anno-tool",onClick:()=>{H("tap"),Dt()},disabled:!v,"aria-label":r("annot.undo"),title:r("annot.undo"),children:a.jsx("span",{"aria-hidden":"true",children:"↩"})}),V.annotation?null:a.jsx("button",{type:"button",className:"ak-anno-tool",onClick:()=>{H("tap"),$(!0)},disabled:!f||x,"aria-label":r("annot.stampTool"),title:r("annot.stampTool"),children:a.jsx("span",{"aria-hidden":"true",children:"🏷️"})}),a.jsx("input",{className:"ak-anno-note",value:k,onChange:L=>m(L.target.value),placeholder:r("annot.notePlaceholder"),maxLength:200})]}),e.status==="blocked"?a.jsxs("div",{className:"ak-anno-actions",children:[a.jsx("button",{className:"ak-anno-done",type:"button",disabled:P||x||Z,"aria-busy":P,onClick:Ge,children:r(P?"annot.sending":"annot.doneShort")}),a.jsx(Zn,{tone:"danger",ms:800,label:r("annot.archiveShort"),hint:r("annot.holdHint"),disabled:x||Z,onFire:$e})]}):null]})]}),K?a.jsxs(Qe,{title:r("annot.stampSheetTitle"),onClose:()=>$(!1),children:[a.jsx("div",{className:"list",children:Qu.map(L=>a.jsxs("button",{className:"list-item",onClick:()=>{ht(L.id),$(!1)},children:[a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{className:"row-title",style:{display:"block"},children:[L.emoji," ",r(L.key)]}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:L.instruction})]}),a.jsx("span",{"aria-hidden":"true",className:"ak-anno-more-chev",children:"›"})]},L.id))}),a.jsx("div",{className:"row-sub",style:{padding:"12px 6px 18px",lineHeight:1.7},children:r("annot.stampsHint")})]}):null]})}function IS(e,t,n,s){var i;const r=$v(t);if(r.length){e.save(),e.font='700 11px system-ui, -apple-system, "Segoe UI", sans-serif',e.textBaseline="middle";for(const l of r){const o=((i=l.stroke)==null?void 0:i.points)||[],[c,d]=o[o.length-1]||[0,0],g=`#${l.index} ${l.emoji}`,f=6,h=e.measureText(g).width+f*2,x=18,b=x/2,w=Math.max(1,Math.min(c-h/2,n-h-1)),S=Math.max(1,Math.min(d+8,s-x-1));e.beginPath(),e.moveTo(w+b,S),e.arcTo(w+h,S,w+h,S+x,b),e.arcTo(w+h,S+x,w,S+x,b),e.arcTo(w,S+x,w,S,b),e.arcTo(w,S,w+h,S,b),e.closePath(),e.fillStyle=AS,e.fill(),e.strokeStyle="rgba(0, 0, 0, .35)",e.lineWidth=1,e.stroke(),e.fillStyle=RS,e.fillText(g,w+f,S+x/2+.5)}e.restore()}}function _S(e,t){const n=t.points;if(!(!n||n.length<2)){if(e.save(),e.strokeStyle=Cm,e.fillStyle="rgba(225, 29, 72, 0.18)",e.lineWidth=4,e.lineCap="round",e.lineJoin="round",t.tool==="pen"){e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let s=1;s<n.length;s++)e.lineTo(n[s][0],n[s][1]);e.stroke()}else if(t.tool==="rect"){const[s,r]=n[0],[i,l]=n[n.length-1],o=Math.min(s,i),c=Math.min(r,l),d=Math.abs(i-s),g=Math.abs(l-r);e.fillRect(o,c,d,g),e.strokeRect(o,c,d,g)}else if(t.tool==="arrow"){const[s,r]=n[0],[i,l]=n[n.length-1];e.beginPath(),e.moveTo(s,r),e.lineTo(i,l),e.stroke();const o=Math.atan2(l-r,i-s),c=Math.max(12,Math.min(28,Math.hypot(i-s,l-r)*.28));e.beginPath(),e.moveTo(i,l),e.lineTo(i-c*Math.cos(o-Math.PI/7),l-c*Math.sin(o-Math.PI/7)),e.lineTo(i-c*Math.cos(o+Math.PI/7),l-c*Math.sin(o+Math.PI/7)),e.closePath(),e.fillStyle=Cm,e.fill()}e.restore()}}const MS="補足:",LS="全体へのレビュー:",OS="(未選択",DS=new RegExp("^Q(\\d+)\\.\\s*(.*?):\\s*(.*)$"),$S=new RegExp(`^(.*?)(?:\\s*\\/\\s*${MS}\\s*(.*))?$`),FS=new RegExp(`^${LS}\\s*(.*)$`);function Tm(e){const t={answers:[],global:""},n=String(e||"").split(`
76
+ `);let s=!1;for(const r of n){const i=DS.exec(r);if(i){const o=i[3],c=$S.exec(o),d=((c==null?void 0:c[1])||"").trim();t.answers.push({id:`q${i[1]}`,choice:d.startsWith(OS)?null:d,note:((c==null?void 0:c[2])||"").trim()}),s=!1;continue}const l=FS.exec(r);if(l){t.global=l[1]||"",s=!0;continue}if(r.trim()==="---")break;s&&(t.global+=`
77
+ ${r}`)}return t.global=t.global.trim(),t}function Am(e,t,n,s,r){const{head:i,sub:l}=av(`Q${n+1}`,t,s==null?void 0:s.text);return{src:`/api/review/${e}/thumb/${r}`,head:i,sub:l}}const mo={review:"review.status.review",ready:"review.status.ready",running:"review.status.running",blocked:"review.status.blocked",done:"review.status.done"},BS=[{id:"waiting",key:"review.tab.waiting"},{id:"active",key:"review.tab.active"},{id:"done",key:"review.tab.done"}];function Rm(e){var r;const t=e.progress||{},n=Date.now(),s=i=>{if(!i)return null;const l=Math.max(0,Math.round((n-i)/1e3));return l<90?C("review.ago.seconds",{n:l}):l<3600?C("review.ago.minutes",{n:Math.round(l/60)}):C("review.ago.hours",{n:Math.round(l/3600)})};if(e.status==="running"){const i=s(t.heartbeatAt),l=s(t.startedAt);return[C("review.progress.reflecting"),l?C("review.progress.since",{ago:l}):"",i?C("review.progress.beat",{ago:i}):""].join("")}if(e.status==="ready")return C("review.progress.ready");if(e.status==="blocked"&&((r=e.review)!=null&&r.label)){const i=s(t.lastEventAt);return C("review.progress.waiting")+(i?C("review.progress.presented",{ago:i}):"")}return e.status==="done"?C("review.progress.done")+(t.lastEventAt?` ・ ${s(t.lastEventAt)}`:""):""}function pp({tone:e,children:t}){return a.jsx("span",{className:`ak-chip ${e||""}`,children:t})}function _c({item:e,onOpen:t}){const{t:n}=Fe(),s=e.review||{},r=qt(e),i=e.completedAt||e.createdAt?tt(e.completedAt||e.createdAt):"";return a.jsxs("button",{className:"ak-row",onClick:()=>{H("tap"),t(e)},type:"button",children:[a.jsxs("div",{className:"ak-row-main",children:[a.jsx("div",{className:"ak-row-title",children:s.title||e.title}),a.jsxs("div",{className:"ak-row-sub",children:[a.jsx("span",{className:"ak-label",children:s.label||e.id}),s.round?a.jsxs("span",{children:["r",s.round]}):null,s.questions?a.jsx("span",{children:n("review.questionsCount",{n:s.questions})}):null,Ek(s.mode)?a.jsx("span",{children:s.mode}):null,a.jsx("span",{children:i})]}),Rm(e)?a.jsx("div",{className:"ak-row-phase",children:Rm(e)}):null]}),a.jsx("div",{className:"ak-row-side",children:a.jsx(pp,{tone:r?"warn":e.status==="done"?"good":"",children:r?n("review.progress.waiting"):mo[e.status]?n(mo[e.status]):e.status})})]})}function Hv({taskId:e,open:t=!1,endpoint:n=null}){var f;const{t:s}=Fe(),[r,i]=u.useState(null),[l,o]=u.useState(null),c=ze.useRef(null),d=n||`/api/review/${e}/worker?limit=30`;u.useEffect(()=>{let h=!0;const x=async()=>{try{const w=await Y(d);if(!h)return;i(w),o(null)}catch(w){h&&o((w==null?void 0:w.message)||s("review.loadFailed"))}};x();const b=t?setInterval(()=>{document.visibilityState==="visible"&&x()},5e3):null;return()=>{h=!1,b&&clearInterval(b)}},[t,e,d]),u.useEffect(()=>{const h=c.current;h&&(h.scrollTop=h.scrollHeight)},[r]);const g=(((f=r==null?void 0:r.feed)==null?void 0:f.messages)||[]).filter(h=>h.role!=="user");return a.jsxs("details",{className:"ak-worker",open:t,children:[a.jsxs("summary",{children:[s("review.workerProgress"),r!=null&&r.status?s("review.workerStatus",{status:r.status==="running"?s("review.status.running"):r.status}):"",g.length?s("review.workerSteps",{n:g.length}):""]}),l?a.jsx("div",{className:"ak-error",children:l}):null,!l&&!g.length?a.jsx("div",{className:"ak-worker-empty",children:s("review.workerEmpty")}):null,a.jsx("div",{className:"ak-worker-log",ref:c,children:g.map(h=>{const x=nv(h.at),b=h.role==="tool"?h.toolName||"tool":"agent",w=String(h.text||"").replace(/\s+/g," ").slice(0,220);return a.jsxs("div",{className:`ak-worker-row ${h.role}`,children:[a.jsx("span",{className:"ak-worker-time",children:x}),a.jsx("span",{className:"ak-worker-tag",children:b}),a.jsx("span",{className:"ak-worker-text",children:w})]},h.id)})})]})}function US({item:e,data:t,onSubmitted:n}){const{t:s}=Fe(),r=t.questions||[],[i,l]=u.useState(()=>{const m={};for(const v of r)m[v.id]={choice:null,note:""};return m}),[o,c]=u.useState(""),[d,g]=u.useState(!1),[f,h]=u.useState(null),[x,b]=u.useState(null),w=(m,v)=>l(T=>({...T,[m]:{...T[m],choice:v}})),S=(m,v)=>l(T=>({...T,[m]:{...T[m],note:v}}));async function k(){g(!0),h(null);try{const m={answers:r.map(T=>{var E,_;return{id:T.id,choice:((E=i[T.id])==null?void 0:E.choice)??null,note:((_=i[T.id])==null?void 0:_.note)??""}}),global:o,by:"mobile",chat:Nn()},v=await Y(`/api/review/${e.id}/answer`,{method:"POST",body:m});n==null||n(v)}catch(m){h((m==null?void 0:m.message)||s("review.sendFailed"))}finally{g(!1)}}return a.jsxs("div",{className:"ak-form",children:[r.map((m,v)=>{var T;return a.jsxs("section",{className:"ak-q",children:[a.jsxs("div",{className:"ak-q-head",children:[a.jsxs("span",{className:"ak-q-no",children:["Q",v+1]}),a.jsx("span",{className:"ak-q-text",children:m.text})]}),a.jsx("div",{className:"ak-opts",children:(m.options||[]).map(E=>{var I;const _=((I=i[m.id])==null?void 0:I.choice)===E.id;return a.jsxs("button",{type:"button",className:`ak-opt${_?" on":""}`,onClick:()=>w(m.id,_?null:E.id),children:[a.jsxs("span",{className:"ak-opt-head",children:[a.jsx("b",{children:E.id}),a.jsx("span",{children:E.label}),E.recommended?a.jsx(pp,{tone:"rec",children:s("review.recommended")}):null,a.jsx("span",{className:"ak-opt-check","aria-hidden":"true",children:"✓"})]}),E.detail?a.jsx("span",{className:"ak-opt-detail",children:E.detail}):null,E.thumb?a.jsx("span",{className:"ak-thumb-btn",role:"button",tabIndex:0,"aria-label":s("review.thumbZoomAria",{head:av(`Q${v+1}`,E).head}),onClick:A=>{A.preventDefault(),A.stopPropagation(),b(Am(e.id,E,v,m,E.thumb))},onKeyDown:A=>{A.key!=="Enter"&&A.key!==" "||(A.preventDefault(),A.stopPropagation(),b(Am(e.id,E,v,m,E.thumb)))},children:a.jsx("img",{className:"ak-opt-thumb",src:`/api/review/${e.id}/thumb/${E.thumb}`,alt:""})}):null]},E.id)})}),a.jsx("input",{className:"ak-note",value:((T=i[m.id])==null?void 0:T.note)||"",onChange:E=>S(m.id,E.target.value),placeholder:s("review.notePlaceholder")})]},m.id)}),a.jsxs("section",{className:"ak-q",children:[a.jsxs("div",{className:"ak-q-head",children:[a.jsx("span",{className:"ak-q-no",children:s("review.globalNo")}),a.jsx("span",{className:"ak-q-text",children:s("review.globalTitle")})]}),a.jsx("textarea",{className:"ak-global",value:o,onChange:m=>c(m.target.value),placeholder:s("review.globalPlaceholder"),rows:3})]}),f?a.jsx("div",{className:"ak-error",children:f}):null,a.jsx("div",{className:"ak-actions",children:a.jsxs("button",{className:"btn primary hm-btn-inner",type:"button",disabled:d,"aria-busy":d,onClick:()=>{H("action"),k()},children:[d?a.jsx(hn,{size:15}):null,a.jsx("span",{children:s(d?"review.sending":"review.submitAnswer")})]})}),a.jsx("p",{className:"ak-hint",children:s("review.formHint")}),x?Gd.createPortal(a.jsxs("div",{className:"ak-zoom",role:"dialog","aria-modal":"true","aria-label":s("review.thumbAlt",{head:x.head}),onClick:()=>b(null),children:[a.jsxs("figure",{onClick:m=>m.stopPropagation(),children:[a.jsx("img",{src:x.src,alt:s("review.thumbAlt",{head:x.head})}),a.jsxs("figcaption",{children:[a.jsx("b",{children:x.head}),x.sub?a.jsx("span",{children:x.sub}):null]})]}),a.jsx("button",{className:"ak-zoom-close",type:"button",onClick:()=>b(null),children:s("common.close")})]}),document.body):null]})}function HS({item:e,onSubmitted:t,notify:n}){const{t:s}=Fe(),[r,i]=u.useState(""),[l,o]=u.useState(!1),[c,d]=u.useState(null);u.useEffect(()=>{const f=async h=>{const x=h.data;if(!(!x||x.type!=="review:reply"&&x.type!=="akapen:reply"||String(x.taskId)!==String(e.id))){o(!0),d(null);try{const b=Tm(x.text),w=await Y(`/api/review/${e.id}/answer`,{method:"POST",body:{...b,by:"mobile",chat:Nn()}});n==null||n(w!=null&&w.duplicate?s("review.duplicate"):s("review.receivedFromSheet")),t==null||t(w)}catch(b){d((b==null?void 0:b.message)||s("review.sendFailed"))}finally{o(!1)}}};return window.addEventListener("message",f),()=>window.removeEventListener("message",f)},[e.id]);async function g(){if(r.trim()){o(!0),d(null);try{const f=Tm(r),h=await Y(`/api/review/${e.id}/answer`,{method:"POST",body:{...f,by:"mobile",chat:Nn()}});t==null||t(h)}catch(f){d((f==null?void 0:f.message)||s("review.sendFailed"))}finally{o(!1)}}}return a.jsxs("div",{className:"ak-form",children:[a.jsx("iframe",{className:"ak-iframe",title:s("review.sheetIframeTitle"),src:`/api/review/${e.id}/sheet`,sandbox:"allow-scripts allow-forms"}),a.jsxs("details",{className:"ak-paste",children:[a.jsx("summary",{children:s("review.pasteSummary")}),a.jsx("textarea",{value:r,onChange:f=>i(f.target.value),placeholder:s("review.pastePlaceholder"),rows:6}),c?a.jsx("div",{className:"ak-error",children:c}):null,a.jsxs("button",{className:"btn primary hm-btn-inner",type:"button",disabled:l||!r.trim(),"aria-busy":l,onClick:()=>{H("action"),g()},children:[l?a.jsx(hn,{size:15}):null,a.jsx("span",{children:s(l?"review.sending":"review.submitPasted")})]})]})]})}function zS({item:e}){const{t}=Fe();return a.jsx("div",{className:"ak-sheetlink",children:a.jsx("a",{className:"ak-link",href:`/api/review/${e.id}/view`,target:"_blank",rel:"noreferrer",children:t("review.openSheet")})})}function WS({item:e,data:t,answer:n,notify:s,onStartAnnotation:r,onReopened:i,onOpenChat:l}){const{t:o}=Fe(),c=e.review||{},d=mo[e.status]?o(mo[e.status]):e.status,g=c.answeredAt?tt(Date.parse(c.answeredAt)):null,[f,h]=u.useState(null),[x,b]=u.useState(!1),[w,S]=u.useState(!1),[k,m]=u.useState(""),[v,T]=u.useState(!1);u.useEffect(()=>{if(h(null),b(!1),S(!1),m(""),c.mode!=="annotation")return;let P=!0;return Y(`/api/review/${e.id}/annotation`).then(y=>P&&h((y==null?void 0:y.data)??null)).catch(()=>P&&h(null)),()=>{P=!1}},[e.id,c.mode]);async function E(){if(!v){T(!0);try{const P=await Y(`/api/review/${e.id}/reopen`,{method:"POST",body:{reason:k.trim()||o("review.reopenReasonDefault")}});if(!(P!=null&&P.ok))throw new Error(o("review.reopenFailed"));s==null||s(o("review.reopened")),i==null||i()}catch(P){s==null||s((P==null?void 0:P.message)||o("review.reopenFailed"))}finally{T(!1)}}}const _=Nk(t,n),I=_.rows.some(P=>P.choice||P.note)||!!_.global,A=c.image?`/api/review/${e.id}/image${w?"?compare=1":"?annotated=1"}`:null;return a.jsxs("div",{className:"ak-form",children:[a.jsxs("div",{className:"ak-readonly",children:[a.jsx(pp,{tone:e.status==="done"?"good":"",children:d}),a.jsx("span",{className:"ak-label",children:c.label||e.id}),c.repo?a.jsx("span",{children:Du(c.repo)}):null,c.round?a.jsxs("span",{children:["r",c.round]}):null,c.questions?a.jsx("span",{children:o("review.questionsCount",{n:c.questions})}):null,g?a.jsx("span",{children:o("review.answeredAtLabel",{time:g})}):null,e.completedAt?a.jsx("span",{children:o("review.completedLabel",{time:tt(e.completedAt)})}):null]}),a.jsxs("p",{className:"ak-hint",children:[o("review.readonlyHint",{label:d}),e.result?a.jsxs(a.Fragment,{children:[a.jsx("br",{}),e.result]}):null]}),A?a.jsxs("div",{className:"ak-anno-preview",children:[c.hasCompare?a.jsx("button",{className:`ak-compare-pill${w?" on":""}`,type:"button","aria-pressed":w,title:o("annot.compareAria"),onClick:()=>{H("tap"),S(P=>!P)},children:o(w?"annot.compareBefore":"annot.compareAfter")}):null,a.jsx("button",{type:"button",className:"ak-anno-preview-btn",onClick:()=>{H("tap"),b(!0)},children:a.jsx("img",{src:A,alt:o("review.imageAlt",{title:c.title||e.title})})}),f?a.jsxs("div",{className:"ak-anno-preview-meta",children:[a.jsx("span",{children:o("review.annotationMeta",{n:Array.isArray(f.marks)?f.marks.length:0})}),f.note?a.jsx("span",{children:o("review.annotationNote",{note:f.note})}):null]}):null]}):null,I?a.jsxs("details",{className:"ak-answers",children:[a.jsx("summary",{children:o("review.answersSummary")}),a.jsx("ol",{className:"ak-answer-list",children:_.rows.map((P,y)=>a.jsxs("li",{children:[a.jsx("div",{className:"ak-answer-q",children:P.question||P.id}),a.jsx("div",{className:"ak-answer-a",children:P.choice?`${P.choice}. ${P.label}`:o("review.delegated")}),P.note?a.jsx("div",{className:"ak-answer-note",children:P.note}):null]},P.id||y))}),_.global?a.jsx("div",{className:"ak-answer-global",children:o("review.globalNote",{text:_.global})}):null]}):null,a.jsxs("div",{className:"ak-followup",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>{H("tap"),r==null||r(c.target||"")},children:o("review.addAnnotation")}),c.chat?a.jsx("button",{type:"button",className:"btn ghost",onClick:()=>{H("tap"),l==null||l(c.chat)},children:o("review.openOriginChat")}):null]}),e.status==="done"?a.jsxs("details",{className:"ak-reopen",children:[a.jsx("summary",{children:o("review.reopenSummary")}),a.jsx("textarea",{className:"inp",rows:2,value:k,onChange:P=>m(P.target.value.slice(0,400)),placeholder:o("review.reopenPlaceholder")}),a.jsxs("button",{type:"button",className:"btn hm-btn-inner",disabled:v,"aria-busy":v,onClick:()=>{H("action"),E()},children:[v?a.jsx(hn,{size:14}):null,a.jsx("span",{children:o(v?"review.sending":"review.reopenSubmit")})]})]}):null,x&&A?Gd.createPortal(a.jsxs("div",{className:"ak-zoom",role:"dialog","aria-modal":"true","aria-label":o("review.zoomAria"),onClick:()=>b(!1),children:[a.jsxs("figure",{onClick:P=>P.stopPropagation(),children:[a.jsx("img",{src:A,alt:o("review.zoomAlt",{title:c.title||e.title})}),a.jsxs("figcaption",{children:[a.jsx("b",{children:c.title||e.title}),f!=null&&f.note?a.jsx("span",{children:f.note}):null]})]}),a.jsx("button",{className:"ak-zoom-close",type:"button",onClick:()=>b(!1),children:o("common.close")})]}),document.body):null]})}function VS(e){return new Promise((t,n)=>{const s=URL.createObjectURL(e),r=new Image;r.onload=()=>{const i=Math.max(r.naturalWidth,r.naturalHeight),l=Math.min(1,1600/i),o=Math.round(r.naturalWidth*l),c=Math.round(r.naturalHeight*l),d=document.createElement("canvas");d.width=o,d.height=c,d.getContext("2d").drawImage(r,0,0,o,c),URL.revokeObjectURL(s),t(d.toDataURL("image/jpeg",.85))},r.onerror=()=>{URL.revokeObjectURL(s),n(new Error(C("review.imageLoadFailed")))},r.src=s})}let ui=null,ps=null;function KS(){return Promise.allSettled([Y("/api/review/library?limit=36").then(e=>(ui=e.items||[],ui)),Y("/api/review/targets").then(e=>(ps=e.targets||[],ps))])}function Mc(e,t){const n=String(t??"").trim().toLowerCase();return!n||!Array.isArray(e)?null:e.find(s=>String((s==null?void 0:s.id)??"").toLowerCase()===n)??e.find(s=>String((s==null?void 0:s.path)??"").toLowerCase()===n)??null}function QS({onCreated:e,onClose:t,notify:n,initialTarget:s=""}){const{t:r}=Fe(),[i,l]=u.useState(()=>ui),[o,c]=u.useState(()=>ps||[]),[d,g]=u.useState(()=>{var P;const A=Mc(ps,s);return(A==null?void 0:A.path)||((P=ps==null?void 0:ps[0])==null?void 0:P.path)||""}),[f,h]=u.useState(!!s),[x,b]=u.useState(!1),[w,S]=u.useState(null),[k,m]=u.useState(!1),v=ze.useRef(null);u.useEffect(()=>{let A=!0;return Y("/api/review/library?limit=36").then(P=>{const y=P.items||[];ui=y,A&&l(y)}).catch(P=>{A&&(ui||l([]),S((P==null?void 0:P.message)||r("review.listFailed")))}),Y("/api/review/targets").then(P=>{const y=P.targets||[];if(ps=y,!A)return;c(y);const K=Mc(y,s);g($=>{var V;return $||(K==null?void 0:K.path)||((V=y[0])==null?void 0:V.path)||""})}).catch(()=>{A&&!ps&&c([])}),()=>{A=!1}},[s]);async function T(A){b(!0),S(null);try{const P=Nn(),y=await Y("/api/review/annotation/new",{method:"POST",body:{...A,chat:P}});if(!(y!=null&&y.ok))throw new Error((y==null?void 0:y.message)||r("review.createFailed"));const K=Mc(o,A==null?void 0:A.target);K!=null&&K.id&&fS(globalThis.localStorage,K.id),n==null||n(r("review.createdAnno",{image:y.image})),e==null||e(y)}catch(P){S((P==null?void 0:P.message)||r("review.createFailed"))}finally{b(!1)}}async function E(A){var y;const P=(y=A.target.files)==null?void 0:y[0];if(P){b(!0),S(null);try{const K=await VS(P);await T({source:"upload",image:K,title:P.name.replace(/\.[a-z]+$/i,""),slug:P.name,target:d})}catch(K){S((K==null?void 0:K.message)||r("review.importFailed")),b(!1)}}}const _=o.find(A=>A.path===d)||null,I=f&&_&&i?i.filter(A=>{var P;return((P=A.repo)==null?void 0:P.id)===_.id}):i;return a.jsx(Qe,{title:r("review.newAnnoTitle"),onClose:t,children:a.jsxs("div",{className:"ak-new",children:[a.jsx("div",{className:"list-head",children:r("review.sourceDevice")}),a.jsx("button",{className:"btn primary",type:"button",disabled:x,onClick:()=>{var A;return(A=v.current)==null?void 0:A.click()},children:r("review.pickFromDevice")}),a.jsx("input",{ref:v,type:"file",accept:"image/*",hidden:!0,onChange:E}),o.length?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"list-head",style:{marginTop:4},children:r("review.target")}),a.jsxs("button",{type:"button",className:"pick-item spec-now","aria-expanded":o.length>1?k:void 0,onClick:()=>{o.length<=1||(H("tap"),m(A=>!A))},children:[a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:_?r("review.targetOption",{label:_.label,id:_.id}):r("review.target")}),a.jsx("span",{className:"pick-sub",children:r("review.target")})]}),a.jsxs("span",{className:"pick-meta",children:[o.length>1?`${o.length}`:null,o.length>1?a.jsx("span",{"aria-hidden":"true",children:k?"▴":"▾"}):null]})]}),k&&o.length>1?a.jsx("div",{className:"pick-list spec-accordion",role:"listbox","aria-label":r("review.target"),children:o.filter(A=>A.path!==d).map(A=>a.jsxs("button",{type:"button",className:"pick-item",onClick:()=>{H("tap"),g(A.path),m(!1)},children:[a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:r("review.targetOption",{label:A.label,id:A.id})})}),a.jsx("span",{className:"pick-meta","aria-hidden":"true",children:"›"})]},A.path))}):null]}):null,a.jsx("div",{className:"list-head",style:{marginTop:4},children:r("review.sourceLibrary")}),_&&(i!=null&&i.length)?a.jsxs("div",{className:"chips",style:{padding:0},children:[a.jsx("button",{type:"button",className:`chip${f?" on":""}`,onClick:()=>{H("tap"),h(!0)},children:r("review.onlyRepo",{id:_.id})}),a.jsx("button",{type:"button",className:`chip${f?"":" on"}`,onClick:()=>{H("tap"),h(!1)},children:r("review.all")})]}):null,w?a.jsx("div",{className:"ak-error",children:w}):null,a.jsx("div",{className:"ak-new-sub",children:r("review.librarySub",{n:I?I.length:"…"})}),I&&!I.length?a.jsx("div",{className:"ak-worker-empty",children:r(f?"review.repoEmpty":"review.libraryEmpty")}):null,a.jsx("div",{className:"ak-new-grid",children:(I||[]).map(A=>a.jsxs("button",{type:"button",className:"ak-new-item",disabled:x,onClick:()=>T({source:A.source==="capture"?"capture":"library",path:A.path,title:A.name.replace(/^\d{8}-\d{4}-/,"").replace(/\.[a-z]+$/i,""),target:d}),children:[a.jsxs("span",{className:"ak-new-thumb",children:[a.jsx("img",{src:`/api/review/library/file?path=${encodeURIComponent(A.path)}`,alt:"",loading:"lazy"}),a.jsx("span",{className:"ak-new-tag",children:A.source})]}),a.jsxs("span",{className:"ak-new-cap",children:[a.jsx("span",{className:"ak-new-when",children:jk(A.mtime)}),a.jsx("span",{className:"ak-new-repo",title:`${Du(A.repo)} · ${A.path}`,children:Du(A.repo)})]})]},A.path))}),a.jsx("p",{className:"ak-hint",children:r("review.newAnnoHint")})]})})}function GS({notify:e,focusRequest:t=null,onConsumedFocus:n,active:s=!0}){var M,W,L,se,ue;const{t:r}=Fe(),[i,l]=u.useState({loading:!0,items:[],error:null}),[o,c]=u.useState("waiting"),[d,g]=u.useState(null),[f,h]=u.useState(!1),[x,b]=u.useState(()=>bm()),[w,S]=u.useState(null),[k,m]=u.useState(null),[v,T]=u.useState(null),[E,_]=u.useState(!1),[I,A]=u.useState(""),[P,y]=u.useState(!1),[K,$]=u.useState(!1),[V,D]=u.useState(!1),[X,ge]=u.useState([]),Z=u.useRef(0),G=u.useRef(!0),q=u.useCallback(async()=>{try{const ee=(await Y("/api/review")).items||[];G.current=!0,l({loading:!1,items:ee,error:null});try{window.dispatchEvent(new CustomEvent("hm:review-items",{detail:{items:ee}}))}catch{}return KS(),ee}catch(U){return G.current=!1,l({loading:!1,items:[],error:(U==null?void 0:U.message)||r("review.loadFailed")}),[]}},[]),ce=u.useCallback(async()=>(await q(),G.current),[q]);u.useEffect(()=>{q();const U=setInterval(()=>{document.visibilityState==="visible"&&q()},15e3);return()=>clearInterval(U)},[q]);const te=u.useMemo(()=>wk(i.items,P?Number.MAX_SAFE_INTEGER:ri),[i.items,P]),pe={waiting:te.waiting.length,active:te.active.length},ve=u.useMemo(()=>Pk(w),[w]),xe=d?te.waiting.findIndex(U=>U.id===d.id)+1:0,Oe=u.useCallback(async U=>{g(U),S(null),m(null),T(null),A(""),_(!1);const ee=U.review||{};if(Ck(ee)){_(!0);try{const we=await Y(`/api/review/${U.id}/data`);S(we.data),m(we.answer??null)}catch(we){qt(U)&&T((we==null?void 0:we.message)||r("review.sheetMissing"))}finally{_(!1)}}},[]);u.useEffect(()=>{if(!t||i.loading)return;if(t.openNewAnnotation){b(t.target||""),h(!0),n==null||n();return}const U=i.items.find(ee=>{var we;return t.taskId&&ee.id===t.taskId||t.label&&((we=ee.review)==null?void 0:we.label)===t.label});U?(c(qt(U)?"waiting":U.status==="done"?"done":"active"),Oe(U)):c("done"),n==null||n()},[t,i.loading,i.items,Oe,n]);function Ae(){g(null),S(null),m(null),T(null),_(!1)}const et=u.useCallback(async()=>{try{const U=await Y("/api/review/feed?limit=6"),ee=Array.isArray(U.items)?U.items:[];ge(ee);const we=Date.now();try{localStorage.setItem("hm.reviewSeenAt",String(we))}catch{}try{window.dispatchEvent(new CustomEvent("hm:review-seen",{detail:{at:we}}))}catch{}const ut=ee.filter(He=>He.kind==="done"||/^✅/.test(String(He.text||""))),Ee=ut[ut.length-1];Ee&&Ee.at>Z.current&&(Z.current&&(e==null||e(r("review.feedNotice",{text:String(Ee.text).replace(/^✅\s*/,"")}))),Z.current=Ee.at)}catch{}},[e]);u.useEffect(()=>{if(!s)return;et();const U=setInterval(()=>document.visibilityState==="visible"&&et(),15e3);return()=>clearInterval(U)},[et,s]);async function We(U,ee,we){var wt,Tt;const ut=ee!=null&&ee.duplicate?null:we||((wt=ee==null?void 0:ee.files)!=null&&wt.approval?"stamp":"approve");ut&&bt(ut);const Ee=await q(),He=ee!=null&&ee.duplicate?r("review.duplicate"):(Tt=ee==null?void 0:ee.files)!=null&&Tt.approval?r("annot.approved"):r("review.answerSent"),$t=xk(Ee,U);if($t){D(!1),await Oe($t),e==null||e(r("review.nextOpened",{head:He}));return}c("waiting"),Ae(),D(!0),bt("allClear"),e==null||e(r("review.noneLeft",{head:He}))}async function Dt(){if(!(!d||K||!ve.canFastTrack)){$(!0);try{const U=await Y(`/api/review/${d.id}/answer`,{method:"POST",body:{answers:ve.answers,global:"",by:"mobile",chat:Nn()}});await We(d.id,U,"fastTrack")}catch(U){e==null||e((U==null?void 0:U.message)||r("review.fastTrackFailed"))}finally{$(!1)}}}const ht=i.items.length>0,{split:ct}=op(),yt=!!(d&&((M=d.review)==null?void 0:M.mode)==="annotation"&&qt(d)),Ge=d?(((W=d.review)==null?void 0:W.title)||d.title)+"":"",$e=d?a.jsxs(a.Fragment,{children:[qt(d)&&xe>0&&pe.waiting>1?a.jsx("div",{className:"ak-wait-bar",children:a.jsx("span",{className:"ak-wait-pill",children:r("review.waitPill",{i:xe,n:pe.waiting})})}):null,qt(d)&&ve.canFastTrack&&((L=w==null?void 0:w.questions)!=null&&L.length)?a.jsxs("div",{className:"ak-fasttrack",children:[a.jsx("button",{className:"btn fast-track",type:"button",disabled:K,"aria-busy":K,onClick:Dt,children:K?r("review.sending"):r("review.fastTrack",{summary:ve.summary})}),a.jsx("p",{className:"ak-fasttrack-hint",children:r("review.fastTrackHint")})]}):null,((se=d.review)==null?void 0:se.mode)!=="annotation"?a.jsx(zS,{item:d}):null,qt(d)?a.jsxs(a.Fragment,{children:[v?a.jsx("div",{className:"ak-error",children:r("review.openSheetDirectly",{error:v})}):null,(ue=w==null?void 0:w.questions)!=null&&ue.length?a.jsx(US,{item:d,data:w,onSubmitted:U=>We(d.id,U)}):E?a.jsx(Wn,{label:r("common.loading")}):a.jsx(HS,{item:d,onSubmitted:U=>We(d.id,U)})]}):E&&!w?a.jsx(Wn,{label:r("common.loading")}):a.jsx(WS,{item:d,data:w,answer:k,notify:e,onStartAnnotation:U=>{Ae(),b(U||""),h(!0)},onReopened:async()=>{await q(),Ae()},onOpenChat:U=>{Ae(),window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:U}}))}}),qt(d)?a.jsxs("div",{className:"ak-form",children:[a.jsx("div",{className:"row-sub",children:r("review.closeReasonLabel")}),a.jsx("textarea",{className:"inp",rows:2,style:{marginTop:6},value:I,onChange:U=>A(U.target.value.slice(0,400)),placeholder:r("review.closeReasonPlaceholder")}),a.jsx(Av,{board:d.board||"mobile",taskId:d.id,note:I,notify:e,onClosed:()=>{A(""),q(),setTimeout(()=>g(null),600)}})]}):null,a.jsx(Hv,{taskId:d.id,open:["running","ready"].includes(d.status)})]}):null;return a.jsxs("div",{className:ct?"pane ak-page split-layout review":"pane ak-page",children:[a.jsxs("div",{className:ct?"split-master":void 0,children:[a.jsxs("div",{className:"ak-head",children:[a.jsxs("div",{children:[a.jsx("div",{className:"ak-title",children:r("review.title")}),a.jsx("div",{className:"ak-sub",children:pe.waiting?r("review.waitingSub",{n:pe.waiting}):r("review.noneWaiting")})]}),a.jsxs("span",{className:"ak-head-actions",children:[a.jsx("button",{className:"btn ak-new-btn",type:"button",onClick:()=>{H("tap"),h(!0)},children:r("review.newAnnotation")}),a.jsx(Xs,{onRefresh:ce})]})]}),V?a.jsxs("div",{className:"ak-allclear",role:"status","aria-live":"polite",children:[a.jsx("span",{children:r("review.allClear")}),a.jsx("button",{className:"icon-btn",type:"button","aria-label":r("common.close"),onClick:()=>{H("tap"),D(!1)},children:a.jsx(Me,{name:"close",size:16})})]}):null,X.length?a.jsx("div",{className:"ak-feed","aria-live":"polite",children:X.slice(-3).map((U,ee)=>a.jsxs("div",{className:"ak-feed-row",children:[a.jsx("span",{className:"ak-feed-at",children:nv(U.at)}),a.jsx("span",{className:"ak-feed-text",children:U.text})]},`${U.at}-${ee}`))}):null,a.jsx("div",{className:"chips ak-tabs",role:"tablist",children:BS.map(U=>a.jsxs("button",{type:"button",role:"tab","aria-selected":o===U.id,className:`chip${o===U.id?" on":""}`,onClick:()=>{o!==U.id&&H("tap"),c(U.id)},children:[r(U.key),U.id!=="done"&&pe[U.id]?` ${pe[U.id]}`:null]},U.id))}),i.error?a.jsx("div",{className:"ak-error",children:i.error}):null,i.loading?a.jsx(Wn,{label:r("common.loading")}):null,!i.loading&&!ht?a.jsxs("div",{className:"empty",children:[r("review.emptyNoSheets"),a.jsx("br",{}),r("review.emptyNoSheetsHint")]}):null,!i.loading&&ht&&o==="waiting"?te.waiting.length?a.jsx("section",{className:"ak-group",children:te.waiting.map(U=>a.jsx(_c,{item:U,onOpen:Oe},U.id))}):a.jsxs("div",{className:"ak-empty-card",children:[a.jsx("div",{className:"ak-empty-title",children:r("review.noneWaiting")}),a.jsx("p",{className:"ak-empty-body",children:r("review.emptyBody")}),a.jsx("button",{className:"ak-empty-btn",type:"button",onClick:()=>h(!0),children:r("review.emptyNewAnnotation")}),a.jsx("p",{className:"ak-empty-note",children:r("review.emptyNote")}),a.jsx("div",{className:"ak-empty-meta",children:r("review.emptyMeta",{active:pe.active,done:te.doneTotal})})]}):null,!i.loading&&ht&&o==="active"?te.active.length?a.jsx("section",{className:"ak-group",children:te.active.map(U=>a.jsx(_c,{item:U,onOpen:Oe},U.id))}):a.jsx("div",{className:"empty",children:r("review.noActive")}):null,!i.loading&&ht&&o==="done"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"ak-group-title",children:P?r("review.allDone",{n:te.doneTotal}):Sk(te.doneTotal)}),te.done.length?a.jsx("section",{className:"ak-group",children:te.done.map(U=>a.jsx(_c,{item:U,onOpen:Oe},U.id))}):null,te.doneTotal>te.done.length?a.jsx("button",{className:"btn ghost",style:{width:"100%",marginTop:8},onClick:()=>y(!0),children:r("review.showAllDone",{n:te.doneTotal-te.done.length})}):P&&te.doneTotal>ri?a.jsx("button",{className:"btn ghost",style:{width:"100%",marginTop:8},onClick:()=>y(!1),children:r("review.showRecentOnly",{n:ri})}):null]}):null]}),f?a.jsx(QS,{notify:e,initialTarget:x,onClose:()=>h(!1),onCreated:async U=>{h(!1),b(bm()),await q(),g({id:U.taskId,title:U.label,status:"blocked",review:{mode:"annotation",label:U.label}})}}):null,!ct&&yt?a.jsx(Em,{item:d,notify:e,onClose:()=>g(null),onSubmitted:U=>We(d.id,U)}):null,!ct&&d&&!yt?a.jsx(Qe,{title:Ge,onClose:Ae,children:$e}):null,ct?a.jsx("div",{className:"split-detail",children:d?yt?a.jsx(Em,{item:d,notify:e,onClose:()=>g(null),onSubmitted:U=>We(d.id,U)}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"split-detail-head",children:[a.jsx("span",{className:"split-detail-title",children:Ge}),a.jsx("button",{className:"icon-btn",onClick:Ae,"aria-label":r("common.close"),children:a.jsx(Me,{name:"close",size:18})})]}),a.jsx("div",{className:"split-detail-body",children:$e})]}):a.jsxs("div",{className:"split-placeholder",children:[a.jsx("b",{children:r("review.selectPlaceholder")}),a.jsx("span",{children:r("review.selectHint")})]})}):null]})}const YS=5e3,Fr={running:"tasks.status.running",ready:"tasks.status.ready",done:"tasks.status.done",blocked:"tasks.status.blocked",failed:"tasks.status.failed",archived:"tasks.status.archived",todo:"tasks.status.todo"},JS={"zero-stop":"tasks.modeZeroStop","fast-track-review":"tasks.modeFastTrack","visual-gate":"tasks.modeVisualGate"};function Pm({batch:e,t}){const n=JS[e==null?void 0:e.mode];return n?a.jsx("span",{className:`spec-mode is-${e.mode}`,children:t(n)}):null}function Im({specList:e,currentSpec:t,open:n,onToggle:s,onPick:r,t:i}){if(!t)return null;const l=(e??[]).filter(c=>c.path!==t.path),o=c=>[i("tasks.specBatchCount",{n:(c.batches??[]).length}),c.mtime?i("tasks.specUpdated",{when:tt(c.mtime)}):null].filter(Boolean).join(" · ");return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"pick-item spec-now","aria-expanded":l.length?n:void 0,"aria-label":i("tasks.specNowAria",{name:t.title}),onClick:()=>{H("tap"),s()},children:[a.jsxs("span",{className:"pick-main",children:[a.jsxs("span",{className:"pick-title",children:[a.jsx("span",{"aria-hidden":"true",children:"📄"})," ",t.title]}),a.jsx("span",{className:"pick-sub",children:`${o(t)} · ${t.path}`})]}),a.jsxs("span",{className:"pick-meta",children:[l.length?i("tasks.specCountOf",{n:e.length}):null,l.length?a.jsx("span",{"aria-hidden":"true",children:n?"▴":"▾"}):null]})]}),n&&l.length?a.jsx("div",{className:"pick-list spec-accordion",children:l.map(c=>a.jsxs("button",{type:"button",className:"pick-item",onClick:()=>{H("tap"),r(c)},children:[a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:c.title}),a.jsx("span",{className:"pick-sub",children:o(c)})]}),a.jsx("span",{className:"pick-meta","aria-hidden":"true",children:"›"})]},c.path))}):null]})}const zv="hm.board";function qS(){try{return localStorage.getItem(zv)}catch{return null}}function XS({overview:e,refresh:t,notify:n,initialInbox:s=null,focusBoard:r=null,onConsumedFocusBoard:i,taskToolRequest:l=null,onConsumedTaskTool:o,active:c=!0}){var Ui,Pa,Hi,wn;const{t:d}=Fe(),[g,f]=u.useState([]),[h,x]=u.useState(null),[b,w]=u.useState([]),[S,k]=u.useState(null),[m,v]=u.useState(null),[T,E]=u.useState(!1),[_,I]=u.useState(""),[A,P]=u.useState(!1),[y,K]=u.useState(!0),[$,V]=u.useState(null),[D,X]=u.useState(null),[ge,Z]=u.useState(!1),[G,q]=u.useState(!1),[ce,te]=u.useState(null),[pe,ve]=u.useState(!1),[xe,Oe]=u.useState(null),[Ae,et]=u.useState(!1),[We,Dt]=u.useState(0),[ht,ct]=u.useState(0),[yt,Ge]=u.useState(!1),[$e,M]=u.useState(null),[W,L]=u.useState(!1),[se,ue]=u.useState(null),[U,ee]=u.useState([]),[we,ut]=u.useState(!1),[Ee,He]=u.useState(!1),[$t,wt]=u.useState(!1),[Tt,F]=u.useState(null),[_e,Nt]=u.useState([]),[Kn,mt]=u.useState(!1),[Ns,me]=u.useState(""),[jt,Ue]=u.useState(!1),[rs,Qn]=u.useState(""),[It,Gt]=u.useState(!1);u.useEffect(()=>{l&&(l.kind==="brainstorm"?(Qn(l.seed||""),Ue(!0)):l.kind==="seed"&&(me(l.seed||""),mt(!0)),o==null||o())},[l,o]);const[Ke,sn]=u.useState(null),[An,rn]=u.useState(!1),[js,ke]=u.useState([]),[as,z]=u.useState([]),[de,ie]=u.useState(null),Ne="#inbox",Ye=u.useRef(!1),Re=u.useCallback((N=null)=>{ie(N??null),Ge(!0),window.location.hash.startsWith(Ne)||(window.history.pushState({hmSheet:"inbox"},"",N?`${Ne}:${N}`:Ne),Ye.current=!0)},[]),je=u.useCallback(()=>{if(Ge(!1),Ye.current&&window.location.hash.startsWith(Ne)){Ye.current=!1,window.history.back();return}window.location.hash.startsWith(Ne)&&window.history.replaceState({},"",window.location.pathname+window.location.search)},[]);u.useEffect(()=>{const N=()=>{window.location.hash.startsWith(Ne)||(Ye.current=!1,Ge(!1))};return window.addEventListener("popstate",N),()=>window.removeEventListener("popstate",N)},[]);const Se=u.useRef(!1);u.useEffect(()=>{const N=B=>{var re;return Re(((re=B==null?void 0:B.detail)==null?void 0:re.task)??null)};return window.addEventListener("hm:open-inbox",N),()=>window.removeEventListener("hm:open-inbox",N)},[]),u.useEffect(()=>{!s||Se.current||(Se.current=!0,Re(s.task??null))},[s,Re]);const Ce=u.useCallback(async()=>{try{const B=(await Y("/api/boards")).boards??[];f(B),x(re=>{var Je,lt,ln;if(re)return re;const ye=qS();return ye&&B.some(Ts=>Ts.slug===ye)?ye:((Je=B.find(Ts=>Ts.current))==null?void 0:Je.slug)??((lt=B.find(Ts=>!Ts.archived))==null?void 0:lt.slug)??((ln=B[0])==null?void 0:ln.slug)??null})}catch(N){n(N.message)}finally{K(!1)}},[n]);u.useEffect(()=>{try{h&&localStorage.setItem(zv,h)}catch{}},[h]);const Te=u.useCallback(async N=>{if(!N)return!1;try{const B=await Y(`/api/boards/${encodeURIComponent(N)}/tasks?limit=60`);return w(B.tasks??[]),!0}catch(B){return w([]),n(B.message),!1}},[n]);u.useEffect(()=>{Ce()},[Ce]),u.useEffect(()=>{if(!c)return;let N=!0;const B=()=>Y("/api/usage?hours=24").then(ye=>N&&te(ye)).catch(()=>{});B();const re=setInterval(()=>document.visibilityState==="visible"&&B(),6e4);return()=>{N=!1,clearInterval(re)}},[c]),u.useEffect(()=>{if(!c)return;let N=!0;const B=()=>Y("/api/live").then(ye=>{var lt;if(!N)return;const Je=Number(((lt=ye==null?void 0:ye.counts)==null?void 0:lt.turns)??0);Dt(Je);try{window.dispatchEvent(new CustomEvent("hm:live-turns",{detail:{turns:Je,items:Array.isArray(ye==null?void 0:ye.turns)?ye.turns:[]}}))}catch{}}).catch(()=>{});B();const re=setInterval(()=>document.visibilityState==="visible"&&B(),1e4);return()=>{N=!1,clearInterval(re)}},[c]);const xt=u.useCallback(async()=>{try{const N=await Y("/api/inbox"),B=(N==null?void 0:N.items)??[];ct(Ou(B));try{window.dispatchEvent(new CustomEvent("hm:inbox-items",{detail:{items:B}}))}catch{}}catch{}},[]);u.useEffect(()=>{if(!c)return;xt();const N=setInterval(()=>document.visibilityState==="visible"&&xt(),15e3);return()=>clearInterval(N)},[xt,c]);const ft=u.useCallback(async N=>{if(!N){M(null);return}try{const B=await Y(`/api/specs?board=${encodeURIComponent(N)}`),re=(Array.isArray(B==null?void 0:B.specs)?B.specs:[]).filter(ye=>(ye.batches??[]).length>0);M(re.length?{repo:B.repo??null,path:B.path??null,specs:re}:null),ue(ye=>{var Je;return ye&&re.some(lt=>lt.path===ye)?ye:((Je=re[0])==null?void 0:Je.path)??null})}catch{M(null)}},[]);u.useEffect(()=>{ft(h)},[h,ft]);const Uo=u.useCallback(async()=>(await Promise.all([h?Te(h):Promise.resolve(!0),xt(),ft(h),t?t():Promise.resolve(!0)]))[0]!==!1,[h,Te,xt,ft,t]);u.useEffect(()=>{if(!h||!c)return;Te(h);const N=setInterval(()=>document.visibilityState==="visible"&&Te(h),5e3);return()=>clearInterval(N)},[h,Te,c]);const Rn=u.useCallback(async()=>{if(!h){sn(null);return}try{const N=await Y(`/api/architect/jobs?board=${encodeURIComponent(h)}`);N!=null&&N.ok&&sn(N)}catch{sn(null)}},[h]),Na=u.useMemo(()=>xv((Ke==null?void 0:Ke.jobs)??[],as,h??""),[Ke,as,h]),Cs=kv(Na),nr=u.useMemo(()=>$b((Ke==null?void 0:Ke.jobs)??[]),[Ke]);u.useEffect(()=>{if(!c)return;Rn();const N=setInterval(()=>document.visibilityState==="visible"&&Rn(),Cs);return()=>clearInterval(N)},[Rn,Cs,c]);const ja=u.useMemo(()=>{const N=(Ke==null?void 0:Ke.specReady)??[],B=(Ke==null?void 0:Ke.pending)??[];return[...N.map(re=>`r:${re==null?void 0:re.spec}:${re==null?void 0:re.batchCount}:${re!=null&&re.launched?1:0}`),...B.map(re=>`p:${re==null?void 0:re.path}:${re==null?void 0:re.pendingCount}`)].join("|")},[Ke]);u.useEffect(()=>{ja&&ft(h)},[ja,h,ft]);const Oi=u.useMemo(()=>{const N=bv({specReady:(Ke==null?void 0:Ke.specReady)??[],pending:(Ke==null?void 0:Ke.pending)??[]});return!N||js.includes(N.path)?null:N},[Ke,js]),Di=u.useCallback(async N=>{if(!(!N||An||!h)){rn(!0);try{const B=Nn(globalThis.localStorage),re=await Y("/api/specs/launch",{method:"POST",body:{board:h,specRelPath:N.path,batchIds:N.ids,...B?{chat:B}:{}}});n(d("seed.bannerFiled",{n:((re==null?void 0:re.created)??[]).length}));try{bt("launch")}catch{}await Promise.all([Rn(),Te(h),ft(h)])}catch(B){n((B==null?void 0:B.message)??d("seed.failed"))}finally{rn(!1)}}},[An,h,n,d,Rn,Te,ft]),$i=!b.some(N=>N.status==="running"||N.status==="ready"||N.status==="todo");u.useEffect(()=>{if(!h){k(null);return}if(!h||!c)return;let N=!0;const B=()=>Y(`/api/specs/reports?board=${encodeURIComponent(h)}&limit=1`).then(ye=>{if(!N)return;const Je=Array.isArray(ye==null?void 0:ye.reports)?ye.reports:Array.isArray(ye==null?void 0:ye.items)?ye.items:[];k(Je[0]??null)}).catch(()=>{N&&k(null)});B();const re=setInterval(()=>document.visibilityState==="visible"&&B(),3e4);return()=>{N=!1,clearInterval(re)}},[h,$i,c]);const Ho=u.useMemo(()=>{const N=dr(S==null?void 0:S.at);return!!N&&Date.now()-N<24*60*60*1e3},[S]),Tr=u.useMemo(()=>S!=null&&S.markdown?ci(S.markdown):null,[S]),Pn=u.useCallback(()=>{if(S){H("tap");try{window.dispatchEvent(new CustomEvent("hm:discuss-pipeline",{detail:{sessionId:S.sessionId??null,repoPath:S.repoPath??null,board:S.board??h,prompt:zr(S,""),title:S.label??null}}))}catch{}}},[S,h]);u.useEffect(()=>{if(!(r!=null&&r.board)||!g.length)return;g.some(B=>B.slug===r.board)&&x(r.board);const N=String(r.taskId??"").trim();N&&sr({id:N,title:""},r.board),i==null||i()},[r,g,i]);const sr=async(N,B=h)=>{const re=String(B??h??"").trim();v({loading:!0,board:re,...N}),V(null),X(null);try{const ye=await Y(`/api/boards/${encodeURIComponent(re)}/tasks/${encodeURIComponent(N.id)}`);v({...ye,board:re})}catch(ye){n(ye.message),v(null)}};u.useEffect(()=>{const N=m==null?void 0:m.id,B=m==null?void 0:m.status;if(!N||!(B==="running"||B==="ready"))return;const re=String((m==null?void 0:m.board)??h??"");let ye=!0;const Je=setInterval(async()=>{if(document.visibilityState==="visible")try{const lt=await Y(`/api/boards/${encodeURIComponent(re)}/tasks/${encodeURIComponent(N)}`);if(!ye)return;v(ln=>ln&&ln.id===N?{...ln,...lt,board:re,loading:!1}:ln)}catch{}},YS);return()=>{ye=!1,clearInterval(Je)}},[m==null?void 0:m.id,m==null?void 0:m.status,m==null?void 0:m.board,h]);const Ar=String((m==null?void 0:m.board)??h??""),In=N=>{const B=String((N==null?void 0:N.taskId)??"").trim(),re=String((N==null?void 0:N.board)??h??"").trim();if(!B||!re){et(!0);return}H("tap"),re!==h&&g.some(Je=>Je.slug===re)&&x(re);const ye=String((N==null?void 0:N.seed)??"").trim();sr({id:B,title:ye?ye.slice(0,40):B},re)},gn=async N=>{if(!($!=null&&$.files)){V({loading:!0});try{const B=await Y(`/api/boards/${encodeURIComponent(Ar)}/tasks/${encodeURIComponent(N)}/diff`);V(B)}catch(B){V({ok:!1,reason:B.message})}}},Rr=async(N,B)=>{if((D==null?void 0:D.path)===B){X(null);return}X({path:B,loading:!0});try{const re=await Y(`/api/boards/${encodeURIComponent(Ar)}/tasks/${encodeURIComponent(N)}/diff?file=${encodeURIComponent(B)}`);X({...re,path:B})}catch(re){X({path:B,ok:!1,reason:re.message})}},Ca=async N=>{P(!0);try{const B=String((N==null?void 0:N.board)??Ar).trim(),re=await Y(`/api/boards/${encodeURIComponent(B)}/tasks/${encodeURIComponent(N.id)}/abort`,{method:"POST",body:{reason:d("tasks.abortReason")}});n(d("tasks.aborted",{reclaim:re.reclaimed,block:re.blocked})),v(null),Te(B)}catch(B){n(B.message)}finally{P(!1)}},is=async N=>{P(!0);try{const B=await Y(`/api/gateway/${N}`,{method:"POST",body:{confirm:N.toUpperCase()}});return n(d("tasks.actionRan",{action:N})),E(!1),I(""),t==null||t(),B}catch(B){n(B.message)}finally{P(!1)}},ls=async()=>{P(!0);try{await Y("/api/gateway/pause",{method:"POST",body:{confirm:"PAUSE",reason:"mobile"}}),n(d("tasks.pausedDone")),t==null||t()}catch(N){n(N.message)}finally{P(!1)}},Pr=async()=>{P(!0);try{await Y("/api/gateway/resume",{method:"POST",body:{confirm:"RESUME"}}),n(d("tasks.resumed")),t==null||t()}catch(N){n(N.message)}finally{P(!1)}},Ft=e==null?void 0:e.bridge,Es=(Ui=e==null?void 0:e.system)==null?void 0:Ui.memory,Ea=(Pa=e==null?void 0:e.system)==null?void 0:Pa.disk,Ir=b.filter(N=>N.status==="running").length,os=(e==null?void 0:e.paused)??{engaged:!1},{split:rr}=op(),vn=($e==null?void 0:$e.specs)??[],De=vn.find(N=>N.path===se)??vn[0]??null,ar=xm((De==null?void 0:De.batches)??[],b),an=new Set(ar.byId.keys()),Ta=new Set(b.filter(N=>N.status!=="done"&&N.status!=="archived").map(N=>Rv(N.title)).filter(Boolean)),Gn=ar.allDone,Yn=N=>{var B,re;return[(B=N==null?void 0:N.counts)!=null&&B.running?d("tasks.boardRunning",{n:N.counts.running}):null,(re=N==null?void 0:N.counts)!=null&&re.blocked?d("tasks.boardBlocked",{n:N.counts.blocked}):null,N!=null&&N.archived?d("tasks.boardArchived"):null,N!=null&&N.lastActivityAt?tt(N.lastActivityAt*1e3):null].filter(Boolean).join(" · ")},_n=g.find(N=>N.slug===h)??null,Mn=()=>((De==null?void 0:De.batches)??[]).filter(N=>!an.has(N.id)).map(N=>N.id),Aa=()=>{De&&(H("tap"),ee(Mn()),wt(!1),Nt([]),L(!0))},_r=()=>{De&&(H("tap"),wt(!1),He(!0))},Bt=(N,B=!1)=>{if(N&&(ue(N.path),wt(!1),Nt([]),B)){const re=xm(N.batches??[],b);ee((N.batches??[]).filter(ye=>!re.byId.has(ye.id)).map(ye=>ye.id))}},yn=N=>{const B=typeof N=="string"?N:N==null?void 0:N.path;B&&(H("tap"),F({path:B,title:typeof N=="string"?null:(N==null?void 0:N.title)??null,board:typeof N=="string"?null:(N==null?void 0:N.board)??null}))},Fi=(N=null)=>{H("tap"),Oe({board:(N==null?void 0:N.board)??h??null,spec:(N==null?void 0:N.spec)??(De==null?void 0:De.path)??null})},zo=async()=>{if(!(!De||!U.length||!h)){ut(!0);try{const N=await Y("/api/specs/launch",{method:"POST",body:{board:h,specRelPath:De.path,batchIds:U,assignee:"mobile",chat:Nn(globalThis.localStorage)||void 0}});bt("launch"),n(d("tasks.specLaunched",{created:(N.created??[]).length,skipped:(N.skipped??[]).length})),L(!1),ee([]),Te(h)}catch(N){n(N.message)}finally{ut(!1)}}},Ra=m?m.loading?a.jsx(Wn,{label:d("tasks.detailLoading")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:d("tasks.status")}),a.jsxs("b",{children:[Fr[m.status]?d(Fr[m.status]):m.status,m.workerPid?` ・ pid ${m.workerPid}`:""]})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:d("tasks.started")}),a.jsx("b",{children:m.startedAt?tt(m.startedAt):"—"})]}),m.branch?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:d("tasks.branch")}),a.jsx("b",{className:"mono",children:m.branch})]}):null,m.body?a.jsx("div",{className:"body-text",children:m.body}):null,m.result?a.jsx("div",{className:"body-text result",children:m.result}):null,(Hi=m.git)!=null&&Hi.head?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:d("tasks.commit")}),a.jsxs("b",{className:"mono",children:[m.git.head,m.git.branch?` (${m.git.branch})`:""]})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:d("tasks.message")}),a.jsx("b",{className:"git-msg",children:m.git.subject||"—"})]}),a.jsxs("button",{className:"accordion",onClick:()=>{$!=null&&$.loading||($?V(null):gn(m.id))},children:[a.jsxs("span",{className:"acc-title",children:[d("tasks.changedFiles"),$!=null&&$.ok?a.jsxs("span",{className:"diff-sum",children:[a.jsxs("span",{className:"add",children:["+",$.total.add]})," ",a.jsxs("span",{className:"del",children:["−",$.total.del]})]}):null]}),a.jsx("span",{className:"acc-caret",children:$?"▾":"▸"})]}),$?$.loading?a.jsxs("div",{className:"row-sub hm-btn-inner",style:{padding:"6px 4px"},children:[a.jsx(hn,{size:12}),a.jsx("span",{children:d("common.loading")})]}):$.ok?a.jsxs("div",{className:"diff-list",children:[($.files??[]).map(N=>a.jsxs("div",{children:[a.jsxs("button",{className:`diff-row${(D==null?void 0:D.path)===N.path?" on":""}`,onClick:()=>Rr(m.id,N.path),children:[a.jsx("span",{className:"diff-path mono",children:N.path}),a.jsx("span",{className:"diff-nums",children:N.binary?a.jsx("span",{className:"git-dirty",children:"binary"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"add",children:["+",N.add]})," ",a.jsxs("span",{className:"del",children:["−",N.del]})]})})]}),(D==null?void 0:D.path)===N.path?D.loading?a.jsxs("div",{className:"row-sub hm-btn-inner",style:{padding:"6px 10px"},children:[a.jsx(hn,{size:12}),a.jsx("span",{children:d("common.loading")})]}):D.ok?a.jsx("pre",{className:"patch",children:D.text}):a.jsx("div",{className:"row-sub",style:{padding:"6px 10px"},children:D.reason}):null]},N.path)),($.files??[]).length?null:a.jsx("div",{className:"empty",children:d("tasks.noDiff")}),$.truncated?a.jsx("div",{className:"row-sub",children:d("tasks.diffLimit")}):null,$.dirty?a.jsx("div",{className:"row-sub",children:d("tasks.dirtyNote")}):null]}):a.jsx("div",{className:"row-sub",style:{padding:"6px 4px"},children:$.reason}):null]}):null,(wn=m.discord)!=null&&wn.url?a.jsx("button",{className:"btn dc-btn",onClick:()=>window.open(m.discord.url,"_blank","noopener"),children:d("tasks.openThread")}):null,m.status==="running"||m.workerPid?a.jsx("div",{style:{marginTop:12},children:a.jsx(Zn,{label:d("tasks.abortTask"),sub:d("tasks.abortSub"),tone:"danger",disabled:A,onFire:()=>Ca(m)})}):null,m.sessionId?a.jsx("div",{style:{marginTop:12},children:a.jsx(Hv,{taskId:m.id,open:m.status==="running"||m.status==="ready",endpoint:`/api/boards/${encodeURIComponent(Ar)}/tasks/${encodeURIComponent(m.id)}/worker?limit=30`})}):null,a.jsx("div",{className:"list-head",style:{marginTop:16},children:a.jsx("span",{children:d("tasks.events")})}),a.jsxs("div",{className:"timeline",children:[uS(m.events??[]).map((N,B)=>{const re=N.kind==="heartbeat"&&N.count>1;return a.jsxs("div",{className:"tl",children:[a.jsx("span",{className:"tl-dot"}),a.jsxs("span",{className:"tl-main",children:[a.jsx("span",{className:"row-title",children:re?d("tasks.heartbeatCount",{n:N.count}):N.kind}),a.jsx("span",{className:"row-sub",children:re?d("tasks.heartbeatRange",{first:tt(N.firstAt),last:tt(N.at)}):tt(N.at)})]})]},B)}),(m.events??[]).length?null:a.jsx("div",{className:"empty",children:d("tasks.noEvents")})]})]}):null,Bi=()=>{v(null),I("")};return a.jsxs("div",{className:rr?"pane split-layout tasks":"pane",children:[a.jsxs("div",{className:rr?"split-master":void 0,children:[os.engaged?a.jsxs("div",{className:"banner paused",children:[d("tasks.pausedBanner",{reason:os.reason?` ・ ${os.reason}`:""}),a.jsx("button",{onClick:Pr,disabled:A,children:d("tasks.resume")})]}):null,ht?a.jsxs("button",{className:"inbox-bar",onClick:()=>Re(null),children:[a.jsx("span",{children:d("tasks.inboxBar",{n:ht})}),a.jsx("span",{className:"inbox-bar-go",children:d("tasks.inboxBarGo")})]}):null,a.jsx(Ev,{job:Na,board:h??"",repo:($e==null?void 0:$e.repo)??null,chat:Nn(globalThis.localStorage)||null,onInspect:In,onRetried:async()=>{await Promise.all([Rn(),ft(h)])},onDismiss:N=>z(B=>[...B,N]),notify:n}),a.jsx(Nv,{banner:Oi,busy:An,onFile:Di,onDismiss:N=>ke(B=>[...B,N.path]),onPreview:N=>yn({path:N.path,title:N.title})}),a.jsxs("div",{className:"seed-entry",children:[a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{H("tap"),me(""),mt(!0)},"aria-label":d("seed.openAria"),children:["📝 ",d("seed.title")]}),a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{H("tap"),Qn(""),Ue(!0)},children:["🧠 ",d("brainstorm.title")]}),a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{H("tap"),Gt(!0)},children:["🛠 ",d("refactor.title")]})]}),De?a.jsxs("button",{className:`spec-bar${Gn?" is-done":""}`,onClick:Gn?_r:Aa,"aria-label":d(Gn?"tasks.specHistoryAria":"tasks.specBarAria",{name:De.title}),children:[a.jsxs("span",{className:"spec-bar-main",children:[a.jsx("span",{className:"spec-bar-title",children:Gn?`✅ ${d("tasks.specAllDone")}`:`🚀 ${d("tasks.specLaunchpad")}`}),a.jsx("span",{className:"spec-bar-name",children:De.title})]}),a.jsxs("span",{className:"spec-bar-n",children:[d("tasks.specBatchCount",{n:De.batches.length}),a.jsx(Me,{name:"chevron",size:14})]})]}):null,S&&($i||Ho)?a.jsxs("details",{className:`pipeline-summary-card${String(S.status??"")==="halted"?" is-halted":""}`,children:[a.jsxs("summary",{className:"pipeline-summary-head",children:[a.jsx("span",{className:"pipeline-summary-icon","aria-hidden":"true",children:String(S.status??"")==="halted"?"⚠️":"🎉"}),a.jsx("span",{className:"pipeline-summary-title",children:S.label||d("tasks.pipelineSummary")}),a.jsx("span",{className:"pipeline-summary-sub",children:qd(S,48)}),a.jsx("span",{className:"pipeline-summary-when",children:tt(dr(S.at)||0)})]}),a.jsxs("div",{className:"pipeline-summary-body",children:[Tr,a.jsxs("div",{className:"pipeline-summary-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:Pn,children:d("tasks.discussReport")}),a.jsx("button",{type:"button",className:"report-card-btn",onClick:()=>Fi(S),children:d("receipt.open")}),a.jsx("button",{type:"button",className:"report-card-btn",onClick:N=>{const B=N.currentTarget.closest("details");B&&(B.open=!1)},children:d("tasks.pipelineCollapse")})]})]})]}):null,a.jsxs("div",{className:"strip",children:[a.jsxs("div",{className:`stat ${(Ft==null?void 0:Ft.ok)===!1?"bad":Ft?"good":""}`,children:[a.jsx("span",{className:"stat-k",children:d("tasks.bridge")}),a.jsx("span",{className:"stat-v",children:Ft?Ft.ok?d("tasks.ok"):d("tasks.disconnected"):"—"})]}),a.jsxs("button",{className:"stat",onClick:()=>ve(!0),"aria-label":d("tasks.usageAria"),children:[a.jsx("span",{className:"stat-k",children:"24h"}),a.jsx("span",{className:"stat-v",children:ce!=null&&ce.ok?oa(ce.totals.cost):"—"})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-k",children:d("tasks.memory")}),a.jsx("span",{className:"stat-v",children:Es?`${Es.percent}%`:"—"})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-k",children:d("tasks.disk")}),a.jsx("span",{className:"stat-v",children:Ea?`${Ea.percent}%`:"—"})]}),a.jsxs("button",{className:`stat ${Ir||nr?"warn":""}`,onClick:()=>et(!0),"aria-label":d("tasks.liveAria"),children:[a.jsxs("span",{className:"stat-k",children:[d("tasks.runningLabel"),We||nr?a.jsx("i",{className:"live-dot",title:d("tasks.turnTitle",{n:We+nr})}):null]}),a.jsx("span",{className:"stat-v",children:Ir+We+nr})]})]}),a.jsxs("button",{className:"pick-item board-now",onClick:()=>q(!0),"aria-label":d("tasks.boardOpenAria"),title:d("tasks.boardList"),children:[a.jsxs("span",{className:"pick-main",children:[a.jsxs("span",{className:"pick-title",children:[a.jsx("span",{"aria-hidden":"true",children:(_n==null?void 0:_n.icon)??"🗂"})," ",(_n==null?void 0:_n.name)??h??d("tasks.board")]}),a.jsx("span",{className:"pick-sub",children:Yn(_n)})]}),a.jsxs("span",{className:"pick-meta",children:[d("tasks.boardCount",{n:g.length}),a.jsx(Me,{name:"chevron",size:14})]})]}),G&&a.jsx(Qe,{title:d("tasks.board"),onClose:()=>q(!1),children:a.jsx("div",{className:"pick-list",children:g.map(N=>a.jsxs("button",{className:`pick-item${h===N.slug?" on":""}`,onClick:()=>{x(N.slug),q(!1)},children:[a.jsx("span",{"aria-hidden":"true",children:N.icon}),a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:N.name}),a.jsx("span",{className:"pick-sub",children:Yn(N)})]}),a.jsx("span",{className:"pick-meta",children:h===N.slug?"✓":""})]},N.slug))})}),Kn?a.jsx(Sv,{board:h??"",repo:($e==null?void 0:$e.repo)??null,chat:Nn(globalThis.localStorage)||null,initialText:Ns,notify:n,onClose:()=>{mt(!1),me("")},onSeeded:()=>Rn()}):null,jt?a.jsx(zb,{initialSeed:rs,board:h??"",repo:($e==null?void 0:$e.repo)??null,notify:n,onClose:()=>{Ue(!1),Qn("")}}):null,It?a.jsx(Wb,{board:h??"",notify:n,onClose:()=>Gt(!1)}):null,W&&De?a.jsxs(Qe,{title:d("tasks.specSheetTitle"),onClose:()=>!we&&L(!1),children:[a.jsxs("div",{className:`spec-context-box${$t?" is-open":""}`,children:[a.jsx(Im,{specList:vn,currentSpec:De,open:$t,onToggle:()=>wt(N=>!N),onPick:N=>Bt(N,!0),t:d}),a.jsx("div",{className:"spec-md-row",children:a.jsx("button",{type:"button",className:"btn spec-md-open",onClick:()=>yn(De),children:`📄 ${d("tasks.specMdPreview")}`})})]}),a.jsxs("div",{className:"spec-children-section",children:[a.jsx("div",{className:"list-head spec-children-head",children:d("tasks.specBatchesHead",{n:De.batches.length})}),a.jsx("div",{className:"list",children:De.batches.map(N=>{const B=an.has(N.id),re=Ta.has(N.id),ye=U.includes(N.id),Je=_e.includes(N.id);return a.jsxs("div",{className:`spec-batch${ye?" on":""}`,children:[a.jsxs("button",{type:"button",className:`list-item${ye?" on":""}`,onClick:()=>{H("tap"),ee(lt=>lt.includes(N.id)?lt.filter(ln=>ln!==N.id):[...lt,N.id])},children:[a.jsx("span",{className:"spec-check","aria-hidden":"true",children:ye?"☑":"☐"}),a.jsxs("span",{style:{flex:"1 1 auto",minWidth:0},children:[a.jsxs("span",{className:"row-title",children:["[",N.id,"] ",N.title]}),a.jsx(Pm,{batch:N,t:d}),N.objective?a.jsx("span",{className:"row-sub",children:N.objective.slice(0,140)}):null]}),B?a.jsx("span",{className:"spec-taken",children:d(re?"tasks.specAlready":"tasks.specFiledDone")}):null]}),a.jsxs("button",{type:"button",className:"link spec-batch-toggle","aria-expanded":Je,onClick:()=>{H("tap"),Nt(lt=>lt.includes(N.id)?lt.filter(ln=>ln!==N.id):[...lt,N.id])},children:[d("tasks.specDetailToggle")," ",Je?"▴":"▾"]}),Je?a.jsx("div",{className:"spec-batch-detail",children:ci(N.section||N.title||"")}):null]},N.id)})}),Gn?a.jsx("button",{className:"btn",style:{marginTop:12,width:"100%"},onClick:()=>{L(!1),_r()},children:d("tasks.specHistoryTitle")}):a.jsx("button",{className:"btn primary",style:{marginTop:12,width:"100%"},disabled:we||!U.length,onClick:zo,children:we?d("tasks.specLaunching"):d("tasks.specLaunchBtn",{n:U.length})}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px",lineHeight:1.6},children:d("tasks.specNote")})]})]}):null,Ee&&De?a.jsxs(Qe,{title:d("tasks.specHistoryTitle"),onClose:()=>He(!1),children:[a.jsxs("div",{className:`spec-context-box${$t?" is-open":""}`,children:[a.jsx(Im,{specList:vn,currentSpec:De,open:$t,onToggle:()=>wt(N=>!N),onPick:N=>Bt(N,!1),t:d}),a.jsx("div",{className:"spec-md-row",children:a.jsx("button",{type:"button",className:"btn spec-md-open",onClick:()=>yn(De),children:`📄 ${d("tasks.specMdPreview")}`})})]}),a.jsxs("div",{className:"spec-children-section",children:[a.jsx("div",{className:"list-head spec-children-head",children:d("tasks.specBatchesHead",{n:De.batches.length})}),a.jsx("div",{className:"pick-list",children:De.batches.map(N=>{var lt;const B=ar.byId.get(N.id)??null,re=B&&(B.status==="done"||B.status==="archived"),ye=B?Fr[B.status]?d(Fr[B.status]):B.status:d("tasks.specNotFiled"),Je=re?B!=null&&B.completedAt?tt(B.completedAt):null:B!=null&&B.startedAt?d("tasks.specStartedAt",{when:tt(B.startedAt)}):null;return a.jsxs("details",{className:"pick-item history-row",children:[a.jsxs("summary",{className:"history-summary",children:[a.jsx("span",{className:`dot ${(B==null?void 0:B.status)??"todo"}`}),a.jsxs("span",{className:"history-title",title:`[${N.id}] ${N.title}`,children:["[",N.id,"] ",N.title]}),a.jsx("span",{className:"history-state",children:re?d("tasks.specDoneBadge"):ye}),a.jsx(Me,{name:"chevron",size:14})]}),a.jsxs("div",{className:"history-body",children:[a.jsxs("div",{className:"history-head",children:[a.jsx(Pm,{batch:N,t:d}),a.jsx("span",{className:"history-state-in",children:ye}),Je?a.jsx("span",{className:"history-when",children:Je}):null]}),N.objective?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"history-label",children:d("tasks.specObjective")}),a.jsx("div",{className:"history-objective",children:N.objective})]}):null,B!=null&&B.result?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"history-label",children:d("tasks.specResult")}),a.jsx("div",{className:"history-result",children:B.result})]}):null,(lt=B==null?void 0:B.git)!=null&&lt.head?a.jsxs("div",{className:"git-badge",children:[a.jsx("span",{className:"git-sha",children:B.git.head}),B.git.subject?a.jsx("span",{className:"git-subject",children:B.git.subject}):null]}):null,B?a.jsx("button",{type:"button",className:"btn history-open-task",onClick:()=>{H("action"),He(!1),sr(B)},children:`🔍 ${d("tasks.specOpenTask")}`}):null,a.jsxs("details",{className:"history-sub-details",children:[a.jsx("summary",{children:d("tasks.specSection")}),a.jsx("div",{className:"history-section",children:ci(N.section||N.title||"")})]})]})]},N.id)})}),Gn?null:a.jsx("button",{className:"btn",style:{marginTop:12,width:"100%"},onClick:()=>{He(!1),Aa()},children:d("tasks.specOpenLaunch")}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px",lineHeight:1.6},children:d("tasks.specHistoryNote")})]})]}):null,Tt?a.jsx(Jb,{board:Tt.board??h,repo:($e==null?void 0:$e.repo)??null,path:Tt.path,title:Tt.title,onClose:()=>F(null)}):null,a.jsxs("div",{className:"list-head",children:[a.jsx("span",{children:d("tasks.tasks")}),a.jsxs("span",{style:{display:"flex",gap:10,alignItems:"center"},children:[a.jsx("button",{className:"link",onClick:()=>{H("tap"),Z(!0)},children:d("tasks.newTask")}),a.jsx(Xs,{variant:"link",onRefresh:Uo})]})]}),y?a.jsx(Wn,{label:d("common.loading")}):null,!y&&!b.length?a.jsx("div",{className:"empty",children:d("tasks.empty")}):null,a.jsx("div",{className:"list",children:b.map(N=>{var B;return a.jsxs("button",{className:"row",onClick:()=>{H("tap"),sr(N)},children:[a.jsx("span",{className:`dot ${N.status}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:N.title}),a.jsxs("span",{className:"row-sub",children:[Fr[N.status]?d(Fr[N.status]):N.status,N.status==="running"&&N.elapsedSec!=null?` ・ ${d("tasks.elapsedMin",{n:Math.floor(N.elapsedSec/60)})}`:"",N.failures?` ・ ${d("tasks.failures",{n:N.failures})}`:"",N.completedAt?` ・ ${tt(N.completedAt)}`:""]}),(B=N.git)!=null&&B.head?a.jsxs("span",{className:"git-badge",children:[a.jsx("span",{className:"git-sha",children:N.git.head}),a.jsx("span",{className:"git-subject",children:N.git.subject||d("tasks.noMessage")}),N.git.dirty?a.jsx("span",{className:"git-dirty",children:d("tasks.uncommitted")}):null,N.discord?a.jsx("span",{className:"git-dc",role:"link",tabIndex:0,title:d("tasks.openInDiscord"),onClick:re=>{re.stopPropagation(),window.open(N.discord.url,"_blank","noopener")},onKeyDown:re=>{re.key==="Enter"&&(re.stopPropagation(),window.open(N.discord.url,"_blank","noopener"))},children:"Discord"}):null]}):null]}),a.jsx(Me,{name:"chevron",size:16})]},N.id)})}),a.jsxs("button",{className:"kill-open",onClick:()=>E(!0),children:[a.jsx(Me,{name:"bolt",size:18}),d("tasks.emergency")]}),T?a.jsxs(Qe,{title:d("tasks.emergencyTitle"),onClose:()=>!A&&E(!1),children:[a.jsx("div",{className:"warn-card",children:d("tasks.emergencyNote",{n:Ir})}),a.jsx("div",{className:"warn-card",style:{marginTop:8},children:os.engaged?d("tasks.pausedNow",{at:os.engagedAt??d("tasks.unknownTime")}):d("tasks.pauseHelp")}),os.engaged?a.jsx("button",{className:"btn",style:{marginTop:10,width:"100%"},onClick:Pr,disabled:A,children:d("tasks.resumeEstop")}):a.jsx("div",{className:"hold-grid",style:{marginTop:10},children:a.jsx(Zn,{label:d("tasks.pauseLabel"),sub:d("tasks.pauseSub"),tone:"safe",disabled:A,onFire:ls})}),a.jsxs("div",{className:"hold-grid",children:[a.jsx(Zn,{label:d("tasks.drainLabel"),sub:d("tasks.drainSub"),tone:"safe",disabled:A,onFire:()=>is("drain")}),a.jsx(Zn,{label:d("tasks.restartLabel"),sub:d("tasks.restartSub"),tone:"danger",disabled:A,onFire:()=>is("restart")}),a.jsx(Zn,{label:d("tasks.stopLabel"),sub:d("tasks.stopSub"),tone:"danger",disabled:A,onFire:()=>is("stop")}),a.jsx(Zn,{label:d("tasks.startLabel"),sub:d("tasks.startSub"),tone:"safe",disabled:A,onFire:()=>is("start")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 4px"},children:d("tasks.auditNote")})]}):null,ge?a.jsx(gb,{board:h,boards:g,notify:n,onClose:()=>Z(!1),onCreated:N=>{h&&(N==null?void 0:N.board)===h?Te(h):N!=null&&N.board&&x(N.board)}}):null,pe?a.jsx(vv,{data:ce,hours:24,board:h,spec:(De==null?void 0:De.path)??null,onClose:()=>ve(!1)}):null,xe?a.jsx(ap,{board:xe.board,spec:xe.spec,onClose:()=>Oe(null),notify:n}):null,yt?a.jsx(nS,{notify:n,onClose:je,onChanged:xt,focusTaskId:de}):null,Ae?a.jsx(Tv,{notify:n,onClose:()=>et(!1),onAbortTask:()=>h&&Te(h)}):null]}),m&&!rr?a.jsx(Qe,{title:m.title??m.id,onClose:Bi,children:Ra}):null,rr?a.jsx("div",{className:"split-detail",children:m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"split-detail-head",children:[a.jsx("span",{className:"split-detail-title",children:m.title??m.id}),a.jsx("button",{className:"icon-btn",onClick:Bi,"aria-label":d("common.close"),children:a.jsx(Me,{name:"close",size:18})})]}),a.jsx("div",{className:"split-detail-body",children:Ra})]}):a.jsxs("div",{className:"split-placeholder",children:[a.jsx("b",{children:d("tasks.selectPlaceholder")}),a.jsx("span",{children:d("tasks.selectHint")})]})}):null]})}function ZS({onEvent:e,onReady:t,onState:n}){const[s,r]=u.useState("connecting"),[i,l]=u.useState(!1),o=u.useRef(null),c=u.useRef(new Map),d=u.useRef(1),g=u.useRef(0),f=u.useRef(null),h=u.useRef(!1),x=u.useRef(Date.now()),b=u.useRef(e),w=u.useRef(t),S=u.useRef(n);b.current=e,w.current=t,S.current=n,u.useEffect(()=>{const E=setInterval(()=>{const _=x.current;l(!!_&&Date.now()-_>2e3)},400);return()=>clearInterval(E)},[]);const k=u.useCallback(E=>{for(const[_,I]of c.current)I({id:_,error:{message:E}});c.current.clear()},[]),m=u.useCallback((E,_={},I=2e4)=>{const A=o.current,P=d.current++;return new Promise(y=>{if(!A||A.readyState!==WebSocket.OPEN){y({id:P,error:{message:C("socket.notConnected")}});return}const K=setTimeout(()=>{c.current.delete(P),y({id:P,error:{message:"timeout"}})},I);c.current.set(P,$=>{clearTimeout(K),y($)}),A.send(JSON.stringify({jsonrpc:"2.0",id:P,method:E,params:_}))})},[]),v=u.useCallback(()=>{var _;if(o.current&&o.current.readyState<=WebSocket.OPEN)return;r("connecting"),(_=S.current)==null||_.call(S,"connecting"),x.current||(x.current=Date.now());const E=vk("/ws/chat");o.current=E,E.onopen=()=>{g.current=0},E.onmessage=I=>{var y,K,$,V;let A;try{A=JSON.parse(I.data)}catch{return}if(A.id&&c.current.has(A.id)){c.current.get(A.id)(A),c.current.delete(A.id);return}((y=A==null?void 0:A.params)==null?void 0:y.type)==="gateway.ready"&&(x.current=null,l(!1),r("ready"),(K=S.current)==null||K.call(S,"ready"),($=w.current)==null||$.call(w)),(V=b.current)==null||V.call(b,A)},E.onerror=()=>{var I;r("error"),(I=S.current)==null||I.call(S,"error")},E.onclose=()=>{var A;if(o.current=null,x.current||(x.current=Date.now()),r("closed"),(A=S.current)==null||A.call(S,"closed"),k(C("socket.disconnected")),h.current)return;const I=Math.min(15e3,1e3*2**g.current);g.current+=1,clearTimeout(f.current),f.current=setTimeout(()=>v(),I)}},[k]),T=u.useCallback(()=>{var E;if(g.current=0,!o.current||o.current.readyState!==WebSocket.OPEN){try{(E=o.current)==null||E.close()}catch{}o.current=null,v()}},[v]);return u.useEffect(()=>{h.current=!1,v();const E=()=>{if(document.visibilityState!=="visible")return;const I=o.current;(!I||I.readyState!==WebSocket.OPEN)&&T()},_=()=>T();return document.addEventListener("visibilitychange",E),window.addEventListener("online",_),window.addEventListener("pageshow",E),()=>{var I;h.current=!0,document.removeEventListener("visibilitychange",E),window.removeEventListener("online",_),window.removeEventListener("pageshow",E),clearTimeout(f.current);try{(I=o.current)==null||I.close()}catch{}o.current=null}},[v,T]),{rpc:m,state:s,reconnectNow:T,showBanner:i}}const dt="mobile",Gu="hm.storedProfile",_m="hm.defaultProfile";function e0(e=globalThis.localStorage){try{return!e||e.getItem(_m)===dt?!1:(e.removeItem(Gu),e.setItem(_m,dt),!0)}catch{return!1}}function t0({storedSid:e,sessions:t,profile:n}={}){if(e)return{sid:e,from:"stored"};const s=n||"default",r=(t||[]).filter(o=>o&&o.id&&(o.profile||"default")===s);if(!r.length)return null;const i=o=>Number(o.updated_at??o.started_at??0)||0;return{sid:r.reduce((o,c)=>i(c)>i(o)?c:o).id,from:"recent"}}function Mm(e,t,n=3){const s=t||"default",r=i=>Number(i.updated_at??i.started_at??0)||0;return(e||[]).filter(i=>i&&i.id&&(i.profile||"default")===s).sort((i,l)=>r(l)-r(i)).slice(0,n)}function n0(e,t=null){if(!e)return!1;const n=String(e.id??"").trim();return n?!!(t&&n===String(t).trim()||n.startsWith("local-")||String(e.source??"").trim().toLowerCase()==="kanban"):!1}const s0=["banners","chips","snippets","composer"];function r0(){return s0.slice()}function a0(e=[],t=[],n=""){const s=Array.isArray(e)&&e.length?e:[n],r=new Map;for(const l of Array.isArray(t)?t:[]){const o=l==null?void 0:l.profile;if(!o)continue;const c=Number((l==null?void 0:l.started_at)??0);Number.isFinite(c)&&c>(r.get(o)??-1)&&r.set(o,c)}const i=l=>l===n?0:l==="default"?1:2;return[...new Set(s.filter(Boolean))].sort((l,o)=>i(l)-i(o)||(r.get(o)??-1)-(r.get(l)??-1)||l.localeCompare(o))}const Il=56,Lm=400;function hp(e,t=44){const n=String(e??"").replace(/\s+/g," ").trim();if(!n||n.length<=t)return n;if(!/\s/.test(n)&&n.includes("/")){const s=n.split("/").filter(Boolean);if(s.length>=2){const r=`…/${s.slice(-2).join("/")}`;if(r.length<=t)return r}return`…${n.slice(-(t-1))}`}return`${n.slice(0,t-1)}…`}function Om(e,t=0){const n=String(e??"").trim();if(!n)return"";let s=n;if(n.startsWith("{")||n.startsWith("[")){const i=l0(n);if(i!==void 0){const l=_l(i);l&&(s=l)}else{const l="error|output|stdout|stderr|result|content|message|status|text",o=n.match(new RegExp(`"(?:${l})"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`))||n.match(new RegExp(`"(?:${l})"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`));o&&(s=o0(o[1]))}}const r=c0(s);return r?t>0&&r.length>t?`${r.slice(0,t-1)}…`:r:""}const i0=["error","output","stdout","stderr","result","content","message","status","text"];function l0(e){try{return JSON.parse(e)}catch{return}}function o0(e){try{return JSON.parse(`"${e}"`)}catch{return e}}function _l(e,t=0){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(s=>_l(s,t+1)).filter(Boolean).join(`
78
+ `);if(!e||typeof e!="object")return"";for(const n of i0)if(n in e){const s=_l(e[n],t+1);if(s)return s}return t>=2?"":Object.entries(e).slice(0,4).map(([n,s])=>{const r=_l(s,t+1);return r?`${n}: ${r}`:""}).filter(Boolean).join(" · ")}function c0(e){for(const t of String(e??"").split(`
79
+ `)){const n=t.replace(/\s+/g," ").trim();if(n)return n}return""}function Wv(e,t){const n=t&&typeof t=="object"?t:{},s=l=>typeof l=="string"?l:"",r=(...l)=>{for(const o of l){const c=s(n[o]).trim();if(c)return c}return""};let i="";switch(e){case"terminal":i=r("command");break;case"execute_code":i=r("code");break;case"write_file":case"patch":case"read_file":i=r("path","file_path");break;case"browser_exec":i=r("code");break;case"web_search":i=r("query");break;case"delegate_task":i=r("goal");break;case"kanban_create":case"kanban_comment":i=r("title","text","task_id");break;default:i=r("command","path","file_path","query","goal","text")}return i.replace(/\s+/g," ").trim()}function Vv(e,t){const n=Wv(e,t);return n.length>Lm?`${n.slice(0,Lm-1)}…`:n}function Kv(e,t){const n=Wv(e,t);return n?e==="write_file"||e==="patch"||e==="read_file"||!/\s/.test(n)&&n.includes("/")?hp(n,Il):n.length>Il?`${n.slice(0,Il-1)}…`:n:""}function u0(e,t){const n=Array.isArray(e)?e.slice():[],s=String((t==null?void 0:t.id)||(t==null?void 0:t.name));if((t==null?void 0:t.kind)==="start")return n.push({id:s,name:String(t.name),detail:Kv(t.name,t.args),full:Vv(t.name,t.args),done:!1}),n.slice(-8);if((t==null?void 0:t.kind)==="complete"){for(let r=n.length-1;r>=0;r-=1)if(n[r].id===s&&!n[r].done)return n[r]={...n[r],done:!0,ms:Number(t.duration_ms)||void 0},n}return n}function Lc(e,t=n=>Number(n)||0){const n=[];let s=[];for(let i=0;i<(e??[]).length;i+=1){const l=e[i];if(l){if(l.role==="tool"){const o=String(l.toolName||"tool"),c=l.toolArgs?Kv(o,l.toolArgs):"",d=l.toolArgs?Vv(o,l.toolArgs):"",g=hp(Om(l.text),Il),f=String(l.text??""),h=Om(l.text,300);s.push({id:String(l.id??i),name:o,detail:c||g,full:d&&h?`${d}
80
+ → ${h}`:d||h||f.slice(0,300),done:!0,at:t(l.at??l.timestamp??l.created_at)});continue}if(l.role==="user"){if(s.length&&n.length&&n[n.length-1].role==="assistant"){const o=n[n.length-1];n[n.length-1]={...o,tools:[...o.tools??[],...s]},s=[]}n.push({role:"user",text:String(l.text??""),mid:l.id,at:t(l.at??l.timestamp??l.created_at)}),s=[];continue}if(l.role==="assistant"){const o={role:"assistant",text:String(l.text??""),mid:l.id,at:t(l.at??l.timestamp??l.created_at)};s.length&&(o.tools=s,s=[]),n.push(o)}}}const r=s.slice();if(r.length&&n.length&&n[n.length-1].role==="assistant"){const i=n[n.length-1];n[n.length-1]={...i,tools:[...i.tools??[],...r]}}return{blocks:n,trailingTools:r}}function d0({scrollHeight:e=0,clientHeight:t=0,offsetHeight:n=0,cap:s=120}={}){const r=Math.max(0,(n||0)-(t||0));return Math.min(s,e+r)}function p0({key:e="",shiftKey:t=!1,isComposing:n=!1}={}){return e!=="Enter"||n?!1:!!t}const fl="hm.session.seen.v1";function Qv(e){if(!e||typeof e!="object")return null;const t=Number(e.count),n=Number(e.at);return!Number.isFinite(t)||t<0||!Number.isFinite(n)||n<=0?null:{count:Math.floor(t),at:Math.floor(n),opened:e.opened===!0}}function Cn(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=[];for(const[r,i]of Object.entries(t)){const l=String(r??"").trim(),o=Qv(i);l&&o&&n.push([l,o])}n.sort((r,i)=>r[1].at-i[1].at);const s={};for(const[r,i]of n.slice(-100))s[r]=i;return s}function h0(e){if(e&&typeof e=="object")return Cn(e);const t=String(e??"").trim();if(!t)return{};try{const n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{}:Cn(n)}catch{return{}}}function Oc(e){return JSON.stringify(Cn(e))}function m0(e,t,n){const s=Cn(e),r=Number(n)>0?Math.floor(Number(n)):Date.now();for(const i of Array.isArray(t)?t:[]){const l=String((i==null?void 0:i.id)??"").trim();!l||Object.prototype.hasOwnProperty.call(s,l)||(s[l]={count:Math.max(0,Math.floor(Number(i==null?void 0:i.message_count)||0)),at:r,opened:!1})}return Cn(s)}function f0(e,t,n,s){const r=String(t??"").trim();if(!r)return Cn(e);const i=Number(n),l=Number(s)>0?Math.floor(Number(s)):Date.now(),o=Cn(e),c=o[r],d=(c==null?void 0:c.count)??0;return o[r]={count:Number.isFinite(i)&&i>=0?Math.max(d,Math.floor(i)):d,at:l,opened:!0},Cn(o)}function g0(e,t,n,s){const r=String(n??"").trim(),i=Cn(e);if(!r)return i;const l=(Array.isArray(t)?t:[]).find(d=>String((d==null?void 0:d.id)??"").trim()===r);if(!l)return i;const o=i[r],c=Math.max(0,Math.floor(Number(l==null?void 0:l.message_count)||0));if(c>((o==null?void 0:o.count)??-1)){const d=Number(s)>0?Math.floor(Number(s)):Date.now();i[r]={count:Math.max((o==null?void 0:o.count)??0,c),at:d,opened:!0}}return Cn(i)}function v0(e,t,n){var i,l;const s=Cn(e),r=Number(n)>0?Math.floor(Number(n)):Date.now();for(const o of Array.isArray(t)?t:[]){const c=String((o==null?void 0:o.id)??"").trim();c&&(s[c]={count:Math.max(0,Math.floor(Number(o==null?void 0:o.message_count)||0),((i=s[c])==null?void 0:i.count)??0),at:r,opened:((l=s[c])==null?void 0:l.opened)===!0})}return Cn(s)}function y0(e,t){if(!e)return 0;if(Array.isArray(e))return e.reduce((n,s)=>String((s==null?void 0:s.sessionId)??"")===t?n+1:n,0);if(typeof e.get=="function"){const n=Number(e.get(t));return Number.isFinite(n)&&n>0?Math.floor(n):0}if(typeof e=="object"){const n=Number(e[t]);return Number.isFinite(n)&&n>0?Math.floor(n):0}return 0}function w0(e,t){return e?typeof e.has=="function"?e.has(t):Array.isArray(e)?e.some(n=>String(n??"")===t):!1:!1}function x0({session:e,unreadReportMap:t=null,seenMap:n=null,activeDrawerSid:s=null,liveSessionIds:r=null}={}){const i=String((e==null?void 0:e.id)??"").trim();if(!i)return{isActive:!1,isRunning:!1,unreadReports:0,unreadReplies:0};const l=s!=null&&String(s)===i,o=!!(e!=null&&e.is_active)||w0(r,i),c=y0(t,i),d=n&&typeof n=="object"?Qv(n[i]):null,g=Math.max(0,Math.floor(Number(e==null?void 0:e.message_count)||0)),f=(d==null?void 0:d.opened)===!0,h=!l&&f&&g>d.count?Math.max(1,g-d.count):0;return{isActive:l,isRunning:o,unreadReports:c,unreadReplies:h}}function k0(e){return(Array.isArray(e)?e:[]).filter(t=>Number(t==null?void 0:t.unreadReports)>0||Number(t==null?void 0:t.unreadReplies)>0).length}function b0(e){const t=Math.floor(Number(e)||0);return t<=0?"":t>1?`+${t}`:"NEW"}function Dc(e,t=120){e&&(e.style.height="auto",e.style.height=`${d0({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,offsetHeight:e.offsetHeight,cap:t})}px`)}function S0(e,t){if(!(t!=null&&t.length))return e;const n=t.map(r=>({...r,done:!0})),s=e.slice();for(let r=s.length-1;r>=0;r-=1){if(s[r].role==="assistant")return s[r]={...s[r],tools:[...s[r].tools??[],...n]},s;if(s[r].role==="user")break}return[...s,{role:"assistant",text:"",open:!1,tools:n,at:Date.now()}]}function Gv({text:e,onCopyCode:t,copyLabel:n}){return u.useMemo(()=>ci(e,{onCopyCode:t,copyLabel:n}),[e,t,n])}function N0({report:e,open:t,onToggle:n,onDiscuss:s,onOpenBoard:r,onCopyCode:i,onReceipt:l}){const o=String((e==null?void 0:e.status)??"")==="halted",c=String((e==null?void 0:e.markdown)||(e==null?void 0:e.text)||"");return a.jsxs("div",{className:`msg report-card${o?" is-halted":""}`,title:Lo(e==null?void 0:e.at),children:[a.jsxs("button",{type:"button",className:"report-card-head",onClick:n,"aria-expanded":!!t,children:[a.jsx("span",{className:"report-card-icon","aria-hidden":"true",children:o?"⚠️":"🎉"}),a.jsx("span",{className:"report-card-title",children:(e==null?void 0:e.label)||C("chat.pipelineReport")}),a.jsx("span",{className:`report-chip ${o?"halted":"done"}`,children:C(o?"chat.reportHalted":"chat.reportDone")}),a.jsx("span",{className:"report-card-time",children:tt(e==null?void 0:e.at)}),a.jsx("span",{className:"report-card-caret","aria-hidden":"true",children:t?"▾":"▸"})]}),t?a.jsx("div",{className:"report-card-body",children:a.jsx(Gv,{text:c,onCopyCode:i,copyLabel:C("chat.copy")})}):a.jsx("div",{className:"report-card-summary",children:qd(e)}),a.jsxs("div",{className:"report-card-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:s,children:C("chat.discussNextSteps")}),a.jsx("button",{type:"button",className:"report-card-btn",onClick:l,children:C("receipt.open")}),e!=null&&e.board?a.jsx("button",{type:"button",className:"report-card-btn",onClick:r,children:C("chat.openBoard")}):null]})]})}function $c({rows:e,prefix:t,expandedMap:n,onToggle:s}){return a.jsx("ol",{className:"tool-rows",children:e.map((r,i)=>{const l=`${t}-${r.id||""}-${i}`,o=!!n[l],c=o?r.full||r.detail:r.detail||r.full,d=!!(r.full&&r.full!==r.detail);return a.jsxs("li",{className:`${r.done?"done":"run"}${o?" expanded":""}${d?" tappable":""}`,onClick:d?g=>{g.stopPropagation(),s(l)}:void 0,children:[a.jsx("span",{className:"tool-state","aria-hidden":"true",children:r.done?"✓":a.jsx("span",{className:"tool-spin"})}),a.jsx("span",{className:"tool-name",children:r.name}),c?a.jsx("span",{className:"tool-detail",children:c}):null,r.done?a.jsx("span",{className:"tool-ms",children:r.ms?`${(r.ms/1e3).toFixed(1)}s`:""}):a.jsx("span",{className:"tool-ms",children:"…"})]},l)})})}const j0=1500;function C0({sessions:e,sessionBadges:t,pipelineSessionIds:n,readonlySessionId:s,orphanReports:r,refreshing:i,markDisabled:l,onRefresh:o,onMarkAllRead:c,onOpenOrphan:d,onNewChat:g,onOpenSession:f}){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"drawer-actions",children:[a.jsx(Xs,{variant:"btn",label:C("chat.drawerRefresh"),busy:i,onRefresh:o}),a.jsxs("button",{type:"button",className:"btn drawer-mark-read",disabled:l,onClick:()=>{H("tap"),c()},children:[a.jsx("span",{"aria-hidden":"true",children:"✓"})," ",C("chat.markAllRead")]})]}),r.map(h=>a.jsxs("button",{className:"row drawer-report-row",title:C("chat.unreadReportTitle"),onClick:()=>d(h),children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[a.jsx("span",{"aria-hidden":"true",children:"📋"})," ",h.label||C("chat.pipelineReport")]}),a.jsxs("span",{className:"row-sub",children:[h.board?`${h.board} · `:"",C("chat.reportNoSession")]})]}),a.jsx("span",{className:"row-badge done","aria-hidden":"true",children:"!"})]},`report:${h.sessionId}`)),a.jsxs("button",{className:"row",onClick:g,children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:C("chat.newChat")}),a.jsx("span",{className:"row-sub",children:C("chat.newChatRowSub")})]}),a.jsx(Me,{name:"plus",size:16})]}),e.map(h=>{const x=h.profile&&h.profile!==dt,b=`${h.profile??"default"}:${h.id}`,w=t[b]??{isActive:!1,isRunning:!1,unreadReports:0,unreadReplies:0},S=n0(h,s),k=b0(w.unreadReplies);return a.jsxs("button",{className:`row${w.isActive?" on":""}${S?" ro":""}${w.unreadReports||n.has(String(h.id))?" has-report":""}`,title:w.unreadReports?C("chat.unreadReportTitle"):C(k?"chat.newReplyTitle":S?"chat.readonlyTitle":"chat.resumableTitle"),onClick:()=>f(h),children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[n.has(String(h.id))?a.jsx("span",{className:"row-report-mark",title:C("chat.pipelineReport"),"aria-label":C("chat.pipelineReport"),children:"📋"}):null,h.title||h.id]}),a.jsxs("span",{className:"row-sub session-meta",children:[a.jsx("span",{className:`row-mode ${S?"ro":"resumable"}`,title:C(S?"chat.readonlyTitle":"chat.resumableTitle"),children:C(S?"chat.readonlyShort":"chat.resumableShort")}),x?a.jsx("span",{className:"prof-chip on",children:h.profile}):null,a.jsxs("span",{children:[h.source??"cli"," ・ ",h.message_count??0," msg ・ ",tt((h.started_at??0)*1e3),h.is_active?C("chat.runningSuffix"):""]})]})]}),w.isRunning?a.jsx("span",{className:"row-dot running",title:C("chat.runningTitle"),"aria-label":C("chat.runningTitle")}):null,w.unreadReports?a.jsx("span",{className:"row-badge done",title:C("chat.unreadReportTitle"),"aria-label":C("chat.reportAria"),children:w.unreadReports}):null,k?a.jsx("span",{className:"row-badge new",title:C("chat.newReplyTitle"),children:k}):null,a.jsx(Me,{name:"chevron",size:16})]},b)})]})}function E0({notify:e,chatReports:t=[],reviewItems:n=[],liveTurns:s=[],active:r=!1,openRequest:i=null,onConsumedOpen:l,discussRequest:o=null,onConsumedDiscuss:c}){var Dp,$p,Fp,Bp;const{lang:d}=Fe(),{wide:g}=op(),[f,h]=u.useState([]),[x,b]=u.useState(null),[w,S]=u.useState(null),[k,m]=u.useState(""),[v,T]=u.useState([]),[E,_]=u.useState(null),[I,A]=u.useState(""),[P,y]=u.useState(!1),[K,$]=u.useState(null),[V,D]=u.useState(Date.now()),[X,ge]=u.useState([]),[Z,G]=u.useState({}),[q,ce]=u.useState(!1),[te,pe]=u.useState(!0),[ve,xe]=u.useState(null),[Oe,Ae]=u.useState(null),[et,We]=u.useState(!1),[Dt,ht]=u.useState(!1),[ct,yt]=u.useState(""),[Ge,$e]=u.useState(null),[M,W]=u.useState({}),[L,se]=u.useState({}),[ue,U]=u.useState(null),[ee,we]=u.useState(null),[ut,Ee]=u.useState(!1),[He,$t]=u.useState(null),[wt,Tt]=u.useState(!1),[F,_e]=u.useState([]),[Nt,Kn]=u.useState(null),[mt,Ns]=u.useState([]),[me,jt]=u.useState(null),[Ue,rs]=u.useState(dt),[Qn,It]=u.useState(dt),[Gt,Ke]=u.useState([]),[sn,An]=u.useState(!1),[rn,js]=u.useState([]),[ke,as]=u.useState(null),[z,de]=u.useState(dt),[ie,Ne]=u.useState(null),[Ye,Re]=u.useState(!1),[je,Se]=u.useState(!1),[Ce,Te]=u.useState([]),[xt,ft]=u.useState(!1),[Uo,Rn]=u.useState(!1),[Na,Cs]=u.useState({}),nr=u.useRef(null),ja=u.useRef(null),Oi=u.useRef(null),[Di,$i]=u.useState([]),[Ho,Tr]=u.useState(!1),Pn=u.useRef({}),[sr,Ar]=u.useState(()=>Sa());u.useEffect(()=>Uv(Ar),[]);const In=u.useRef(null),gn=u.useRef(null),Rr=u.useRef(dt),Ca=u.useRef(null),is=u.useRef([]),ls=u.useRef([]),Pr=u.useRef([]);Pr.current=Array.isArray(t)?t:[];const Ft=u.useRef(null),Es=u.useRef(null),Ea=u.useRef(0),Ir=u.useRef(0),os=u.useRef(new WeakMap),rr=u.useRef(0),vn=u.useRef(null),De=u.useRef(!0),ar=u.useRef([]),an=u.useRef(null);ar.current=X;const Ta=u.useRef(!1),Gn=u.useRef(new Set);u.useEffect(()=>{const p=Gn.current;return()=>{for(const j of p)URL.revokeObjectURL(j);p.clear()}},[]),In.current=x,gn.current=w,Rr.current=Qn,Ca.current=ke,is.current=rn;const Yn=u.useCallback(async()=>{if(is.current.length)return is.current;try{const p=await Y("/api/repos"),j=Array.isArray(p==null?void 0:p.repos)?p.repos:[];return js(j),j}catch{return[]}},[]),_n=u.useCallback(async p=>{const j=String(p??"").trim().toLowerCase();if(!j)return null;const R=Q=>(Array.isArray(Q)?Q:[]).find(oe=>(oe==null?void 0:oe.path)&&String(oe.path).trim().toLowerCase()===j)??null,O=R(is.current);if(O)return O;try{return R(await Yn())}catch{return null}},[Yn]),Mn=u.useCallback(async p=>{var O;try{const Q=await Y("/api/sessions?limit=40"),oe=(Q.sessions??[]).map(ae=>({id:ae.id,title:ae.title,source:ae.source,profile:ae.profile??"default",message_count:ae.messages??0,is_active:ae.active,started_at:ae.lastActive?Math.floor(ae.lastActive/1e3):null}));if(Array.isArray(Q.profiles)&&Q.profiles.length&&Ke(Q.profiles),oe.length)return ls.current=oe,h(oe),oe}catch{}const j=await p("session.list",{}),R=((O=j==null?void 0:j.result)==null?void 0:O.sessions)??[];return ls.current=R,h(R),R},[]),Aa=u.useRef(d);Aa.current=d;const _r=u.useCallback(async()=>{const p=d;try{const j=await Y(`/api/snippets?lang=${encodeURIComponent(p)}`);if(Aa.current!==p)return;$i(j.snippets??[])}catch{}},[d]);u.useEffect(()=>{_r();const p=()=>_r();return window.addEventListener("hm:snippets",p),window.addEventListener("hm:lang",p),()=>{window.removeEventListener("hm:snippets",p),window.removeEventListener("hm:lang",p)}},[_r]);const Bt=(($p=(Dp=ke==null?void 0:ke.boards)==null?void 0:Dp[0])==null?void 0:$p.slug)??"",yn=u.useCallback(async()=>{try{const p=Bt?`?board=${encodeURIComponent(Bt)}`:"",j=await Y(`/api/architect/jobs${p}`);j!=null&&j.ok&&$t(j)}catch{$t(null)}},[Bt]),Fi=u.useMemo(()=>xv((He==null?void 0:He.jobs)??[],mt,Bt),[He,mt,Bt]),zo=u.useCallback(p=>{if(p){H("tap");try{const j=p.taskId?"hm:open-task":"hm:open-live";window.dispatchEvent(new CustomEvent(j,{detail:{taskId:p.taskId??null,board:p.board??Bt??null,jobId:p.id??null}}))}catch{}}},[Bt]),Ra=kv(Fi);u.useEffect(()=>{if(!r&&!ut)return;yn();const p=setInterval(yn,Ra);return()=>clearInterval(p)},[r,ut,yn,Ra]);const Bi=u.useMemo(()=>{const p=bv({specReady:(He==null?void 0:He.specReady)??[],pending:(He==null?void 0:He.pending)??[]});return!p||F.includes(p.path)?null:p},[He,F]),Ui=u.useCallback(async p=>{if(!(!p||wt)){Tt(!0);try{const j=await Y("/api/specs/launch",{method:"POST",body:{...Bt?{board:Bt}:{},specRelPath:p.path,batchIds:p.ids,...x?{chat:x}:{}}});e(C("seed.bannerFiled",{n:((j==null?void 0:j.created)??[]).length}));try{bt("launch")}catch{}await yn()}catch(j){e((j==null?void 0:j.message)??C("seed.failed"))}finally{Tt(!1)}}},[Bt,wt,x,e,C,yn]),Pa=u.useCallback(async(p,j="default")=>{if(!p)return;const R=j&&j!=="default"?j:null;try{const O=new URLSearchParams({limit:"300",tools:"1"});R&&O.set("profile",R);const Q=await Y(`/api/sessions/${encodeURIComponent(p)}/transcript?${O}`);if(!(Q!=null&&Q.ok)||!Array.isArray(Q.messages)||gn.current!==p&&In.current!==p)return;_({sessionId:p,profile:R,hasMore:!!Q.hasMore,oldestId:Q.oldestId??null,loadingMore:!1});const{blocks:oe}=Lc(Q.messages,dr);if(!oe.length)return;T(ae=>{const ne=ae[ae.length-1];return ne!=null&&ne.open?ae:oe})}catch{}},[]),Hi=u.useCallback(async()=>{const p=E;if(!(p!=null&&p.sessionId)||!p.hasMore||!p.oldestId||p.loadingMore)return;const j=Ft.current,R=j==null?void 0:j.querySelector("[data-mid]");Es.current=R?{mid:R.getAttribute("data-mid"),top:R.getBoundingClientRect().top}:null,De.current=!1,_(O=>O&&{...O,loadingMore:!0});try{const O=new URLSearchParams({limit:"250",before:String(p.oldestId),tools:"1"});p.profile&&p.profile!=="default"&&O.set("profile",p.profile);const Q=await Y(`/api/sessions/${encodeURIComponent(p.sessionId)}/transcript?${O}`);if(!(Q!=null&&Q.ok)){e((Q==null?void 0:Q.reason)??C("chat.cannotOpen")),Es.current=null,_(ae=>ae&&{...ae,loadingMore:!1});return}const{blocks:oe}=Lc(Q.messages??[],dr);T(ae=>{const ne=new Set(ae.filter(be=>be.mid!=null).map(be=>`m${be.mid}`)),le=oe.filter(be=>be.mid==null||!ne.has(`m${be.mid}`));return le.length?[...le,...ae]:ae}),_({sessionId:p.sessionId,profile:p.profile??null,hasMore:!!Q.hasMore,oldestId:Q.oldestId??null,loadingMore:!1})}catch(O){e((O==null?void 0:O.message)||C("chat.cannotOpen")),Es.current=null,_(Q=>Q&&{...Q,loadingMore:!1})}},[E,e]);u.useLayoutEffect(()=>{const p=Es.current;if(!p)return;Es.current=null;const j=Ft.current;if(!j)return;const R=j.querySelector(`[data-mid="${p.mid}"]`);if(!R)return;const O=R.getBoundingClientRect().top-p.top;O&&(j.scrollTop=Math.max(0,j.scrollTop+O))},[v]);const wn=u.useCallback(async(p,j,R="default")=>{var O,Q,oe;Se(!0);try{const ae=await p("session.resume",{session_id:j,...R&&R!=="default"?{profile:R}:{}}),ne=ae==null?void 0:ae.result;if(!(ne!=null&&ne.session_id))return{ok:!1,sid:null,error:(ae==null?void 0:ae.error)??null};hl(globalThis.localStorage,null),b(ne.session_id);const le=ne.resumed??j;S(le),rs(R||"default");const be=((O=ne.info)==null?void 0:O.cwd)??ne.cwd??"";be?Yn().then(fe=>{In.current===ne.session_id&&as(vS(fe,be))}):as(null);const Pe=Array.isArray(ne.messages)?ne.messages:[];return(oe=an.current)==null||oe.call(an,le,Math.max(Number((Q=ls.current.find(fe=>String(fe.id)===String(le)))==null?void 0:Q.message_count)||0,Pe.length)),T(Pe.filter(fe=>fe.role==="user"||fe.role==="assistant").map(fe=>({role:fe.role==="user"?"user":"assistant",text:String(fe.text??""),at:dr(fe.at??fe.timestamp??fe.created_at)})).filter(fe=>fe.text.trim().length>0)),Pa(le,R),{ok:!0,sid:ne.session_id}}finally{Se(!1)}},[Yn,Pa]),N=u.useCallback(p=>{var Q,oe,ae,ne;const j=(Q=p==null?void 0:p.params)==null?void 0:Q.type,R=((oe=p==null?void 0:p.params)==null?void 0:oe.payload)??{},O=(ae=p==null?void 0:p.params)==null?void 0:ae.session_id;if(!(O&&In.current&&O!==In.current)){if(j==="tool.start"||j==="tool.complete"){const le=R.args&&typeof R.args=="object"?R.args:{};ge(be=>u0(be,{kind:j==="tool.start"?"start":"complete",id:R.tool_id||R.tool_call_id||R.name||"",name:R.name||R.tool_name||"tool",args:le,duration_ms:R.duration_ms}));return}if(j==="message.start"){const le=ar.current;y(!0),$(Date.now()),yt(""),ce(!1),ge([]),T(be=>{const Pe=le.length?S0(be,le):be,fe=Pe[Pe.length-1];return(fe==null?void 0:fe.role)==="assistant"&&fe.open&&!fe.text?Pe:[...Pe,{role:"assistant",text:"",open:!0,at:Date.now()}]});return}if(j==="thinking.delta"){yt(le=>(le+(R.text??"")).slice(-400));return}if(j==="message.delta"){const le=R.text??"";if(!le)return;T(be=>{const Pe=[...be],fe=Pe[Pe.length-1];return(fe==null?void 0:fe.role)==="assistant"&&fe.open?Pe[Pe.length-1]={...fe,text:fe.text+le}:Pe.push({role:"assistant",text:le,open:!0,at:Date.now()}),Pe});return}if(j==="message.complete"){const le=ar.current;$(null),y(!1),yt(""),ce(!1),ge([]),Ae(R.usage??null),T(be=>{const Pe=[...be],fe=Pe[Pe.length-1],Jt=le.map(Or=>({...Or,done:!0}));return(fe==null?void 0:fe.role)==="assistant"?Pe[Pe.length-1]={...fe,text:R.text??fe.text,open:!1,tools:Jt.length?[...fe.tools??[],...Jt]:fe.tools}:Jt.length&&Pe.push({role:"assistant",text:String(R.text??""),open:!1,tools:Jt,at:Date.now()}),Pe});{const be=gn.current??In.current;be&&Mn((ne=B.current)==null?void 0:ne.rpc).then(Pe=>{var Jt;const fe=(Array.isArray(Pe)?Pe:[]).find(Or=>String(Or.id)===String(be));fe&&((Jt=an.current)==null||Jt.call(an,fe.id,fe.message_count))}).catch(()=>{})}return}j==="session.title"&&R.title&&m(R.title)}},[]),B=u.useRef(null),re=u.useRef(null),ye=u.useRef(null),Je=u.useRef("idle"),lt=u.useCallback(async()=>{var O,Q;const p=(O=B.current)==null?void 0:O.rpc;if(!p)return;Ta.current&&(Ta.current=!1,e(C("chat.reconnected"))),await Mn(p);const j=ye.current;if(ye.current=null,j){await((Q=re.current)==null?void 0:Q.call(re,j.id,j.focusId??null,j.profile??"default"));return}if(!gn.current&&Sm())return;const R=t0({storedSid:gn.current,sessions:ls.current,profile:Rr.current});if(R)if(R.from==="recent"&&S(R.sid),!(await wn(p,R.sid,Rr.current)).ok)b(null),e(C("chat.previousChatFailed"));else{const ae=ls.current.find(ne=>ne.id===R.sid);ae!=null&&ae.title&&m(ae.title)}},[Mn,e,wn]),ln=u.useCallback(p=>{(p==="closed"||p==="error")&&(y(!1),Ta.current=!0)},[]),Ts=ZS({onEvent:N,onReady:lt,onState:ln});B.current=Ts;const{rpc:Ln,showBanner:uy,state:zi}=Ts;Je.current=zi,u.useEffect(()=>{try{e0();const p=localStorage.getItem("hm.storedSid");p&&!gn.current&&S(p);const j=localStorage.getItem(Gu);j&&It(j);const R=p?null:Sm();R&&(R.profile&&(rs(R.profile),It(R.profile)),Yn().then(O=>{if(In.current||gn.current)return;const Q=O.find(oe=>oe.id===R.repoId);Q&&as(Q)}))}catch{}},[]),u.useEffect(()=>{try{w?(localStorage.setItem("hm.storedSid",w),localStorage.setItem(iv,w)):localStorage.removeItem("hm.storedSid"),localStorage.setItem(Gu,Qn||dt)}catch{}},[w,Qn]);const ir=(me==null?void 0:me.sessionId)||x||w||null,On=u.useMemo(()=>me!=null&&me.sessionId?[String(me.sessionId)]:[w,x].filter(Boolean).map(String),[me==null?void 0:me.sessionId,w,x]),Yt=u.useMemo(()=>s.find(p=>(p==null?void 0:p.sessionId)&&On.includes(String(p.sessionId)))??null,[s,On]),gt=u.useMemo(()=>{const p=(n??[]).filter(O=>O&&O.status!=="done"),j=p.find(O=>{var Q;return((Q=O.review)==null?void 0:Q.chat)&&On.includes(String(O.review.chat))});if(j)return j;if(!ke)return null;const R=ke.path?String(ke.path).toLowerCase():"";return p.find(O=>{var Q,oe,ae;return!((Q=O.review)!=null&&Q.chat)&&(((oe=O.review)==null?void 0:oe.repo)===ke.id||R&&((ae=O.review)==null?void 0:ae.target)&&String(O.review.target).toLowerCase().startsWith(R))})??null},[n,On,ke]),xn=!!(P||Yt),Wo=u.useRef(!1),[dy,mp]=u.useState(!1);u.useEffect(()=>{if(Wo.current&&!xn){mp(!0);const p=setTimeout(()=>mp(!1),240);return Wo.current=xn,()=>clearTimeout(p)}Wo.current=xn},[xn]);const fp=u.useMemo(()=>Kk(On,t,me?"":(ke==null?void 0:ke.path)??""),[On,t,me,ke==null?void 0:ke.path]),lr=u.useMemo(()=>zk(t,fp),[t,fp]),Vo=u.useMemo(()=>Qk(v,lr),[v,lr]),py=lr.length?lr[lr.length-1].key:"";u.useEffect(()=>{if(!xn)return;const p=setInterval(()=>D(Date.now()),1e3);return()=>clearInterval(p)},[xn]);const Ko=gt&&(gt.status==="running"||gt.status==="ready")?gt.id:null;u.useEffect(()=>{if(!Ko){xe(null);return}let p=!0;const j=async()=>{try{const O=await Y(`/api/review/${encodeURIComponent(Ko)}/worker?limit=8`);p&&xe(O)}catch{}};j();const R=setInterval(()=>{document.visibilityState==="visible"&&j()},4e3);return()=>{p=!1,clearInterval(R)}},[Ko]),u.useEffect(()=>{const p=Ft.current;p&&(me!=null&&me.focusId||De.current&&(p.scrollTop=p.scrollHeight))},[v,xn,X,ct,gt,ve,me==null?void 0:me.focusId,py]);const Ia=u.useCallback(p=>{const j=Ft.current;if(!j||!p)return;const R=j.querySelector(`[data-mid="${p}"]`);if(!R)return;const O=R.getBoundingClientRect().top-j.getBoundingClientRect().top;j.scrollTop=Math.max(0,j.scrollTop+O-10)},[]);u.useEffect(()=>{if(!(me!=null&&me.focusId))return;const p=setTimeout(()=>Ia(me.focusId),120),j=setTimeout(()=>Ia(me.focusId),500);return()=>{clearTimeout(p),clearTimeout(j)}},[me==null?void 0:me.focusId,v.length,Ia]),u.useEffect(()=>{const p=w??x;if(!p){$e(null);return}let j=!0;return Y(`/api/discord/session?session_id=${encodeURIComponent(p)}`).then(R=>j&&$e(R.link??null)).catch(()=>j&&$e(null)),()=>{j=!1}},[w,x]),u.useEffect(()=>{try{W(io(localStorage.getItem(ca))),Cs(h0(localStorage.getItem(fl)))}catch{W({}),Cs({})}},[]);const cs=u.useCallback(p=>{if(!p)return;const j=Wk(Pr.current,p);W(R=>{const O=ov(R,p,Math.max(Date.now(),j));try{localStorage.setItem(ca,JSON.stringify(O))}catch{}return O})},[]),hy=u.useCallback((p,j)=>{p&&Cs(R=>{const O=f0(R,p,j,Date.now());try{localStorage.setItem(fl,Oc(O))}catch{}return O})},[]);an.current=hy,u.useEffect(()=>{f.length&&Cs(p=>{const j=Date.now(),R=m0(p,f,j),O=r&&ir?g0(R,f,ir,j):R;try{localStorage.setItem(fl,Oc(O))}catch{}return O})},[f,r,ir]),u.useEffect(()=>{const p=()=>{var R;const j=(R=B.current)==null?void 0:R.rpc;j&&Mn(j)};return window.addEventListener("hm:wake-sync",p),()=>window.removeEventListener("hm:wake-sync",p)},[Mn]);const _a=u.useCallback(async({force:p=!1}={})=>{var R;const j=Date.now();if(!p&&j-Ea.current<j0)return!0;Ea.current=j;try{window.dispatchEvent(new CustomEvent("hm:refresh-reports"));const O=(R=B.current)==null?void 0:R.rpc;if(Je.current==="ready"&&O){ht(!0);try{await Mn(O)}finally{ht(!1)}}return!0}catch{return!1}},[Mn]),my=u.useCallback(()=>{We(!0),_a()},[_a]);u.useEffect(()=>{const p=Array.isArray(s)?s.length:0,j=Ir.current;Ir.current=p,j>0&&p<j&&_a({force:!0})},[s,_a]);const fy=u.useCallback(()=>{const p=Date.now();Cs(j=>{const R=v0(j,f,p);try{localStorage.setItem(fl,Oc(R))}catch{}return R}),W(j=>{const R=Vk(j,Pr.current,p);try{localStorage.setItem(ca,JSON.stringify(R))}catch{}return R})},[f]),gp=u.useMemo(()=>Hk(t,M),[t,M]),Dn=u.useMemo(()=>lv(t,M,On),[t,M,On]),vp=u.useMemo(()=>Fk(t),[t]),yp=u.useMemo(()=>$u(t,M),[t,M]),gy=u.useMemo(()=>Bk(yp,(f??[]).map(p=>p.id)),[yp,f]),vy=u.useMemo(()=>new Set(vp.map(p=>String(p.sessionId))),[vp]),wp=u.useMemo(()=>{const p={};for(const j of Array.isArray(t)?t:[]){const R=String((j==null?void 0:j.sessionId)??""),O=Number(j==null?void 0:j.at);!R||!Number.isFinite(O)||O<=(Number(M[R])||0)||(p[R]=(p[R]||0)+1)}return p},[t,M]),Qo=u.useMemo(()=>{const p=new Set((Array.isArray(s)?s:[]).map(R=>String((R==null?void 0:R.sessionId)??"")).filter(Boolean)),j={};for(const R of Array.isArray(f)?f:[])j[`${R.profile??"default"}:${R.id}`]=x0({session:R,unreadReportMap:wp,seenMap:Na,activeDrawerSid:ir,liveSessionIds:p});return j},[f,wp,Na,ir,s]),Mr=u.useMemo(()=>k0(Object.values(Qo)),[Qo]);u.useEffect(()=>{try{window.dispatchEvent(new CustomEvent("hm:chat-unread",{detail:{count:Dn.length}}))}catch{}},[Dn.length]),u.useEffect(()=>{try{window.dispatchEvent(new CustomEvent("hm:chat-streaming",{detail:{streaming:xn}}))}catch{}},[xn]);const Go=u.useCallback(p=>{G(j=>({...j,[p]:!j[p]}))},[]),xp=u.useCallback(async p=>{var j;try{if(!((j=navigator.clipboard)!=null&&j.writeText))throw new Error(C("chat.copyUnsupported"));await navigator.clipboard.writeText(p),H("tap"),e(C("chat.copied"))}catch(R){e((R==null?void 0:R.message)||C("chat.copyFailed"))}},[e]),or=u.useCallback(p=>{const j=String(p??"").trim();if(!j)return;A(j);const R=()=>{const O=vn.current;if(O){try{O.focus({preventScroll:!1})}catch{O.focus()}O.style.height="auto",Dc(O);try{O.setSelectionRange(j.length,j.length)}catch{}}};requestAnimationFrame(R),setTimeout(R,150)},[]),yy=u.useCallback(p=>{H("tap"),or(zr(p,C("chat.discussFallback")))},[or]),wy=u.useCallback(p=>{if(p){H("tap"),cs(p.sessionId);try{window.dispatchEvent(new CustomEvent("hm:discuss-pipeline",{detail:{sessionId:p.sessionId??null,repoPath:p.repoPath??null,board:p.board??null,prompt:zr(p,C("chat.discussFallback")),title:p.label??null}}))}catch{}We(!1)}},[cs,or]),xy=u.useCallback(p=>{H("tap");try{window.dispatchEvent(new CustomEvent("hm:open-board",{detail:{board:(p==null?void 0:p.board)??null}}))}catch{}},[]),ky=u.useCallback(p=>{H("tap"),U({board:(p==null?void 0:p.board)??null,spec:(p==null?void 0:p.spec)??null})},[]);u.useEffect(()=>{if(!(!r||!On.length))for(const p of On)gp.includes(p)&&cs(p)},[r,On,gp,cs]);const by=async(p,j=1600)=>{var R,O,Q;if(!((R=p.type)!=null&&R.startsWith("image/"))||p.type==="image/gif")return p;try{const oe=await createImageBitmap(p),ae=Math.min(1,j/Math.max(oe.width,oe.height));if(ae>=.999&&p.size<6e5)return(O=oe.close)==null||O.call(oe),p;const ne=document.createElement("canvas");ne.width=Math.round(oe.width*ae),ne.height=Math.round(oe.height*ae),ne.getContext("2d").drawImage(oe,0,0,ne.width,ne.height),(Q=oe.close)==null||Q.call(oe);const le=await new Promise(be=>ne.toBlob(be,"image/webp",.9));return!le||le.size>=p.size?p:new File([le],`${p.name.replace(/\.[^.]+$/,"")||"image"}.webp`,{type:"image/webp"})}catch{return p}},Lr=u.useCallback(async p=>{const j=[...p??[]].filter(Boolean);if(!j.length)return;const R=6-Ce.length;if(R<=0){e(C("chat.maxAttachments"));return}for(const O of j.slice(0,R)){const Q=(O.type||"").startsWith("image/"),oe=Q?10*1024*1024:25*1024*1024;if(O.size>oe){e(C("chat.tooLarge",{name:O.name||C("chat.fileFallback"),mb:Math.round(oe/1048576)}));continue}try{const ae=Q?await by(O):O,ne=Q?URL.createObjectURL(ae):null;ne&&Gn.current.add(ne),Te(le=>[...le,{id:`${Date.now()}-${Math.random().toString(36).slice(2,7)}`,kind:Q?"image":"file",name:O.name||(Q?"image":"file"),bytes:ae.size,file:ae,preview:ne}])}catch(ae){e(ae.message)}}},[Ce.length,e]),Sy=u.useCallback(async()=>{var p;try{if(!((p=navigator.clipboard)!=null&&p.read))throw new Error(C("chat.clipReadUnsupported"));const j=await navigator.clipboard.read(),R=[];for(const O of j){const Q=(O.types??[]).find(ne=>ne.startsWith("image/"));if(!Q)continue;const oe=await O.getType(Q),ae=Q==="image/jpeg"?"jpg":Q.split("/")[1];R.push(new File([oe],`clipboard-${Date.now()}.${ae}`,{type:Q}))}if(!R.length)throw new Error(C("chat.clipNoImage"));await Lr(R),ft(!1)}catch(j){e(j.message)}},[Lr,e]),kp=p=>new Promise((j,R)=>{const O=new FileReader;O.onload=()=>j(String(O.result)),O.onerror=()=>R(new Error(C("chat.readFailed"))),O.readAsDataURL(p)}),Yo=u.useCallback(async(p,j,R)=>{var Q;const O=[];for(const oe of R)if(oe.kind==="image"){const ne=(await kp(oe.file)).split(",")[1]??"",le=await p("image.attach_bytes",{session_id:j,content_base64:ne,filename:oe.name});if(le!=null&&le.error)throw new Error(C("chat.attachImageFailed",{message:le.error.message}))}else{const ae=await kp(oe.file),ne=await p("file.attach",{session_id:j,data_url:ae,name:oe.name});if(ne!=null&&ne.error)throw new Error(C("chat.attachFailed",{message:ne.error.message}));(Q=ne==null?void 0:ne.result)!=null&&Q.ref_text&&O.push(ne.result.ref_text)}return O},[]),Ma=u.useCallback(async p=>{var Jt,Or,Up;const j=String(p??I).trim();if(!j&&!Ce.length||P)return;const R=Ce,O=R.filter(st=>st.kind==="image"),Q=R.filter(st=>st.kind==="file"),oe=j||(R.length?C("chat.checkAttachments"):"");p==null&&(A(""),vn.current&&(vn.current.style.height="")),Te([]),y(!0);const ae=Date.now();T(st=>[...st,{role:"user",text:oe,at:ae,images:O.map(on=>({url:on.preview,name:on.name})),files:Q.map(on=>({name:on.name,bytes:on.bytes}))},{role:"assistant",text:"",open:!0,at:ae+1}]);const ne=st=>{y(!1),e(st),T(on=>[...on,{role:"notice",text:st,at:Date.now()}])};let le=x;if(!le){const st=await Ln("session.create",{title:oe.slice(0,24),...Ue&&Ue!=="default"?{profile:Ue}:{},...(Jt=Ca.current)!=null&&Jt.path?{cwd:Ca.current.path}:{}});if(le=(Or=st==null?void 0:st.result)==null?void 0:Or.session_id,S(((Up=st==null?void 0:st.result)==null?void 0:Up.stored_session_id)??le??null),It(Ue||dt),!le)return ne(C("chat.sessionCreateFailed"));hl(globalThis.localStorage,null),b(le),m(oe.slice(0,24))}const be=st=>st.length?`${oe}${C("chat.attachmentsHeader")}${st.map(on=>`- ${on}`).join(`
81
+ `)}${C("chat.attachInstruction")}`:oe;let Pe=[];if(R.length){Rn(!0);try{Pe=await Yo(Ln,le,R)}catch(st){return Rn(!1),ne(st.message)}Rn(!1)}let fe=await Ln("prompt.submit",{session_id:le,text:be(Pe)});if(fe!=null&&fe.error&&/session not found/i.test(fe.error.message??"")){const st=gn.current;if(st){const on=await wn(Ln,st,Rr.current);if(on.ok&&on.sid){le=on.sid;let qo=Pe;if(R.length)try{qo=await Yo(Ln,le,R)}catch{qo=[]}fe=await Ln("prompt.submit",{session_id:le,text:be(qo)})}}}fe!=null&&fe.error&&ne(C("chat.sendFailed",{message:fe.error.message})),H("action"),bt("send",{sfx:C("fx.sfx.send")})},[I,Ce,P,x,Ln,e,Yo,wn,Ue]),bp=u.useCallback(()=>Ma(),[Ma]),Ny=u.useCallback(async()=>{x&&(await Ln("session.interrupt",{session_id:x}),y(!1),yt(""),e(C("chat.interrupted")))},[x,Ln,e]),As=u.useCallback((p=dt,j=null,R=null)=>{const O=p||dt,Q=j!=null&&j.path?j:null,oe=(R==null?void 0:R.slug)??"";b(null),S(null),m(""),T([]),_(null),Ae(null),jt(null),rs(O),It(O),as(Q),Ne(null),We(!1),An(!1),Q?(gS(globalThis.localStorage,{id:Q.id,board:oe?{slug:oe}:null}),hl(globalThis.localStorage,{repoId:Q.id,profile:O}),e(C("chat.newChatWith",{target:`${za(Q)}${oe?` ・ ${oe}`:""}`}))):hl(globalThis.localStorage,null)},[e]),Wi=u.useCallback(async(p,j,R,O=null)=>{var Q,oe;Se(!0);try{const ae=new URLSearchParams({limit:"300",tools:"1"});O&&O!=="default"&&ae.set("profile",O);const ne=await Y(`/api/sessions/${encodeURIComponent(p)}/transcript?${ae}`);if(!ne.ok)return e(ne.reason??C("chat.cannotOpen")),!1;b(null),jt({sessionId:p,focusId:j??null,title:ne.title??R??"",profile:O&&O!=="default"?O:null});const{blocks:le}=Lc(ne.messages??[],dr);return(oe=an.current)==null||oe.call(an,p,Math.max(Number((Q=ls.current.find(be=>String(be.id)===String(p)))==null?void 0:Q.message_count)||0,Array.isArray(ne.messages)?ne.messages.length:0)),T(le),_({sessionId:p,profile:O&&O!=="default"?O:null,hasMore:!!ne.hasMore,oldestId:ne.oldestId??null,loadingMore:!1}),(ne.title||R)&&m(ne.title||R),j&&requestAnimationFrame(()=>Ia(j)),!0}catch(ae){return e(ae.message),!1}finally{Se(!1)}},[e,Ia]),jy=u.useCallback(async(p,j=null,R="default")=>{var ae;We(!1),T([]),_(null),Ae(null),jt(null),rs(R||"default");const O=f.find(ne=>ne.id===p&&(ne.profile??"default")===(R||"default")),Q=(O==null?void 0:O.title)??((ae=f.find(ne=>ne.id===p))==null?void 0:ae.title)??"";m(Q);const oe=await wn(Ln,p,R);if(!oe.ok){const ne=oe.error;if((ne==null?void 0:ne.code)===4132||/Kanban worker transcript/i.test((ne==null?void 0:ne.message)??"")){await Wi(p,j,Q,R);return}b(null),S(null),e(ne!=null&&ne.message?C("chat.openFailed",{message:ne.message}):C("chat.resumeFailed"))}},[Ln,wn,f,e,Wi]);re.current=jy;const Rs=u.useCallback((p,j=null,R="default")=>{var O;p&&(cs(p),Je.current==="ready"?(O=re.current)==null||O.call(re,p,j,R):ye.current={id:p,focusId:j,profile:R})},[cs]);u.useEffect(()=>{const p=j=>{var R,O,Q;return Rs((R=j==null?void 0:j.detail)==null?void 0:R.id,((O=j==null?void 0:j.detail)==null?void 0:O.messageId)??null,((Q=j==null?void 0:j.detail)==null?void 0:Q.profile)||"default")};return window.addEventListener("hm:open-session",p),()=>window.removeEventListener("hm:open-session",p)},[Rs]),u.useEffect(()=>{i!=null&&i.id&&(Rs(i.id,i.messageId??null,i.profile||"default"),l==null||l())},[i,Rs,l]),u.useEffect(()=>{if(!o)return;let p=!0;const j=String(o.sessionId??"").trim();return(async()=>{if(j&&j!==yr){const O=ls.current.find(Q=>String(Q.id)===j);Rs(j,null,(O==null?void 0:O.profile)||Ue||dt)}else{const O=await _n(o.repoPath);if(!p)return;As(Ue||dt,O??null,o.board?{slug:o.board}:null)}or(zr({followUpPrompt:o.prompt},C("chat.discussFallback"))),c==null||c()})(),()=>{p=!1}},[o,Rs,As,or,c,Ue,_n]);const Jo=u.useCallback((p,j=!1)=>{if(Tr(!1),H("tap"),(p==null?void 0:p.action)==="seed"){Ee(!0);return}if(j){Ma(p.text);return}const R=vn.current,O=I??"",Q=(R==null?void 0:R.selectionStart)??O.length,oe=(R==null?void 0:R.selectionEnd)??O.length,ae=O.slice(0,Q),ne=O.slice(oe),le=ae&&!/\s$/.test(ae)?" ":"";A(`${ae}${le}${p.text}${ne}`),requestAnimationFrame(()=>{const be=vn.current;if(!be)return;be.focus();const Pe=ae.length+le.length,fe=/\{\{[^}]*\}\}/.exec(p.text);fe?be.setSelectionRange(Pe+fe.index,Pe+fe.index+fe[0].length):be.setSelectionRange(Pe+p.text.length,Pe+p.text.length),be.style.height="auto",Dc(be)})},[I,Ma]),Sp=u.useCallback(async()=>{var R,O,Q,oe;if(window.dispatchEvent(new CustomEvent("hm:refresh-reports")),Je.current!=="ready")return(O=(R=B.current)==null?void 0:R.reconnectNow)==null||O.call(R),!0;const p=(Q=B.current)==null?void 0:Q.rpc;if(!p)return!1;if(await Mn(p),P)return!0;if(me!=null&&me.sessionId)return await Wi(me.sessionId,me.focusId,me.title,me.profile||"default");const j=gn.current??In.current;if(j){const ae=await wn(p,j,Ue||dt);if(!(ae!=null&&ae.ok))return e((oe=ae==null?void 0:ae.error)!=null&&oe.message?C("chat.updateFailed",{message:ae.error.message}):C("chat.updateChatFailed")),!1}return!0},[Mn,P,me,Wi,wn,Ue,e]),Vi=u.useCallback(()=>{We(!1),An(!0),Ne(null),de(Ue||dt),Yn()},[Ue,Yn]),Np=u.useCallback(p=>{var j;if(p){if(!((j=p.boards)!=null&&j.length)){Ne({kind:"create",repo:p});return}if(p.boards.length>1){Ne({kind:"board",repo:p});return}As(z,p,pS(p.boards))}},[z]),Cy=u.useCallback(async()=>{const p=ie==null?void 0:ie.repo;if(!(!p||Ye)){Re(!0);try{const j=await Y(`/api/repos/${encodeURIComponent(p.id)}/board`,{method:"POST",body:{}});if(!(j!=null&&j.ok)||!j.board){e((j==null?void 0:j.error)??C("chat.boardCreateFailed"));return}e(C("chat.boardCreated",{slug:j.board.slug})),js(R=>R.map(O=>O.id===p.id?{...O,boards:[{slug:j.board.slug,name:j.board.name??j.board.slug}]}:O)),As(z,p,{slug:j.board.slug,name:j.board.name??j.board.slug})}catch(j){e(j.message)}finally{Re(!1)}}},[ie,Ye,z,e,As]),jp=Di.filter(p=>p.hot).slice(0,8),Ey=u.useMemo(()=>a0(Gt,f,dt),[Gt,f]),Cp=u.useMemo(()=>hS(),[sn]),Ki=u.useMemo(()=>mS(rn,Ov()),[rn,sn]),Ep=g,Tp=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`prof-chip${Ue!==dt?" on":""}`,title:C("chat.profileTitle",{profile:Ue}),children:Ue}),ke?a.jsx("button",{className:"prof-chip repo-chip",title:C("chat.repoTitle",{id:ke.id,path:ke.path}),"aria-label":C("chat.repoTitleShort",{id:ke.id}),onClick:()=>{H("tap"),Vi()},children:ke.id}):null]}),Ty=a.jsxs("div",{className:"chat-head",children:[a.jsxs("button",{className:"icon-btn",onClick:()=>{H("tap"),my()},"aria-label":Mr?C("chat.sessionsAria",{n:Mr}):C("chat.sessions"),children:[a.jsx(Me,{name:"grid",size:18}),Mr?a.jsx("span",{className:"drawer-btn-badge","aria-hidden":"true",children:Mr}):null,!Mr&&Dn.length?a.jsx("span",{className:"nav-dot done","aria-hidden":"true"}):null]}),a.jsx("span",{className:"chat-title",children:k||C("chat.title")}),Tp,Ge!=null&&Ge.url?a.jsx("button",{className:"icon-btn dc-icon",title:`Discord: ${Ge.chatName??""}`,"aria-label":C("chat.discordAria"),onClick:()=>{H("tap"),window.open(Ge.url,"_blank","noopener")},children:a.jsx("span",{"aria-hidden":"true",children:"#"})}):null,a.jsx(Xs,{variant:"icon",ariaLabel:C("chat.refreshChatAria"),onRefresh:Sp}),a.jsx("button",{className:"icon-btn",onClick:()=>{H("tap"),Vi()},"aria-label":C("chat.newChatAria"),children:a.jsx(Me,{name:"plus",size:18})})]}),Ap=a.jsxs(a.Fragment,{children:[uy?a.jsx("div",{className:"banner",children:C("chat.recovering")}):null,Dn.length?a.jsxs("div",{className:"chat-report-banner",role:"status",children:[a.jsx("span",{className:"chat-report-banner-text",children:C("chat.otherReport",{label:Dn[0].label||Dn[0].taskId||qd(Dn[0],40)||String(Dn[0].text??"").slice(0,28)})}),a.jsx("button",{type:"button",className:"chat-report-btn primary",onClick:()=>{H("tap");const p=Dn[0];if(p.sessionId===yr){if(gn.current??In.current){cs(yr),requestAnimationFrame(()=>{const O=Ft.current;O&&(O.scrollTop=O.scrollHeight)});return}cs(yr),or(zr(p,C("chat.discussFallback"))),_n(p.repoPath).then(O=>{As(Ue||dt,O??null,p.board?{slug:p.board}:null)});return}const j=f.find(R=>String(R.id)===p.sessionId);Rs(p.sessionId,null,(j==null?void 0:j.profile)||Ue||dt),or(zr(p,""))},children:C("chat.open")}),a.jsx("button",{type:"button",className:"chat-report-btn",onClick:()=>{H("tap"),cs(Dn[0].sessionId)},children:C("chat.seen")})]}):null,me?a.jsxs("div",{className:"banner ro",children:[C("chat.readonly"),me.profile?C("chat.readonlyProfileSuffix",{profile:me.profile}):C("chat.readonlyBoardSuffix")]}):null]}),Rp=a.jsx(a.Fragment,{children:a.jsxs("div",{className:"chat-body",children:[a.jsxs("div",{className:"chat-scroll",ref:Ft,onScroll:()=>{const p=Ft.current;if(!p)return;const j=p.scrollHeight-p.scrollTop-p.clientHeight<80;De.current=j,pe(j)},children:[!v.length&&(je||zi==="connecting")?a.jsx(Wn,{label:C(zi==="connecting"?"chat.connecting":"chat.loadingChat")}):v.length?null:a.jsxs("div",{className:"empty",children:[a.jsx("div",{children:C("chat.sendToStart")}),Mm(f,Ue,2).length?a.jsxs("div",{className:"empty-recent","aria-label":C("chat.recentAria"),children:[a.jsx("div",{className:"empty-recent-head",children:C("chat.recentHead")}),Mm(f,Ue,2).map(p=>a.jsxs("button",{type:"button",className:"empty-recent-row",title:p.title||p.id,onClick:async()=>{var R;const j=await wn((R=B.current)==null?void 0:R.rpc,p.id,p.profile||Ue);j!=null&&j.ok&&S(p.id)},children:[a.jsx("span",{className:"empty-recent-title",children:p.title||p.id}),a.jsx("span",{className:"empty-recent-when",children:tt(dr(p.updated_at??p.started_at))}),a.jsx("span",{className:"empty-recent-mark","aria-hidden":"true",children:"›"})]},p.id))]}):null]}),E!=null&&E.hasMore&&(E!=null&&E.oldestId)?a.jsx("button",{type:"button",className:"chat-older",disabled:E.loadingMore,onClick:()=>{H("tap"),Hi()},children:E.loadingMore?C("chat.loadingOlder"):C("chat.loadOlder")}):null,Vo.map((p,j)=>{var oe,ae,ne;if(p.kind==="report"){const le=p.report;if(Jd(le)){const Pe=lr.findIndex(Jt=>Jt.key===le.key)===lr.length-1,fe=le.key in L?!!L[le.key]:Pe;return a.jsx(N0,{report:le,open:fe,onToggle:()=>{H("tap"),se(Jt=>({...Jt,[le.key]:!fe}))},onDiscuss:()=>yy(le),onReceipt:()=>ky(le),onOpenBoard:()=>xy(le),onCopyCode:xp},le.key)}return a.jsxs("div",{className:"msg report",title:Lo(le.at),children:[a.jsxs("span",{className:"report-body",children:["🖊 ",le.text]}),a.jsx("button",{type:"button",className:"report-link",onClick:()=>{H("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:le.taskId,label:le.label}}))},children:C("chat.reviewAndAnnotate")})]},le.key)}const R=p.block,O=p.index;let Q=R.mid!=null&&R.mid!==""?`mid-${R.mid}`:os.current.get(R);return Q||(rr.current+=1,Q=`at-${R.at||O}-${rr.current}`,os.current.set(R,Q)),R.role==="user"?a.jsx("div",{"data-mid":R.mid,className:`msg user${me!=null&&me.focusId&&R.mid===me.focusId?" hit":""}`,children:a.jsxs("div",{className:"bubble",children:[(oe=R.images)!=null&&oe.length?a.jsx("div",{className:"bubble-imgs",children:R.images.map((le,be)=>le.url?a.jsx("span",{className:"bubble-img",children:a.jsx("img",{src:le.url,alt:le.name??C("chat.attachedImage")})},be):null)}):null,(ae=R.files)!=null&&ae.length?a.jsx("div",{className:"bubble-files",children:R.files.map((le,be)=>a.jsxs("span",{className:"file-chip",children:["📎 ",le.name,le.bytes?a.jsx("span",{className:"file-size",children:Tl(le.bytes)}):null]},be))}):null,R.text,R.text?a.jsx("button",{type:"button",className:"bubble-menu-btn","aria-label":C("chat.bubbleMenuAria"),onClick:le=>{le.stopPropagation(),H("tap"),we({text:R.text,role:"user",mid:R.mid??null})},children:a.jsx(Me,{name:"more",size:14})}):null]})},Q):R.role==="assistant"?a.jsx("div",{"data-mid":R.mid,className:`msg bot${me!=null&&me.focusId&&R.mid===me.focusId?" hit":""}`,children:a.jsxs("div",{className:`bubble${dy&&j===Vo.length-1?" vibe-settle-flash":""}`,children:[(ne=R.tools)!=null&&ne.length?a.jsxs("details",{className:"msg-tools",children:[a.jsx("summary",{children:C("chat.toolsRan",{count:R.tools.length})}),a.jsx($c,{rows:R.tools,prefix:Q,expandedMap:Z,onToggle:Go})]}):null,R.text?a.jsxs(a.Fragment,{children:[a.jsx(Gv,{text:R.text,onCopyCode:xp,copyLabel:C("chat.copy")}),a.jsx("button",{type:"button",className:"bubble-menu-btn","aria-label":C("chat.bubbleMenuAria"),onClick:le=>{le.stopPropagation(),H("tap"),we({text:R.text,role:"assistant",mid:R.mid??null})},children:a.jsx(Me,{name:"more",size:14})})]}):R.open?a.jsx("span",{className:"dots",children:"…"}):""]})},Q):a.jsx("div",{className:"msg notice",children:R.text},Q)}),xn?(()=>{var le,be;const p=K||(Yt==null?void 0:Yt.startedAt),j=p?Math.max(0,Math.floor((V-p)/1e3)):0,R=String(Math.floor(j/60)).padStart(2,"0"),O=String(j%60).padStart(2,"0"),Q=!X.length&&((le=Yt==null?void 0:Yt.lastTool)!=null&&le.name)?[{id:"live-last",name:Yt.lastTool.name,detail:Yt.lastActivity||"",full:Yt.lastActivity||"",done:!1}]:[],oe=X.length?X:Q,ae=ct?ct.trim().split(`
82
+ `):[],ne=q?ct.trim():ae.slice(-3).join(`
83
+ `);return a.jsxs("div",{className:"thinking thinking-card","data-heat":j>=30?"high":"normal",role:"status",children:[a.jsxs("div",{className:"working-head",children:[a.jsx("span",{className:"working-dot","aria-hidden":"true"}),a.jsxs("b",{className:"working-shimmer",children:["Working… ",R,":",O]}),a.jsx("span",{className:"working-meta",children:X.length?C("chat.toolProgress",{n:X.length}):(be=Yt==null?void 0:Yt.lastTool)!=null&&be.name?C("chat.lastTool",{name:Yt.lastTool.name}):C("chat.thinking")})]}),oe.length?a.jsx($c,{rows:oe,prefix:"live",expandedMap:Z,onToggle:Go}):null,ne?a.jsx("div",{className:`thinking-text${q?" expanded":""}`,onClick:()=>ce(Pe=>!Pe),children:ne}):null]})})():null,gt?qt(gt)?a.jsxs("div",{className:"chat-live-card warn",role:"status",children:[a.jsxs("div",{className:"chat-live-head",children:[a.jsx("span",{className:"chat-live-title",children:C("chat.reviewLabel",{title:((Fp=gt.review)==null?void 0:Fp.title)||gt.title})}),a.jsx("button",{type:"button",className:"chat-report-btn primary",onClick:()=>{var p;H("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:gt.id,label:(p=gt.review)==null?void 0:p.label}}))},children:C("chat.openInReview")})]}),a.jsx("div",{className:"chat-live-sub",children:C("chat.linkedWaiting")})]}):a.jsxs("div",{className:"chat-live-card running","data-heat":gt.status==="running"?"high":"normal",role:"status",children:[a.jsxs("div",{className:"chat-live-head",children:[a.jsx("span",{className:"working-dot","aria-hidden":"true"}),a.jsx("b",{className:"working-shimmer",children:gt.status==="running"?C("chat.workerRunning"):C("chat.workerQueued")}),a.jsx("button",{type:"button",className:"chat-report-btn",onClick:()=>{var p;H("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:gt.id,label:(p=gt.review)==null?void 0:p.label}}))},children:C("chat.watchProgress")})]}),a.jsx("div",{className:"chat-live-sub",children:((Bp=gt.review)==null?void 0:Bp.title)||gt.title}),(()=>{var j;const p=(((j=ve==null?void 0:ve.feed)==null?void 0:j.messages)||[]).filter(R=>R.role!=="user").slice(-4);return p.length?a.jsx($c,{rows:p.map((R,O)=>{const Q=String(R.text||"").replace(/\s+/g," ").trim();return{id:String(R.id??O),name:R.role==="tool"?R.toolName||"tool":"agent",detail:hp(Q,56),full:Q.slice(0,300),done:O<p.length-1}}),prefix:`worker-${gt.id}`,expandedMap:Z,onToggle:Go}):null})()]}):null,Oe?a.jsxs("div",{className:"usage",children:["in ",Oe.input??0," / out ",Oe.output??0,Oe.cache_read?` / cache ${Oe.cache_read}`:""]}):null]}),!te&&Vo.length>0?a.jsx("button",{type:"button",className:`chat-jump-bottom${xn||gt?" active":""}`,onClick:()=>{H("tap");const p=Ft.current;p&&(p.scrollTop=p.scrollHeight,De.current=!0,pe(!0))},children:C(xn||gt?"chat.jumpLatest":"chat.jumpBottomPlain")}):null]})}),Pp=a.jsx(a.Fragment,{children:Ce.length?a.jsx("div",{className:"attach-rail",children:Ce.map(p=>a.jsxs("div",{className:`attach-item${p.kind==="image"?" img":""}`,children:[p.kind==="image"?a.jsx("img",{src:p.preview,alt:p.name}):a.jsxs("span",{className:"attach-file",children:["📎",a.jsx("span",{className:"attach-file-name",children:p.name})]}),a.jsx("button",{className:"attach-x","aria-label":C("chat.removeAttachment"),onClick:()=>{p.preview&&(URL.revokeObjectURL(p.preview),Gn.current.delete(p.preview)),Te(j=>j.filter(R=>R.id!==p.id))},children:"×"})]},p.id))}):null}),Ip=a.jsx(a.Fragment,{children:a.jsx(Ev,{job:Fi,board:Bt,repo:(ke==null?void 0:ke.id)??null,chat:x??ir??null,onInspect:zo,onRetried:()=>yn(),onDismiss:async p=>{Ns(j=>[...j,p]),await yn()},notify:e})}),_p=a.jsx(a.Fragment,{children:a.jsx(Nv,{banner:Bi,busy:wt,onFile:Ui,onDismiss:p=>_e(j=>[...j,p.path]),onPreview:p=>Kn({path:p.path,title:p.title,board:p.board??null})})}),Mp=a.jsx(a.Fragment,{children:sr.chat&&(jp.length||!me)?a.jsxs("div",{className:"action-bar",children:[a.jsx("div",{className:"chips-scroll",children:jp.map(p=>a.jsx("button",{className:`snippet-chip${p.trigger?" trigger":""}`,disabled:P,title:p.text,onPointerDown:()=>{var j;clearTimeout((j=Pn.current)==null?void 0:j.timer),Pn.current={fired:!1},Pn.current.timer=setTimeout(()=>{Pn.current.fired=!0,Jo(p,!0)},550)},onPointerUp:()=>{var j;return clearTimeout((j=Pn.current)==null?void 0:j.timer)},onPointerLeave:()=>{var j;return clearTimeout((j=Pn.current)==null?void 0:j.timer)},onPointerCancel:()=>{var j;return clearTimeout((j=Pn.current)==null?void 0:j.timer)},onClick:()=>{var j;if((j=Pn.current)!=null&&j.fired){Pn.current.fired=!1;return}Jo(p)},children:p.label},p.id))}),a.jsx("button",{className:"snippet-chip add",onClick:()=>Tr(!0),"aria-label":C("chat.snippetListAria"),children:a.jsx("span",{className:"snippet-chip-add-glyph",children:"+"})})]}):null}),Lp=a.jsxs(a.Fragment,{children:[me?a.jsx("div",{className:"composer-ro",children:C("chat.readonlyComposer")}):null,a.jsxs("div",{className:"composer",style:me?{display:"none"}:void 0,children:[a.jsx("button",{className:"plus","aria-label":C("chat.attachAria"),onClick:()=>ft(!0),disabled:P,children:a.jsx("span",{"aria-hidden":"true",children:"+"})}),a.jsx("textarea",{ref:vn,rows:1,value:I,placeholder:C("chat.composerPlaceholder"),onChange:p=>{A(p.target.value),Dc(p.target)},onPaste:p=>{var R;const j=[...((R=p.clipboardData)==null?void 0:R.items)??[]].filter(O=>O.kind==="file"&&(O.type||"").startsWith("image/")).map(O=>O.getAsFile()).filter(Boolean);j.length&&(p.preventDefault(),Lr(j))},onKeyDown:p=>{var j;p0({key:p.key,shiftKey:p.shiftKey,isComposing:(j=p.nativeEvent)==null?void 0:j.isComposing})&&(p.preventDefault(),bp())}}),P?a.jsx("button",{className:"send stop",onClick:Ny,"aria-label":C("chat.interrupt"),children:a.jsx(Me,{name:"stop",size:18})}):a.jsx("button",{className:"send",onClick:bp,disabled:!I.trim()&&!Ce.length||Uo,"aria-label":C("chat.sendAria"),children:a.jsx(Me,{name:"send",size:18})})]})]}),Ay=a.jsxs("div",{className:"chat-split-head",children:[a.jsx("span",{className:"chat-title",children:k||C("chat.title")}),a.jsx(Xs,{variant:"icon",ariaLabel:C("chat.refreshChatAria"),onRefresh:Sp}),a.jsx("button",{className:"icon-btn",onClick:()=>{H("tap"),Vi()},"aria-label":C("chat.newChatAria"),children:a.jsx(Me,{name:"plus",size:18})})]}),Op=a.jsx(C0,{sessions:f,sessionBadges:Qo,pipelineSessionIds:vy,readonlySessionId:me==null?void 0:me.sessionId,orphanReports:gy,refreshing:Dt,markDisabled:!Mr&&!Dn.length,onRefresh:()=>_a({force:!0}),onMarkAllRead:fy,onOpenOrphan:wy,onNewChat:Vi,onOpenSession:p=>Rs(p.id,null,p.profile??"default")}),Ry={banners:a.jsxs(a.Fragment,{children:[Ap,Ip,_p]}),chips:Tp,snippets:Mp,composer:a.jsxs(a.Fragment,{children:[Pp,Lp]})};return a.jsxs("div",{className:Ep?"pane chat split-layout":"pane chat","data-conn":zi,children:[Ep?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"chat-split-master",children:[a.jsx("div",{className:"chat-split-list",children:Op}),a.jsx("div",{className:"chat-split-stack",children:r0().map(p=>a.jsx("div",{className:"chat-split-group","data-chat-group":p,children:Ry[p]},p))})]}),a.jsxs("div",{className:"chat-split-detail",children:[Ay,Rp]})]}):a.jsxs(a.Fragment,{children:[Ty,Ap,Rp,Pp,Ip,_p,Mp,Lp]}),a.jsx("input",{ref:nr,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,hidden:!0,onChange:p=>{Lr(p.target.files),p.target.value=""}}),a.jsx("input",{ref:ja,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:p=>{Lr(p.target.files),p.target.value=""}}),a.jsx("input",{ref:Oi,type:"file",multiple:!0,hidden:!0,onChange:p=>{Lr(p.target.files),p.target.value=""}}),xt?a.jsxs(Qe,{title:C("chat.attachSheetTitle"),onClose:()=>ft(!1),children:[a.jsxs("div",{className:"list",children:[a.jsxs("button",{className:"list-item",onClick:()=>{var p;ft(!1),(p=nr.current)==null||p.click()},children:[a.jsxs("span",{style:{flex:1},children:[a.jsx("span",{className:"row-title",children:C("chat.pickImage")}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:C("chat.pickImageSub")})]}),a.jsx(Me,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:()=>{var p;ft(!1),(p=ja.current)==null||p.click()},children:[a.jsxs("span",{style:{flex:1},children:[a.jsx("span",{className:"row-title",children:C("chat.takePhoto")}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:C("chat.takePhotoSub")})]}),a.jsx(Me,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:()=>{var p;ft(!1),(p=Oi.current)==null||p.click()},children:[a.jsxs("span",{style:{flex:1},children:[a.jsx("span",{className:"row-title",children:C("chat.pickFile")}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:C("chat.pickFileSub")})]}),a.jsx(Me,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:Sy,children:[a.jsxs("span",{style:{flex:1},children:[a.jsx("span",{className:"row-title",children:C("chat.fromClipboard")}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:C("chat.fromClipboardSub")})]}),a.jsx(Me,{name:"chevron"})]}),sr.chat?null:a.jsxs("button",{className:"list-item",onClick:()=>{ft(!1),Tr(!0)},children:[a.jsxs("span",{style:{flex:1},children:[a.jsx("span",{className:"row-title",children:C("chat.snippetsFromPlus")}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:C("chat.snippetsFromPlusSub")})]}),a.jsx(Me,{name:"chevron"})]})]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 6px 18px",lineHeight:1.7},children:C("chat.attachNote")})]}):null,ut?a.jsx(Sv,{board:Bt,repo:(ke==null?void 0:ke.id)??null,chat:x??ir??null,notify:e,onClose:()=>Ee(!1),onSeeded:()=>yn()}):null,Ho?a.jsxs(Qe,{title:C("chat.snippetsTitle"),onClose:()=>Tr(!1),children:[a.jsx("div",{className:"list",children:Di.map(p=>a.jsxs("button",{className:"list-item",onClick:()=>Jo(p),children:[a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{className:"row-title",style:{display:"block"},children:[p.label,p.hot?a.jsx("span",{className:"pill",style:{marginLeft:8},children:C("chat.bar")}):null,p.custom?a.jsx("span",{className:"pill",style:{marginLeft:6},children:C("chat.mine")}):null]}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.text.replace(/\n/g," ")})]}),a.jsx(Me,{name:"chevron"})]},p.id))}),a.jsxs("div",{className:"row-sub",style:{padding:"12px 6px 18px",lineHeight:1.7},children:[C("chat.snippetNote"),C("chat.snippetCustomNote")]})]}):null,sn?a.jsxs(Qe,{title:(ie==null?void 0:ie.kind)==="board"?C("chat.chooseBoard"):(ie==null?void 0:ie.kind)==="create"?C("chat.createBoard"):(ie==null?void 0:ie.kind)==="all"?C("chat.allRepos"):C("chat.newChat"),onClose:()=>ie?Ne(null):An(!1),children:[ie?null:a.jsxs(a.Fragment,{children:[Ey.map(p=>a.jsxs("button",{className:`row${z===p?" on":""}`,onClick:()=>de(p),"aria-pressed":z===p,children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[p,p===dt?a.jsx("span",{className:"prof-chip",children:C("chat.defaultChip")}):null,z===p?a.jsx("span",{className:"prof-chip on",children:C("chat.selectedChip")}):null]}),a.jsx("span",{className:"row-sub",children:p==="default"?C("chat.usualWork"):p===dt?C("chat.thisDeviceDefault"):C("chat.profileSuffix",{p})})]}),a.jsx(Me,{name:z===p?"check":"chevron",size:16})]},p)),a.jsx("div",{className:"sec",children:C("chat.repoSection")}),Ki.rows.map(p=>a.jsxs("button",{className:`row${Cp===p.id?" on":""}`,onClick:()=>Np(p),title:C("chat.repoRowTitle",{label:p.label,path:p.path}),children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[za(p),Cp===p.id?a.jsx("span",{className:"prof-chip",children:C("chat.lastChip")}):null]}),a.jsxs("span",{className:"row-sub",children:[km(p.boards),p.boards.length>1?" ›":""]})]}),a.jsx(Me,{name:"chevron",size:16})]},p.id)),rn.length?null:a.jsx("div",{className:"row-sub",style:{padding:"6px 6px 10px",lineHeight:1.7},children:C("chat.reposLoading")}),Ki.hidden>0?a.jsxs("button",{className:"row",onClick:()=>Ne({kind:"all"}),children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:C("chat.allReposRow")}),a.jsx("span",{className:"row-sub",children:C("chat.reposHidden",{n:Ki.hidden,total:Ki.total})})]}),a.jsx(Me,{name:"chevron",size:16})]}):null,a.jsxs("button",{className:"row",onClick:()=>As(z,null,null),children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:C("chat.noRepo")}),a.jsx("span",{className:"row-sub",children:C("chat.noRepoSub")})]}),a.jsx(Me,{name:"chevron",size:16})]}),a.jsxs("div",{className:"row-sub",style:{padding:"10px 6px 18px",lineHeight:1.7},children:[C("chat.pickProfileThenRepo"),C("chat.boardBecomesDefault")]})]}),(ie==null?void 0:ie.kind)==="all"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sec",children:C("chat.allReposSection",{n:rn.length})}),rn.map(p=>a.jsxs("button",{className:"row",onClick:()=>Np(p),title:C("chat.repoRowTitle",{label:p.label,path:p.path}),children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:za(p)}),a.jsxs("span",{className:"row-sub",children:[km(p.boards),p.boards.length>1?" ›":""]})]}),a.jsx(Me,{name:"chevron",size:16})]},p.id))]}):null,(ie==null?void 0:ie.kind)==="board"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sec",children:C("chat.repoBoards",{repo:za(ie.repo)})}),(ie.repo.boards??[]).map(p=>a.jsxs("button",{className:"row",onClick:()=>As(z,ie.repo,p),children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:p.name||p.slug}),a.jsxs("span",{className:"row-sub",children:[p.slug,p.current?C("chat.currentBoard"):""]})]}),a.jsx(Me,{name:"chevron",size:16})]},p.slug)),a.jsx("div",{className:"row-sub",style:{padding:"10px 6px 18px",lineHeight:1.7},children:C("chat.boardPickNote",{n:ie.repo.boards.length})})]}):null,(ie==null?void 0:ie.kind)==="create"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sec",children:C("chat.noBoardsSection")}),a.jsx("div",{className:"row-sub",style:{padding:"6px 6px 12px",lineHeight:1.7},children:C("chat.noBoardsBody",{repo:za(ie.repo)})}),a.jsxs("button",{className:"row",onClick:Cy,disabled:Ye,"aria-busy":Ye,children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:Ye?C("chat.creating"):C("chat.createBoardRow",{id:ie.repo.id})}),a.jsx("span",{className:"row-sub",children:ie.repo.path})]}),a.jsx(Me,{name:"check",size:16})]}),a.jsxs("button",{className:"row",onClick:()=>Ne(null),children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:C("chat.dontCreate")}),a.jsx("span",{className:"row-sub",children:C("chat.dontCreateSub")})]}),a.jsx(Me,{name:"chevron",size:16})]})]}):null]}):null,et?a.jsx(Qe,{title:C("chat.drawerTitle"),onClose:()=>We(!1),children:Op}):null,ue?a.jsx(ap,{board:ue.board,spec:ue.spec,onClose:()=>U(null),notify:e}):null,ee?a.jsxs(Qe,{title:C("chat.bubbleMenuTitle"),onClose:()=>we(null),children:[a.jsx("div",{className:"bubble-menu-preview",children:ee.text.slice(0,180)}),a.jsxs("div",{className:"pick-list",children:[a.jsx("button",{type:"button",className:"pick-item",onClick:async()=>{var p,j;try{await((j=(p=navigator.clipboard)==null?void 0:p.writeText)==null?void 0:j.call(p,ee.text)),e==null||e(C("chat.bubbleCopied"))}catch{e==null||e(C("chat.bubbleCopied"))}we(null)},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleCopy")})})}),a.jsx("button",{type:"button",className:"pick-item",onClick:async()=>{const p=ee.text.split(`
84
+ `).map(j=>j.trim()).find(Boolean)||"";await Y("/api/memos",{method:"POST",body:{title:p.slice(0,60),body:ee.text,tags:["clip"],kind:"clip",color:ee.role==="user"?"teal":"default",source:{chatId:x||void 0,chatTitle:k||void 0,board:(ke==null?void 0:ke.board)||void 0,repo:(ke==null?void 0:ke.id)||void 0,mid:ee.mid?String(ee.mid):void 0}}}),window.dispatchEvent(new CustomEvent("hm:memos-changed")),bt("approve"),e==null||e(C("chat.bubbleSavedMemo")),we(null)},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleSaveMemo")})})}),a.jsx("button",{type:"button",className:"pick-item",onClick:()=>{const p=ee.text.slice(0,600);we(null),window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:p,repo:ke==null?void 0:ke.path,board:ke==null?void 0:ke.board}}))},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleToSeed")})})})]}),me?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"list-head",style:{marginTop:12},children:C("chat.bubbleContinueHead")}),a.jsxs("div",{className:"pick-list",children:[[{label:C("chat.bubbleSummarize"),key:"chat.bubbleSummarizePrompt"},{label:C("chat.bubbleBrainstorm"),key:"chat.bubbleBrainstormPrompt"},{label:C("chat.bubbleDig"),key:"chat.bubbleDigPrompt"}].map(p=>a.jsx("button",{type:"button",className:"pick-item",onClick:()=>{const j=ee.text.slice(0,600).replace(/\n+/g,`
85
+ > `);we(null),Ma(C(p.key,{quote:j}))},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:p.label})})},p.key)),a.jsx("button",{type:"button",className:"pick-item",onClick:()=>{const p=ee.text.slice(0,320).replace(/\n+/g,`
86
+ > `);A(j=>j?`${j}
87
+ > ${p}
88
+
89
+ `:`> ${p}
90
+
91
+ `),we(null),setTimeout(()=>{var j;return(j=vn.current)==null?void 0:j.focus()},60)},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleQuote")})})})]})]})]}):null]})}let Ds=null;const fo=new Set;typeof window<"u"&&(window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),Ds=e,fo.forEach(t=>t())}),window.addEventListener("appinstalled",()=>{Ds=null,fo.forEach(e=>e())}));function T0(){const[e,t]=u.useState(!!Ds),[n,s]=u.useState(!1);return u.useEffect(()=>{var o;const r=()=>t(!!Ds);fo.add(r);const i=[500,1500,3e3,6e3].map(c=>setTimeout(r,c)),l=(o=window.matchMedia)==null?void 0:o.call(window,"(display-mode: standalone)");return s(!!(l!=null&&l.matches)),()=>{fo.delete(r),i.forEach(clearTimeout)}},[]),{available:e,installed:n,prompt:async()=>{if(!Ds)return null;Ds.prompt();const r=await Ds.userChoice;return Ds=null,t(!1),(r==null?void 0:r.outcome)??null}}}function A0(){try{return"serviceWorker"in navigator?navigator.serviceWorker.controller?C("install.swControlled"):C("install.swWaiting"):C("install.swUnsupported")}catch{return"—"}}async function R0(e){try{const t=await fetch(e,{cache:"no-store"});return{status:t.status,type:t.headers.get("content-type")??"",res:t}}catch(t){return{status:0,type:`error: ${t.message}`,res:null}}}async function P0(e){try{const t=await fetch(e,{cache:"no-store"});if(!t.ok)return{ok:!1,why:`HTTP ${t.status}`,w:0,h:0};const n=await t.blob();try{const s=await createImageBitmap(n);return{ok:!0,w:s.width,h:s.height,bytes:n.size,mime:n.type}}catch{const s=URL.createObjectURL(n);try{const r=await new Promise((i,l)=>{const o=new Image;o.onload=()=>i(o),o.onerror=()=>l(new Error("decode")),o.src=s});return{ok:!0,w:r.naturalWidth,h:r.naturalHeight,bytes:n.size,mime:n.type}}catch{return{ok:!1,why:C("diag.decodeError"),w:0,h:0}}finally{URL.revokeObjectURL(s)}}}catch(t){return{ok:!1,why:t.message,w:0,h:0}}}async function I0(){var m;const e=[],t=(v,T,E)=>e.push({label:v,ok:T,detail:E}),n=document.querySelector('link[rel="manifest"]');if(t(C("diag.manifestLink"),!!n,n?n.getAttribute("href"):C("diag.linkMissing")),!n)return e;const s=new URL(n.getAttribute("href"),location.href).href,r=await R0(s);if(t(C("diag.manifestFetch"),r.status===200,`HTTP ${r.status} / ${r.type}`),!r.res||!r.res.ok)return e;let i;try{i=JSON.parse(await r.res.text())}catch(v){return t(C("diag.manifestJson"),!1,v.message),e}t(C("diag.manifestJson"),!0,C("diag.entries",{count:Object.keys(i).length})),t("name",!!i.name,i.name??C("diag.none")),t("short_name",!!i.short_name,i.short_name??C("diag.none"));const l=new URL(i.start_url??".",s).href,o=new URL(i.scope??"./",s).href,c=i.id,d=c==null?null:new URL(c,s).href;t("start_url",!0,l),t("scope",!0,o),t("id",!0,d??C("diag.idUnset")),t(C("diag.startInScope"),l.startsWith(o),`${l} ⊂ ${o}`),t(C("diag.idSameOrigin"),!d||new URL(d).origin===location.origin,d??"-");const g=i.display??"browser",f=["standalone","fullscreen","minimal-ui"].includes(g);t("display",f,g);const h=i.icons??[];t(C("diag.iconCount"),h.length>0,C("diag.iconCountValue",{count:h.length}));let x=!1,b=!1,w=!1;for(const v of h){const T=new URL(v.src,s).href,E=await P0(T),_=v.sizes??"",I=v.purpose??"any",A=Math.max(E.w,E.h);E.ok&&A>=192&&I.split(" ").includes("any")&&(x=!0),E.ok&&A>=512&&I.split(" ").includes("any")&&(b=!0),E.ok&&I.split(" ").includes("maskable")&&(w=!0);const P=!_||_==="any"||_.split(" ").includes(`${E.w}x${E.h}`);t(`icon ${v.src.split("/").pop()}`,E.ok&&P,E.ok?C("diag.iconLine",{w:E.w,h:E.h,bytes:E.bytes,purpose:I,declared:_}):`${E.why}`)}t(C("diag.any192"),x,C(x?"diag.present":"diag.missingInstall")),t(C("diag.any512"),b,C(b?"diag.present":"diag.missingInstall")),t(C("diag.maskable"),w,C(w?"diag.present":"diag.maskableMissing"));const S=(m=navigator.serviceWorker)==null?void 0:m.controller;t(C("diag.swControl"),!!S,S?S.scriptURL:C("diag.swNone"));try{const T=(await navigator.serviceWorker.getRegistrations()).find(E=>l.startsWith(E.scope));t(C("diag.swCovering"),!!T,T?T.scope:C("diag.none"))}catch(v){t(C("diag.swCovering"),!1,v.message)}const k=["standalone","minimal-ui","fullscreen","browser"];return t(C("diag.viewMode"),!0,k.filter(v=>matchMedia(`(display-mode: ${v})`).matches).join(", ")||C("diag.unknown")),t("referrer",!0,document.referrer||C("diag.empty")),t("UA",!0,navigator.userAgent.slice(0,80)),e}const Yv="hm.theme",wa="dark",_0=["dark","light"],M0={dark:"#051319",light:"#f4f7f8"},Jv="(prefers-color-scheme: dark)";function Bo(e){if(e==null)return null;const t=String(e).trim().toLowerCase();return t?t==="system"||t==="auto"?"system":t==="dark"||t==="light"?t:null:null}function L0(e){try{if(typeof window<"u"&&typeof window.matchMedia=="function")return!!window.matchMedia(Jv).matches}catch{}return!0}function O0(e,t){const n=Bo(e)??wa;return n==="system"?(t&&typeof t.systemDark=="boolean"?t.systemDark:L0())?"dark":"light":n}function D0(){try{const e=typeof localStorage>"u"?null:localStorage.getItem(Yv);return Bo(e)??wa}catch{return wa}}let Ai=wa,go="dark";const Yu=new Set;let Ht=null;function $0(){for(const e of[...Yu])try{e(go,Ai)}catch{}}function F0(e){const t=_0.includes(e)?e:"dark";if(typeof document>"u")return t;try{const n=document.documentElement;n.dataset.theme!==t&&(n.dataset.theme=t),n.style.colorScheme!==t&&(n.style.colorScheme=t);const s=document.querySelector('meta[name="theme-color"]'),r=M0[t];s&&s.getAttribute("content")!==r&&s.setAttribute("content",r)}catch{}return t}function Ju(e,t){const n=Bo(e)??wa,s=O0(n,t),r=n!==Ai||s!==go;return Ai=n,go=s,F0(s),r&&!(t!=null&&t.silent)&&$0(),s}function B0(e){const t=Bo(e)??wa;try{typeof localStorage<"u"&&localStorage.setItem(Yv,t)}catch{}return Ju(t),t}function U0(){return Ai}function Ml(){return go}function Dm(e){return Yu.add(e),()=>Yu.delete(e)}function qv(){if(Ju(D0(),{silent:!0}),Ht||typeof window>"u"||typeof window.matchMedia!="function")return()=>{};try{Ht=window.matchMedia(Jv);const e=()=>{Ai==="system"&&Ju("system")};return typeof Ht.addEventListener=="function"?Ht.addEventListener("change",e):typeof Ht.addListener=="function"&&Ht.addListener(e),()=>{try{typeof(Ht==null?void 0:Ht.removeEventListener)=="function"?Ht.removeEventListener("change",e):typeof(Ht==null?void 0:Ht.removeListener)=="function"&&Ht.removeListener(e)}catch{}Ht=null}}catch{return()=>{}}}let Ms=null;function Xv(e,t=globalThis.window){var l,o;const n=Number(t==null?void 0:t.innerWidth)||390,s=Number(t==null?void 0:t.innerHeight)||844,r=Number(e==null?void 0:e.clientX),i=Number(e==null?void 0:e.clientY);if(Number.isFinite(r)&&Number.isFinite(i)&&(r>0||i>0))return{x:Math.round(r),y:Math.round(i)};try{const c=(o=(l=e==null?void 0:e.currentTarget)==null?void 0:l.getBoundingClientRect)==null?void 0:o.call(l);if(c&&c.width>0&&c.height>0)return{x:Math.round(c.left+c.width/2),y:Math.round(c.top+c.height/2)}}catch{}return{x:Math.round(n/2),y:Math.round(s/2)}}function Zv(e,t,n=globalThis.document){var s,r;try{const i=((s=n==null?void 0:n.querySelector)==null?void 0:s.call(n,".shell"))??(n==null?void 0:n.body);if(!i||typeof i.animate!="function")return null;try{(r=Ms==null?void 0:Ms.cancel)==null||r.call(Ms)}catch{}const l=i.animate(e,t);return Ms=l,l.onfinish=()=>{Ms===l&&(Ms=null)},l}catch{return null}}function H0(e,t){var g,f,h,x,b,w;if(gs()===e||Fo()||typeof document>"u")return um(e);const{x:s,y:r}=Xv(t),i=Number((g=globalThis.window)==null?void 0:g.innerWidth)||390,l=Number((f=globalThis.window)==null?void 0:f.innerHeight)||844,o=Math.ceil(Math.hypot(Math.max(s,i-s),Math.max(r,l-r)));let c=e;const d=()=>{c=um(e),c==="dopamine"&&(bt("vibeWarp",{x:s,y:r,sound:!1}),tp("approve"))};if(typeof document.startViewTransition=="function")try{return(w=(b=(x=(h=document.startViewTransition(d).ready)==null?void 0:h.then)==null?void 0:x.call(h,()=>{var k,m,v,T;c==="dopamine"?(m=(k=document.documentElement)==null?void 0:k.animate)==null||m.call(k,{clipPath:[`circle(0px at ${s}px ${r}px)`,`circle(${o}px at ${s}px ${r}px)`]},{duration:420,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}):(T=(v=document.documentElement)==null?void 0:v.animate)==null||T.call(v,{opacity:[0,1]},{duration:240,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})}))==null?void 0:b.catch)==null||w.call(b,()=>{}),c}catch{}return d(),Zv([{opacity:.78},{opacity:1}],{duration:220,easing:"ease-out"}),c}function z0(e,t,n){var d,g,f,h,x,b;if(typeof t!="function")return;const s=Ml();if(Fo()||typeof document>"u"){t(e);return}const{x:r,y:i}=Xv(n),l=Number((d=globalThis.window)==null?void 0:d.innerWidth)||390,o=Number((g=globalThis.window)==null?void 0:g.innerHeight)||844,c=Math.ceil(Math.hypot(Math.max(r,l-r),Math.max(i,o-i)));if(typeof document.startViewTransition=="function")try{(b=(x=(h=(f=document.startViewTransition(()=>{t(e)}).ready)==null?void 0:f.then)==null?void 0:h.call(f,()=>{var S,k;Ml()!==s&&((k=(S=document.documentElement)==null?void 0:S.animate)==null||k.call(S,{clipPath:[`circle(0px at ${r}px ${i}px)`,`circle(${c}px at ${r}px ${i}px)`]},{duration:340,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}))}))==null?void 0:x.catch)==null||b.call(x,()=>{});return}catch{}t(e),Ml()!==s&&Zv([{opacity:.76},{opacity:1}],{duration:220,easing:"ease-out"})}const $m=8;function W0(e,{limit:t=$m,expanded:n=!1}={}){const s=Array.isArray(e)?e:[],r=Number.isFinite(t)&&t>0?Math.floor(t):$m,i=Math.max(0,s.length-r),l=i>0;return{visible:l&&n?s:s.slice(0,r),hiddenCount:i,canExpand:l,expanded:l&&!!n}}function V0(){const e=u.useSyncExternalStore(Dm,U0,()=>"dark"),t=u.useSyncExternalStore(Dm,Ml,()=>"dark"),n=u.useCallback(s=>{B0(s)},[]);return{pref:e,resolved:t,setPref:n}}function K0({notify:e,board:t=""}){var m,v,T;const{t:n}=Fe(),[s,r]=u.useState(null),[i,l]=u.useState(!1),[o,c]=u.useState(null),[d,g]=u.useState(!1),[f,h]=u.useState(null),x=u.useCallback(async()=>{try{const E=await Y("/api/pipeline/status");E!=null&&E.ok?(r(E),l(!1)):l(!0)}catch{l(!0)}try{const E=t?`?board=${encodeURIComponent(t)}`:"",_=await Y(`/api/architect/jobs${E}`);_!=null&&_.ok&&c(_)}catch{c(null)}},[t]);u.useEffect(()=>{x()},[x]);const b=u.useCallback(async()=>{if(!d){g(!0),h(null),H("action");try{const E=await Y("/api/pipeline/optimize",{method:"POST",body:{}});E!=null&&E.ok?(r(E.status??s),e==null||e(n("settings.pipelineOptimized"))):h((E==null?void 0:E.error)??n("settings.pipelineUnavailable"))}catch(E){h((E==null?void 0:E.code)==="UNKNOWN_ENDPOINT"?n("settings.pipelineUnavailable"):(E==null?void 0:E.message)??"")}finally{g(!1),x()}}},[d,x,e,s,n]),w=!!((m=s==null?void 0:s.soul)!=null&&m.applied),S=Array.isArray((v=s==null?void 0:s.hermes)==null?void 0:v.present)?s.hermes.present.length:0,k=Array.isArray((T=s==null?void 0:s.bundled)==null?void 0:T.names)?s.bundled.names.length:0;return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineLead")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:n("settings.pipelineRunner")}),a.jsx("span",{className:"pill on",children:n("seed.runnerHermes")})]}),a.jsx("p",{className:"row-sub",style:{margin:"6px 0 10px",lineHeight:1.6},children:n("settings.pipelineRunnerHint")}),i?a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineUnavailable")}):a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSoul")}),a.jsx("b",{children:n(w?"settings.pipelineApplied":"settings.pipelineMissing")})]}),k?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSkills")}),a.jsxs("b",{children:[S,"/",k]})]}):null,o?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineJobs")}),a.jsx("b",{children:Array.isArray(o.jobs)?o.jobs.length:0})]}):null,o&&Array.isArray(o.pending)?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelinePending")}),a.jsx("b",{children:o.pending.length})]}):null,a.jsx("button",{type:"button",className:"seed-submit",style:{marginTop:10},disabled:d||i,onClick:b,children:n(d?"settings.pipelineOptimizing":"settings.pipelineOptimize")}),f?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:f}):null]})}function Q0(){var e,t;try{return(document.referrer||"").startsWith("android-app://")?"webapk":((t=(e=window.matchMedia)==null?void 0:e.call(window,"(display-mode: standalone)"))==null?void 0:t.matches)?"standalone":"browser"}catch{return"unknown"}}const G0=[{value:"auto",key:"settings.languageAuto"},...dk.map(e=>({value:e,key:e==="ja"?"settings.languageJa":"settings.languageEn"}))],Y0=[{value:"dark",key:"settings.themeDark"},{value:"light",key:"settings.themeLight"},{value:"system",key:"settings.themeSystem"}],J0=[{value:"dopamine",key:"settings.vibeDopamine"},{value:"serotonin",key:"settings.vibeSerotonin"}],q0=[{id:"chat",key:"settings.barChat"},{id:"annotation",key:"settings.barAnnotation"},{id:"term",key:"settings.barTerm"}];function X0({rows:e,margin:t=4,size:n=300}){const s=ze.useRef(null);return u.useEffect(()=>{const r=s.current;if(!r||!(e!=null&&e.length))return;const i=e.length+t*2,l=Math.max(2,Math.floor(n/i)),o=Math.min(3,window.devicePixelRatio||1),c=i*l,d=Math.round(l*o);r.width=c*o,r.height=c*o,r.style.width=`${c}px`,r.style.height=`${c}px`;const g=r.getContext("2d");g.imageSmoothingEnabled=!1,g.fillStyle="#ffffff",g.fillRect(0,0,r.width,r.height),g.fillStyle="#000000";for(let f=0;f<e.length;f+=1)for(let h=0;h<e[f].length;h+=1)e[f][h]==="1"&&g.fillRect((h+t)*d,(f+t)*d,d,d)},[e,t,n]),a.jsx("canvas",{ref:s,className:"pair-qr-canvas",role:"img","aria-label":"Pairing QR"})}function Z0({notify:e,lang:t}){const{t:n}=Fe(),[s,r]=u.useState("chat"),[i,l]=u.useState({chat:null,term:null}),[o,c]=u.useState({label:"",text:"",hot:!1,run:!0}),[d,g]=u.useState(null),[f,h]=u.useState(!1),x=s==="term"?"/api/snippets/term":"/api/snippets",b=s==="term"?"hm:term-snippets":"hm:snippets",w=i[s],S=(w==null?void 0:w.overrides)??{},k=(w==null?void 0:w.custom)??[],m=(w==null?void 0:w.customMax)??16,v=((w==null?void 0:w.allSnippets)??[]).filter(D=>!D.custom),T=((w==null?void 0:w.allSnippets)??[]).filter(D=>D.custom),E=u.useCallback(async()=>{try{const D=await Y(`${x}?lang=${encodeURIComponent(t)}`);l(X=>({...X,[s]:D}))}catch(D){e(D.message)}},[x,s,t,e]);u.useEffect(()=>{E()},[E]);const _=u.useCallback(async(D,X)=>{h(!0);try{const ge=await Y(x,{method:"PUT",body:D});return l(Z=>({...Z,[s]:ge})),window.dispatchEvent(new Event(b)),X&&e(X),!0}catch(ge){return e(ge.message),!1}finally{h(!1)}},[x,s,b,e]),I=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hot:!D.hot}}}),A=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hidden:!D.hidden}}}),P=(D,X)=>_({custom:D},X),y=D=>P(k.map(X=>X.id===D.id?{...X,hot:!X.hot}:X)),K=async()=>{const D=o.label.trim(),X=o.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));if(k.length>=m)return e(n("settings.snippetLimit",{max:m}));const ge={label:D,text:X,hot:o.hot};s==="term"&&(ge.run=o.run),await P([...k,ge],n("settings.saved"))&&c({label:"",text:"",hot:!1,run:!0})},$=async()=>{if(!d)return;const D=d.label.trim(),X=d.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));const ge=k.map(G=>G.id===d.id?{...G,label:D,text:X,hot:d.hot,...s==="term"?{run:d.run}:{}}:G);await P(ge,n("settings.saved"))&&g(null)},V=async()=>{h(!0);try{const[D,X]=await Promise.all([Y("/api/snippets",{method:"PUT",body:{reset:!0}}),Y("/api/snippets/term",{method:"PUT",body:{reset:!0}})]);l({chat:D,term:X}),g(null),c({label:"",text:"",hot:!1,run:!0}),window.dispatchEvent(new Event("hm:snippets")),window.dispatchEvent(new Event("hm:term-snippets")),e(n("settings.snippetResetDone"))}catch(D){e(D.message)}finally{h(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:"⚡"}),a.jsx("span",{className:"settings-card-title",children:n("settings.snippets")}),a.jsx("span",{className:"settings-card-action",children:a.jsx("button",{className:"link",disabled:f,onClick:V,children:n("settings.snippetReset")})})]}),a.jsxs("div",{className:"chips",role:"group","aria-label":n("settings.snippets"),style:{marginBottom:10},children:[a.jsx("button",{className:`chip${s==="chat"?" on":""}`,onClick:()=>r("chat"),children:n("settings.snippetChat")}),a.jsx("button",{className:`chip${s==="term"?" on":""}`,onClick:()=>r("term"),children:n("settings.snippetTerm")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.snippetBuiltin")})}),a.jsxs("div",{className:"list",children:[v.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.label}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:`chip${D.hot?" on":""}`,disabled:f,onClick:()=>I(D),"aria-label":`${n("settings.snippetHot")} ${D.label}`,children:n("settings.snippetHot")}),a.jsx("button",{className:`chip${D.hidden?"":" on"}`,disabled:f,onClick:()=>A(D),"aria-label":`${D.hidden?n("settings.snippetShow"):n("settings.snippetHide")} ${D.label}`,children:D.hidden?n("settings.snippetShow"):n("settings.snippetHide")})]},D.id)),v.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.customSnippets",{count:k.length,max:m})})}),a.jsxs("div",{className:"list",children:[T.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[D.label,D.hot?a.jsx("span",{className:"pill",style:{marginLeft:8},children:n("settings.bar")}):null,s==="term"&&D.run?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("term.run")}):null,D.hidden?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("settings.snippetHiddenPill")}):null]}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:"link",disabled:f,onClick:()=>y(D),children:n("settings.snippetHot")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>g({id:D.id,label:D.label,text:D.text,hot:D.hot,run:D.run!==!1}),children:n("settings.snippetEdit")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>P(k.filter(X=>X.id!==D.id)),children:n("settings.delete")})]},D.id)),T.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),d?a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetEditTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:d.label,onChange:D=>g({...d,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:d.text,onChange:D=>g({...d,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:d.hot,onChange:D=>g({...d,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:d.run,onChange:D=>g({...d,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsxs("div",{className:"row",style:{marginTop:10},children:[a.jsx("button",{className:"btn",disabled:f,onClick:$,children:n("settings.snippetSave")}),a.jsx("button",{className:"link",style:{marginLeft:10},onClick:()=>g(null),children:n("settings.snippetCancel")})]})]}):null,a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetAddTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:o.label,onChange:D=>c({...o,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:o.text,onChange:D=>c({...o,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:o.hot,onChange:D=>c({...o,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:o.run,onChange:D=>c({...o,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsx("button",{className:"btn",onClick:K,disabled:f||k.length>=m,style:{marginTop:10},children:n(f?"settings.saving":"settings.snippetAdd")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 6px 0",lineHeight:1.7},children:n("settings.snippetHint")})]})}const eN=[{id:"sec-appearance",icon:"🎨",key:"settings.secAppearance"},{id:"sec-pairing",icon:"📱",key:"settings.secPairing"},{id:"sec-snippets",icon:"⚡",key:"settings.secSnippets"},{id:"sec-pipeline",icon:"🏗️",key:"settings.secPipeline"},{id:"sec-repos",icon:"📁",key:"settings.secRepos"},{id:"sec-audit",icon:"🛡️",key:"settings.secAudit"},{id:"sec-status",icon:"🩺",key:"settings.secStatus"}];function Br({icon:e,title:t,action:n}){return a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:e}),a.jsx("span",{className:"settings-card-title",children:t}),n?a.jsx("span",{className:"settings-card-action",children:n}):null]})}function tN({overview:e,notify:t,refresh:n}){var He,$t,wt,Tt;const{lang:s,t:r,pref:i,setPref:l}=Fe(),{pref:o,setPref:c}=V0(),d=T0(),[g,f]=u.useState(null),[h,x]=u.useState(!1),[b,w]=u.useState(null),[S,k]=u.useState(!1),[m,v]=u.useState(null),[T,E]=u.useState("gateway"),[_,I]=u.useState([]),[A,P]=u.useState(()=>Xd()),[y,K]=u.useState(()=>gs()),[$,V]=u.useState(()=>ep()),[D,X]=u.useState(()=>Sa());u.useEffect(()=>hv(K),[]);const[ge,Z]=u.useState([]),[G,q]=u.useState([]),[ce,te]=u.useState(""),[pe,ve]=u.useState(""),[xe,Oe]=u.useState(!1),[Ae,et]=u.useState(null),[We,Dt]=u.useState(!1),ht=u.useCallback(async()=>{H("tap"),Dt(!0);try{const F=await Y("/api/auth/pairing");et(F)}catch(F){t==null||t(F.message)}finally{Dt(!1)}},[t]),ct=u.useCallback(async F=>{try{await navigator.clipboard.writeText(F),t==null||t(r("settings.pairingCopied"))}catch{t==null||t(F)}},[t,r]),yt=u.useCallback(async()=>{try{const F=await Y("/api/repos");return Z(Array.isArray(F==null?void 0:F.repos)?F.repos:[]),q(Array.isArray(F==null?void 0:F.scanDirs)?F.scanDirs:[]),!0}catch(F){return t(F.message),!1}},[t]),Ge=u.useCallback(async({method:F="POST",path:_e="/api/repos",body:Nt,done:Kn})=>{Oe(!0);try{const mt=await Y(_e,{method:F,body:Nt});return Z(Array.isArray(mt==null?void 0:mt.repos)?mt.repos:[]),Array.isArray(mt==null?void 0:mt.scanDirs)&&q(mt.scanDirs),t(Kn),!0}catch(mt){return t(mt.message),!1}finally{Oe(!1)}},[t]),$e=u.useCallback(async()=>{try{const F=await Y("/api/audit?lines=80");return w(F.lines??[]),!0}catch(F){return t(F.message),!1}},[t]);u.useEffect(()=>{$e(),yt(),Y("/api/sessions?limit=5").then(F=>I(F.sessions??[])).catch(()=>{})},[$e,yt]);const M=async F=>{try{const _e=await Y(`/api/logs?file=${encodeURIComponent(F)}&lines=200`);v({name:_e.file,text:_e.text})}catch(_e){t(_e.message)}},W=u.useCallback(F=>{var Nt;H("tap");const _e=typeof document<"u"?document.getElementById(F):null;(Nt=_e==null?void 0:_e.scrollIntoView)==null||Nt.call(_e,{behavior:"smooth",block:"start"})},[]),L=(He=e==null?void 0:e.system)==null?void 0:He.memory,se=($t=e==null?void 0:e.system)==null?void 0:$t.disk,ue=e==null?void 0:e.bridge,U=e==null?void 0:e.kanban,ee=Array.isArray(b)?b.slice().reverse():[],we=W0(ee,{expanded:S}),ut=Q0(),Ee=ut==="standalone"?r("settings.standalone"):ut==="browser"?r("settings.browser"):ut==="webapk"?"WebAPK":"—";return a.jsxs("div",{className:"pane center-readable",children:[a.jsx("nav",{className:"settings-nav","aria-label":r("settings.sections"),children:eN.map(F=>a.jsxs("button",{type:"button",className:"settings-nav-chip",onClick:()=>W(F.id),children:[a.jsx("span",{"aria-hidden":"true",children:F.icon}),a.jsx("span",{children:r(F.key)})]},F.id))}),a.jsxs("section",{id:"sec-appearance",className:"card settings-card",children:[a.jsx(Br,{icon:"🎨",title:r("settings.secAppearance")}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.language")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},children:G0.map(F=>a.jsx("button",{type:"button",className:`chip${i===F.value?" on":""}`,"aria-pressed":i===F.value,onClick:()=>{H("tap"),l(F.value)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.theme")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},role:"group","aria-label":r("settings.theme"),children:Y0.map(F=>a.jsx("button",{type:"button",className:`chip${o===F.value?" on":""}`,"aria-pressed":o===F.value,onClick:_e=>{H("tap"),z0(F.value,c,_e)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.vibe")})}),a.jsx("div",{className:"chips",style:{marginBottom:6},role:"group","aria-label":r("settings.vibe"),children:J0.map(F=>a.jsx("button",{type:"button",className:`chip vibe-chip${y===F.value?" on":""}`,"aria-pressed":y===F.value,onClick:_e=>{H("tap");const Nt=H0(F.value,_e);K(Nt),t==null||t(r("settings.vibeSwitched",{mode:r(F.key)}))},children:r(F.key)},F.value))}),a.jsx("p",{className:"row-sub",style:{marginBottom:8,lineHeight:1.6},children:r("settings.vibeHint")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:r("settings.haptics")}),a.jsx("button",{type:"button",role:"switch","aria-checked":A,"aria-label":r("settings.haptics"),className:`hm-switch${A?" on":""}`,onClick:()=>{const F=Gk(!A);P(F),F&&H("tap")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsxs("span",{children:[r("settings.sound"),a.jsx("span",{className:"row-sub",style:{display:"block",lineHeight:1.5,marginTop:2},children:r("settings.soundHint")})]}),a.jsx("button",{type:"button",role:"switch","aria-checked":$,"aria-label":r("settings.sound"),className:`hm-switch${$?" on":""}`,onClick:()=>{const F=eb(!$);V(F),H("tap"),F&&tp("approve")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.bars")})}),q0.map(F=>a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsx("span",{children:r(F.key)}),a.jsx("button",{type:"button",role:"switch","aria-checked":D[F.id]!==!1,"aria-label":r(F.key),"data-bar":F.id,className:`hm-switch${D[F.id]!==!1?" on":""}`,onClick:()=>{H("tap"),X(CS(F.id,D[F.id]===!1))},children:a.jsx("span",{className:"hm-switch-knob"})})]},F.id)),a.jsx("p",{className:"row-sub",style:{marginTop:8,marginBottom:0,lineHeight:1.6},children:r("settings.barsHint")})]}),a.jsxs("section",{id:"sec-pairing",className:"card settings-card",children:[a.jsx(Br,{icon:"📱",title:r("settings.secPairing")}),a.jsx("div",{className:"row-sub",style:{marginTop:8,lineHeight:1.6},children:r("settings.pairingHint")}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:10},disabled:We,onClick:ht,children:[We?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(We?"settings.pairingLoading":"settings.showPairingQr")})]})]}),a.jsx("section",{id:"sec-snippets",className:"card settings-card",children:a.jsx(Z0,{notify:t,lang:s})}),a.jsxs("section",{id:"sec-pipeline",className:"card settings-card",children:[a.jsx(Br,{icon:"🏗️",title:r("settings.secPipeline")}),a.jsx(K0,{notify:t,board:(()=>{try{return localStorage.getItem(_v)??""}catch{return""}})()})]}),a.jsxs("section",{id:"sec-repos",className:"card settings-card",children:[a.jsx(Br,{icon:"📁",title:r("settings.repos",{count:ge.length}),action:a.jsx("button",{className:"link",disabled:xe,onClick:async()=>{H("tap"),await Ge({path:"/api/repos/scan",done:r("settings.rescanned")})},children:r("settings.rescan")})}),a.jsxs("div",{className:"list",children:[ge.map(F=>{var _e;return a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[F.label,F.source==="custom"?a.jsx("span",{className:"pill",style:{marginLeft:8},children:r("settings.manual")}):null]}),a.jsx("span",{className:"row-sub",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r("settings.repoLine",{path:F.path,source:F.source,count:((_e=F.boards)==null?void 0:_e.length)??0})})]}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({method:"DELETE",path:`/api/repos/${encodeURIComponent(F.id)}`,done:r("settings.hidden")}),children:r("settings.hide")})]},F.id)}),ge.length?null:a.jsx("div",{className:"empty",children:r("settings.reposEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.scanDirs")})}),a.jsxs("div",{className:"list",children:[G.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:"row-main",style:{minWidth:0},children:a.jsx("span",{className:"row-title mono",children:F})}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({body:{scanDirs:G.filter(_e=>_e!==F)},done:r("settings.removed")}),children:r("settings.delete")})]},F)),G.length?null:a.jsx("div",{className:"empty",children:r("settings.scanDirsEmpty")})]}),a.jsx("input",{className:"inp",style:{marginTop:10},placeholder:r("settings.scanDirPlaceholder"),maxLength:200,value:ce,onChange:F=>te(F.target.value)}),a.jsx("button",{className:"btn",disabled:xe||!ce.trim(),style:{marginTop:8},onClick:async()=>{const F=[...G,ce.trim()];await Ge({body:{scanDirs:F},done:r("settings.scanDirAdded")})&&te("")},children:r("settings.addScanDir")}),a.jsx("input",{className:"inp",placeholder:r("settings.repoPathPlaceholder"),maxLength:300,value:pe,onChange:F=>ve(F.target.value),style:{marginTop:8}}),a.jsx("button",{className:"btn",disabled:xe||!pe.trim(),style:{marginTop:8},onClick:async()=>{await Ge({body:{path:pe.trim()},done:r("settings.repoAdded")})&&ve("")},children:r("settings.addRepo")})]}),a.jsxs("section",{id:"sec-audit",className:"card settings-card",children:[a.jsx(Br,{icon:"🛡️",title:r("settings.secAudit"),action:a.jsx(Xs,{variant:"link",onRefresh:$e})}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.logs")})}),a.jsx("div",{className:"row",children:["gateway","errors","agent"].map(F=>a.jsxs("button",{className:"chip",onClick:()=>{H("tap"),M(F)},style:{marginRight:6},children:[F,".log"]},F))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.audit")})}),a.jsxs("div",{className:"list",children:[we.visible.map((F,_e)=>a.jsx("div",{className:"row static",children:a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.kind}),a.jsxs("span",{className:"row-sub",children:[Lo(F.at),F.task?` ・ ${F.task}`:"",F.action?` ・ ${F.action}`:"",F.ok===!1?` ・ ${r("settings.auditFailed")}`:""]})]})},`${F.at??"x"}-${F.kind??""}-${_e}`)),we.visible.length?null:a.jsx("div",{className:"empty",children:r("settings.auditEmpty")})]}),we.canExpand?a.jsx("button",{type:"button",className:"btn settings-audit-more","aria-expanded":we.expanded,style:{marginTop:8},onClick:()=>{H("tap"),k(F=>!F)},children:we.expanded?r("settings.auditCollapse"):r("settings.auditShowMore",{count:we.hiddenCount})}):null]}),a.jsxs("section",{id:"sec-status",className:"card settings-card",children:[a.jsx(Br,{icon:"🩺",title:r("settings.secStatus")}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Hermes"}),a.jsx("b",{children:((wt=e==null?void 0:e.hermes)==null?void 0:wt.version)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.model")}),a.jsx("b",{children:((Tt=e==null?void 0:e.hermes)==null?void 0:Tt.model)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.memory")}),a.jsx("b",{children:L?r("settings.memoryValue",{used:Tl(L.used),total:Tl(L.total),percent:L.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.disk")}),a.jsx("b",{children:se?r("settings.diskValue",{free:Tl(se.free),percent:se.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.bridge")}),a.jsx("b",{className:(ue==null?void 0:ue.ok)===!1?"bad-text":"",children:ue?ue.ok?r("settings.bridgeOk",{uptime:ue.uptimeSec}):r("settings.disconnected"):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.reviewWaiting")}),a.jsx("b",{children:U?r("settings.kanbanValue",{waiting:U.reviewWaiting,running:U.running}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.lastChecked")}),a.jsx("b",{children:tt(e==null?void 0:e.checkedAt)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.launchSource")}),a.jsx("b",{children:Ee})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.installability")}),a.jsx("b",{children:d.available?r("settings.installPossible"):d.installed?r("settings.installDone"):r("settings.installNo")})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Service Worker"}),a.jsx("b",{children:A0()})]}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8},disabled:h,"aria-busy":h,onClick:async()=>{H("tap"),x(!0);try{const F=await I0();f(F),Y("/api/client-error",{method:"POST",body:{kind:"pwa-diag",href:location.href,referrer:document.referrer||"",displayMode:["standalone","minimal-ui","fullscreen","browser"].filter(_e=>matchMedia(`(display-mode: ${_e})`).matches).join(","),rows:F}}).catch(()=>{})}finally{x(!1)}},children:[h?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(h?"settings.diagRunning":"settings.diagRun")})]}),g&&a.jsx("div",{className:"diag",style:{marginTop:10,fontSize:12,lineHeight:1.5},children:g.map(F=>a.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0"},children:[a.jsx("span",{style:{color:F.ok?"var(--good)":"var(--bad)",flex:"0 0 auto"},children:F.ok?"✓":"✗"}),a.jsx("span",{style:{flex:"1 1 auto",color:F.ok?"var(--text)":"var(--danger-fg)"},children:F.label}),a.jsx("span",{style:{flex:"1 1 50%",color:"var(--muted)",wordBreak:"break-all",textAlign:"right"},children:F.detail})]},F.label))}),d.available&&a.jsx("button",{className:"btn primary",style:{marginTop:8},onClick:async()=>{const F=await d.prompt();t==null||t(r(F==="accepted"?"settings.installPromptAccepted":"settings.installPromptCancelled"))},children:r("settings.installApp")}),a.jsx(Xs,{label:r("settings.refresh"),ariaLabel:r("settings.refreshAria"),className:"hm-btn-inner",onRefresh:async()=>!!await(n==null?void 0:n())}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.recentSessions")})}),a.jsxs("div",{className:"list",children:[_.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${F.active?"running":"done"}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.title??F.id}),a.jsxs("span",{className:"row-sub",children:[F.source," ・ ",F.messages," msg ・ ",F.lastActivity??""]})]})]},F.id)),_.length?null:a.jsx("div",{className:"empty",children:r("settings.none")})]}),a.jsxs("div",{className:"row-sub",style:{padding:"10px 0 0",lineHeight:1.7},children:[r("settings.about",{version:"0.2.2"})," ",a.jsx("span",{className:"mono",children:"~/.hermes/plugin-data/hermes-pilot/token"})]})]}),m?a.jsx(Qe,{title:m.name,onClose:()=>v(null),children:a.jsx("pre",{className:"logbox",children:m.text})}):null,Ae?a.jsxs(Qe,{title:r("settings.pairingTitle"),onClose:()=>et(null),children:[a.jsx("div",{className:"row-sub",style:{lineHeight:1.6},children:r("settings.pairingScanHint")}),Ae.qrPng?a.jsx("div",{className:"pair-qr",children:a.jsx("img",{className:"pair-qr-img",src:Ae.qrPng,width:287,height:287,alt:"Pairing QR"})}):Ae.qrRows?a.jsx("div",{className:"pair-qr",children:a.jsx(X0,{rows:Ae.qrRows,margin:Ae.qrMargin??4,size:Math.min(320,Math.max(220,(typeof window<"u"?window.innerWidth:390)-70))})}):Ae.qrSvg?a.jsx("div",{className:"pair-qr",dangerouslySetInnerHTML:{__html:Ae.qrSvg}}):a.jsx("div",{className:"empty",children:r("settings.pairingEmpty")}),a.jsx("div",{className:"list",style:{marginTop:10},children:(Ae.targets??[]).map(F=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:F.label}),a.jsx("span",{className:"row-sub mono",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F.url})]}),a.jsx("button",{className:"link",onClick:()=>ct(F.url),children:r("settings.pairingCopy")})]},F.url))}),a.jsx("div",{className:"row-sub",style:{marginTop:10,lineHeight:1.6},children:r("settings.pairingNote")})]}):null]})}function nN({onClose:e,onOpenSession:t,notify:n}){const{t:s}=Fe(),[r,i]=u.useState(""),[l,o]=u.useState(null),[c,d]=u.useState(!1),g=u.useRef(null),f=u.useRef(0);u.useEffect(()=>{const b=setTimeout(()=>{var w;return(w=g.current)==null?void 0:w.focus()},120);return()=>clearTimeout(b)},[]);const h=u.useCallback(async b=>{const w=b.trim();if(!w){o(null);return}const S=++f.current;d(!0);try{const k=await Y(`/api/search?q=${encodeURIComponent(w)}&limit=30`);S===f.current&&o(k)}catch(k){S===f.current&&(o({ok:!1,reason:k.message,hits:[]}),n==null||n(k.message))}finally{S===f.current&&d(!1)}},[n]);u.useEffect(()=>{const b=setTimeout(()=>h(r),280);return()=>clearTimeout(b)},[r,h]);const x=(l==null?void 0:l.hits)??[];return a.jsxs(Qe,{title:s("search.title"),onClose:e,children:[a.jsx("input",{ref:g,className:"inp",value:r,onChange:b=>i(b.target.value),placeholder:s("search.placeholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,inputMode:"search",enterKeyHint:"search"}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px 4px",display:"flex",alignItems:"center",gap:6},children:c?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12}),a.jsx("span",{children:s("search.searching")})]}):l!=null&&l.ok?s("search.resultCount",{count:x.length,ms:Math.round(l.tookMs)}):(l==null?void 0:l.reason)??s("search.hint")}),a.jsxs("div",{className:"list",children:[x.map(b=>a.jsx("button",{className:"list-item",onClick:()=>{H("tap"),t==null||t(b),e==null||e()},children:a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsx("span",{className:"row-title",style:{fontSize:12.5},children:b.snippet||s("search.emptySnippet")}),a.jsxs("span",{className:"row-sub",children:[b.role==="user"?s("search.you"):b.role==="assistant"?"Hermes":b.role,` ・ ${tt(b.at)}`,b.sessionTitle?` ・ ${String(b.sessionTitle).slice(0,28)}`:"",b.profile&&b.profile!=="default"?` ・ ${b.profile}`:"",b.source?` ・ ${b.source}`:""]})]})},`${b.profile??"default"}:${b.messageId}`)),!c&&(l!=null&&l.ok)&&!x.length?a.jsx("div",{className:"empty",children:s("search.none")}):null]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 4px 18px",lineHeight:1.7},children:s("search.note")})]})}const sN=["title","body","tagsText","color","pinned","checklist"],Ri=e=>e==null?"":String(e);function ey(e){return Array.isArray(e)?e.map(t=>({id:Ri(t==null?void 0:t.id),text:Ri(t==null?void 0:t.text),done:!!(t!=null&&t.done)})):[]}function qu(e){const t=e??{},n={};for(const s of sN)s==="checklist"?n[s]=ey(t.checklist):s==="pinned"?n[s]=!!t.pinned:n[s]=Ri(t[s]);return JSON.stringify(n)}function Xu(e){return e?Ri(e.title).trim()||Ri(e.body).trim()?!0:ey(e.checklist).length>0:!1}function rN(e,t){if(!e)return!1;if(t==null||t==="")return Xu(e);const n=typeof t=="string"?t:qu(t);return qu(e)!==n}function ty(e){return e==="list"}function Fm(e){return!ty(e)}function aN(e,t={}){var r;const n=t.canOpenChat!==!1,s=[{action:"pin",labelKey:e!=null&&e.pinned?"notes.unpin":"notes.pin"},{action:"brainstorm",labelKey:"notes.brainstorm"},{action:"seed",labelKey:"notes.toSeed"}];return n&&((r=e==null?void 0:e.source)!=null&&r.chatId)&&s.push({action:"chat",labelKey:"notes.openChat"}),s}const ny="hm.memosView",sy=["one","two","list"],Zu="two";function iN(e){const t=typeof e=="string"?e.trim():"";return sy.includes(t)?t:Zu}function lN(e,t){if(!e||typeof e.setItem!="function"||!sy.includes(t))return!1;try{return e.setItem(ny,t),!0}catch{return!1}}const oN=3;function cN(e=[],t,n=oN){const s=Array.isArray(e)?e:[];return t!=="two"||s.length<=n?{visible:s,hidden:0}:{visible:s.slice(0,n),hidden:s.length-n}}function uN(e){if(!e||typeof e.getItem!="function")return Zu;try{return iN(e.getItem(ny))}catch{return Zu}}const dN=["default","teal","amber","violet"],pN=[{view:"one",glyph:"1",labelKey:"notes.viewOne"},{view:"two",glyph:"2",labelKey:"notes.viewTwo"},{view:"list",glyph:"☰",labelKey:"notes.viewList"}];function hN(e){return String(e??"").split(/[,、\s]+/).map(t=>t.trim().replace(/^#+/,"")).filter(Boolean)}function mN({notify:e,onOpenChat:t}){const{t:n}=Fe(),[s,r]=u.useState([]),[i,l]=u.useState([]),[o,c]=u.useState(!0),[d,g]=u.useState(""),[f,h]=u.useState("all"),[x,b]=u.useState(""),[w,S]=u.useState(null),[k,m]=u.useState(""),[v,T]=u.useState(!1),[E,_]=u.useState(()=>uN(typeof localStorage>"u"?null:localStorage)),[I,A]=u.useState(null),[P,y]=u.useState(null),[K,$]=u.useState(!1),[V,D]=u.useState(0),X=u.useCallback(async()=>{var M,W;try{const[L,se]=await Promise.allSettled([Y("/api/memos"),Y("/api/chat-reports?limit=20")]);L.status==="fulfilled"&&Array.isArray((M=L.value)==null?void 0:M.memos)&&r(L.value.memos),se.status==="fulfilled"&&Array.isArray((W=se.value)==null?void 0:W.reports)&&l(se.value.reports)}finally{c(!1)}},[]);u.useEffect(()=>{X();const M=()=>X();return window.addEventListener("hm:memos-changed",M),()=>window.removeEventListener("hm:memos-changed",M)},[X]);const ge=u.useMemo(()=>{const M=new Set;for(const W of s)for(const L of W.tags||[])M.add(L);return[...M].slice(0,12)},[s]),Z=u.useMemo(()=>{var W;const M=new Set;for(const L of s)(W=L.source)!=null&&W.reportKey&&M.add(L.source.reportKey);return M},[s]),G=u.useMemo(()=>{const M=d.trim().toLowerCase();return s.filter(W=>{if(f==="pinned"&&!W.pinned||f==="report"&&W.kind!=="report")return!1;if(f.startsWith("tag:")){const se=f.slice(4).toLowerCase();if(!(W.tags||[]).some(ue=>ue.toLowerCase()===se))return!1}return M?[W.title,W.body,...W.tags||[],...(W.checklist||[]).map(se=>se.text)].join(`
92
+ `).toLowerCase().includes(M):!0})},[s,f,d]),q=u.useCallback(async()=>{const M=x.trim();if(!(!M||v)){T(!0);try{const W=await Y("/api/memos",{method:"POST",body:{title:"",body:M,tags:["idea"],kind:"note",color:"default"}});W!=null&&W.memo&&r(L=>[W.memo,...L]),b(""),bt("approve"),e==null||e(n("notes.saved"))}catch(W){e==null||e((W==null?void 0:W.message)||"Error")}finally{T(!1)}}},[x,v,e,n]),ce=u.useCallback(async(M,W)=>{var ue;(ue=W==null?void 0:W.stopPropagation)==null||ue.call(W),H("tap");const L=!M.pinned;r(U=>U.map(ee=>ee.id===M.id?{...ee,pinned:L}:ee));const se=await Y(`/api/memos/${encodeURIComponent(M.id)}`,{method:"PATCH",body:{pinned:L}});se!=null&&se.memo&&X()},[X]),te=u.useCallback(async(M,W,L)=>{var U;(U=L==null?void 0:L.stopPropagation)==null||U.call(L),H("tap");const se=(M.checklist||[]).find(ee=>ee.id===W);se&&!se.done&&bt("spark",{x:L==null?void 0:L.clientX,y:L==null?void 0:L.clientY,sound:!1});const ue=(M.checklist||[]).map(ee=>ee.id===W?{...ee,done:!ee.done}:ee);r(ee=>ee.map(we=>we.id===M.id?{...we,checklist:ue}:we)),await Y(`/api/memos/${encodeURIComponent(M.id)}`,{method:"PATCH",body:{checklist:ue}})},[]),pe=u.useCallback(async M=>{const W=M.key||`${M.at||""}:${M.title||""}`;if(!Z.has(W))try{const L=await Y("/api/memos",{method:"POST",body:{title:M.title||M.specTitle||"Report",body:M.summary||M.body||"",tags:["report"],kind:"report",color:"amber",source:{chatId:M.chat||void 0,board:M.board||void 0,reportKey:W}}});L!=null&&L.memo&&(r(se=>[L.memo,...se]),bt("approve"),e==null||e(n("notes.inboxSaved")))}catch(L){e==null||e((L==null?void 0:L.message)||"Error")}},[Z,e,n]),ve=(M=null)=>{if(H("tap"),m(""),$(!1),M){const W={id:M.id,title:M.title||"",body:M.body||"",tagsText:(M.tags||[]).join(", "),pinned:!!M.pinned,color:M.color||"default",kind:M.kind||"note",checklist:[...M.checklist||[]]};S(W),y(qu(W))}else S({id:null,title:"",body:"",tagsText:"idea",pinned:!1,color:"default",kind:"note",checklist:[]}),y(null)},xe=async()=>{if(!w||v)return!1;const M=hN(w.tagsText);if(!w.id&&!Xu(w))return!1;T(!0);try{let W=!1;if(w.id){const L=await Y(`/api/memos/${encodeURIComponent(w.id)}`,{method:"PATCH",body:{title:w.title,body:w.body,tags:M,pinned:w.pinned,color:w.color,checklist:w.checklist}});L!=null&&L.memo&&(X(),bt("approve"),e==null||e(n("notes.saved")),W=!0)}else{const L=await Y("/api/memos",{method:"POST",body:{title:w.title,body:w.body,tags:M,pinned:w.pinned,color:w.color,kind:"note",checklist:w.checklist}});L!=null&&L.memo&&(X(),bt("approve"),e==null||e(n("notes.saved")),W=!0)}return W&&($(!1),y(null),S(null)),W}catch(W){return e==null||e((W==null?void 0:W.message)||"Error"),!1}finally{T(!1)}},Oe=u.useCallback(()=>{if(!v){if(!rN(w,P)){$(!1),S(null);return}H("tap"),$(!0)}},[w,P,v]),Ae=async()=>{$(!1),await xe()},et=()=>{H("tap"),$(!1),m(""),y(null),S(null)},We=()=>{H("tap"),$(!1),D(M=>M+1)},Dt=async()=>{if(!(!(w!=null&&w.id)||v)){T(!0);try{await Y(`/api/memos/${encodeURIComponent(w.id)}`,{method:"DELETE"}),r(M=>M.filter(W=>W.id!==w.id)),$(!1),y(null),S(null),e==null||e(n("notes.deleted"))}catch(M){e==null||e((M==null?void 0:M.message)||"Error")}finally{T(!1)}}},ht=(M,W)=>{var se;(se=W==null?void 0:W.stopPropagation)==null||se.call(W),H("tap");const L=[M.title,M.body].filter(Boolean).join(`
93
+ `).trim();window.dispatchEvent(new CustomEvent("hm:open-brainstorm",{detail:{seed:L,memoId:M.id}}))},ct=(M,W)=>{var se,ue,U;(se=W==null?void 0:W.stopPropagation)==null||se.call(W),H("tap");const L=[M.title,M.body,...(M.checklist||[]).map(ee=>`- [${ee.done?"x":" "}] ${ee.text}`)].filter(Boolean).join(`
94
+ `).trim();window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:L,repo:(ue=M.source)==null?void 0:ue.repo,board:(U=M.source)==null?void 0:U.board}}))},yt=(M,W)=>{var L;A(null),W&&(M==="pin"?ce(W):M==="brainstorm"?ht(W):M==="seed"?ct(W):M==="chat"&&((L=W.source)!=null&&L.chatId)&&(H("tap"),t==null||t(W.source.chatId)))},Ge=M=>{H("tap"),_(M);try{lN(window.localStorage,M)}catch{}},$e=u.useMemo(()=>i.filter(M=>{const W=M.key||`${M.at||""}:${M.title||""}`;return!Z.has(W)}),[i,Z]);return a.jsxs("div",{className:"pane memos-pane",children:[a.jsxs("div",{className:"memos-header",children:[a.jsxs("div",{className:"memos-header-titles",children:[a.jsxs("div",{className:"memos-header-title",children:["💡 ",n("notes.title")]}),a.jsx("div",{className:"memos-header-sub",children:n("notes.subtitle")})]}),a.jsxs("div",{className:"memos-header-actions",children:[a.jsx("button",{type:"button",className:"btn primary memos-new-btn",onClick:()=>ve(null),children:n("notes.newBtn")}),a.jsx(Xs,{variant:"icon",onRefresh:X})]})]}),a.jsxs("div",{className:"memos-quick-bar",children:[a.jsx("input",{type:"text",className:"memos-quick-input",value:x,placeholder:n("notes.quickPlaceholder"),onChange:M=>b(M.target.value),onKeyDown:M=>{var W;M.key==="Enter"&&!((W=M.nativeEvent)!=null&&W.isComposing)&&(M.preventDefault(),q())}}),a.jsx("button",{type:"button",className:"btn",disabled:!x.trim()||v,onClick:q,children:n("notes.addChecklistBtn")})]}),a.jsxs("div",{className:"memos-search-row",children:[a.jsx("input",{type:"search",className:"memos-search-input",value:d,placeholder:n("notes.searchPlaceholder"),onChange:M=>g(M.target.value)}),a.jsx("div",{className:"memos-view-seg",role:"group","aria-label":n("notes.viewGroupAria"),children:pN.map(M=>a.jsx("button",{type:"button",className:`memos-view-btn${E===M.view?" on":""}`,"aria-pressed":E===M.view,"aria-label":n(M.labelKey),title:n(M.labelKey),onClick:()=>Ge(M.view),children:M.glyph},M.view))})]}),a.jsxs("div",{className:"chips memos-filter-chips",children:[a.jsx("button",{type:"button",className:`chip${f==="all"?" on":""}`,onClick:()=>h("all"),children:n("notes.filterAll")}),a.jsx("button",{type:"button",className:`chip${f==="pinned"?" on":""}`,onClick:()=>h("pinned"),children:n("notes.filterPinned")}),a.jsx("button",{type:"button",className:`chip${f==="report"?" on":""}`,onClick:()=>h("report"),children:n("notes.filterReports")}),ge.map(M=>a.jsxs("button",{type:"button",className:`chip${f===`tag:${M}`?" on":""}`,onClick:()=>h(f===`tag:${M}`?"all":`tag:${M}`),children:["#",M]},M))]}),$e.length?a.jsxs("details",{className:"memos-inbox-box",children:[a.jsxs("summary",{className:"memos-inbox-summary",children:[a.jsxs("span",{children:["📬 ",n("notes.inboxHead",{n:$e.length})]}),a.jsx(Me,{name:"chevron",size:14})]}),a.jsx("div",{className:"memos-inbox-list",children:$e.slice(0,6).map((M,W)=>a.jsxs("div",{className:"memos-inbox-row",children:[a.jsxs("div",{className:"memos-inbox-main",children:[a.jsx("div",{className:"row-title",children:M.title||M.specTitle||"Report"}),M.summary?a.jsx("div",{className:"row-sub",children:M.summary}):null]}),a.jsx("button",{type:"button",className:"btn",onClick:()=>pe(M),children:n("notes.inboxSave")})]},M.key||W))})]}):null,o?a.jsx(Wn,{label:n("common.loading")}):null,!o&&!G.length?a.jsx("div",{className:"empty",children:n("notes.empty")}):null,a.jsx("div",{className:`memos-grid view-${E}`,children:G.map(M=>{var se,ue,U,ee,we,ut;const W=[(se=M.source)==null?void 0:se.chatTitle,(ue=M.source)==null?void 0:ue.repo,(U=M.source)==null?void 0:U.board].filter(Boolean).join(" · "),L=cN(M.checklist,E);return a.jsxs("article",{className:`card memo-card color-${M.color||"default"}${M.pinned?" is-pinned":""}${M.body?" has-body":""}`,onClick:()=>ve(M),children:[a.jsxs("div",{className:"memo-card-head",children:[a.jsx("div",{className:"memo-card-title",children:M.title||(M.kind==="report"?"📬 Report":"💡")}),Fm(E)?a.jsx("button",{type:"button",className:`memo-pin-btn${M.pinned?" on":""}`,"aria-label":M.pinned?n("notes.unpin"):n("notes.pin"),onClick:Ee=>ce(M,Ee),children:"📌"}):null]}),M.body?a.jsx("div",{className:"memo-card-body",children:M.body}):null,(ee=M.checklist)!=null&&ee.length?a.jsxs("div",{className:"memo-checklist",children:[L.visible.map(Ee=>E==="two"?a.jsxs("span",{className:`memo-check-row${Ee.done?" done":""}`,children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id):a.jsxs("button",{type:"button",className:`memo-check-row${Ee.done?" done":""}`,onClick:He=>te(M,Ee.id,He),children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id)),L.hidden?a.jsx("span",{className:"memo-check-more",children:n("notes.moreItems",{n:L.hidden})}):null]}):null,(we=M.tags)!=null&&we.length?a.jsx("div",{className:"memo-tags",children:M.tags.map(Ee=>a.jsxs("span",{className:"memo-tag",children:["#",Ee]},Ee))}):null,W?a.jsx("div",{className:"memo-source-meta",children:n("notes.sourceMeta",{meta:W})}):null,Fm(E)?a.jsxs("div",{className:"memo-card-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>ht(M,Ee),children:n("notes.brainstorm")}),a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:Ee=>ct(M,Ee),children:n("notes.toSeed")}),(ut=M.source)!=null&&ut.chatId&&t?a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>{Ee.stopPropagation(),H("tap"),t(M.source.chatId)},children:n("notes.openChat")}):null]}):null,ty(E)?a.jsx("button",{type:"button",className:"memo-more-btn","aria-label":n("notes.more"),"aria-haspopup":"dialog",onClick:Ee=>{Ee.stopPropagation(),H("tap"),A(M)},children:"⋯"}):null]},M.id)})}),I?a.jsx(Qe,{title:I.title||n("notes.menuTitle"),onClose:()=>A(null),children:a.jsx("div",{className:"memo-menu",children:aN(I,{canOpenChat:!!t}).map(M=>a.jsx("button",{type:"button",className:"memo-menu-row",onClick:()=>yt(M.action,I),children:n(M.labelKey)},M.action))})}):null,w?a.jsxs(Qe,{title:w.id?n("notes.editTitle"):n("notes.createTitle"),onClose:Oe,historyKey:V,children:[K?a.jsxs("div",{className:"memo-unsaved",role:"alertdialog","aria-label":n("notes.unsavedTitle"),children:[a.jsx("div",{className:"memo-unsaved-title",children:n("notes.unsavedTitle")}),a.jsx("div",{className:"memo-unsaved-sub",children:n("notes.unsavedSub")}),a.jsxs("div",{className:"memo-unsaved-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v,onClick:Ae,children:n("notes.saveAndClose")}),a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:et,children:n("notes.discard")}),a.jsx("button",{type:"button",className:"btn",onClick:We,children:n("notes.keepEditing")})]})]}):null,a.jsxs("div",{className:"memo-editor",style:K?{display:"none"}:void 0,children:[a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTitle")}),a.jsx("input",{type:"text",className:"memo-input",value:w.title,placeholder:n("notes.fieldTitlePh"),onChange:M=>S(W=>({...W,title:M.target.value}))})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldBody")}),a.jsx("textarea",{rows:4,className:"memo-textarea",value:w.body,placeholder:n("notes.fieldBodyPh"),onChange:M=>S(W=>({...W,body:M.target.value}))})]}),a.jsxs("div",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldChecklist")}),a.jsxs("div",{className:"memo-editor-checks",children:[w.checklist.map(M=>a.jsxs("div",{className:"memo-editor-check-item",children:[a.jsx("input",{type:"checkbox",checked:M.done,onChange:()=>S(W=>({...W,checklist:W.checklist.map(L=>L.id===M.id?{...L,done:!L.done}:L)}))}),a.jsx("span",{className:M.done?"done":"",children:M.text}),a.jsx("button",{type:"button",className:"link",onClick:()=>S(W=>({...W,checklist:W.checklist.filter(L=>L.id!==M.id)})),children:"✕"})]},M.id)),a.jsxs("div",{className:"memo-check-add-row",children:[a.jsx("input",{type:"text",className:"memo-input",value:k,placeholder:n("notes.addChecklistPh"),onChange:M=>m(M.target.value)}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{const M=k.trim();M&&(S(W=>({...W,checklist:[...W.checklist,{id:`c_${Date.now()}`,text:M,done:!1}]})),m(""))},children:n("notes.addChecklistBtn")})]})]})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTags")}),a.jsx("input",{type:"text",className:"memo-input",value:w.tagsText,placeholder:n("notes.fieldTagsPh"),onChange:M=>S(W=>({...W,tagsText:M.target.value}))})]}),a.jsxs("div",{className:"memo-color-row",children:[a.jsx("span",{children:n("notes.colorLabel")}),a.jsx("div",{className:"chips",style:{padding:0},children:dN.map(M=>a.jsx("button",{type:"button",className:`chip${w.color===M?" on":""}`,onClick:()=>S(W=>({...W,color:M})),children:M},M))})]}),a.jsxs("div",{className:"memo-editor-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v||!w.id&&!Xu(w),onClick:xe,children:n("notes.save")}),w.id?a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:Dt,children:n("notes.delete")}):null]})]})]}):null]})}const fN={allClear:18,receipt:18,vibeWarp:18,launch:16,fastTrack:16,approve:12,stamp:12,combo:10,send:5,spark:4},gN=720,vN=1800,yN=2400,Bm=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .job-bar-x, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, .pick-item, .list-item, .row:not(.static), .stat, .spec-bar, .inbox-bar, details > summary, .link, .code-copy, button.t-pill, .nav-item",wN=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, details > summary, button.t-pill, .nav-item",xN=".hm-switch, .seed-toggle",kN=".seed-seg-btn, .chip, .prof-chip, .snippet-chip.trigger, .settings-nav-chip",bN={fastTrack:"fx.sfx.fastTrack",approve:"fx.sfx.approve",stamp:"fx.sfx.stamp",launch:"fx.sfx.launch",vibeWarp:"fx.sfx.vibeWarp",send:"fx.sfx.send",allClear:"fx.sfx.allClear",receipt:"fx.sfx.allClear",toggle:"fx.sfx.toggle"};function Fc(){var e,t,n;try{return!!((n=(t=(e=globalThis.window)==null?void 0:e.matchMedia)==null?void 0:t.call(e,np))!=null&&n.matches)}catch{return!1}}function ry(e=0){return e>=3?{hues:["gold","gold","amber","gold-dim"],primary:"#fbbf24",secondary:"#fde68a"}:e===2?{hues:["cyan","gold","teal","gold"],primary:"#22d3ee",secondary:"#fbbf24"}:{hues:["teal","mint","cyan","gold-dim"],primary:"#2dd4bf",secondary:"#5eead4"}}function SN(e,t=0){const n=fN[e]??12,{hues:s}=ry(t);return Array.from({length:n},(r,i)=>{const l=Math.PI*2*i/n+Math.random()*.5,o=(e==="spark"||e==="send"?24:54)+Math.random()*(e==="spark"||e==="send"?32:96);return{id:i,dx:Math.round(Math.cos(l)*o),dy:Math.round(Math.sin(l)*o-(e==="allClear"?26:e==="send"?34:0)),rot:Math.round(Math.random()*300-150),delay:Math.round(Math.random()*90),hue:s[i%s.length]}})}function Um({kind:e,x:t,y:n,width:s,height:r,sfxText:i,combo:l=0}){var _,I;const o=((_=globalThis.window)==null?void 0:_.innerWidth)||390,c=((I=globalThis.window)==null?void 0:I.innerHeight)||844,d=Number.isFinite(t)?t:o*.5,g=Number.isFinite(n)?n:c*.38,f=Number.isFinite(s)&&s>0?s:84,h=Number.isFinite(r)&&r>0?r:36,x=ry(l),b=e==="approve"||e==="fastTrack"||e==="launch"||e==="vibeWarp"||e==="allClear"||e==="receipt"||e==="tapImpact",w=e==="tap"||e==="toggle",S=b?10:w?6:e==="spark"||e==="send"?4:6,k=Array.from({length:S},(A,P)=>({angle:Math.PI*2*P/S+(Math.random()-.5)*.25,inner:(w?10:12)+Math.random()*8,outer:(b?54:w?36:30)+Math.random()*24,color:P%2===0?x.primary:x.secondary})),m=e==="spark"||e==="send"?0:b?5:3,v=Array.from({length:m},(A,P)=>{const y=P%2===0?-1:1;return{ox:d+y*(f*.34+Math.random()*12),oy:g+h*.25+(Math.random()-.5)*8,vx:y*(26+Math.random()*32),vy:8+Math.random()*16,r0:4.5+Math.random()*3.5,r1:(b?16:12)+Math.random()*8}}),T=e==="spark"?3:e==="send"?4:b?8:5,E=Array.from({length:T},(A,P)=>{const y=Math.PI*2*P/T+Math.random()*.4,K=(e==="spark"?40:w?72:85)+Math.random()*65;return{x:d,y:g,vx:Math.cos(y)*K,vy:Math.sin(y)*K-35,rot:Math.random()*Math.PI*2,vrot:(Math.random()-.5)*10,size:(w?3:3.5)+Math.random()*3,color:P%2===0?x.primary:x.secondary}});return{start:performance.now(),duration:e==="vibeWarp"?440:b?520:380,cx:d,cy:g,h,hasImpact:b||w,irisRing:e==="vibeWarp"?{maxR:Math.ceil(Math.hypot(Math.max(d,o-d),Math.max(g,c-g)))}:null,trail:e==="send"?{x:d,y:g,dy:-165}:null,rays:k,smokes:v,chips:E,sfxText:i||null,sfxTilt:(Math.random()-.5)*.22,vw:o,vh:c}}function NN(){const{t:e}=Fe(),[t,n]=u.useState(()=>gs()),[s,r]=u.useState([]),[i,l]=u.useState(null),[o,c]=u.useState(null),[d,g]=u.useState(null),f=u.useRef(0),h=u.useRef([]),x=u.useRef(null),b=u.useRef([]),w=u.useRef(0),S=u.useRef(0),k=u.useRef(e);k.current=e;const m=()=>{for(const I of h.current)clearTimeout(I);h.current=[]},v=(I,A)=>{const P=setTimeout(I,A);return h.current.push(P),P},T=()=>{w.current&&(cancelAnimationFrame(w.current),w.current=0),b.current=[];const I=x.current;if(I){const A=I.getContext("2d");A&&A.clearRect(0,0,I.width,I.height)}},E=()=>{if(w.current||Fc())return;const I=A=>{if(gs()!=="dopamine"||document.visibilityState==="hidden"){T();return}const P=x.current;if(!P){w.current=0;return}const y=P.getContext("2d");if(!y){w.current=0;return}const K=Math.min(window.devicePixelRatio||1,2),$=window.innerWidth,V=window.innerHeight,D=Math.round($*K),X=Math.round(V*K);(P.width!==D||P.height!==X)&&(P.width=D,P.height=X),y.setTransform(K,0,0,K,0,0),y.clearRect(0,0,$,V);const ge=[];for(const Z of b.current){const G=A-Z.start,q=G/Z.duration;if(q>=1)continue;ge.push(Z);const ce=1-Math.pow(1-q,3);if(Z.irisRing){const te=Math.max(8,Z.irisRing.maxR*ce);y.save(),y.globalAlpha=Math.max(0,(1-q)*.92),y.strokeStyle="#22d3ee",y.lineWidth=Math.max(1.5,5*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,te,0,Math.PI*2),y.stroke(),y.strokeStyle="#fde68a",y.lineWidth=Math.max(1,2*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,Math.max(4,te-4),0,Math.PI*2),y.stroke(),y.restore()}if(Z.hasImpact&&q<.7){const te=q/.7,pe=1-Math.pow(1-te,2);y.save(),y.globalAlpha=Math.max(0,1-te)*.75,y.strokeStyle="#fbbf24",y.lineWidth=2*(1-te)+.5,y.beginPath(),y.arc(Z.cx,Z.cy,12+pe*46,0,Math.PI*2),y.stroke();for(const ve of Z.rays){const xe=ve.inner+pe*14,Oe=ve.inner+(ve.outer-ve.inner)*pe;y.strokeStyle=ve.color,y.lineWidth=2.2*(1-te),y.beginPath(),y.moveTo(Z.cx+Math.cos(ve.angle)*xe,Z.cy+Math.sin(ve.angle)*xe),y.lineTo(Z.cx+Math.cos(ve.angle)*Oe,Z.cy+Math.sin(ve.angle)*Oe),y.stroke()}y.restore()}if(Z.trail){const te=Z.trail.y+Z.trail.dy*ce,pe=Z.trail.y+Z.trail.dy*Math.max(0,ce-.35),ve=y.createLinearGradient(Z.trail.x,pe,Z.trail.x,te);ve.addColorStop(0,"rgba(34, 211, 238, 0)"),ve.addColorStop(.6,"rgba(45, 212, 191, 0.85)"),ve.addColorStop(1,"rgba(251, 191, 36, 0.95)"),y.save(),y.globalAlpha=Math.max(0,1-q),y.strokeStyle=ve,y.lineWidth=2.5,y.lineCap="round",y.beginPath(),y.moveTo(Z.trail.x,pe),y.lineTo(Z.trail.x,te),y.stroke(),y.restore()}if(Z.smokes.length){y.save();for(const te of Z.smokes){const pe=te.ox+te.vx*ce,ve=te.oy+te.vy*ce,xe=te.r0+(te.r1-te.r0)*ce;y.globalAlpha=Math.max(0,(1-q)*.36),y.fillStyle="#d1fae5",y.beginPath(),y.arc(pe,ve,xe,0,Math.PI*2),y.fill()}y.restore()}if(Z.chips.length){const te=G/1e3;y.save();for(const pe of Z.chips){const ve=pe.x+pe.vx*te,xe=pe.y+pe.vy*te+140*te*te;y.save(),y.translate(ve,xe),y.rotate(pe.rot+pe.vrot*te),y.globalAlpha=Math.max(0,1-q),y.fillStyle=pe.color,y.beginPath(),y.moveTo(0,-pe.size),y.lineTo(pe.size*.7,0),y.lineTo(0,pe.size),y.lineTo(-pe.size*.7,0),y.closePath(),y.fill(),y.restore()}y.restore()}if(Z.sfxText){const te=Math.min(1,q*1.15),pe=te<.25?.6+te/.25*.5:1.1-Math.min(1,(te-.25)/.25)*.1,ve=te>.65?Math.max(0,1-(te-.65)/.35):1,xe=Math.max(44,Math.min($-44,Z.cx)),Oe=Math.max(30,Math.min(V-28,Z.cy-Z.h*.55-14-ce*14));y.save(),y.translate(xe,Oe),y.rotate(Z.sfxTilt),y.scale(pe,pe),y.globalAlpha=ve,y.font="900 15px system-ui, -apple-system, sans-serif",y.textAlign="center",y.textBaseline="middle",y.lineJoin="round",y.lineWidth=4,y.strokeStyle="rgba(11, 18, 22, 0.92)",y.strokeText(Z.sfxText,0,0),y.fillStyle="#fde68a",y.fillText(Z.sfxText,0,0),y.restore()}}b.current=ge,ge.length>0?w.current=requestAnimationFrame(I):(w.current=0,y.clearRect(0,0,$,V))};w.current=requestAnimationFrame(I)};u.useEffect(()=>hv(n),[]),u.useEffect(()=>{const I=A=>{if(gs()!=="dopamine")return;const P=(A==null?void 0:A.detail)??{},y=String(P.kind??"combo"),K=f.current+=1,$=Number(P.combo)||0;if(r(V=>[...V,{id:K,kind:y,x:P.x,y:P.y,particles:SN(y,$)}].slice(-4)),v(()=>r(V=>V.filter(D=>D.id!==K)),gN),!Fc()&&document.visibilityState!=="hidden"){const V=bN[y],D=P.sfx||(V?k.current(V):null),X=performance.now();if(D)for(const Z of b.current)Z.fromClick&&X-Z.start<120&&(Z.sfxText=null);const ge=Um({kind:y,x:P.x,y:P.y,width:P.width,height:P.height,sfxText:D,combo:$});b.current=[...b.current,ge].slice(-6),E(),(y==="launch"||y==="vibeWarp")&&(g({id:K}),v(()=>g(Z=>(Z==null?void 0:Z.id)===K?null:Z),440))}$>=2&&(l({n:$,id:K}),v(()=>l(V=>(V==null?void 0:V.id)===K?null:V),vN)),$>=1&&(document.documentElement.dataset.combo=$>=3?"3":String($),clearTimeout(S.current),S.current=setTimeout(()=>{delete document.documentElement.dataset.combo},$o)),(y==="allClear"||y==="receipt")&&(c({kind:y,id:K}),v(()=>c(V=>(V==null?void 0:V.id)===K?null:V),yN))};return window.addEventListener(Fu,I),()=>window.removeEventListener(Fu,I)},[]),u.useEffect(()=>{const I=A=>{var y,K;const P=(K=(y=A.target)==null?void 0:y.closest)==null?void 0:K.call(y,Bm);!P||P.disabled||H("tap")};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[]),u.useEffect(()=>{if(t!=="dopamine"||Fc())return;const I=A=>{var K,$;if(gs()!=="dopamine")return;const P=($=(K=A.target)==null?void 0:K.closest)==null?void 0:$.call(K,Bm);if(!P||P.disabled)return;if(!P.matches(wN)){P.classList.remove("fx-sakuga-lite"),P.offsetWidth,P.classList.add("fx-sakuga-lite"),v(()=>P.classList.remove("fx-sakuga-lite"),180);return}if(P.classList.remove("fx-sakuga-pop"),P.offsetWidth,P.classList.add("fx-sakuga-pop"),v(()=>P.classList.remove("fx-sakuga-pop"),340),document.visibilityState!=="hidden"){const V=P.getBoundingClientRect();if(V.width>0&&V.height>0){const D=P.matches(xN),X=!D&&P.matches(kN),ge=P.classList.contains("send")&&!P.classList.contains("stop"),Z=P.classList.contains("primary")||P.classList.contains("fast-track")||P.classList.contains("seed-submit")||P.classList.contains("ak-empty-btn")||P.classList.contains("ak-new-btn")||P.classList.contains("spec-banner-btn")&&!P.classList.contains("ghost")||ge,G=D||X?"toggle":Z?"tapImpact":"tap",q=D?k.current("fx.sfx.toggle"):X?k.current("fx.sfx.tick"):ge?k.current("fx.sfx.send"):Z?k.current("fx.sfx.tapImpact"):null,ce=Um({kind:G,x:V.left+V.width/2,y:V.top+V.height/2,width:V.width,height:V.height,sfxText:q});ce.fromClick=!0,b.current=[...b.current,ce].slice(-6),E()}}};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[t]),u.useEffect(()=>{const I=()=>{document.visibilityState==="hidden"&&T()};return document.addEventListener("visibilitychange",I),()=>document.removeEventListener("visibilitychange",I)},[]),u.useEffect(()=>{t!=="dopamine"&&(m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T(),r([]),l(null),c(null),g(null))},[t]),u.useEffect(()=>()=>{m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T()},[]);const _=t==="dopamine";return a.jsxs("div",{className:`fx-layer${_?"":" off"}`,"aria-hidden":"true",children:[a.jsx("canvas",{ref:x,className:"fx-canvas","aria-hidden":"true"}),_?s.map(I=>a.jsx("div",{className:`fx-burst fx-${I.kind}`,style:{left:I.x==null?"50%":`${I.x}px`,top:I.y==null?"38%":`${I.y}px`},children:I.particles.map(A=>a.jsx("i",{className:`fx-particle ${A.hue}`,style:{"--fx-dx":`${A.dx}px`,"--fx-dy":`${A.dy}px`,"--fx-rot":`${A.rot}deg`,animationDelay:`${A.delay}ms`}},A.id))},I.id)):null,_&&i?a.jsx("div",{className:"fx-combo-pill",children:e("fx.combo",{n:i.n})},`c${i.id}`):null,_&&o?a.jsxs("div",{className:"fx-allclear-card",children:[a.jsx("span",{className:"fx-allclear-emoji","aria-hidden":"true",children:"🎉"}),a.jsx("span",{children:e("fx.allClear")})]},`f${o.id}`):null,_&&d?a.jsx("div",{className:"fx-scan-sweep"},`s${d.id}`):null]})}const vo=["token","pair"],ay=/^[0-9a-f]{32,}$/i;function iy(e=globalThis.location){const t=String((e==null?void 0:e.search)??""),n=new URLSearchParams(t.startsWith("?")?t.slice(1):t);for(const r of vo){const i=n.get(r);if(i&&String(i).trim())return String(i).trim()}const s=String((e==null?void 0:e.hash)??"").replace(/^#/,"");if(!s)return null;if(s.includes("=")){const r=new URLSearchParams(s);for(const i of vo){const l=r.get(i);if(l&&String(l).trim())return String(l).trim()}return null}return ay.test(s)?s:null}function jN(e=globalThis.location,t=globalThis.history){var i;if(!iy(e))return!1;let n;try{n=new URL(String((e==null?void 0:e.href)??`http://127.0.0.1${(e==null?void 0:e.pathname)??"/"}${(e==null?void 0:e.search)??""}${(e==null?void 0:e.hash)??""}`))}catch{return!1}let s=!1;for(const l of vo)n.searchParams.has(l)&&(n.searchParams.delete(l),s=!0);const r=n.hash.replace(/^#/,"");if(r){if(ay.test(r))n.hash="",s=!0;else if(r.includes("=")){const l=new URLSearchParams(r);let o=!1;for(const c of vo)l.has(c)&&(l.delete(c),o=!0);if(o){const c=l.toString();n.hash=c?`#${c}`:"",s=!0}}}if(!s)return!1;try{return(i=t==null?void 0:t.replaceState)==null||i.call(t,null,"",`${n.pathname}${n.search}${n.hash}`),!0}catch{return!1}}async function CN(e,t=globalThis.fetch){if(typeof e!="string"||!e)return{ok:!1,error:"EMPTY_TOKEN"};let n;try{n=await t("/api/auth/login",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({token:e})})}catch{return{ok:!1,error:"OFFLINE"}}return n!=null&&n.ok?{ok:!0,status:n.status}:{ok:!1,status:(n==null?void 0:n.status)??0,error:"REJECTED"}}async function EN({loc:e=globalThis.location,historyObj:t=globalThis.history,fetchImpl:n=globalThis.fetch}={}){const s=iy(e);if(!s)return{handled:!1,ok:!1};const r=await CN(s,n);return r.ok?(jN(e,t),{handled:!0,ok:!0}):{handled:!0,ok:!1,error:r.error}}const TN=3e4,ly="hermes-pilot:chunk-reload-at",AN=[/failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/importing a module script failed/i,/loading chunk\s*[\w-]*\s*failed/i,/loading css chunk\s*[\w-]*\s*failed/i,/dynamically imported module.*(failed|error)/i];function oy(e){if(!e)return!1;if(typeof e=="object"&&String(e.name??"")==="ChunkLoadError")return!0;const t=String((e==null?void 0:e.message)??e);return AN.some(n=>n.test(t))}const RN=(()=>{const e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,String(n))},removeItem:t=>{e.delete(t)}}})();function PN(){try{if(typeof sessionStorage<"u"&&sessionStorage){const e=`${ly}:probe`;return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),sessionStorage}}catch{}return RN}const IN=e=>new Promise(t=>setTimeout(t,e));function _N(e,{retries:t=2,delayMs:n=250,sleep:s=IN,isChunkError:r=oy}={}){const i=async l=>{try{return await e()}catch(o){if(l>=t||!r(o))throw o;return await s(n*(l+1)),i(l+1)}};return i(0)}function MN({storage:e,now:t=Date.now,reload:n=()=>{typeof location<"u"&&typeof location.reload=="function"&&location.reload()},cooldownMs:s=TN,key:r=ly}={}){const i=e??PN();return function(){const o=t();let c=0;try{c=Number((i==null?void 0:i.getItem(r))??0)||0}catch{c=0}if(c&&o-c<s)return!1;try{i==null||i.setItem(r,String(o))}catch{}return n(),!0}}const cy=MN(),LN=u.lazy(()=>_N(()=>_y(()=>import("./TermPane-q4f5Zu0I.js"),__vite__mapDeps([0,1]))).then(e=>({default:e.TermPane}))),ON=[{id:"tasks",key:"nav.tasks",icon:"grid"},{id:"review",key:"nav.review",icon:"pen"},{id:"chat",key:"nav.chat",icon:"chat"},{id:"notes",key:"nav.notes",icon:"memo"},{id:"term",key:"nav.term",icon:"term"},{id:"settings",key:"nav.settings",icon:"gear"}];function Ur({active:e,children:t}){const n=u.useRef(null);return u.useEffect(()=>{const s=n.current;if(!s)return;const r=!e;if("inert"in s&&(s.inert=r),r){const i=document.activeElement;i&&s.contains(i)&&typeof i.blur=="function"&&i.blur()}},[e]),a.jsx("div",{ref:n,className:`pane-host${e?"":" is-hidden"}`,"aria-hidden":e?void 0:"true",children:t})}function DN({error:e,onRetry:t}){const{t:n}=Fe();return a.jsx("div",{className:"pane",children:a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"row-title",children:n("app.tabError")}),a.jsx("div",{className:"row-sub",style:{marginTop:6,lineHeight:1.7},children:String((e==null?void 0:e.message)??e)}),a.jsx("button",{className:"btn",style:{marginTop:12},onClick:t,children:n("common.retry")}),a.jsx("div",{className:"row-sub",style:{marginTop:8},children:n("app.tabErrorLog")})]})})}class Hr extends ze.Component{constructor(t){super(t),this.state={error:null,retryKey:0}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){try{fetch("/api/client-error",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({message:String((t==null?void 0:t.message)??t),stack:String((t==null?void 0:t.stack)??"").slice(0,4e3),componentStack:String((n==null?void 0:n.componentStack)??"").slice(0,4e3),tab:this.props.tab,ua:navigator.userAgent,url:location.href})}).catch(()=>{})}catch{}}retry(){oy(this.state.error)&&cy()||this.setState(t=>({error:null,retryKey:t.retryKey+1}))}render(){return this.state.error?a.jsx(DN,{error:this.state.error,onRetry:()=>this.retry()}):a.jsx(ze.Fragment,{children:this.props.children},`${this.props.tab}:${this.state.retryKey}`)}}function $N(){const{t:e}=Fe(),[t]=u.useState(()=>ik());u.useEffect(()=>qv(),[]),u.useEffect(()=>{const z=de=>{var ie;cy()&&((ie=de.preventDefault)==null||ie.call(de))};return window.addEventListener("vite:preloadError",z),()=>window.removeEventListener("vite:preloadError",z)},[]),u.useEffect(()=>{ub()},[]);const[n,s]=u.useState((t==null?void 0:t.open)==="inbox"||(t==null?void 0:t.open)==="tasks"?"tasks":(t==null?void 0:t.open)==="chat"?"chat":"tasks"),[r,i]=u.useState(null),[l,o]=u.useState("ok"),[c,d]=u.useState(!1),[g,f]=u.useState(""),[h,x]=u.useState(null),[b,w]=u.useState(!0),[S,k]=u.useState(!1),[m,v]=u.useState(()=>({[n]:!0})),T=!!m.chat,[E,_]=u.useState(0),[I,A]=u.useState(0),[P,y]=u.useState(0),[K,$]=u.useState(0),V=u.useRef(0),[D,X]=u.useState([]),[ge,Z]=u.useState(0),[G,q]=u.useState(0),[ce,te]=u.useState(0),[pe,ve]=u.useState(0),[xe,Oe]=u.useState([]),[Ae,et]=u.useState(0),[We,Dt]=u.useState([]),[ht,ct]=u.useState(!1),[yt,Ge]=u.useState(null),[$e,M]=u.useState(null),[W,L]=u.useState(null);u.useEffect(()=>{const z=ie=>{L({kind:"brainstorm",...(ie==null?void 0:ie.detail)||{}}),s("tasks")},de=ie=>{L({kind:"seed",...(ie==null?void 0:ie.detail)||{}}),s("tasks")};return window.addEventListener("hm:open-brainstorm",z),window.addEventListener("hm:open-seed",de),()=>{window.removeEventListener("hm:open-brainstorm",z),window.removeEventListener("hm:open-seed",de)}},[]);const[se,ue]=u.useState(null),[U,ee]=u.useState(null),[we,ut]=u.useState(null),[Ee,He]=u.useState(!1),[$t,wt]=u.useState(!1),Tt=u.useRef(T);Tt.current=T;const F=u.useRef(0),_e=u.useRef(null),Nt=u.useRef(n);Nt.current=n,u.useEffect(()=>{try{F.current=Number(localStorage.getItem(rm))||0}catch{F.current=0}},[]),u.useEffect(()=>{if(!(n!=="tasks"||!ge))try{const z=io(localStorage.getItem(ca)),de=Date.now(),ie={...z};for(const Ne of $u(D,z))ie[Ne.sessionId]=Math.max(de,Number(Ne.at)||0);localStorage.setItem(ca,JSON.stringify(ie)),Z(0)}catch{}},[n,ge,D]);const Kn=u.useCallback(()=>{const z=Date.now();F.current=z,q(0);try{localStorage.setItem(rm,String(z))}catch{}},[]),mt=1500,Ns=u.useRef([]),me=u.useRef(0),jt=u.useCallback(z=>(Ns.current.push(z),()=>{Ns.current=Ns.current.filter(de=>de!==z)}),[]),Ue=u.useCallback(({force:z=!1}={})=>{const de=Date.now();if(!(!z&&de-me.current<mt)){me.current=de;for(const ie of Ns.current)try{Promise.resolve(ie()).catch(()=>{})}catch{}try{window.dispatchEvent(new CustomEvent("hm:wake-sync"))}catch{}}},[mt]);u.useEffect(()=>{const z=()=>{document.visibilityState==="visible"&&Ue()},de=()=>Ue(),ie=()=>Ue({force:!0});return document.addEventListener("visibilitychange",z),window.addEventListener("focus",de),window.addEventListener("online",ie),()=>{document.removeEventListener("visibilitychange",z),window.removeEventListener("focus",de),window.removeEventListener("online",ie)}},[Ue]),u.useEffect(()=>{Ue({force:!0})},[n,Ue]),u.useEffect(()=>{n==="chat"&&Kn()},[n,Kn]),u.useEffect(()=>{const z=Ce=>{var Te;return te(Number((Te=Ce.detail)==null?void 0:Te.count)||0)},de=Ce=>{var Te;return ct(!!((Te=Ce.detail)!=null&&Te.streaming))},ie=Ce=>{s("review"),Ge({...Ce.detail||{},nonce:Date.now()})},Ne=Ce=>{s("chat"),!Tt.current&&Ce.detail&&M(Ce.detail)},Ye=Ce=>{s("chat"),ue({...Ce.detail||{},nonce:Date.now()})},Re=Ce=>{var Te;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,nonce:Date.now()})},je=()=>wt(!0),Se=Ce=>{var Te,xt,ft;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,taskId:((xt=Ce.detail)==null?void 0:xt.taskId)??((ft=Ce.detail)==null?void 0:ft.id)??null,nonce:Date.now()})};return window.addEventListener("hm:chat-unread",z),window.addEventListener("hm:chat-streaming",de),window.addEventListener("hm:open-review",ie),window.addEventListener("hm:open-session",Ne),window.addEventListener("hm:discuss-pipeline",Ye),window.addEventListener("hm:open-board",Re),window.addEventListener("hm:open-live",je),window.addEventListener("hm:open-task",Se),()=>{window.removeEventListener("hm:chat-unread",z),window.removeEventListener("hm:chat-streaming",de),window.removeEventListener("hm:open-review",ie),window.removeEventListener("hm:open-session",Ne),window.removeEventListener("hm:discuss-pipeline",Ye),window.removeEventListener("hm:open-board",Re),window.removeEventListener("hm:open-live",je),window.removeEventListener("hm:open-task",Se)}},[]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review/chat-reports?limit=200");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Nt.current==="chat"&&Kn(),X(je),q(Uk(je,F.current).length);try{const Te=io(localStorage.getItem(ca));if(Z($u(je,Te).length),!Tt.current){const xt=Nn(localStorage);te(lv(je,Te,xt?[xt]:[]).length)}}catch{}const Se=je.reduce((Te,xt)=>Number(xt==null?void 0:xt.at)>Number((Te==null?void 0:Te.at)??-1)?xt:Te,null),Ce=Number(Se==null?void 0:Se.at)||0;if(_e.current===null)_e.current=Ce;else if(Nt.current==="chat"&&Ce>_e.current){_e.current=Ce;const Te=Se.label||Se.taskId||"";It(Te?C("app.reviewDoneLabel",{label:Te}):C("app.reviewDone"))}else Ce>_e.current&&(_e.current=Ce)}catch{}};de();const ie=jt(de),Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3),Ye=()=>de();return window.addEventListener("hm:refresh-reports",Ye),()=>{z=!1,clearInterval(Ne),ie(),window.removeEventListener("hm:refresh-reports",Ye)}},[Kn,jt]),u.useEffect(()=>{try{V.current=Number(localStorage.getItem("hm.reviewSeenAt"))||0}catch{V.current=0}},[]),u.useEffect(()=>{if(b||(t==null?void 0:t.open)!=="inbox")return;const z=setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:t.task}}))},200);return()=>clearTimeout(z)},[b,t]),u.useEffect(()=>{const z=()=>{const de=window.location.hash.replace(/^#/,"");if(!de.startsWith("inbox"))return;const ie=de.includes(":")?de.split(":")[1]:null;window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:ie}}))};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]);const rs=u.useRef(null);u.useEffect(()=>{v(z=>z[n]?z:{...z,[n]:!0})},[n]);const Qn=u.useRef(null);u.useEffect(()=>{var de;const z=(de=Qn.current)==null?void 0:de.querySelector(".nav-item.on");z&&typeof z.scrollIntoView=="function"&&z.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})},[n]);const It=u.useCallback(z=>{x({msg:z,at:Date.now()}),clearTimeout(rs.current),rs.current=setTimeout(()=>x(null),2600)},[]),Gt=u.useCallback(async()=>{try{const z=await Y("/api/overview");return i(z),o("ok"),d(!1),z}catch(z){return z.status===401?(d(!0),null):(o(z.code==="OFFLINE"?"offline":"error"),null)}},[]);u.useEffect(()=>{let z=!0;(async()=>{try{await EN()}catch{}z&&(await Gt(),z&&w(!1))})();const de=setInterval(()=>{z&&document.visibilityState==="visible"&&Gt()},5e3),ie=jt(Gt);return()=>{z=!1,clearInterval(de),ie()}},[Gt,jt]);const Ke=bk({reviewWaiting:E,inboxPending:I});u.useEffect(()=>{var z,de;try{Ke>0?(z=navigator.setAppBadge)==null||z.call(navigator,Ke):(de=navigator.clearAppBadge)==null||de.call(navigator)}catch{}},[Ke]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Dt(je),_(sm(je)),y(jc(je))}catch{}},ie=Re=>{var Se;const je=Array.isArray((Se=Re.detail)==null?void 0:Se.items)?Re.detail.items:[];Dt(je),_(sm(je)),y(jc(je))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:review-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const je=await Y("/api/review/feed?limit=20");z&&$(kk(je.items,V.current).length)}catch{}},ie=je=>{var Se;z&&y(jc((Se=je.detail)==null?void 0:Se.items))},Ne=je=>{var Ce;const Se=Number((Ce=je.detail)==null?void 0:Ce.at)||Date.now();V.current=Se,$(0);try{localStorage.setItem("hm.reviewSeenAt",String(Se))}catch{}};de();const Ye=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie),window.addEventListener("hm:review-seen",Ne);const Re=jt(de);return()=>{z=!1,clearInterval(Ye),Re(),window.removeEventListener("hm:review-items",ie),window.removeEventListener("hm:review-seen",Ne)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/inbox");z&&A(Ou(Re.items))}catch{}},ie=Re=>{var je;return A(Ou((je=Re.detail)==null?void 0:je.items))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="tasks"&&de()},15e3);window.addEventListener("hm:inbox-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:inbox-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{var Re,je;try{const Se=await Y("/api/live");if(!z)return;ve(Number(((Re=Se==null?void 0:Se.counts)==null?void 0:Re.turns)??0)),Oe(Array.isArray(Se==null?void 0:Se.turns)?Se.turns:[]),et(Number(((je=Se==null?void 0:Se.counts)==null?void 0:je.architect)??0))}catch{}},ie=Re=>{var je,Se,Ce;z&&(ve(Number(((je=Re.detail)==null?void 0:je.turns)??0)),Array.isArray((Se=Re.detail)==null?void 0:Se.items)&&Oe(Re.detail.items),((Ce=Re.detail)==null?void 0:Ce.architect)!==void 0&&et(Number(Re.detail.architect)||0))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3);window.addEventListener("hm:live-turns",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:live-turns",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Ne=await Y("/api/usage?hours=24");z&&ut(Ne)}catch{}};de();const ie=setInterval(()=>document.visibilityState==="visible"&&de(),6e4);return()=>{z=!1,clearInterval(ie)}},[]);const sn=Lk({conn:l,bridge:(r==null?void 0:r.bridge)??null}),An=E+I,rn=Mk({tasksRunning:r==null?void 0:r.runningTasks,turns:pe,architectRunning:Ae}),js=_k(xe),ke=Ik(we==null?void 0:we.cacheHitRate),as=u.useCallback(()=>{H("tap");const z=Ok({reviewItems:We,inboxPending:I});if(z){if(z.kind==="review"){s("review"),Ge({taskId:z.taskId,nonce:Date.now()});return}s("tasks"),setTimeout(()=>window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:null}})),120)}},[We,I]);return c?a.jsxs("div",{className:"login",children:[a.jsx("h1",{children:"Hermes Pilot"}),a.jsx("p",{children:e("app.loginPrompt")}),a.jsx("input",{value:g,onChange:z=>f(z.target.value),placeholder:"~/.hermes/plugin-data/hermes-pilot/token",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("button",{onClick:()=>{const z=g.trim();z&&(location.href=`/auth?t=${encodeURIComponent(z)}`)},children:e("app.loginButton")}),a.jsx("p",{className:"hint",children:e("app.loginHint")})]}):a.jsxs("div",{className:"app",children:[a.jsxs("header",{className:"topbar",children:[a.jsxs("span",{className:"brand",onDoubleClick:z=>{if(gs()!=="dopamine")return;const de=z.currentTarget.getBoundingClientRect();bt("allClear",{x:Math.round(de.left+de.width/2),y:Math.round(de.bottom+8),width:Math.round(de.width),height:Math.round(de.height)})},children:["Hermes ",a.jsx("b",{children:"Pilot"})]}),a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[a.jsx("button",{className:"icon-btn","aria-label":e("app.search"),onClick:()=>{H("tap"),k(!0)},children:a.jsx(Me,{name:"search",size:18})}),a.jsx("span",{className:`conn ${l}`,title:e(l==="ok"?"app.connected":"app.disconnected"),children:l==="ok"?"●":"○"})]})]}),a.jsxs("div",{className:"telemetry",role:"status","aria-live":"polite",children:[a.jsx("button",{className:`t-pill gw ${sn}`,onClick:()=>{H("tap"),Gt()},"aria-label":e(sn==="ok"?"app.gwOkAria":"app.gwDownAria"),title:e(sn==="ok"?"app.connected":"app.bridgeOffline"),children:sn==="ok"?a.jsxs(a.Fragment,{children:[a.jsx("i",{className:"t-dot ok","aria-hidden":"true"}),e("status.gw")]}):a.jsxs("span",{className:"t-gw-bad",children:[e("status.gw")," · ",e(sn==="offline"?"status.offline":"app.gwError")]})}),An>0?a.jsxs("button",{className:"t-pill warn pill-warn-pulse",onClick:as,"aria-label":e("app.jumpWaitingAria",{n:An}),children:["🔔 ",e("status.reviewWaiting",{n:An})]}):null,rn>0?a.jsxs("button",{className:"t-pill run",onClick:()=>{H("tap"),wt(!0)},"aria-label":e("app.jumpRunningAria",{n:rn}),children:[a.jsx("i",{className:"t-dot live","aria-hidden":"true"}),"⚡ ",e("status.running",{n:rn}),js?a.jsxs("span",{className:"t-tool",children:[" · ",js]}):null]}):null,ke!==null?a.jsxs("button",{className:"t-pill gem",onClick:()=>{H("tap"),He(!0)},"aria-label":e("app.cacheAria",{pct:ke}),children:["💎 ",ke,"%"]}):null]}),l!=="ok"?a.jsxs("div",{className:"banner",children:[e("app.bridgeOffline"),a.jsx("button",{onClick:()=>{H("tap"),Gt()},children:e("common.retry")})]}):null,a.jsx("main",{className:"panes",children:b?a.jsx(Wn,{label:e("common.loading")}):a.jsxs(a.Fragment,{children:[m.tasks?a.jsx(Ur,{active:n==="tasks",children:a.jsx(Hr,{tab:"tasks",children:a.jsx(XS,{overview:r,refresh:Gt,notify:It,initialInbox:(t==null?void 0:t.open)==="inbox"?t:null,focusBoard:U,onConsumedFocusBoard:()=>ee(null),taskToolRequest:W,onConsumedTaskTool:()=>L(null),active:n==="tasks"})})}):null,m.review?a.jsx(Ur,{active:n==="review",children:a.jsx(Hr,{tab:"review",children:a.jsx(GS,{notify:It,focusRequest:yt,onConsumedFocus:()=>Ge(null),active:n==="review"})})}):null,m.notes?a.jsx(Ur,{active:n==="notes",children:a.jsx(Hr,{tab:"notes",children:a.jsx(mN,{notify:It,onOpenChat:z=>{M({id:z}),s("chat")}})})}):null,m.term?a.jsx(Ur,{active:n==="term",children:a.jsx(Hr,{tab:"term",children:a.jsx(u.Suspense,{fallback:a.jsx(Wn,{label:e("app.termLoading")}),children:a.jsx(LN,{notify:It,active:n==="term"})})})}):null,m.settings?a.jsx(Ur,{active:n==="settings",children:a.jsx(Hr,{tab:"settings",children:a.jsx(tN,{overview:r,notify:It,refresh:Gt})})}):null,m.chat?a.jsx(Ur,{active:n==="chat",children:a.jsx(Hr,{tab:"chat",children:a.jsx(E0,{notify:It,chatReports:D,reviewItems:We,liveTurns:xe,active:n==="chat",openRequest:$e,onConsumedOpen:()=>M(null),discussRequest:se,onConsumedDiscuss:()=>ue(null)})})}):null]})}),a.jsx("nav",{className:"nav",ref:Qn,children:ON.map(z=>{const de=e(z.key),ie=I+ge,Ne=z.id==="review"?E:z.id==="tasks"?ie:0,Ye=(Number(r==null?void 0:r.runningTasks)||0)+pe+Ae,Re=z.id==="review"?Cc({waiting:E,unseen:K,running:P}):z.id==="tasks"?Cc({waiting:ie,running:Ye}):z.id==="chat"?Cc({unseen:Math.max(G,ce),running:ht?1:0}):null,je=!Ne&&Re==="done"?"done":!Ne&&Re==="running"?"running":null,Se=Ne?e(z.id==="review"?"app.navWaiting":"app.navApproval",{label:de,n:Ne}):je==="done"?e("app.navDone",{label:de}):je==="running"?e(z.id==="review"?"app.navReflecting":"app.navRunning",{label:de}):void 0;return a.jsxs("button",{className:`nav-item${n===z.id?" on":""}`,"aria-current":n===z.id?"page":void 0,"aria-label":Se,onClick:()=>{n!==z.id&&H("tap"),s(z.id)},children:[a.jsxs("span",{className:"nav-icon",children:[a.jsx(Me,{name:z.icon}),Ne?a.jsx("span",{className:"nav-badge","aria-hidden":"true",children:Ne}):null,je?a.jsx("span",{className:`nav-dot ${je}`,"aria-hidden":"true"}):null]}),a.jsx("span",{children:de})]},z.id)})}),h?a.jsx("div",{className:`toast ${n}`,children:h.msg}):null,S?a.jsx(nN,{notify:It,onClose:()=>k(!1),onOpenSession:z=>{s("chat"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:z.sessionId,messageId:z.messageId,profile:z.profile}}))},120)}}):null,$t?a.jsx(Tv,{notify:It,onClose:()=>wt(!1)}):null,Ee?a.jsx(vv,{data:we,hours:24,onClose:()=>He(!1)}):null,a.jsx(NN,{})]})}qv();async function FN(){tv(document.getElementById("root")).render(a.jsx(qk,{children:a.jsx($N,{})}))}FN();if("serviceWorker"in navigator){window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})});const e="hm.swReload";try{sessionStorage.getItem(e)==="1"&&sessionStorage.removeItem(e)}catch{}navigator.serviceWorker.addEventListener("controllerchange",()=>{try{if(sessionStorage.getItem(e)==="1")return;sessionStorage.setItem(e,"1")}catch{}window.location.reload()})}export{Me as I,Qe as S,Sa as a,Y as b,H as h,a as j,vk as o,u as r,Uv as s,Fe as u};