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.
@@ -1,94 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TermPane-U500JD2P.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 sy="modulepreload",ry=function(e){return"/"+e},Np={},ay=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=ry(c),c in Np)return;Np[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":sy,u||(g.as="script"),g.crossOrigin="",g.href=c,o&&g.setAttribute("nonce",o),document.head.appendChild(g),u)return new Promise((h,S)=>{g.addEventListener("load",h),g.addEventListener("error",()=>S(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 iy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bm={exports:{}},go={},Sm={exports:{}},Te={};/**
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 Ti=Symbol.for("react.element"),ly=Symbol.for("react.portal"),oy=Symbol.for("react.fragment"),cy=Symbol.for("react.strict_mode"),uy=Symbol.for("react.profiler"),dy=Symbol.for("react.provider"),py=Symbol.for("react.context"),hy=Symbol.for("react.forward_ref"),my=Symbol.for("react.suspense"),fy=Symbol.for("react.memo"),gy=Symbol.for("react.lazy"),jp=Symbol.iterator;function vy(e){return e===null||typeof e!="object"?null:(e=jp&&e[jp]||e["@@iterator"],typeof e=="function"?e:null)}var Nm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},jm=Object.assign,Cm={};function va(e,t,n){this.props=e,this.context=t,this.refs=Cm,this.updater=n||Nm}va.prototype.isReactComponent={};va.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")};va.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Em(){}Em.prototype=va.prototype;function Gu(e,t,n){this.props=e,this.context=t,this.refs=Cm,this.updater=n||Nm}var Yu=Gu.prototype=new Em;Yu.constructor=Gu;jm(Yu,va.prototype);Yu.isPureReactComponent=!0;var Cp=Array.isArray,Tm=Object.prototype.hasOwnProperty,Ju={current:null},Am={key:!0,ref:!0,__self:!0,__source:!0};function Rm(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)Tm.call(t,s)&&!Am.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),u=0;u<o;u++)c[u]=arguments[u+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:Ti,type:e,key:i,ref:l,props:r,_owner:Ju.current}}function yy(e,t){return{$$typeof:Ti,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function qu(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ti}function wy(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ep=/\/+/g;function Jo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?wy(""+e.key):t.toString(36)}function ml(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 Ti:case ly:l=!0}}if(l)return l=e,r=r(l),e=s===""?"."+Jo(l,0):s,Cp(r)?(n="",e!=null&&(n=e.replace(Ep,"$&/")+"/"),ml(r,t,n,"",function(u){return u})):r!=null&&(qu(r)&&(r=yy(r,n+(!r.key||l&&l.key===r.key?"":(""+r.key).replace(Ep,"$&/")+"/")+e)),t.push(r)),1;if(l=0,s=s===""?".":s+":",Cp(e))for(var o=0;o<e.length;o++){i=e[o];var c=s+Jo(i,o);l+=ml(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+Jo(i,o++),l+=ml(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 Vi(e,t,n){if(e==null)return e;var s=[],r=0;return ml(e,s,"","",function(i){return t.call(n,i,r++)}),s}function xy(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 Wt={current:null},fl={transition:null},ky={ReactCurrentDispatcher:Wt,ReactCurrentBatchConfig:fl,ReactCurrentOwner:Ju};function Pm(){throw Error("act(...) is not supported in production builds of React.")}Te.Children={map:Vi,forEach:function(e,t,n){Vi(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vi(e,function(){t++}),t},toArray:function(e){return Vi(e,function(t){return t})||[]},only:function(e){if(!qu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Te.Component=va;Te.Fragment=oy;Te.Profiler=uy;Te.PureComponent=Gu;Te.StrictMode=cy;Te.Suspense=my;Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ky;Te.act=Pm;Te.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=jm({},e.props),r=e.key,i=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,l=Ju.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(c in t)Tm.call(t,c)&&!Am.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 u=0;u<c;u++)o[u]=arguments[u+2];s.children=o}return{$$typeof:Ti,type:e.type,key:r,ref:i,props:s,_owner:l}};Te.createContext=function(e){return e={$$typeof:py,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:dy,_context:e},e.Consumer=e};Te.createElement=Rm;Te.createFactory=function(e){var t=Rm.bind(null,e);return t.type=e,t};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:hy,render:e}};Te.isValidElement=qu;Te.lazy=function(e){return{$$typeof:gy,_payload:{_status:-1,_result:e},_init:xy}};Te.memo=function(e,t){return{$$typeof:fy,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=fl.transition;fl.transition={};try{e()}finally{fl.transition=t}};Te.unstable_act=Pm;Te.useCallback=function(e,t){return Wt.current.useCallback(e,t)};Te.useContext=function(e){return Wt.current.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e){return Wt.current.useDeferredValue(e)};Te.useEffect=function(e,t){return Wt.current.useEffect(e,t)};Te.useId=function(){return Wt.current.useId()};Te.useImperativeHandle=function(e,t,n){return Wt.current.useImperativeHandle(e,t,n)};Te.useInsertionEffect=function(e,t){return Wt.current.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return Wt.current.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return Wt.current.useMemo(e,t)};Te.useReducer=function(e,t,n){return Wt.current.useReducer(e,t,n)};Te.useRef=function(e){return Wt.current.useRef(e)};Te.useState=function(e){return Wt.current.useState(e)};Te.useSyncExternalStore=function(e,t,n){return Wt.current.useSyncExternalStore(e,t,n)};Te.useTransition=function(){return Wt.current.useTransition()};Te.version="18.3.1";Sm.exports=Te;var d=Sm.exports;const Ue=iy(d);/**
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 by=d,Sy=Symbol.for("react.element"),Ny=Symbol.for("react.fragment"),jy=Object.prototype.hasOwnProperty,Cy=by.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ey={key:!0,ref:!0,__self:!0,__source:!0};function Im(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)jy.call(t,s)&&!Ey.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:Sy,type:e,key:i,ref:l,props:r,_owner:Cy.current}}go.Fragment=Ny;go.jsx=Im;go.jsxs=Im;bm.exports=go;var a=bm.exports,_m={exports:{}},yn={},Mm={exports:{}},Lm={};/**
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(Y,E){var O=Y.length;Y.push(E);e:for(;0<O;){var B=O-1>>>1,J=Y[B];if(0<r(J,E))Y[B]=E,Y[O]=J,O=B;else break e}}function n(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var E=Y[0],O=Y.pop();if(O!==E){Y[0]=O;e:for(var B=0,J=Y.length,ce=J>>>1;B<ce;){var me=2*(B+1)-1,ye=Y[me],Ne=me+1,ke=Y[Ne];if(0>r(ye,O))Ne<J&&0>r(ke,ye)?(Y[B]=ke,Y[Ne]=O,B=Ne):(Y[B]=ye,Y[me]=O,B=me);else if(Ne<J&&0>r(ke,O))Y[B]=ke,Y[Ne]=O,B=Ne;else break e}}return E}function r(Y,E){var O=Y.sortIndex-E.sortIndex;return O!==0?O:Y.id-E.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=[],u=[],f=1,g=null,h=3,S=!1,k=!1,x=!1,N=typeof setTimeout=="function"?setTimeout:null,w=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(Y){for(var E=n(u);E!==null;){if(E.callback===null)s(u);else if(E.startTime<=Y)s(u),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(u)}}function A(Y){if(x=!1,v(Y),!k)if(n(c)!==null)k=!0,fe(T);else{var E=n(u);E!==null&&te(A,E.startTime-Y)}}function T(Y,E){k=!1,x&&(x=!1,w(P),P=-1),S=!0;var O=h;try{for(v(E),g=n(c);g!==null&&(!(g.expirationTime>E)||Y&&!G());){var B=g.callback;if(typeof B=="function"){g.callback=null,h=g.priorityLevel;var J=B(g.expirationTime<=E);E=e.unstable_now(),typeof J=="function"?g.callback=J:g===n(c)&&s(c),v(E)}else s(c);g=n(c)}if(g!==null)var ce=!0;else{var me=n(u);me!==null&&te(A,me.startTime-E),ce=!1}return ce}finally{g=null,h=O,S=!1}}var M=!1,_=null,P=-1,I=5,y=-1;function G(){return!(e.unstable_now()-y<I)}function F(){if(_!==null){var Y=e.unstable_now();y=Y;var E=!0;try{E=_(!0,Y)}finally{E?K():(M=!1,_=null)}}else M=!1}var K;if(typeof m=="function")K=function(){m(F)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,ae=D.port2;D.port1.onmessage=F,K=function(){ae.postMessage(null)}}else K=function(){N(F,0)};function fe(Y){_=Y,M||(M=!0,K())}function te(Y,E){P=N(function(){Y(e.unstable_now())},E)}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(Y){Y.callback=null},e.unstable_continueExecution=function(){k||S||(k=!0,fe(T))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(Y){switch(h){case 1:case 2:case 3:var E=3;break;default:E=h}var O=h;h=E;try{return Y()}finally{h=O}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,E){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var O=h;h=Y;try{return E()}finally{h=O}},e.unstable_scheduleCallback=function(Y,E,O){var B=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?B+O:B):O=B,Y){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=O+J,Y={id:f++,callback:E,priorityLevel:Y,startTime:O,expirationTime:J,sortIndex:-1},O>B?(Y.sortIndex=O,t(u,Y),n(c)===null&&Y===n(u)&&(x?(w(P),P=-1):x=!0,te(A,O-B))):(Y.sortIndex=J,t(c,Y),k||S||(k=!0,fe(T))),Y},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(Y){var E=h;return function(){var O=h;h=E;try{return Y.apply(this,arguments)}finally{h=O}}}})(Lm);Mm.exports=Lm;var Ty=Mm.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 Ay=d,gn=Ty;function Z(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 Om=new Set,ci={};function wr(e,t){oa(e,t),oa(e+"Capture",t)}function oa(e,t){for(ci[e]=t,e=0;e<t.length;e++)Om.add(t[e])}var vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dc=Object.prototype.hasOwnProperty,Ry=/^[: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]*$/,Tp={},Ap={};function Py(e){return Dc.call(Ap,e)?!0:Dc.call(Tp,e)?!1:Ry.test(e)?Ap[e]=!0:(Tp[e]=!0,!1)}function Iy(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 _y(e,t,n,s){if(t===null||typeof t>"u"||Iy(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 Vt(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 Rt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Rt[e]=new Vt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Rt[t]=new Vt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Rt[e]=new Vt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Rt[e]=new Vt(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){Rt[e]=new Vt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Rt[e]=new Vt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Rt[e]=new Vt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Rt[e]=new Vt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Rt[e]=new Vt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Xu=/[\-:]([a-z])/g;function Zu(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(Xu,Zu);Rt[t]=new Vt(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(Xu,Zu);Rt[t]=new Vt(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(Xu,Zu);Rt[t]=new Vt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!1,!1)});Rt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Rt[e]=new Vt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ed(e,t,n,s){var r=Rt.hasOwnProperty(t)?Rt[t]:null;(r!==null?r.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(_y(t,n,r,s)&&(n=null),s||r===null?Py(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 bs=Ay.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ki=Symbol.for("react.element"),Br=Symbol.for("react.portal"),Ur=Symbol.for("react.fragment"),td=Symbol.for("react.strict_mode"),$c=Symbol.for("react.profiler"),Dm=Symbol.for("react.provider"),$m=Symbol.for("react.context"),nd=Symbol.for("react.forward_ref"),Fc=Symbol.for("react.suspense"),Bc=Symbol.for("react.suspense_list"),sd=Symbol.for("react.memo"),Ps=Symbol.for("react.lazy"),Fm=Symbol.for("react.offscreen"),Rp=Symbol.iterator;function _a(e){return e===null||typeof e!="object"?null:(e=Rp&&e[Rp]||e["@@iterator"],typeof e=="function"?e:null)}var st=Object.assign,qo;function Ha(e){if(qo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);qo=t&&t[1]||""}return`
35
- `+qo+e}var Xo=!1;function Zo(e,t){if(!e||Xo)return"";Xo=!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(u){var s=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){s=u}e.call(t.prototype)}else{try{throw Error()}catch(u){s=u}e()}}catch(u){if(u&&s&&typeof u.stack=="string"){for(var r=u.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{Xo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ha(e):""}function My(e){switch(e.tag){case 5:return Ha(e.type);case 16:return Ha("Lazy");case 13:return Ha("Suspense");case 19:return Ha("SuspenseList");case 0:case 2:case 15:return e=Zo(e.type,!1),e;case 11:return e=Zo(e.type.render,!1),e;case 1:return e=Zo(e.type,!0),e;default:return""}}function Uc(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 Ur:return"Fragment";case Br:return"Portal";case $c:return"Profiler";case td:return"StrictMode";case Fc:return"Suspense";case Bc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case $m:return(e.displayName||"Context")+".Consumer";case Dm:return(e._context.displayName||"Context")+".Provider";case nd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sd:return t=e.displayName||null,t!==null?t:Uc(e.type)||"Memo";case Ps:t=e._payload,e=e._init;try{return Uc(e(t))}catch{}}return null}function Ly(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 Uc(t);case 8:return t===td?"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 Ks(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Oy(e){var t=Bm(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 Qi(e){e._valueTracker||(e._valueTracker=Oy(e))}function Um(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Bm(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function _l(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 Hc(e,t){var n=t.checked;return st({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pp(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Ks(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 Hm(e,t){t=t.checked,t!=null&&ed(e,"checked",t,!1)}function zc(e,t){Hm(e,t);var n=Ks(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")?Wc(e,t.type,n):t.hasOwnProperty("defaultValue")&&Wc(e,t.type,Ks(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ip(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 Wc(e,t,n){(t!=="number"||_l(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var za=Array.isArray;function Zr(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=""+Ks(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 Vc(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Z(91));return st({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function _p(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Z(92));if(za(n)){if(1<n.length)throw Error(Z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ks(n)}}function zm(e,t){var n=Ks(t.value),s=Ks(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 Mp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Wm(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 Kc(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Wm(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Gi,Vm=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(Gi=Gi||document.createElement("div"),Gi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Gi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ui(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ka={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},Dy=["Webkit","ms","Moz","O"];Object.keys(Ka).forEach(function(e){Dy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ka[t]=Ka[e]})});function Km(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ka.hasOwnProperty(e)&&Ka[e]?(""+t).trim():t+"px"}function Qm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=Km(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,r):e[n]=r}}var $y=st({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 Qc(e,t){if(t){if($y[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function Gc(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 Yc=null;function rd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jc=null,ea=null,ta=null;function Lp(e){if(e=Pi(e)){if(typeof Jc!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=ko(t),Jc(e.stateNode,e.type,t))}}function Gm(e){ea?ta?ta.push(e):ta=[e]:ea=e}function Ym(){if(ea){var e=ea,t=ta;if(ta=ea=null,Lp(e),t)for(e=0;e<t.length;e++)Lp(t[e])}}function Jm(e,t){return e(t)}function qm(){}var ec=!1;function Xm(e,t,n){if(ec)return e(t,n);ec=!0;try{return Jm(e,t,n)}finally{ec=!1,(ea!==null||ta!==null)&&(qm(),Ym())}}function di(e,t){var n=e.stateNode;if(n===null)return null;var s=ko(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(Z(231,t,typeof n));return n}var qc=!1;if(vs)try{var Ma={};Object.defineProperty(Ma,"passive",{get:function(){qc=!0}}),window.addEventListener("test",Ma,Ma),window.removeEventListener("test",Ma,Ma)}catch{qc=!1}function Fy(e,t,n,s,r,i,l,o,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var Qa=!1,Ml=null,Ll=!1,Xc=null,By={onError:function(e){Qa=!0,Ml=e}};function Uy(e,t,n,s,r,i,l,o,c){Qa=!1,Ml=null,Fy.apply(By,arguments)}function Hy(e,t,n,s,r,i,l,o,c){if(Uy.apply(this,arguments),Qa){if(Qa){var u=Ml;Qa=!1,Ml=null}else throw Error(Z(198));Ll||(Ll=!0,Xc=u)}}function xr(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 Zm(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 Op(e){if(xr(e)!==e)throw Error(Z(188))}function zy(e){var t=e.alternate;if(!t){if(t=xr(e),t===null)throw Error(Z(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 Op(r),e;if(i===s)return Op(r),t;i=i.sibling}throw Error(Z(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(Z(189))}}if(n.alternate!==s)throw Error(Z(190))}if(n.tag!==3)throw Error(Z(188));return n.stateNode.current===n?e:t}function ef(e){return e=zy(e),e!==null?tf(e):null}function tf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=tf(e);if(t!==null)return t;e=e.sibling}return null}var nf=gn.unstable_scheduleCallback,Dp=gn.unstable_cancelCallback,Wy=gn.unstable_shouldYield,Vy=gn.unstable_requestPaint,ot=gn.unstable_now,Ky=gn.unstable_getCurrentPriorityLevel,ad=gn.unstable_ImmediatePriority,sf=gn.unstable_UserBlockingPriority,Ol=gn.unstable_NormalPriority,Qy=gn.unstable_LowPriority,rf=gn.unstable_IdlePriority,vo=null,ss=null;function Gy(e){if(ss&&typeof ss.onCommitFiberRoot=="function")try{ss.onCommitFiberRoot(vo,e,void 0,(e.current.flags&128)===128)}catch{}}var Vn=Math.clz32?Math.clz32:qy,Yy=Math.log,Jy=Math.LN2;function qy(e){return e>>>=0,e===0?32:31-(Yy(e)/Jy|0)|0}var Yi=64,Ji=4194304;function Wa(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 Dl(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=Wa(o):(i&=l,i!==0&&(s=Wa(i)))}else l=n&~r,l!==0?s=Wa(l):i!==0&&(s=Wa(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-Vn(t),r=1<<n,s|=e[n],t&=~r;return s}function Xy(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 Zy(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes;0<i;){var l=31-Vn(i),o=1<<l,c=r[l];c===-1?(!(o&n)||o&s)&&(r[l]=Xy(o,t)):c<=t&&(e.expiredLanes|=o),i&=~o}}function Zc(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function af(){var e=Yi;return Yi<<=1,!(Yi&4194240)&&(Yi=64),e}function tc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ai(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vn(t),e[t]=n}function ew(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-Vn(n),i=1<<r;t[r]=0,s[r]=-1,e[r]=-1,n&=~i}}function id(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Vn(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}var He=0;function lf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var of,ld,cf,uf,df,eu=!1,qi=[],$s=null,Fs=null,Bs=null,pi=new Map,hi=new Map,Ms=[],tw="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 $p(e,t){switch(e){case"focusin":case"focusout":$s=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Bs=null;break;case"pointerover":case"pointerout":pi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":hi.delete(t.pointerId)}}function La(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=Pi(t),t!==null&&ld(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function nw(e,t,n,s,r){switch(t){case"focusin":return $s=La($s,e,t,n,s,r),!0;case"dragenter":return Fs=La(Fs,e,t,n,s,r),!0;case"mouseover":return Bs=La(Bs,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return pi.set(i,La(pi.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,hi.set(i,La(hi.get(i)||null,e,t,n,s,r)),!0}return!1}function pf(e){var t=lr(e.target);if(t!==null){var n=xr(t);if(n!==null){if(t=n.tag,t===13){if(t=Zm(n),t!==null){e.blockedOn=t,df(e.priority,function(){cf(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 gl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=tu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Yc=s,n.target.dispatchEvent(s),Yc=null}else return t=Pi(n),t!==null&&ld(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){gl(e)&&n.delete(t)}function sw(){eu=!1,$s!==null&&gl($s)&&($s=null),Fs!==null&&gl(Fs)&&(Fs=null),Bs!==null&&gl(Bs)&&(Bs=null),pi.forEach(Fp),hi.forEach(Fp)}function Oa(e,t){e.blockedOn===t&&(e.blockedOn=null,eu||(eu=!0,gn.unstable_scheduleCallback(gn.unstable_NormalPriority,sw)))}function mi(e){function t(r){return Oa(r,e)}if(0<qi.length){Oa(qi[0],e);for(var n=1;n<qi.length;n++){var s=qi[n];s.blockedOn===e&&(s.blockedOn=null)}}for($s!==null&&Oa($s,e),Fs!==null&&Oa(Fs,e),Bs!==null&&Oa(Bs,e),pi.forEach(t),hi.forEach(t),n=0;n<Ms.length;n++)s=Ms[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Ms.length&&(n=Ms[0],n.blockedOn===null);)pf(n),n.blockedOn===null&&Ms.shift()}var na=bs.ReactCurrentBatchConfig,$l=!0;function rw(e,t,n,s){var r=He,i=na.transition;na.transition=null;try{He=1,od(e,t,n,s)}finally{He=r,na.transition=i}}function aw(e,t,n,s){var r=He,i=na.transition;na.transition=null;try{He=4,od(e,t,n,s)}finally{He=r,na.transition=i}}function od(e,t,n,s){if($l){var r=tu(e,t,n,s);if(r===null)dc(e,t,s,Fl,n),$p(e,s);else if(nw(r,e,t,n,s))s.stopPropagation();else if($p(e,s),t&4&&-1<tw.indexOf(e)){for(;r!==null;){var i=Pi(r);if(i!==null&&of(i),i=tu(e,t,n,s),i===null&&dc(e,t,s,Fl,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else dc(e,t,s,null,n)}}var Fl=null;function tu(e,t,n,s){if(Fl=null,e=rd(s),e=lr(e),e!==null)if(t=xr(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Zm(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 Fl=e,null}function hf(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(Ky()){case ad:return 1;case sf:return 4;case Ol:case Qy:return 16;case rf:return 536870912;default:return 16}default:return 16}}var Os=null,cd=null,vl=null;function mf(){if(vl)return vl;var e,t=cd,n=t.length,s,r="value"in Os?Os.value:Os.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 vl=r.slice(e,1<s?1-s:void 0)}function yl(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 Xi(){return!0}function Bp(){return!1}function wn(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)?Xi:Bp,this.isPropagationStopped=Bp,this}return st(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=Xi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Xi)},persist:function(){},isPersistent:Xi}),t}var ya={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ud=wn(ya),Ri=st({},ya,{view:0,detail:0}),iw=wn(Ri),nc,sc,Da,yo=st({},Ri,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dd,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!==Da&&(Da&&e.type==="mousemove"?(nc=e.screenX-Da.screenX,sc=e.screenY-Da.screenY):sc=nc=0,Da=e),nc)},movementY:function(e){return"movementY"in e?e.movementY:sc}}),Up=wn(yo),lw=st({},yo,{dataTransfer:0}),ow=wn(lw),cw=st({},Ri,{relatedTarget:0}),rc=wn(cw),uw=st({},ya,{animationName:0,elapsedTime:0,pseudoElement:0}),dw=wn(uw),pw=st({},ya,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hw=wn(pw),mw=st({},ya,{data:0}),Hp=wn(mw),fw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gw={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 yw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vw[e])?!!t[e]:!1}function dd(){return yw}var ww=st({},Ri,{key:function(e){if(e.key){var t=fw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=yl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dd,charCode:function(e){return e.type==="keypress"?yl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?yl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xw=wn(ww),kw=st({},yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zp=wn(kw),bw=st({},Ri,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dd}),Sw=wn(bw),Nw=st({},ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),jw=wn(Nw),Cw=st({},yo,{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}),Ew=wn(Cw),Tw=[9,13,27,32],pd=vs&&"CompositionEvent"in window,Ga=null;vs&&"documentMode"in document&&(Ga=document.documentMode);var Aw=vs&&"TextEvent"in window&&!Ga,ff=vs&&(!pd||Ga&&8<Ga&&11>=Ga),Wp=" ",Vp=!1;function gf(e,t){switch(e){case"keyup":return Tw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hr=!1;function Rw(e,t){switch(e){case"compositionend":return vf(t);case"keypress":return t.which!==32?null:(Vp=!0,Wp);case"textInput":return e=t.data,e===Wp&&Vp?null:e;default:return null}}function Pw(e,t){if(Hr)return e==="compositionend"||!pd&&gf(e,t)?(e=mf(),vl=cd=Os=null,Hr=!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 ff&&t.locale!=="ko"?null:t.data;default:return null}}var Iw={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 Kp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Iw[e.type]:t==="textarea"}function yf(e,t,n,s){Gm(s),t=Bl(t,"onChange"),0<t.length&&(n=new ud("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ya=null,fi=null;function _w(e){Af(e,0)}function wo(e){var t=Vr(e);if(Um(t))return e}function Mw(e,t){if(e==="change")return t}var wf=!1;if(vs){var ac;if(vs){var ic="oninput"in document;if(!ic){var Qp=document.createElement("div");Qp.setAttribute("oninput","return;"),ic=typeof Qp.oninput=="function"}ac=ic}else ac=!1;wf=ac&&(!document.documentMode||9<document.documentMode)}function Gp(){Ya&&(Ya.detachEvent("onpropertychange",xf),fi=Ya=null)}function xf(e){if(e.propertyName==="value"&&wo(fi)){var t=[];yf(t,fi,e,rd(e)),Xm(_w,t)}}function Lw(e,t,n){e==="focusin"?(Gp(),Ya=t,fi=n,Ya.attachEvent("onpropertychange",xf)):e==="focusout"&&Gp()}function Ow(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wo(fi)}function Dw(e,t){if(e==="click")return wo(t)}function $w(e,t){if(e==="input"||e==="change")return wo(t)}function Fw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gn=typeof Object.is=="function"?Object.is:Fw;function gi(e,t){if(Gn(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(!Dc.call(t,r)||!Gn(e[r],t[r]))return!1}return!0}function Yp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jp(e,t){var n=Yp(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=Yp(n)}}function kf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bf(){for(var e=window,t=_l();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=_l(e.document)}return t}function hd(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 Bw(e){var t=bf(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&kf(n.ownerDocument.documentElement,n)){if(s!==null&&hd(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=Jp(n,i);var l=Jp(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 Uw=vs&&"documentMode"in document&&11>=document.documentMode,zr=null,nu=null,Ja=null,su=!1;function qp(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;su||zr==null||zr!==_l(s)||(s=zr,"selectionStart"in s&&hd(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}),Ja&&gi(Ja,s)||(Ja=s,s=Bl(nu,"onSelect"),0<s.length&&(t=new ud("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=zr)))}function Zi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Wr={animationend:Zi("Animation","AnimationEnd"),animationiteration:Zi("Animation","AnimationIteration"),animationstart:Zi("Animation","AnimationStart"),transitionend:Zi("Transition","TransitionEnd")},lc={},Sf={};vs&&(Sf=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function xo(e){if(lc[e])return lc[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Sf)return lc[e]=t[n];return e}var Nf=xo("animationend"),jf=xo("animationiteration"),Cf=xo("animationstart"),Ef=xo("transitionend"),Tf=new Map,Xp="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 Gs(e,t){Tf.set(e,t),wr(t,[e])}for(var oc=0;oc<Xp.length;oc++){var cc=Xp[oc],Hw=cc.toLowerCase(),zw=cc[0].toUpperCase()+cc.slice(1);Gs(Hw,"on"+zw)}Gs(Nf,"onAnimationEnd");Gs(jf,"onAnimationIteration");Gs(Cf,"onAnimationStart");Gs("dblclick","onDoubleClick");Gs("focusin","onFocus");Gs("focusout","onBlur");Gs(Ef,"onTransitionEnd");oa("onMouseEnter",["mouseout","mouseover"]);oa("onMouseLeave",["mouseout","mouseover"]);oa("onPointerEnter",["pointerout","pointerover"]);oa("onPointerLeave",["pointerout","pointerover"]);wr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));wr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));wr("onBeforeInput",["compositionend","keypress","textInput","paste"]);wr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));wr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));wr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Va="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(" "),Ww=new Set("cancel close invalid load scroll toggle".split(" ").concat(Va));function Zp(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,Hy(s,t,void 0,e),e.currentTarget=null}function Af(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,u=o.currentTarget;if(o=o.listener,c!==i&&r.isPropagationStopped())break e;Zp(r,o,u),i=c}else for(l=0;l<s.length;l++){if(o=s[l],c=o.instance,u=o.currentTarget,o=o.listener,c!==i&&r.isPropagationStopped())break e;Zp(r,o,u),i=c}}}if(Ll)throw e=Xc,Ll=!1,Xc=null,e}function Ke(e,t){var n=t[ou];n===void 0&&(n=t[ou]=new Set);var s=e+"__bubble";n.has(s)||(Rf(t,e,2,!1),n.add(s))}function uc(e,t,n){var s=0;t&&(s|=4),Rf(n,e,s,t)}var el="_reactListening"+Math.random().toString(36).slice(2);function vi(e){if(!e[el]){e[el]=!0,Om.forEach(function(n){n!=="selectionchange"&&(Ww.has(n)||uc(n,!1,e),uc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[el]||(t[el]=!0,uc("selectionchange",!1,t))}}function Rf(e,t,n,s){switch(hf(t)){case 1:var r=rw;break;case 4:r=aw;break;default:r=od}n=r.bind(null,t,n,e),r=void 0,!qc||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 dc(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=lr(o),l===null)return;if(c=l.tag,c===5||c===6){s=i=l;continue e}o=o.parentNode}}s=s.return}Xm(function(){var u=i,f=rd(n),g=[];e:{var h=Tf.get(e);if(h!==void 0){var S=ud,k=e;switch(e){case"keypress":if(yl(n)===0)break e;case"keydown":case"keyup":S=xw;break;case"focusin":k="focus",S=rc;break;case"focusout":k="blur",S=rc;break;case"beforeblur":case"afterblur":S=rc;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":S=Up;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":S=ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":S=Sw;break;case Nf:case jf:case Cf:S=dw;break;case Ef:S=jw;break;case"scroll":S=iw;break;case"wheel":S=Ew;break;case"copy":case"cut":case"paste":S=hw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":S=zp}var x=(t&4)!==0,N=!x&&e==="scroll",w=x?h!==null?h+"Capture":null:h;x=[];for(var m=u,v;m!==null;){v=m;var A=v.stateNode;if(v.tag===5&&A!==null&&(v=A,w!==null&&(A=di(m,w),A!=null&&x.push(yi(m,A,v)))),N)break;m=m.return}0<x.length&&(h=new S(h,k,null,n,f),g.push({event:h,listeners:x}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",S=e==="mouseout"||e==="pointerout",h&&n!==Yc&&(k=n.relatedTarget||n.fromElement)&&(lr(k)||k[ys]))break e;if((S||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,S?(k=n.relatedTarget||n.toElement,S=u,k=k?lr(k):null,k!==null&&(N=xr(k),k!==N||k.tag!==5&&k.tag!==6)&&(k=null)):(S=null,k=u),S!==k)){if(x=Up,A="onMouseLeave",w="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(x=zp,A="onPointerLeave",w="onPointerEnter",m="pointer"),N=S==null?h:Vr(S),v=k==null?h:Vr(k),h=new x(A,m+"leave",S,n,f),h.target=N,h.relatedTarget=v,A=null,lr(f)===u&&(x=new x(w,m+"enter",k,n,f),x.target=v,x.relatedTarget=N,A=x),N=A,S&&k)t:{for(x=S,w=k,m=0,v=x;v;v=_r(v))m++;for(v=0,A=w;A;A=_r(A))v++;for(;0<m-v;)x=_r(x),m--;for(;0<v-m;)w=_r(w),v--;for(;m--;){if(x===w||w!==null&&x===w.alternate)break t;x=_r(x),w=_r(w)}x=null}else x=null;S!==null&&eh(g,h,S,x,!1),k!==null&&N!==null&&eh(g,N,k,x,!0)}}e:{if(h=u?Vr(u):window,S=h.nodeName&&h.nodeName.toLowerCase(),S==="select"||S==="input"&&h.type==="file")var T=Mw;else if(Kp(h))if(wf)T=$w;else{T=Ow;var M=Lw}else(S=h.nodeName)&&S.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(T=Dw);if(T&&(T=T(e,u))){yf(g,T,n,f);break e}M&&M(e,h,u),e==="focusout"&&(M=h._wrapperState)&&M.controlled&&h.type==="number"&&Wc(h,"number",h.value)}switch(M=u?Vr(u):window,e){case"focusin":(Kp(M)||M.contentEditable==="true")&&(zr=M,nu=u,Ja=null);break;case"focusout":Ja=nu=zr=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,qp(g,n,f);break;case"selectionchange":if(Uw)break;case"keydown":case"keyup":qp(g,n,f)}var _;if(pd)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Hr?gf(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(ff&&n.locale!=="ko"&&(Hr||P!=="onCompositionStart"?P==="onCompositionEnd"&&Hr&&(_=mf()):(Os=f,cd="value"in Os?Os.value:Os.textContent,Hr=!0)),M=Bl(u,P),0<M.length&&(P=new Hp(P,e,null,n,f),g.push({event:P,listeners:M}),_?P.data=_:(_=vf(n),_!==null&&(P.data=_)))),(_=Aw?Rw(e,n):Pw(e,n))&&(u=Bl(u,"onBeforeInput"),0<u.length&&(f=new Hp("onBeforeInput","beforeinput",null,n,f),g.push({event:f,listeners:u}),f.data=_))}Af(g,t)})}function yi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Bl(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=di(e,n),i!=null&&s.unshift(yi(e,i,r)),i=di(e,t),i!=null&&s.push(yi(e,i,r))),e=e.return}return s}function _r(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function eh(e,t,n,s,r){for(var i=t._reactName,l=[];n!==null&&n!==s;){var o=n,c=o.alternate,u=o.stateNode;if(c!==null&&c===s)break;o.tag===5&&u!==null&&(o=u,r?(c=di(n,i),c!=null&&l.unshift(yi(n,c,o))):r||(c=di(n,i),c!=null&&l.push(yi(n,c,o)))),n=n.return}l.length!==0&&e.push({event:t,listeners:l})}var Vw=/\r\n?/g,Kw=/\u0000|\uFFFD/g;function th(e){return(typeof e=="string"?e:""+e).replace(Vw,`
39
- `).replace(Kw,"")}function tl(e,t,n){if(t=th(t),th(e)!==t&&n)throw Error(Z(425))}function Ul(){}var ru=null,au=null;function iu(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 lu=typeof setTimeout=="function"?setTimeout:void 0,Qw=typeof clearTimeout=="function"?clearTimeout:void 0,nh=typeof Promise=="function"?Promise:void 0,Gw=typeof queueMicrotask=="function"?queueMicrotask:typeof nh<"u"?function(e){return nh.resolve(null).then(e).catch(Yw)}:lu;function Yw(e){setTimeout(function(){throw e})}function pc(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),mi(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);mi(t)}function Us(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 sh(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 wa=Math.random().toString(36).slice(2),ns="__reactFiber$"+wa,wi="__reactProps$"+wa,ys="__reactContainer$"+wa,ou="__reactEvents$"+wa,Jw="__reactListeners$"+wa,qw="__reactHandles$"+wa;function lr(e){var t=e[ns];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ys]||n[ns]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=sh(e);e!==null;){if(n=e[ns])return n;e=sh(e)}return t}e=n,n=e.parentNode}return null}function Pi(e){return e=e[ns]||e[ys],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Vr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Z(33))}function ko(e){return e[wi]||null}var cu=[],Kr=-1;function Ys(e){return{current:e}}function Qe(e){0>Kr||(e.current=cu[Kr],cu[Kr]=null,Kr--)}function ze(e,t){Kr++,cu[Kr]=e.current,e.current=t}var Qs={},Ot=Ys(Qs),ln=Ys(!1),hr=Qs;function ca(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 on(e){return e=e.childContextTypes,e!=null}function Hl(){Qe(ln),Qe(Ot)}function rh(e,t,n){if(Ot.current!==Qs)throw Error(Z(168));ze(Ot,t),ze(ln,n)}function Pf(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(Z(108,Ly(e)||"Unknown",r));return st({},n,s)}function zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qs,hr=Ot.current,ze(Ot,e),ze(ln,ln.current),!0}function ah(e,t,n){var s=e.stateNode;if(!s)throw Error(Z(169));n?(e=Pf(e,t,hr),s.__reactInternalMemoizedMergedChildContext=e,Qe(ln),Qe(Ot),ze(Ot,e)):Qe(ln),ze(ln,n)}var ps=null,bo=!1,hc=!1;function If(e){ps===null?ps=[e]:ps.push(e)}function Xw(e){bo=!0,If(e)}function Js(){if(!hc&&ps!==null){hc=!0;var e=0,t=He;try{var n=ps;for(He=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}ps=null,bo=!1}catch(r){throw ps!==null&&(ps=ps.slice(e+1)),nf(ad,Js),r}finally{He=t,hc=!1}}return null}var Qr=[],Gr=0,Wl=null,Vl=0,Cn=[],En=0,mr=null,hs=1,ms="";function tr(e,t){Qr[Gr++]=Vl,Qr[Gr++]=Wl,Wl=e,Vl=t}function _f(e,t,n){Cn[En++]=hs,Cn[En++]=ms,Cn[En++]=mr,mr=e;var s=hs;e=ms;var r=32-Vn(s)-1;s&=~(1<<r),n+=1;var i=32-Vn(t)+r;if(30<i){var l=r-r%5;i=(s&(1<<l)-1).toString(32),s>>=l,r-=l,hs=1<<32-Vn(t)+r|n<<r|s,ms=i+e}else hs=1<<i|n<<r|s,ms=e}function md(e){e.return!==null&&(tr(e,1),_f(e,1,0))}function fd(e){for(;e===Wl;)Wl=Qr[--Gr],Qr[Gr]=null,Vl=Qr[--Gr],Qr[Gr]=null;for(;e===mr;)mr=Cn[--En],Cn[En]=null,ms=Cn[--En],Cn[En]=null,hs=Cn[--En],Cn[En]=null}var fn=null,mn=null,qe=!1,Wn=null;function Mf(e,t){var n=Tn(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 ih(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,fn=e,mn=Us(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,fn=e,mn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=mr!==null?{id:hs,overflow:ms}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,fn=e,mn=null,!0):!1;default:return!1}}function uu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function du(e){if(qe){var t=mn;if(t){var n=t;if(!ih(e,t)){if(uu(e))throw Error(Z(418));t=Us(n.nextSibling);var s=fn;t&&ih(e,t)?Mf(s,n):(e.flags=e.flags&-4097|2,qe=!1,fn=e)}}else{if(uu(e))throw Error(Z(418));e.flags=e.flags&-4097|2,qe=!1,fn=e}}}function lh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;fn=e}function nl(e){if(e!==fn)return!1;if(!qe)return lh(e),qe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!iu(e.type,e.memoizedProps)),t&&(t=mn)){if(uu(e))throw Lf(),Error(Z(418));for(;t;)Mf(e,t),t=Us(t.nextSibling)}if(lh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){mn=Us(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}mn=null}}else mn=fn?Us(e.stateNode.nextSibling):null;return!0}function Lf(){for(var e=mn;e;)e=Us(e.nextSibling)}function ua(){mn=fn=null,qe=!1}function gd(e){Wn===null?Wn=[e]:Wn.push(e)}var Zw=bs.ReactCurrentBatchConfig;function $a(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(Z(309));var s=n.stateNode}if(!s)throw Error(Z(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(Z(284));if(!n._owner)throw Error(Z(290,e))}return e}function sl(e,t){throw e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function oh(e){var t=e._init;return t(e._payload)}function Of(e){function t(w,m){if(e){var v=w.deletions;v===null?(w.deletions=[m],w.flags|=16):v.push(m)}}function n(w,m){if(!e)return null;for(;m!==null;)t(w,m),m=m.sibling;return null}function s(w,m){for(w=new Map;m!==null;)m.key!==null?w.set(m.key,m):w.set(m.index,m),m=m.sibling;return w}function r(w,m){return w=Vs(w,m),w.index=0,w.sibling=null,w}function i(w,m,v){return w.index=v,e?(v=w.alternate,v!==null?(v=v.index,v<m?(w.flags|=2,m):v):(w.flags|=2,m)):(w.flags|=1048576,m)}function l(w){return e&&w.alternate===null&&(w.flags|=2),w}function o(w,m,v,A){return m===null||m.tag!==6?(m=xc(v,w.mode,A),m.return=w,m):(m=r(m,v),m.return=w,m)}function c(w,m,v,A){var T=v.type;return T===Ur?f(w,m,v.props.children,A,v.key):m!==null&&(m.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ps&&oh(T)===m.type)?(A=r(m,v.props),A.ref=$a(w,m,v),A.return=w,A):(A=jl(v.type,v.key,v.props,null,w.mode,A),A.ref=$a(w,m,v),A.return=w,A)}function u(w,m,v,A){return m===null||m.tag!==4||m.stateNode.containerInfo!==v.containerInfo||m.stateNode.implementation!==v.implementation?(m=kc(v,w.mode,A),m.return=w,m):(m=r(m,v.children||[]),m.return=w,m)}function f(w,m,v,A,T){return m===null||m.tag!==7?(m=pr(v,w.mode,A,T),m.return=w,m):(m=r(m,v),m.return=w,m)}function g(w,m,v){if(typeof m=="string"&&m!==""||typeof m=="number")return m=xc(""+m,w.mode,v),m.return=w,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Ki:return v=jl(m.type,m.key,m.props,null,w.mode,v),v.ref=$a(w,null,m),v.return=w,v;case Br:return m=kc(m,w.mode,v),m.return=w,m;case Ps:var A=m._init;return g(w,A(m._payload),v)}if(za(m)||_a(m))return m=pr(m,w.mode,v,null),m.return=w,m;sl(w,m)}return null}function h(w,m,v,A){var T=m!==null?m.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return T!==null?null:o(w,m,""+v,A);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ki:return v.key===T?c(w,m,v,A):null;case Br:return v.key===T?u(w,m,v,A):null;case Ps:return T=v._init,h(w,m,T(v._payload),A)}if(za(v)||_a(v))return T!==null?null:f(w,m,v,A,null);sl(w,v)}return null}function S(w,m,v,A,T){if(typeof A=="string"&&A!==""||typeof A=="number")return w=w.get(v)||null,o(m,w,""+A,T);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case Ki:return w=w.get(A.key===null?v:A.key)||null,c(m,w,A,T);case Br:return w=w.get(A.key===null?v:A.key)||null,u(m,w,A,T);case Ps:var M=A._init;return S(w,m,v,M(A._payload),T)}if(za(A)||_a(A))return w=w.get(v)||null,f(m,w,A,T,null);sl(m,A)}return null}function k(w,m,v,A){for(var T=null,M=null,_=m,P=m=0,I=null;_!==null&&P<v.length;P++){_.index>P?(I=_,_=null):I=_.sibling;var y=h(w,_,v[P],A);if(y===null){_===null&&(_=I);break}e&&_&&y.alternate===null&&t(w,_),m=i(y,m,P),M===null?T=y:M.sibling=y,M=y,_=I}if(P===v.length)return n(w,_),qe&&tr(w,P),T;if(_===null){for(;P<v.length;P++)_=g(w,v[P],A),_!==null&&(m=i(_,m,P),M===null?T=_:M.sibling=_,M=_);return qe&&tr(w,P),T}for(_=s(w,_);P<v.length;P++)I=S(_,w,P,v[P],A),I!==null&&(e&&I.alternate!==null&&_.delete(I.key===null?P:I.key),m=i(I,m,P),M===null?T=I:M.sibling=I,M=I);return e&&_.forEach(function(G){return t(w,G)}),qe&&tr(w,P),T}function x(w,m,v,A){var T=_a(v);if(typeof T!="function")throw Error(Z(150));if(v=T.call(v),v==null)throw Error(Z(151));for(var M=T=null,_=m,P=m=0,I=null,y=v.next();_!==null&&!y.done;P++,y=v.next()){_.index>P?(I=_,_=null):I=_.sibling;var G=h(w,_,y.value,A);if(G===null){_===null&&(_=I);break}e&&_&&G.alternate===null&&t(w,_),m=i(G,m,P),M===null?T=G:M.sibling=G,M=G,_=I}if(y.done)return n(w,_),qe&&tr(w,P),T;if(_===null){for(;!y.done;P++,y=v.next())y=g(w,y.value,A),y!==null&&(m=i(y,m,P),M===null?T=y:M.sibling=y,M=y);return qe&&tr(w,P),T}for(_=s(w,_);!y.done;P++,y=v.next())y=S(_,w,P,y.value,A),y!==null&&(e&&y.alternate!==null&&_.delete(y.key===null?P:y.key),m=i(y,m,P),M===null?T=y:M.sibling=y,M=y);return e&&_.forEach(function(F){return t(w,F)}),qe&&tr(w,P),T}function N(w,m,v,A){if(typeof v=="object"&&v!==null&&v.type===Ur&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Ki:e:{for(var T=v.key,M=m;M!==null;){if(M.key===T){if(T=v.type,T===Ur){if(M.tag===7){n(w,M.sibling),m=r(M,v.props.children),m.return=w,w=m;break e}}else if(M.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ps&&oh(T)===M.type){n(w,M.sibling),m=r(M,v.props),m.ref=$a(w,M,v),m.return=w,w=m;break e}n(w,M);break}else t(w,M);M=M.sibling}v.type===Ur?(m=pr(v.props.children,w.mode,A,v.key),m.return=w,w=m):(A=jl(v.type,v.key,v.props,null,w.mode,A),A.ref=$a(w,m,v),A.return=w,w=A)}return l(w);case Br:e:{for(M=v.key;m!==null;){if(m.key===M)if(m.tag===4&&m.stateNode.containerInfo===v.containerInfo&&m.stateNode.implementation===v.implementation){n(w,m.sibling),m=r(m,v.children||[]),m.return=w,w=m;break e}else{n(w,m);break}else t(w,m);m=m.sibling}m=kc(v,w.mode,A),m.return=w,w=m}return l(w);case Ps:return M=v._init,N(w,m,M(v._payload),A)}if(za(v))return k(w,m,v,A);if(_a(v))return x(w,m,v,A);sl(w,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,m!==null&&m.tag===6?(n(w,m.sibling),m=r(m,v),m.return=w,w=m):(n(w,m),m=xc(v,w.mode,A),m.return=w,w=m),l(w)):n(w,m)}return N}var da=Of(!0),Df=Of(!1),Kl=Ys(null),Ql=null,Yr=null,vd=null;function yd(){vd=Yr=Ql=null}function wd(e){var t=Kl.current;Qe(Kl),e._currentValue=t}function pu(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 sa(e,t){Ql=e,vd=Yr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(an=!0),e.firstContext=null)}function In(e){var t=e._currentValue;if(vd!==e)if(e={context:e,memoizedValue:t,next:null},Yr===null){if(Ql===null)throw Error(Z(308));Yr=e,Ql.dependencies={lanes:0,firstContext:e}}else Yr=Yr.next=e;return t}var or=null;function xd(e){or===null?or=[e]:or.push(e)}function $f(e,t,n,s){var r=t.interleaved;return r===null?(n.next=n,xd(t)):(n.next=r.next,r.next=n),t.interleaved=n,ws(e,s)}function ws(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 Is=!1;function kd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ff(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 gs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Hs(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,Fe&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,ws(e,n)}return r=s.interleaved,r===null?(t.next=t,xd(s)):(t.next=r.next,r.next=t),s.interleaved=t,ws(e,n)}function wl(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,id(e,n)}}function ch(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 Gl(e,t,n,s){var r=e.updateQueue;Is=!1;var i=r.firstBaseUpdate,l=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,u=c.next;c.next=null,l===null?i=u:l.next=u,l=c;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==l&&(o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=c))}if(i!==null){var g=r.baseState;l=0,f=u=c=null,o=i;do{var h=o.lane,S=o.eventTime;if((s&h)===h){f!==null&&(f=f.next={eventTime:S,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var k=e,x=o;switch(h=t,S=n,x.tag){case 1:if(k=x.payload,typeof k=="function"){g=k.call(S,g,h);break e}g=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=x.payload,h=typeof k=="function"?k.call(S,g,h):k,h==null)break e;g=st({},g,h);break e;case 2:Is=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=r.effects,h===null?r.effects=[o]:h.push(o))}else S={eventTime:S,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(u=f=S,c=g):f=f.next=S,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(f===null&&(c=g),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=f,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);gr|=l,e.lanes=l,e.memoizedState=g}}function uh(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(Z(191,r));r.call(s)}}}var Ii={},rs=Ys(Ii),xi=Ys(Ii),ki=Ys(Ii);function cr(e){if(e===Ii)throw Error(Z(174));return e}function bd(e,t){switch(ze(ki,t),ze(xi,e),ze(rs,Ii),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Kc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Kc(t,e)}Qe(rs),ze(rs,t)}function pa(){Qe(rs),Qe(xi),Qe(ki)}function Bf(e){cr(ki.current);var t=cr(rs.current),n=Kc(t,e.type);t!==n&&(ze(xi,e),ze(rs,n))}function Sd(e){xi.current===e&&(Qe(rs),Qe(xi))}var tt=Ys(0);function Yl(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 mc=[];function Nd(){for(var e=0;e<mc.length;e++)mc[e]._workInProgressVersionPrimary=null;mc.length=0}var xl=bs.ReactCurrentDispatcher,fc=bs.ReactCurrentBatchConfig,fr=0,nt=null,gt=null,bt=null,Jl=!1,qa=!1,bi=0,ex=0;function _t(){throw Error(Z(321))}function jd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gn(e[n],t[n]))return!1;return!0}function Cd(e,t,n,s,r,i){if(fr=i,nt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xl.current=e===null||e.memoizedState===null?rx:ax,e=n(s,r),qa){i=0;do{if(qa=!1,bi=0,25<=i)throw Error(Z(301));i+=1,bt=gt=null,t.updateQueue=null,xl.current=ix,e=n(s,r)}while(qa)}if(xl.current=ql,t=gt!==null&&gt.next!==null,fr=0,bt=gt=nt=null,Jl=!1,t)throw Error(Z(300));return e}function Ed(){var e=bi!==0;return bi=0,e}function Zn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?nt.memoizedState=bt=e:bt=bt.next=e,bt}function _n(){if(gt===null){var e=nt.alternate;e=e!==null?e.memoizedState:null}else e=gt.next;var t=bt===null?nt.memoizedState:bt.next;if(t!==null)bt=t,gt=e;else{if(e===null)throw Error(Z(310));gt=e,e={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},bt===null?nt.memoizedState=bt=e:bt=bt.next=e}return bt}function Si(e,t){return typeof t=="function"?t(e):t}function gc(e){var t=_n(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var s=gt,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,u=i;do{var f=u.lane;if((fr&f)===f)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:e(s,u.action);else{var g={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(o=c=g,l=s):c=c.next=g,nt.lanes|=f,gr|=f}u=u.next}while(u!==null&&u!==i);c===null?l=s:c.next=o,Gn(s,t.memoizedState)||(an=!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,nt.lanes|=i,gr|=i,r=r.next;while(r!==e)}else r===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function vc(e){var t=_n(),n=t.queue;if(n===null)throw Error(Z(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);Gn(i,t.memoizedState)||(an=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function Uf(){}function Hf(e,t){var n=nt,s=_n(),r=t(),i=!Gn(s.memoizedState,r);if(i&&(s.memoizedState=r,an=!0),s=s.queue,Td(Vf.bind(null,n,s,e),[e]),s.getSnapshot!==t||i||bt!==null&&bt.memoizedState.tag&1){if(n.flags|=2048,Ni(9,Wf.bind(null,n,s,r,t),void 0,null),St===null)throw Error(Z(349));fr&30||zf(n,t,r)}return r}function zf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=nt.updateQueue,t===null?(t={lastEffect:null,stores:null},nt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wf(e,t,n,s){t.value=n,t.getSnapshot=s,Kf(t)&&Qf(e)}function Vf(e,t,n){return n(function(){Kf(t)&&Qf(e)})}function Kf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gn(e,n)}catch{return!0}}function Qf(e){var t=ws(e,1);t!==null&&Kn(t,e,1,-1)}function dh(e){var t=Zn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Si,lastRenderedState:e},t.queue=e,e=e.dispatch=sx.bind(null,nt,e),[t.memoizedState,e]}function Ni(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=nt.updateQueue,t===null?(t={lastEffect:null,stores:null},nt.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 Gf(){return _n().memoizedState}function kl(e,t,n,s){var r=Zn();nt.flags|=e,r.memoizedState=Ni(1|t,n,void 0,s===void 0?null:s)}function So(e,t,n,s){var r=_n();s=s===void 0?null:s;var i=void 0;if(gt!==null){var l=gt.memoizedState;if(i=l.destroy,s!==null&&jd(s,l.deps)){r.memoizedState=Ni(t,n,i,s);return}}nt.flags|=e,r.memoizedState=Ni(1|t,n,i,s)}function ph(e,t){return kl(8390656,8,e,t)}function Td(e,t){return So(2048,8,e,t)}function Yf(e,t){return So(4,2,e,t)}function Jf(e,t){return So(4,4,e,t)}function qf(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 Xf(e,t,n){return n=n!=null?n.concat([e]):null,So(4,4,qf.bind(null,t,e),n)}function Ad(){}function Zf(e,t){var n=_n();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&jd(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function eg(e,t){var n=_n();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&jd(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function tg(e,t,n){return fr&21?(Gn(n,t)||(n=af(),nt.lanes|=n,gr|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,an=!0),e.memoizedState=n)}function tx(e,t){var n=He;He=n!==0&&4>n?n:4,e(!0);var s=fc.transition;fc.transition={};try{e(!1),t()}finally{He=n,fc.transition=s}}function ng(){return _n().memoizedState}function nx(e,t,n){var s=Ws(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},sg(e))rg(t,n);else if(n=$f(e,t,n,s),n!==null){var r=zt();Kn(n,e,s,r),ag(n,t,s)}}function sx(e,t,n){var s=Ws(e),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(sg(e))rg(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,Gn(o,l)){var c=t.interleaved;c===null?(r.next=r,xd(t)):(r.next=c.next,c.next=r),t.interleaved=r;return}}catch{}finally{}n=$f(e,t,r,s),n!==null&&(r=zt(),Kn(n,e,s,r),ag(n,t,s))}}function sg(e){var t=e.alternate;return e===nt||t!==null&&t===nt}function rg(e,t){qa=Jl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ag(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,id(e,n)}}var ql={readContext:In,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},rx={readContext:In,useCallback:function(e,t){return Zn().memoizedState=[e,t===void 0?null:t],e},useContext:In,useEffect:ph,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,kl(4194308,4,qf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return kl(4194308,4,e,t)},useInsertionEffect:function(e,t){return kl(4,2,e,t)},useMemo:function(e,t){var n=Zn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Zn();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=nx.bind(null,nt,e),[s.memoizedState,e]},useRef:function(e){var t=Zn();return e={current:e},t.memoizedState=e},useState:dh,useDebugValue:Ad,useDeferredValue:function(e){return Zn().memoizedState=e},useTransition:function(){var e=dh(!1),t=e[0];return e=tx.bind(null,e[1]),Zn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=nt,r=Zn();if(qe){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),St===null)throw Error(Z(349));fr&30||zf(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,ph(Vf.bind(null,s,i,e),[e]),s.flags|=2048,Ni(9,Wf.bind(null,s,i,n,t),void 0,null),n},useId:function(){var e=Zn(),t=St.identifierPrefix;if(qe){var n=ms,s=hs;n=(s&~(1<<32-Vn(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=bi++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ex++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ax={readContext:In,useCallback:Zf,useContext:In,useEffect:Td,useImperativeHandle:Xf,useInsertionEffect:Yf,useLayoutEffect:Jf,useMemo:eg,useReducer:gc,useRef:Gf,useState:function(){return gc(Si)},useDebugValue:Ad,useDeferredValue:function(e){var t=_n();return tg(t,gt.memoizedState,e)},useTransition:function(){var e=gc(Si)[0],t=_n().memoizedState;return[e,t]},useMutableSource:Uf,useSyncExternalStore:Hf,useId:ng,unstable_isNewReconciler:!1},ix={readContext:In,useCallback:Zf,useContext:In,useEffect:Td,useImperativeHandle:Xf,useInsertionEffect:Yf,useLayoutEffect:Jf,useMemo:eg,useReducer:vc,useRef:Gf,useState:function(){return vc(Si)},useDebugValue:Ad,useDeferredValue:function(e){var t=_n();return gt===null?t.memoizedState=e:tg(t,gt.memoizedState,e)},useTransition:function(){var e=vc(Si)[0],t=_n().memoizedState;return[e,t]},useMutableSource:Uf,useSyncExternalStore:Hf,useId:ng,unstable_isNewReconciler:!1};function Hn(e,t){if(e&&e.defaultProps){t=st({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function hu(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:st({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var No={isMounted:function(e){return(e=e._reactInternals)?xr(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=zt(),r=Ws(e),i=gs(s,r);i.payload=t,n!=null&&(i.callback=n),t=Hs(e,i,r),t!==null&&(Kn(t,e,r,s),wl(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=zt(),r=Ws(e),i=gs(s,r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Hs(e,i,r),t!==null&&(Kn(t,e,r,s),wl(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zt(),s=Ws(e),r=gs(n,s);r.tag=2,t!=null&&(r.callback=t),t=Hs(e,r,s),t!==null&&(Kn(t,e,s,n),wl(t,e,s))}};function hh(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?!gi(n,s)||!gi(r,i):!0}function ig(e,t,n){var s=!1,r=Qs,i=t.contextType;return typeof i=="object"&&i!==null?i=In(i):(r=on(t)?hr:Ot.current,s=t.contextTypes,i=(s=s!=null)?ca(e,r):Qs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=No,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=i),t}function mh(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&&No.enqueueReplaceState(t,t.state,null)}function mu(e,t,n,s){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},kd(e);var i=t.contextType;typeof i=="object"&&i!==null?r.context=In(i):(i=on(t)?hr:Ot.current,r.context=ca(e,i)),r.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(hu(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&&No.enqueueReplaceState(r,r.state,null),Gl(e,n,r,s),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function ha(e,t){try{var n="",s=t;do n+=My(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 yc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function fu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var lx=typeof WeakMap=="function"?WeakMap:Map;function lg(e,t,n){n=gs(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Zl||(Zl=!0,ju=s),fu(e,t)},n}function og(e,t,n){n=gs(-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(){fu(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){fu(e,t),typeof s!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),n}function fh(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=kx.bind(null,e,t,n),t.then(e,e))}function gh(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 vh(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=gs(-1,1),t.tag=2,Hs(n,t,1))),n.lanes|=1),e)}var ox=bs.ReactCurrentOwner,an=!1;function Ut(e,t,n,s){t.child=e===null?Df(t,null,n,s):da(t,e.child,n,s)}function yh(e,t,n,s,r){n=n.render;var i=t.ref;return sa(t,r),s=Cd(e,t,n,s,i,r),n=Ed(),e!==null&&!an?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,xs(e,t,r)):(qe&&n&&md(t),t.flags|=1,Ut(e,t,s,r),t.child)}function wh(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!Dd(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,cg(e,t,i,s,r)):(e=jl(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:gi,n(l,s)&&e.ref===t.ref)return xs(e,t,r)}return t.flags|=1,e=Vs(i,s),e.ref=t.ref,e.return=t,t.child=e}function cg(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(gi(i,s)&&e.ref===t.ref)if(an=!1,t.pendingProps=s=i,(e.lanes&r)!==0)e.flags&131072&&(an=!0);else return t.lanes=e.lanes,xs(e,t,r)}return gu(e,t,n,s,r)}function ug(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},ze(qr,hn),hn|=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,ze(qr,hn),hn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,ze(qr,hn),hn|=s}else i!==null?(s=i.baseLanes|n,t.memoizedState=null):s=n,ze(qr,hn),hn|=s;return Ut(e,t,r,n),t.child}function dg(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gu(e,t,n,s,r){var i=on(n)?hr:Ot.current;return i=ca(t,i),sa(t,r),n=Cd(e,t,n,s,i,r),s=Ed(),e!==null&&!an?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,xs(e,t,r)):(qe&&s&&md(t),t.flags|=1,Ut(e,t,n,r),t.child)}function xh(e,t,n,s,r){if(on(n)){var i=!0;zl(t)}else i=!1;if(sa(t,r),t.stateNode===null)bl(e,t),ig(t,n,s),mu(t,n,s,r),s=!0;else if(e===null){var l=t.stateNode,o=t.memoizedProps;l.props=o;var c=l.context,u=n.contextType;typeof u=="object"&&u!==null?u=In(u):(u=on(n)?hr:Ot.current,u=ca(t,u));var f=n.getDerivedStateFromProps,g=typeof f=="function"||typeof l.getSnapshotBeforeUpdate=="function";g||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o!==s||c!==u)&&mh(t,l,s,u),Is=!1;var h=t.memoizedState;l.state=h,Gl(t,s,l,r),c=t.memoizedState,o!==s||h!==c||ln.current||Is?(typeof f=="function"&&(hu(t,n,f,s),c=t.memoizedState),(o=Is||hh(t,n,o,s,h,c,u))?(g||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=u,s=o):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{l=t.stateNode,Ff(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:Hn(t.type,o),l.props=u,g=t.pendingProps,h=l.context,c=n.contextType,typeof c=="object"&&c!==null?c=In(c):(c=on(n)?hr:Ot.current,c=ca(t,c));var S=n.getDerivedStateFromProps;(f=typeof S=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o!==g||h!==c)&&mh(t,l,s,c),Is=!1,h=t.memoizedState,l.state=h,Gl(t,s,l,r);var k=t.memoizedState;o!==g||h!==k||ln.current||Is?(typeof S=="function"&&(hu(t,n,S,s),k=t.memoizedState),(u=Is||hh(t,n,u,s,h,k,c)||!1)?(f||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(s,k,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(s,k,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=k),l.props=s,l.state=k,l.context=c,s=u):(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 vu(e,t,n,s,i,r)}function vu(e,t,n,s,r,i){dg(e,t);var l=(t.flags&128)!==0;if(!s&&!l)return r&&ah(t,n,!1),xs(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=da(t,e.child,null,i),t.child=da(t,null,o,i)):Ut(e,t,o,i),t.memoizedState=s.state,r&&ah(t,n,!0),t.child}function pg(e){var t=e.stateNode;t.pendingContext?rh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rh(e,t.context,!1),bd(e,t.containerInfo)}function kh(e,t,n,s,r){return ua(),gd(r),t.flags|=256,Ut(e,t,n,s),t.child}var yu={dehydrated:null,treeContext:null,retryLane:0};function wu(e){return{baseLanes:e,cachePool:null,transitions:null}}function hg(e,t,n){var s=t.pendingProps,r=tt.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),ze(tt,r&1),e===null)return du(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=Eo(l,s,0,null),e=pr(e,s,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=wu(n),t.memoizedState=yu,e):Rd(t,l));if(r=e.memoizedState,r!==null&&(o=r.dehydrated,o!==null))return cx(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=Vs(r,c),s.subtreeFlags=r.subtreeFlags&14680064),o!==null?i=Vs(o,i):(i=pr(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?wu(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=yu,s}return i=e.child,e=i.sibling,s=Vs(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 Rd(e,t){return t=Eo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rl(e,t,n,s){return s!==null&&gd(s),da(t,e.child,null,n),e=Rd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cx(e,t,n,s,r,i,l){if(n)return t.flags&256?(t.flags&=-257,s=yc(Error(Z(422))),rl(e,t,l,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,r=t.mode,s=Eo({mode:"visible",children:s.children},r,0,null),i=pr(i,r,l,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,t.mode&1&&da(t,e.child,null,l),t.child.memoizedState=wu(l),t.memoizedState=yu,i);if(!(t.mode&1))return rl(e,t,l,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var o=s.dgst;return s=o,i=Error(Z(419)),s=yc(i,s,void 0),rl(e,t,l,s)}if(o=(l&e.childLanes)!==0,an||o){if(s=St,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,ws(e,r),Kn(s,e,r,-1))}return Od(),s=yc(Error(Z(421))),rl(e,t,l,s)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=bx.bind(null,e),r._reactRetry=t,null):(e=i.treeContext,mn=Us(r.nextSibling),fn=t,qe=!0,Wn=null,e!==null&&(Cn[En++]=hs,Cn[En++]=ms,Cn[En++]=mr,hs=e.id,ms=e.overflow,mr=t),t=Rd(t,s.children),t.flags|=4096,t)}function bh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),pu(e.return,t,n)}function wc(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(Ut(e,t,s.children,n),s=tt.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(ze(tt,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&&Yl(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),wc(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&&Yl(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}wc(t,!0,n,null,i);break;case"together":wc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function bl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function xs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gr|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=Vs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ux(e,t,n){switch(t.tag){case 3:pg(t),ua();break;case 5:Bf(t);break;case 1:on(t.type)&&zl(t);break;case 4:bd(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;ze(Kl,s._currentValue),s._currentValue=r;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(ze(tt,tt.current&1),t.flags|=128,null):n&t.child.childLanes?hg(e,t,n):(ze(tt,tt.current&1),e=xs(e,t,n),e!==null?e.sibling:null);ze(tt,tt.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),ze(tt,tt.current),s)break;return null;case 22:case 23:return t.lanes=0,ug(e,t,n)}return xs(e,t,n)}var fg,xu,gg,vg;fg=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}};xu=function(){};gg=function(e,t,n,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,cr(rs.current);var i=null;switch(n){case"input":r=Hc(e,r),s=Hc(e,s),i=[];break;case"select":r=st({},r,{value:void 0}),s=st({},s,{value:void 0}),i=[];break;case"textarea":r=Vc(e,r),s=Vc(e,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Ul)}Qc(n,s);var l;n=null;for(u in r)if(!s.hasOwnProperty(u)&&r.hasOwnProperty(u)&&r[u]!=null)if(u==="style"){var o=r[u];for(l in o)o.hasOwnProperty(l)&&(n||(n={}),n[l]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ci.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in s){var c=s[u];if(o=r!=null?r[u]:void 0,s.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="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(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ci.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Ke("scroll",e),i||o===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};vg=function(e,t,n,s){n!==s&&(t.flags|=4)};function Fa(e,t){if(!qe)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 dx(e,t,n){var s=t.pendingProps;switch(fd(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 on(t.type)&&Hl(),Mt(t),null;case 3:return s=t.stateNode,pa(),Qe(ln),Qe(Ot),Nd(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(nl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wn!==null&&(Tu(Wn),Wn=null))),xu(e,t),Mt(t),null;case 5:Sd(t);var r=cr(ki.current);if(n=t.type,e!==null&&t.stateNode!=null)gg(e,t,n,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(Z(166));return Mt(t),null}if(e=cr(rs.current),nl(t)){s=t.stateNode,n=t.type;var i=t.memoizedProps;switch(s[ns]=t,s[wi]=i,e=(t.mode&1)!==0,n){case"dialog":Ke("cancel",s),Ke("close",s);break;case"iframe":case"object":case"embed":Ke("load",s);break;case"video":case"audio":for(r=0;r<Va.length;r++)Ke(Va[r],s);break;case"source":Ke("error",s);break;case"img":case"image":case"link":Ke("error",s),Ke("load",s);break;case"details":Ke("toggle",s);break;case"input":Pp(s,i),Ke("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},Ke("invalid",s);break;case"textarea":_p(s,i),Ke("invalid",s)}Qc(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&&tl(s.textContent,o,e),r=["children",o]):typeof o=="number"&&s.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&tl(s.textContent,o,e),r=["children",""+o]):ci.hasOwnProperty(l)&&o!=null&&l==="onScroll"&&Ke("scroll",s)}switch(n){case"input":Qi(s),Ip(s,i,!0);break;case"textarea":Qi(s),Mp(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=Ul)}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=Wm(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[ns]=t,e[wi]=s,fg(e,t,!1,!1),t.stateNode=e;e:{switch(l=Gc(n,s),n){case"dialog":Ke("cancel",e),Ke("close",e),r=s;break;case"iframe":case"object":case"embed":Ke("load",e),r=s;break;case"video":case"audio":for(r=0;r<Va.length;r++)Ke(Va[r],e);r=s;break;case"source":Ke("error",e),r=s;break;case"img":case"image":case"link":Ke("error",e),Ke("load",e),r=s;break;case"details":Ke("toggle",e),r=s;break;case"input":Pp(e,s),r=Hc(e,s),Ke("invalid",e);break;case"option":r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=st({},s,{value:void 0}),Ke("invalid",e);break;case"textarea":_p(e,s),r=Vc(e,s),Ke("invalid",e);break;default:r=s}Qc(n,r),o=r;for(i in o)if(o.hasOwnProperty(i)){var c=o[i];i==="style"?Qm(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Vm(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ui(e,c):typeof c=="number"&&ui(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ci.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Ke("scroll",e):c!=null&&ed(e,i,c,l))}switch(n){case"input":Qi(e),Ip(e,s,!1);break;case"textarea":Qi(e),Mp(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Ks(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?Zr(e,!!s.multiple,i,!1):s.defaultValue!=null&&Zr(e,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=Ul)}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)vg(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Z(166));if(n=cr(ki.current),cr(rs.current),nl(t)){if(s=t.stateNode,n=t.memoizedProps,s[ns]=t,(i=s.nodeValue!==n)&&(e=fn,e!==null))switch(e.tag){case 3:tl(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&tl(s.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[ns]=t,t.stateNode=s}return Mt(t),null;case 13:if(Qe(tt),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(qe&&mn!==null&&t.mode&1&&!(t.flags&128))Lf(),ua(),t.flags|=98560,i=!1;else if(i=nl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(Z(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Z(317));i[ns]=t}else ua(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mt(t),i=!1}else Wn!==null&&(Tu(Wn),Wn=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||tt.current&1?yt===0&&(yt=3):Od())),t.updateQueue!==null&&(t.flags|=4),Mt(t),null);case 4:return pa(),xu(e,t),e===null&&vi(t.stateNode.containerInfo),Mt(t),null;case 10:return wd(t.type._context),Mt(t),null;case 17:return on(t.type)&&Hl(),Mt(t),null;case 19:if(Qe(tt),i=t.memoizedState,i===null)return Mt(t),null;if(s=(t.flags&128)!==0,l=i.rendering,l===null)if(s)Fa(i,!1);else{if(yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=Yl(e),l!==null){for(t.flags|=128,Fa(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 ze(tt,tt.current&1|2),t.child}e=e.sibling}i.tail!==null&&ot()>ma&&(t.flags|=128,s=!0,Fa(i,!1),t.lanes=4194304)}else{if(!s)if(e=Yl(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Fa(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!qe)return Mt(t),null}else 2*ot()-i.renderingStartTime>ma&&n!==1073741824&&(t.flags|=128,s=!0,Fa(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=ot(),t.sibling=null,n=tt.current,ze(tt,s?n&1|2:n&1),t):(Mt(t),null);case 22:case 23:return Ld(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?hn&1073741824&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function px(e,t){switch(fd(t),t.tag){case 1:return on(t.type)&&Hl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pa(),Qe(ln),Qe(Ot),Nd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Sd(t),null;case 13:if(Qe(tt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));ua()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qe(tt),null;case 4:return pa(),null;case 10:return wd(t.type._context),null;case 22:case 23:return Ld(),null;case 24:return null;default:return null}}var al=!1,Lt=!1,hx=typeof WeakSet=="function"?WeakSet:Set,le=null;function Jr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){it(e,t,s)}else n.current=null}function ku(e,t,n){try{n()}catch(s){it(e,t,s)}}var Sh=!1;function mx(e,t){if(ru=$l,e=bf(),hd(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,u=0,f=0,g=e,h=null;t:for(;;){for(var S;g!==n||r!==0&&g.nodeType!==3||(o=l+r),g!==i||s!==0&&g.nodeType!==3||(c=l+s),g.nodeType===3&&(l+=g.nodeValue.length),(S=g.firstChild)!==null;)h=g,g=S;for(;;){if(g===e)break t;if(h===n&&++u===r&&(o=l),h===i&&++f===s&&(c=l),(S=g.nextSibling)!==null)break;g=h,h=g.parentNode}g=S}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(au={focusedElem:e,selectionRange:n},$l=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var x=k.memoizedProps,N=k.memoizedState,w=t.stateNode,m=w.getSnapshotBeforeUpdate(t.elementType===t.type?x:Hn(t.type,x),N);w.__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(Z(163))}}catch(A){it(t,t.return,A)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return k=Sh,Sh=!1,k}function Xa(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&&ku(t,n,i)}r=r.next}while(r!==s)}}function jo(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 bu(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 yg(e){var t=e.alternate;t!==null&&(e.alternate=null,yg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ns],delete t[wi],delete t[ou],delete t[Jw],delete t[qw])),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 wg(e){return e.tag===5||e.tag===3||e.tag===4}function Nh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wg(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 Su(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=Ul));else if(s!==4&&(e=e.child,e!==null))for(Su(e,t,n),e=e.sibling;e!==null;)Su(e,t,n),e=e.sibling}function Nu(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(Nu(e,t,n),e=e.sibling;e!==null;)Nu(e,t,n),e=e.sibling}var Tt=null,zn=!1;function Es(e,t,n){for(n=n.child;n!==null;)xg(e,t,n),n=n.sibling}function xg(e,t,n){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(vo,n)}catch{}switch(n.tag){case 5:Lt||Jr(n,t);case 6:var s=Tt,r=zn;Tt=null,Es(e,t,n),Tt=s,zn=r,Tt!==null&&(zn?(e=Tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tt.removeChild(n.stateNode));break;case 18:Tt!==null&&(zn?(e=Tt,n=n.stateNode,e.nodeType===8?pc(e.parentNode,n):e.nodeType===1&&pc(e,n),mi(e)):pc(Tt,n.stateNode));break;case 4:s=Tt,r=zn,Tt=n.stateNode.containerInfo,zn=!0,Es(e,t,n),Tt=s,zn=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)&&ku(n,t,l),r=r.next}while(r!==s)}Es(e,t,n);break;case 1:if(!Lt&&(Jr(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(o){it(n,t,o)}Es(e,t,n);break;case 21:Es(e,t,n);break;case 22:n.mode&1?(Lt=(s=Lt)||n.memoizedState!==null,Es(e,t,n),Lt=s):Es(e,t,n);break;default:Es(e,t,n)}}function jh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new hx),t.forEach(function(s){var r=Sx.bind(null,e,s);n.has(s)||(n.add(s),s.then(r,r))})}}function Un(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:Tt=o.stateNode,zn=!1;break e;case 3:Tt=o.stateNode.containerInfo,zn=!0;break e;case 4:Tt=o.stateNode.containerInfo,zn=!0;break e}o=o.return}if(Tt===null)throw Error(Z(160));xg(i,l,r),Tt=null,zn=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(u){it(r,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)kg(t,e),t=t.sibling}function kg(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Un(t,e),Xn(e),s&4){try{Xa(3,e,e.return),jo(3,e)}catch(x){it(e,e.return,x)}try{Xa(5,e,e.return)}catch(x){it(e,e.return,x)}}break;case 1:Un(t,e),Xn(e),s&512&&n!==null&&Jr(n,n.return);break;case 5:if(Un(t,e),Xn(e),s&512&&n!==null&&Jr(n,n.return),e.flags&32){var r=e.stateNode;try{ui(r,"")}catch(x){it(e,e.return,x)}}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&&Hm(r,i),Gc(o,l);var u=Gc(o,i);for(l=0;l<c.length;l+=2){var f=c[l],g=c[l+1];f==="style"?Qm(r,g):f==="dangerouslySetInnerHTML"?Vm(r,g):f==="children"?ui(r,g):ed(r,f,g,u)}switch(o){case"input":zc(r,i);break;case"textarea":zm(r,i);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var S=i.value;S!=null?Zr(r,!!i.multiple,S,!1):h!==!!i.multiple&&(i.defaultValue!=null?Zr(r,!!i.multiple,i.defaultValue,!0):Zr(r,!!i.multiple,i.multiple?[]:"",!1))}r[wi]=i}catch(x){it(e,e.return,x)}}break;case 6:if(Un(t,e),Xn(e),s&4){if(e.stateNode===null)throw Error(Z(162));r=e.stateNode,i=e.memoizedProps;try{r.nodeValue=i}catch(x){it(e,e.return,x)}}break;case 3:if(Un(t,e),Xn(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{mi(t.containerInfo)}catch(x){it(e,e.return,x)}break;case 4:Un(t,e),Xn(e);break;case 13:Un(t,e),Xn(e),r=e.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(_d=ot())),s&4&&jh(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Lt=(u=Lt)||f,Un(t,e),Lt=u):Un(t,e),Xn(e),s&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(le=e,f=e.child;f!==null;){for(g=le=f;le!==null;){switch(h=le,S=h.child,h.tag){case 0:case 11:case 14:case 15:Xa(4,h,h.return);break;case 1:Jr(h,h.return);var k=h.stateNode;if(typeof k.componentWillUnmount=="function"){s=h,n=h.return;try{t=s,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(x){it(s,n,x)}}break;case 5:Jr(h,h.return);break;case 22:if(h.memoizedState!==null){Eh(g);continue}}S!==null?(S.return=h,le=S):Eh(g)}f=f.sibling}e:for(f=null,g=e;;){if(g.tag===5){if(f===null){f=g;try{r=g.stateNode,u?(i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=g.stateNode,c=g.memoizedProps.style,l=c!=null&&c.hasOwnProperty("display")?c.display:null,o.style.display=Km("display",l))}catch(x){it(e,e.return,x)}}}else if(g.tag===6){if(f===null)try{g.stateNode.nodeValue=u?"":g.memoizedProps}catch(x){it(e,e.return,x)}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===e)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===e)break e;for(;g.sibling===null;){if(g.return===null||g.return===e)break e;f===g&&(f=null),g=g.return}f===g&&(f=null),g.sibling.return=g.return,g=g.sibling}}break;case 19:Un(t,e),Xn(e),s&4&&jh(e);break;case 21:break;default:Un(t,e),Xn(e)}}function Xn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(wg(n)){var s=n;break e}n=n.return}throw Error(Z(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(ui(r,""),s.flags&=-33);var i=Nh(e);Nu(e,i,r);break;case 3:case 4:var l=s.stateNode.containerInfo,o=Nh(e);Su(e,o,l);break;default:throw Error(Z(161))}}catch(c){it(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fx(e,t,n){le=e,bg(e)}function bg(e,t,n){for(var s=(e.mode&1)!==0;le!==null;){var r=le,i=r.child;if(r.tag===22&&s){var l=r.memoizedState!==null||al;if(!l){var o=r.alternate,c=o!==null&&o.memoizedState!==null||Lt;o=al;var u=Lt;if(al=l,(Lt=c)&&!u)for(le=r;le!==null;)l=le,c=l.child,l.tag===22&&l.memoizedState!==null?Th(r):c!==null?(c.return=l,le=c):Th(r);for(;i!==null;)le=i,bg(i),i=i.sibling;le=r,al=o,Lt=u}Ch(e)}else r.subtreeFlags&8772&&i!==null?(i.return=r,le=i):Ch(e)}}function Ch(e){for(;le!==null;){var t=le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lt||jo(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:Hn(t.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&uh(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}uh(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 u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var g=f.dehydrated;g!==null&&mi(g)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Z(163))}Lt||t.flags&512&&bu(t)}catch(h){it(t,t.return,h)}}if(t===e){le=null;break}if(n=t.sibling,n!==null){n.return=t.return,le=n;break}le=t.return}}function Eh(e){for(;le!==null;){var t=le;if(t===e){le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,le=n;break}le=t.return}}function Th(e){for(;le!==null;){var t=le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{jo(4,t)}catch(c){it(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var r=t.return;try{s.componentDidMount()}catch(c){it(t,r,c)}}var i=t.return;try{bu(t)}catch(c){it(t,i,c)}break;case 5:var l=t.return;try{bu(t)}catch(c){it(t,l,c)}}}catch(c){it(t,t.return,c)}if(t===e){le=null;break}var o=t.sibling;if(o!==null){o.return=t.return,le=o;break}le=t.return}}var gx=Math.ceil,Xl=bs.ReactCurrentDispatcher,Pd=bs.ReactCurrentOwner,Rn=bs.ReactCurrentBatchConfig,Fe=0,St=null,pt=null,At=0,hn=0,qr=Ys(0),yt=0,ji=null,gr=0,Co=0,Id=0,Za=null,rn=null,_d=0,ma=1/0,ds=null,Zl=!1,ju=null,zs=null,il=!1,Ds=null,eo=0,ei=0,Cu=null,Sl=-1,Nl=0;function zt(){return Fe&6?ot():Sl!==-1?Sl:Sl=ot()}function Ws(e){return e.mode&1?Fe&2&&At!==0?At&-At:Zw.transition!==null?(Nl===0&&(Nl=af()),Nl):(e=He,e!==0||(e=window.event,e=e===void 0?16:hf(e.type)),e):1}function Kn(e,t,n,s){if(50<ei)throw ei=0,Cu=null,Error(Z(185));Ai(e,n,s),(!(Fe&2)||e!==St)&&(e===St&&(!(Fe&2)&&(Co|=n),yt===4&&Ls(e,At)),cn(e,s),n===1&&Fe===0&&!(t.mode&1)&&(ma=ot()+500,bo&&Js()))}function cn(e,t){var n=e.callbackNode;Zy(e,t);var s=Dl(e,e===St?At:0);if(s===0)n!==null&&Dp(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Dp(n),t===1)e.tag===0?Xw(Ah.bind(null,e)):If(Ah.bind(null,e)),Gw(function(){!(Fe&6)&&Js()}),n=null;else{switch(lf(s)){case 1:n=ad;break;case 4:n=sf;break;case 16:n=Ol;break;case 536870912:n=rf;break;default:n=Ol}n=Rg(n,Sg.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sg(e,t){if(Sl=-1,Nl=0,Fe&6)throw Error(Z(327));var n=e.callbackNode;if(ra()&&e.callbackNode!==n)return null;var s=Dl(e,e===St?At:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=to(e,s);else{t=s;var r=Fe;Fe|=2;var i=jg();(St!==e||At!==t)&&(ds=null,ma=ot()+500,dr(e,t));do try{wx();break}catch(o){Ng(e,o)}while(!0);yd(),Xl.current=i,Fe=r,pt!==null?t=0:(St=null,At=0,t=yt)}if(t!==0){if(t===2&&(r=Zc(e),r!==0&&(s=r,t=Eu(e,r))),t===1)throw n=ji,dr(e,0),Ls(e,s),cn(e,ot()),n;if(t===6)Ls(e,s);else{if(r=e.current.alternate,!(s&30)&&!vx(r)&&(t=to(e,s),t===2&&(i=Zc(e),i!==0&&(s=i,t=Eu(e,i))),t===1))throw n=ji,dr(e,0),Ls(e,s),cn(e,ot()),n;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(Z(345));case 2:nr(e,rn,ds);break;case 3:if(Ls(e,s),(s&130023424)===s&&(t=_d+500-ot(),10<t)){if(Dl(e,0)!==0)break;if(r=e.suspendedLanes,(r&s)!==s){zt(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=lu(nr.bind(null,e,rn,ds),t);break}nr(e,rn,ds);break;case 4:if(Ls(e,s),(s&4194240)===s)break;for(t=e.eventTimes,r=-1;0<s;){var l=31-Vn(s);i=1<<l,l=t[l],l>r&&(r=l),s&=~i}if(s=r,s=ot()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*gx(s/1960))-s,10<s){e.timeoutHandle=lu(nr.bind(null,e,rn,ds),s);break}nr(e,rn,ds);break;case 5:nr(e,rn,ds);break;default:throw Error(Z(329))}}}return cn(e,ot()),e.callbackNode===n?Sg.bind(null,e):null}function Eu(e,t){var n=Za;return e.current.memoizedState.isDehydrated&&(dr(e,t).flags|=256),e=to(e,t),e!==2&&(t=rn,rn=n,t!==null&&Tu(t)),e}function Tu(e){rn===null?rn=e:rn.push.apply(rn,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(!Gn(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 Ls(e,t){for(t&=~Id,t&=~Co,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Vn(t),s=1<<n;e[n]=-1,t&=~s}}function Ah(e){if(Fe&6)throw Error(Z(327));ra();var t=Dl(e,0);if(!(t&1))return cn(e,ot()),null;var n=to(e,t);if(e.tag!==0&&n===2){var s=Zc(e);s!==0&&(t=s,n=Eu(e,s))}if(n===1)throw n=ji,dr(e,0),Ls(e,t),cn(e,ot()),n;if(n===6)throw Error(Z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,nr(e,rn,ds),cn(e,ot()),null}function Md(e,t){var n=Fe;Fe|=1;try{return e(t)}finally{Fe=n,Fe===0&&(ma=ot()+500,bo&&Js())}}function vr(e){Ds!==null&&Ds.tag===0&&!(Fe&6)&&ra();var t=Fe;Fe|=1;var n=Rn.transition,s=He;try{if(Rn.transition=null,He=1,e)return e()}finally{He=s,Rn.transition=n,Fe=t,!(Fe&6)&&Js()}}function Ld(){hn=qr.current,Qe(qr)}function dr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Qw(n)),pt!==null)for(n=pt.return;n!==null;){var s=n;switch(fd(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Hl();break;case 3:pa(),Qe(ln),Qe(Ot),Nd();break;case 5:Sd(s);break;case 4:pa();break;case 13:Qe(tt);break;case 19:Qe(tt);break;case 10:wd(s.type._context);break;case 22:case 23:Ld()}n=n.return}if(St=e,pt=e=Vs(e.current,null),At=hn=t,yt=0,ji=null,Id=Co=gr=0,rn=Za=null,or!==null){for(t=0;t<or.length;t++)if(n=or[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}or=null}return e}function Ng(e,t){do{var n=pt;try{if(yd(),xl.current=ql,Jl){for(var s=nt.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Jl=!1}if(fr=0,bt=gt=nt=null,qa=!1,bi=0,Pd.current=null,n===null||n.return===null){yt=1,ji=t,pt=null;break}e:{var i=e,l=n.return,o=n,c=t;if(t=At,o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,f=o,g=f.tag;if(!(f.mode&1)&&(g===0||g===11||g===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var S=gh(l);if(S!==null){S.flags&=-257,vh(S,l,o,i,t),S.mode&1&&fh(i,u,t),t=S,c=u;var k=t.updateQueue;if(k===null){var x=new Set;x.add(c),t.updateQueue=x}else k.add(c);break e}else{if(!(t&1)){fh(i,u,t),Od();break e}c=Error(Z(426))}}else if(qe&&o.mode&1){var N=gh(l);if(N!==null){!(N.flags&65536)&&(N.flags|=256),vh(N,l,o,i,t),gd(ha(c,o));break e}}i=c=ha(c,o),yt!==4&&(yt=2),Za===null?Za=[i]:Za.push(i),i=l;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var w=lg(i,c,t);ch(i,w);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"&&(zs===null||!zs.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var A=og(i,o,t);ch(i,A);break e}}i=i.return}while(i!==null)}Eg(n)}catch(T){t=T,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function jg(){var e=Xl.current;return Xl.current=ql,e===null?ql:e}function Od(){(yt===0||yt===3||yt===2)&&(yt=4),St===null||!(gr&268435455)&&!(Co&268435455)||Ls(St,At)}function to(e,t){var n=Fe;Fe|=2;var s=jg();(St!==e||At!==t)&&(ds=null,dr(e,t));do try{yx();break}catch(r){Ng(e,r)}while(!0);if(yd(),Fe=n,Xl.current=s,pt!==null)throw Error(Z(261));return St=null,At=0,yt}function yx(){for(;pt!==null;)Cg(pt)}function wx(){for(;pt!==null&&!Wy();)Cg(pt)}function Cg(e){var t=Ag(e.alternate,e,hn);e.memoizedProps=e.pendingProps,t===null?Eg(e):pt=t,Pd.current=null}function Eg(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=px(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{yt=6,pt=null;return}}else if(n=dx(n,t,hn),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);yt===0&&(yt=5)}function nr(e,t,n){var s=He,r=Rn.transition;try{Rn.transition=null,He=1,xx(e,t,n,s)}finally{Rn.transition=r,He=s}return null}function xx(e,t,n,s){do ra();while(Ds!==null);if(Fe&6)throw Error(Z(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(Z(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(ew(e,i),e===St&&(pt=St=null,At=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||il||(il=!0,Rg(Ol,function(){return ra(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Rn.transition,Rn.transition=null;var l=He;He=1;var o=Fe;Fe|=4,Pd.current=null,mx(e,n),kg(n,e),Bw(au),$l=!!ru,au=ru=null,e.current=n,fx(n),Vy(),Fe=o,He=l,Rn.transition=i}else e.current=n;if(il&&(il=!1,Ds=e,eo=r),i=e.pendingLanes,i===0&&(zs=null),Gy(n.stateNode),cn(e,ot()),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(Zl)throw Zl=!1,e=ju,ju=null,e;return eo&1&&e.tag!==0&&ra(),i=e.pendingLanes,i&1?e===Cu?ei++:(ei=0,Cu=e):ei=0,Js(),null}function ra(){if(Ds!==null){var e=lf(eo),t=Rn.transition,n=He;try{if(Rn.transition=null,He=16>e?16:e,Ds===null)var s=!1;else{if(e=Ds,Ds=null,eo=0,Fe&6)throw Error(Z(331));var r=Fe;for(Fe|=4,le=e.current;le!==null;){var i=le,l=i.child;if(le.flags&16){var o=i.deletions;if(o!==null){for(var c=0;c<o.length;c++){var u=o[c];for(le=u;le!==null;){var f=le;switch(f.tag){case 0:case 11:case 15:Xa(8,f,i)}var g=f.child;if(g!==null)g.return=f,le=g;else for(;le!==null;){f=le;var h=f.sibling,S=f.return;if(yg(f),f===u){le=null;break}if(h!==null){h.return=S,le=h;break}le=S}}}var k=i.alternate;if(k!==null){var x=k.child;if(x!==null){k.child=null;do{var N=x.sibling;x.sibling=null,x=N}while(x!==null)}}le=i}}if(i.subtreeFlags&2064&&l!==null)l.return=i,le=l;else e:for(;le!==null;){if(i=le,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Xa(9,i,i.return)}var w=i.sibling;if(w!==null){w.return=i.return,le=w;break e}le=i.return}}var m=e.current;for(le=m;le!==null;){l=le;var v=l.child;if(l.subtreeFlags&2064&&v!==null)v.return=l,le=v;else e:for(l=m;le!==null;){if(o=le,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:jo(9,o)}}catch(T){it(o,o.return,T)}if(o===l){le=null;break e}var A=o.sibling;if(A!==null){A.return=o.return,le=A;break e}le=o.return}}if(Fe=r,Js(),ss&&typeof ss.onPostCommitFiberRoot=="function")try{ss.onPostCommitFiberRoot(vo,e)}catch{}s=!0}return s}finally{He=n,Rn.transition=t}}return!1}function Rh(e,t,n){t=ha(n,t),t=lg(e,t,1),e=Hs(e,t,1),t=zt(),e!==null&&(Ai(e,1,t),cn(e,t))}function it(e,t,n){if(e.tag===3)Rh(e,e,n);else for(;t!==null;){if(t.tag===3){Rh(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(zs===null||!zs.has(s))){e=ha(n,e),e=og(t,e,1),t=Hs(t,e,1),e=zt(),t!==null&&(Ai(t,1,e),cn(t,e));break}}t=t.return}}function kx(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=zt(),e.pingedLanes|=e.suspendedLanes&n,St===e&&(At&n)===n&&(yt===4||yt===3&&(At&130023424)===At&&500>ot()-_d?dr(e,0):Id|=n),cn(e,t)}function Tg(e,t){t===0&&(e.mode&1?(t=Ji,Ji<<=1,!(Ji&130023424)&&(Ji=4194304)):t=1);var n=zt();e=ws(e,t),e!==null&&(Ai(e,t,n),cn(e,n))}function bx(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Tg(e,n)}function Sx(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(Z(314))}s!==null&&s.delete(t),Tg(e,n)}var Ag;Ag=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ln.current)an=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return an=!1,ux(e,t,n);an=!!(e.flags&131072)}else an=!1,qe&&t.flags&1048576&&_f(t,Vl,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;bl(e,t),e=t.pendingProps;var r=ca(t,Ot.current);sa(t,n),r=Cd(null,t,s,e,r,n);var i=Ed();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,on(s)?(i=!0,zl(t)):i=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,kd(t),r.updater=No,t.stateNode=r,r._reactInternals=t,mu(t,s,e,n),t=vu(null,t,s,!0,i,n)):(t.tag=0,qe&&i&&md(t),Ut(null,t,r,n),t=t.child),t;case 16:s=t.elementType;e:{switch(bl(e,t),e=t.pendingProps,r=s._init,s=r(s._payload),t.type=s,r=t.tag=jx(s),e=Hn(s,e),r){case 0:t=gu(null,t,s,e,n);break e;case 1:t=xh(null,t,s,e,n);break e;case 11:t=yh(null,t,s,e,n);break e;case 14:t=wh(null,t,s,Hn(s.type,e),n);break e}throw Error(Z(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Hn(s,r),gu(e,t,s,r,n);case 1:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Hn(s,r),xh(e,t,s,r,n);case 3:e:{if(pg(t),e===null)throw Error(Z(387));s=t.pendingProps,i=t.memoizedState,r=i.element,Ff(e,t),Gl(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=ha(Error(Z(423)),t),t=kh(e,t,s,n,r);break e}else if(s!==r){r=ha(Error(Z(424)),t),t=kh(e,t,s,n,r);break e}else for(mn=Us(t.stateNode.containerInfo.firstChild),fn=t,qe=!0,Wn=null,n=Df(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ua(),s===r){t=xs(e,t,n);break e}Ut(e,t,s,n)}t=t.child}return t;case 5:return Bf(t),e===null&&du(t),s=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,l=r.children,iu(s,r)?l=null:i!==null&&iu(s,i)&&(t.flags|=32),dg(e,t),Ut(e,t,l,n),t.child;case 6:return e===null&&du(t),null;case 13:return hg(e,t,n);case 4:return bd(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=da(t,null,s,n):Ut(e,t,s,n),t.child;case 11:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Hn(s,r),yh(e,t,s,r,n);case 7:return Ut(e,t,t.pendingProps,n),t.child;case 8:return Ut(e,t,t.pendingProps.children,n),t.child;case 12:return Ut(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,ze(Kl,s._currentValue),s._currentValue=l,i!==null)if(Gn(i.value,l)){if(i.children===r.children&&!ln.current){t=xs(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=gs(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?c.next=c:(c.next=f.next,f.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),pu(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(Z(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),pu(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}Ut(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,sa(t,n),r=In(r),s=s(r),t.flags|=1,Ut(e,t,s,n),t.child;case 14:return s=t.type,r=Hn(s,t.pendingProps),r=Hn(s.type,r),wh(e,t,s,r,n);case 15:return cg(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Hn(s,r),bl(e,t),t.tag=1,on(s)?(e=!0,zl(t)):e=!1,sa(t,n),ig(t,s,r),mu(t,s,r,n),vu(null,t,s,!0,e,n);case 19:return mg(e,t,n);case 22:return ug(e,t,n)}throw Error(Z(156,t.tag))};function Rg(e,t){return nf(e,t)}function Nx(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 Tn(e,t,n,s){return new Nx(e,t,n,s)}function Dd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function jx(e){if(typeof e=="function")return Dd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===nd)return 11;if(e===sd)return 14}return 2}function Vs(e,t){var n=e.alternate;return n===null?(n=Tn(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 jl(e,t,n,s,r,i){var l=2;if(s=e,typeof e=="function")Dd(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Ur:return pr(n.children,r,i,t);case td:l=8,r|=8;break;case $c:return e=Tn(12,n,t,r|2),e.elementType=$c,e.lanes=i,e;case Fc:return e=Tn(13,n,t,r),e.elementType=Fc,e.lanes=i,e;case Bc:return e=Tn(19,n,t,r),e.elementType=Bc,e.lanes=i,e;case Fm:return Eo(n,r,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dm:l=10;break e;case $m:l=9;break e;case nd:l=11;break e;case sd:l=14;break e;case Ps:l=16,s=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=Tn(l,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function pr(e,t,n,s){return e=Tn(7,e,s,t),e.lanes=n,e}function Eo(e,t,n,s){return e=Tn(22,e,s,t),e.elementType=Fm,e.lanes=n,e.stateNode={isHidden:!1},e}function xc(e,t,n){return e=Tn(6,e,null,t),e.lanes=n,e}function kc(e,t,n){return t=Tn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cx(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=tc(0),this.expirationTimes=tc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function $d(e,t,n,s,r,i,l,o,c){return e=new Cx(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Tn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kd(i),e}function Ex(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Br,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function Pg(e){if(!e)return Qs;e=e._reactInternals;e:{if(xr(e)!==e||e.tag!==1)throw Error(Z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(on(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Z(171))}if(e.tag===1){var n=e.type;if(on(n))return Pf(e,n,t)}return t}function Ig(e,t,n,s,r,i,l,o,c){return e=$d(n,s,!0,e,r,i,l,o,c),e.context=Pg(null),n=e.current,s=zt(),r=Ws(n),i=gs(s,r),i.callback=t??null,Hs(n,i,r),e.current.lanes=r,Ai(e,r,s),cn(e,s),e}function To(e,t,n,s){var r=t.current,i=zt(),l=Ws(r);return n=Pg(n),t.context===null?t.context=n:t.pendingContext=n,t=gs(i,l),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Hs(r,t,l),e!==null&&(Kn(e,r,l,i),wl(e,r,l)),l}function no(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 Ph(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Fd(e,t){Ph(e,t),(e=e.alternate)&&Ph(e,t)}function Tx(){return null}var _g=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bd(e){this._internalRoot=e}Ao.prototype.render=Bd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));To(e,t,null,null)};Ao.prototype.unmount=Bd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vr(function(){To(null,e,null,null)}),t[ys]=null}};function Ao(e){this._internalRoot=e}Ao.prototype.unstable_scheduleHydration=function(e){if(e){var t=uf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ms.length&&t!==0&&t<Ms[n].priority;n++);Ms.splice(n,0,e),n===0&&pf(e)}};function Ud(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ro(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ih(){}function Ax(e,t,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var u=no(l);i.call(u)}}var l=Ig(t,s,e,0,null,!1,!1,"",Ih);return e._reactRootContainer=l,e[ys]=l.current,vi(e.nodeType===8?e.parentNode:e),vr(),l}for(;r=e.lastChild;)e.removeChild(r);if(typeof s=="function"){var o=s;s=function(){var u=no(c);o.call(u)}}var c=$d(e,0,!1,null,null,!1,!1,"",Ih);return e._reactRootContainer=c,e[ys]=c.current,vi(e.nodeType===8?e.parentNode:e),vr(function(){To(t,c,n,s)}),c}function Po(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=no(l);o.call(c)}}To(t,l,e,r)}else l=Ax(n,t,e,r,s);return no(l)}of=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Wa(t.pendingLanes);n!==0&&(id(t,n|1),cn(t,ot()),!(Fe&6)&&(ma=ot()+500,Js()))}break;case 13:vr(function(){var s=ws(e,1);if(s!==null){var r=zt();Kn(s,e,1,r)}}),Fd(e,1)}};ld=function(e){if(e.tag===13){var t=ws(e,134217728);if(t!==null){var n=zt();Kn(t,e,134217728,n)}Fd(e,134217728)}};cf=function(e){if(e.tag===13){var t=Ws(e),n=ws(e,t);if(n!==null){var s=zt();Kn(n,e,t,s)}Fd(e,t)}};uf=function(){return He};df=function(e,t){var n=He;try{return He=e,t()}finally{He=n}};Jc=function(e,t,n){switch(t){case"input":if(zc(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=ko(s);if(!r)throw Error(Z(90));Um(s),zc(s,r)}}}break;case"textarea":zm(e,n);break;case"select":t=n.value,t!=null&&Zr(e,!!n.multiple,t,!1)}};Jm=Md;qm=vr;var Rx={usingClientEntryPoint:!1,Events:[Pi,Vr,ko,Gm,Ym,Md]},Ba={findFiberByHostInstance:lr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Px={bundleType:Ba.bundleType,version:Ba.version,rendererPackageName:Ba.rendererPackageName,rendererConfig:Ba.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:bs.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ef(e),e===null?null:e.stateNode},findFiberByHostInstance:Ba.findFiberByHostInstance||Tx,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 ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ll.isDisabled&&ll.supportsFiber)try{vo=ll.inject(Px),ss=ll}catch{}}yn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rx;yn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ud(t))throw Error(Z(200));return Ex(e,t,null,n)};yn.createRoot=function(e,t){if(!Ud(e))throw Error(Z(299));var n=!1,s="",r=_g;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=$d(e,1,!1,null,null,n,!1,s,r),e[ys]=t.current,vi(e.nodeType===8?e.parentNode:e),new Bd(t)};yn.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(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=ef(t),e=e===null?null:e.stateNode,e};yn.flushSync=function(e){return vr(e)};yn.hydrate=function(e,t,n){if(!Ro(t))throw Error(Z(200));return Po(null,e,t,!0,n)};yn.hydrateRoot=function(e,t,n){if(!Ud(e))throw Error(Z(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",l=_g;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),t=Ig(t,null,e,1,n??null,r,!1,i,l),e[ys]=t.current,vi(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 Ao(t)};yn.render=function(e,t,n){if(!Ro(t))throw Error(Z(200));return Po(null,e,t,!1,n)};yn.unmountComponentAtNode=function(e){if(!Ro(e))throw Error(Z(40));return e._reactRootContainer?(vr(function(){Po(null,null,e,!1,function(){e._reactRootContainer=null,e[ys]=null})}),!0):!1};yn.unstable_batchedUpdates=Md;yn.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Ro(n))throw Error(Z(200));if(e==null||e._reactInternals===void 0)throw Error(Z(38));return Po(e,t,n,!1,s)};yn.version="18.3.1-next-f1338f8080-20240426";function Mg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mg)}catch(e){console.error(e)}}Mg(),_m.exports=yn;var Hd=_m.exports,Lg,_h=Hd;Lg=_h.createRoot,_h.hydrateRoot;function Ix(){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 u=e.toString();return window.history.replaceState({},"",window.location.pathname+(u?`?${u}`:"")+window.location.hash),c}catch{return null}}const _x={"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/mobile-pwa/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.saved":"Note saved","notes.deleted":"Note deleted","notes.brainstorm":"🧠 Brainstorm","notes.toSeed":"📝 Spec Seed","notes.openChat":"💬 Source chat","notes.sourceMeta":"From {meta}","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"},Mx={"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/mobile-pwa/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.saved":"メモを保存しました","notes.deleted":"メモを削除しました","notes.brainstorm":"🧠 ブレスト","notes.toSeed":"📝 仕様策定","notes.openChat":"💬 元チャット","notes.sourceMeta":"出典: {meta}","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":"起票できませんでした"},Mh={en:"en-US",ja:"ja-JP"};let Au="en";function Lx(e){return Au=e==="ja"?"ja":"en",Au}function Io(e){return Mh[Au]??Mh.en}function aa(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 Ts(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 Ox(e){if(e==null||!Number.isFinite(e))return"—";const t=e*100;return t>=99.95?"100%":`${t.toFixed(1)}%`}function Ht(e,t={}){const n=Number(e??0);return Number.isFinite(n)?new Intl.NumberFormat(Io(),t).format(n):"—"}function Cl(e,t){if(!Number.isFinite(e)||e<=0)return"—";const n=(s,r)=>new Intl.NumberFormat(Io(),{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 Je(e,t){if(!e)return"—";const n=Math.max(0,Math.round((Date.now()-Number(e))/1e3)),s=new Intl.RelativeTimeFormat(Io(),{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 _o(e,t={},n){const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?"—":new Intl.DateTimeFormat(Io(),{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",...t}).format(s)}function Og(e,t){return _o(e,{year:void 0,month:void 0,day:void 0,hour:"2-digit",minute:"2-digit"})}const Dx=["en","ja"],zd="en",Dg="hm.lang",bc={en:_x,ja:Mx};function fa(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 Lh(e){return String(e??"").trim().toLowerCase().startsWith("ja")?"ja":"en"}function Oh({stored:e,languages:t,language:n}={}){const s=fa(e);if(s==="en"||s==="ja")return s;const r=Array.isArray(t)?t.filter(Boolean):[];return r.length?Lh(r[0]):n?Lh(n):zd}function Ru(e){return Oh(typeof navigator>"u"?{stored:e}:{stored:e,languages:navigator.languages,language:navigator.language})}function $x(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 Mo(e,t,n){const s=fa(e)==="ja"?"ja":zd,i=(bc[s]??bc.en)[t]??bc.en[t];return i==null?String(t):$x(i,n)}let ti=Ru($g());const Pu=new Set;function $g(){try{return fa(localStorage.getItem(Dg))}catch{return null}}function so(){return ti}function Dh(e){const t=fa(e),n=t==="en"||t==="ja"?t:ti,s=n!==ti;if(ti=n,Lx(n),s)for(const r of[...Pu])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 Fx(e){return Pu.add(e),()=>Pu.delete(e)}function C(e,t){return Mo(ti,e,t)}const Bx="",Ux=()=>globalThis.__hmDemoFetch??null,Hx=()=>globalThis.__hmDemoSocket??null;function $h(e,t,n){if(!e)return t;const s=`err.${e}`,r=Mo(so(),s,n);return r===s?t:r}async function X(e,{method:t="GET",body:n}={}){const s=Ux();if(s)return s(e,{method:t,body:n});let r;try{r=await fetch(`${Bx}${e}`,{method:t,credentials:"same-origin",headers:{...n!==void 0?{"content-type":"application/json"}:{},"accept-language":so(),"x-client":"mobile"},body:n!==void 0?JSON.stringify(n):void 0})}catch{const o=new Error($h("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,u=(l==null?void 0:l.params)??(o==null?void 0:o.params)??null,f=(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}`,g=new Error($h(c,f,u));throw g.status=r.status,g.code=c,g.params=u,g}return l}function zx(e){const t=Hx();if(t)return t(e);const n=location.protocol==="https:"?"wss":"ws";return new WebSocket(`${n}://${location.host}${e}`)}const ni=8;function sn(e){var t;return(e==null?void 0:e.status)==="blocked"&&!!((t=e==null?void 0:e.review)!=null&&t.label)}const Wx=new Set(["review","ready","running","blocked"]);function Vx(e,t=ni){const n=Array.isArray(e)?e.filter(Boolean):[],s=n.filter(sn),r=n.filter(l=>!sn(l)&&l.status!=="done"&&Wx.has(l.status)),i=n.filter(l=>l.status==="done");return{waiting:s,active:r,done:i.slice(0,t),doneTotal:i.length}}function Kx(e,t){return(Array.isArray(e)?e:[]).find(s=>sn(s)&&s.id!==t)||null}function Fh(e){return(Array.isArray(e)?e.filter(Boolean):[]).filter(sn).length}function Iu(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 _u(e){return(Array.isArray(e)?e.filter(Boolean):[]).filter(n=>!Iu(n)).length}function Sc(e){return(Array.isArray(e)?e:[]).filter(n=>n&&(n.status==="running"||n.status==="ready")).length}function Qx(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 Nc({waiting:e=0,unseen:t=0,running:n=0}={}){return Number(e)>0?"waiting":Number(t)>0?"done":Number(n)>0?"running":null}function Gx({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 Yx(e){const t=Number(e)||0;return t?C("review.doneRecent",{n:Math.min(t,ni)}):C("review.doneEmpty")}function Fg(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 Jx(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(u=>String((u==null?void 0:u.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(u=>String((u==null?void 0:u.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 qx(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 Mu(e){return(typeof e=="string"?e:String((e==null?void 0:e.id)??(e==null?void 0:e.label)??"")).trim()||"—"}function Xx(e){return(e==null?void 0:e.mode)!=="annotation"}function Zx(e){return!!e&&e!=="standard"&&e!=="sheet"}const ek=/recommend|\u63a8\u5968/i,tk=/not\s+recommended|no\s+recommend|\u975e\u63a8\u5968/i;function nk(e){if(!e)return!1;const t=e.recommended;if(t===!0||t==="true")return!0;const n=`${e.label??""} ${e.detail??""}`;return tk.test(n)?!1:ek.test(n)}function sk(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(f=>nk(f))||null,c=String((r==null?void 0:r.id)??`q${i+1}`),u=o&&o.id!=null&&o.id!==""?String(o.id):null;n.push({id:c,choice:u,note:""}),u&&s.push(`Q${i+1}:${u}`)}),{canFastTrack:s.length>0,summary:s.join(" · "),answers:n}}function rk(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 ak(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 ik({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=>sn(s));return n!=null&&n.id?{kind:"review",taskId:String(n.id)}:Number(t)>0?{kind:"inbox"}:null}const Bh="hm.chatReportSeenAt",ia="hm.chatReportSeen",Uh=3,ck="hm.storedSid",Bg="hm.lastStoredSid",ur="__latest__",uk=["kind","status","board","spec","repoPath","markdown","followUpPrompt","counts"];function Wd(e){return String((e==null?void 0:e.kind)??"")==="pipeline"}function Lo(e){const t={};for(const n of uk){const s=e==null?void 0:e[n];s!=null&&(t[n]=s)}return t}function Lu(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(!Wd(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)??""),...Lo(i)})}return[...r.values()].sort((i,l)=>l.at-i.at)}function dk(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(!Wd(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)??""),...Lo(i)})}return[...r.values()].sort((i,l)=>l.at-i.at)}function pk(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 An(e=globalThis.localStorage){try{return String((e==null?void 0:e.getItem(ck))||(e==null?void 0:e.getItem(Bg))||"").trim()}catch{return""}}function hk(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 mk(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 fk(e,t,n=Uh){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)||Uh);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,...Lo(i)}))}function Ug(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 u=i.get(o);(!u||c>=u.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)??""),...Lo(l)})}return[...i.values()].sort((l,o)=>o.at-l.at)}function ro(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 Hg(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((u,f)=>u[1]-f[1]).slice(-50),c={};for(const[u,f]of o)c[u]=f;return c}function gk(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=ro(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=Hg(r,l,Math.max(s,o));return r}function sr(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 yk(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(ur)?s:(Array.isArray(t)?t:[]).some(l=>String((l==null?void 0:l.sessionId)??"").trim()===ur&&String((l==null?void 0:l.repoPath)??"").trim().toLowerCase()===r)?[...s,ur]:s}function Vd(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 Fr(e,t=""){return String((e==null?void 0:e.followUpPrompt)??"").trim()||String(t??"").trim()}function wk(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 zg="hm.haptic",Hh={tap:16,action:22,heavy:32,success:[8,35,10],error:[14,35,14]};function Kd(e=globalThis.localStorage){try{return(e==null?void 0:e.getItem(zg))!=="0"}catch{return!0}}function xk(e,t=globalThis.localStorage){const n=!!e;try{t==null||t.setItem(zg,n?"1":"0")}catch{}return n}function kk(e,t=globalThis.navigator,n=globalThis.localStorage){if(!Array.isArray(e)&&typeof e!="number"||!Kd(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 z(e="tap",t=globalThis.navigator,n=globalThis.localStorage){if(!Kd(n)||typeof(t==null?void 0:t.vibrate)!="function")return!1;const s=Hh[e]??Hh.tap;try{return!!t.vibrate(s)}catch{return!1}}const Wg=d.createContext(null);function bk(e){try{localStorage.setItem(Dg,e)}catch{}}function Sk({children:e,initial:t}){const[n,s]=d.useState(()=>fa(t)??$g()??"auto"),r=d.useMemo(()=>n==="en"||n==="ja"?n:Ru("auto"),[n]);d.useEffect(()=>{Dh(r),typeof document<"u"&&document.documentElement.setAttribute("lang",r)},[r]),d.useEffect(()=>Fx(o=>{o!==r&&s(o)}),[r]);const i=d.useCallback(o=>{const c=fa(o)??"auto";s(c),bk(c),Dh(c==="auto"?Ru("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=d.useMemo(()=>({lang:r,pref:n,locale:r==="ja"?"ja-JP":"en-US",setPref:i,t:(o,c)=>Mo(r,o,c)}),[r,n,i]);return d.createElement(Wg.Provider,{value:l},e)}function $e(){return d.useContext(Wg)??{lang:so()??zd,pref:"auto",locale:so()==="ja"?"ja-JP":"en-US",setPref:()=>{},t:C}}function Oe({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 vn({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 Qn({label:e,size:t=18}){const{t:n}=$e(),s=e??n("common.loading");return a.jsxs("div",{className:"hm-loader",role:"status","aria-live":"polite",children:[a.jsx(vn,{size:t}),s?a.jsx("span",{children:s}):null]})}function yr({onRefresh:e,variant:t="btn",label:n,ariaLabel:s,busy:r=!1,disabled:i=!1,className:l=""}){const{t:o}=$e(),c=n??o("common.refresh"),u=s??o("common.refresh"),[f,g]=d.useState(!1),[h,S]=d.useState(!1),k=d.useRef(null),x=d.useRef(!0);d.useEffect(()=>(x.current=!0,()=>{x.current=!1,clearTimeout(k.current)}),[]);const N=f||r,w=async()=>{if(N||i||!e)return;z("tap"),clearTimeout(k.current),S(!1),g(!0);const A=Date.now();let T=!0;try{await e()===!1&&(T=!1)}catch{T=!1}const M=Math.max(0,260-(Date.now()-A));M&&await new Promise(_=>setTimeout(_,M)),x.current&&(g(!1),T?(S(!0),k.current=setTimeout(()=>{x.current&&S(!1)},1100)):z("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:w,disabled:N||i,"aria-busy":N,"aria-label":u,title:u,children:[a.jsx("span",{className:`hm-refresh-ico${N?" hm-spin":""}`,"aria-hidden":"true",children:a.jsx(Oe,{name:h?"check":"refresh",size:v})}),t!=="icon"&&c?a.jsx("span",{children:N?o("common.refreshing"):h?o("common.refreshed"):c}):null]})}let Nk=0;const es=[];let rr=!1,Mr=null,ao=!1,zh=!1;function jk(){var t;if(ao){ao=!1;return}if(!es.length){rr=!1;return}const e=es.pop();es.length||(rr=!1),(t=e==null?void 0:e.close)==null||t.call(e)}function We({title:e,onClose:t,children:n}){const{t:s}=$e(),r=d.useRef(t);r.current=t,d.useEffect(()=>{var c,u;if(typeof window>"u"||!((c=window.history)!=null&&c.pushState)||((u=window.history.state)==null?void 0:u.hmSheet)==="inbox"||window.location.hash.startsWith("#inbox"))return;zh||(window.addEventListener("popstate",jk),zh=!0),Mr!==null&&(clearTimeout(Mr),Mr=null);const l=`s-${++Nk}`,o={token:l,close:()=>{var f;return(f=r.current)==null?void 0:f.call(r)}};if(es.push(o),!rr)try{window.history.pushState({...window.history.state??{},hmSheetId:l},"",window.location.href),rr=!0}catch{const f=es.indexOf(o);f!==-1&&es.splice(f,1);return}return()=>{const f=es.indexOf(o);f!==-1&&es.splice(f,1),es.length===0&&rr&&Mr===null&&(Mr=setTimeout(()=>{if(Mr=null,es.length===0&&rr){rr=!1,ao=!0;try{window.history.back()}catch{ao=!1}}},0))}},[]);const i=()=>{z("tap"),t==null||t()};return a.jsx("div",{className:"sheet-wrap",onClick:i,children:a.jsxs("div",{className:"sheet",onClick:l=>l.stopPropagation(),children:[a.jsxs("div",{className:"sheet-head",children:[a.jsx("span",{children:e}),a.jsx("button",{className:"icon-btn",onClick:i,"aria-label":s("common.close"),children:a.jsx(Oe,{name:"close",size:18})})]}),a.jsx("div",{className:"sheet-body",children:n})]})})}function ts({onFire:e,ms:t=1500,label:n,sub:s,hint:r,tone:i="danger",disabled:l}){const[o,c]=d.useState(0),u=d.useRef(null),f=d.useRef(null),g=d.useRef(0),h=d.useCallback(()=>{clearTimeout(u.current),cancelAnimationFrame(f.current),c(0)},[]),S=d.useCallback(()=>{if(l)return;g.current=performance.now();const k=()=>{const x=Math.min(1,(performance.now()-g.current)/t);c(x),x<1&&(f.current=requestAnimationFrame(k))};f.current=requestAnimationFrame(k),u.current=setTimeout(()=>{h(),z("heavy"),e()},t)},[l,t,e,h]);return d.useEffect(()=>h,[h]),a.jsxs("button",{className:`hold ${i}`,disabled:l,onPointerDown:S,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 Vg="hm.sound",Wh=.14,Ft={C5:523.25,E5:659.25,G5:783.99,C6:1046.5};function Qd(){try{return globalThis.localStorage??null}catch{return null}}function Gd(e=Qd()){try{return(e==null?void 0:e.getItem(Vg))!=="0"}catch{return!0}}function Ck(e,t=Qd()){const n=!!e;try{t==null||t.setItem(Vg,n?"1":"0")}catch{}return n}function Ek(e){return 2**((Math.max(1,Math.min(7,Math.floor(Number(e)||1)))-1)*2/12)}function Tk(e="tap",t=1){const n=(l,o,c,u="triangle",f=.1)=>({freq:Number(l.toFixed(2)),at:Number(o.toFixed(3)),dur:c,type:u,gain:Math.min(Wh,f)});let s;switch(e){case"send":s=[n(Ft.E5,0,.045,"sine",.065),n(Ft.G5,.03,.05,"sine",.055)];break;case"approve":case"stamp":s=[n(Ft.C5,0,.08,"triangle",.1),n(Ft.G5,.05,.08,"sine",.1)];break;case"launch":s=[n(Ft.C5,0,.08,"triangle",.1),n(Ft.E5,.045,.08,"triangle",.1),n(Ft.G5,.09,.1,"sine",.1)];break;case"combo":{const l=Ek(t);s=[n(Ft.C5*l,0,.07,"sine",.09),n(Ft.E5*l,.045,.07,"sine",.09),n(Ft.G5*l,.09,.08,"sine",.09)];break}case"allClear":case"receipt":s=[n(Ft.C5,0,.16,"triangle",.11),n(Ft.E5,.05,.16,"sine",.11),n(Ft.G5,.1,.16,"sine",.11),n(Ft.C6,.15,.18,"sine",.1)];break;default:s=[n(Ft.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(Wh,i)}}let jc=null;function Yd(e,t={}){if(!Gd(t.storage??Qd()))return!1;const n=t.AudioContext??globalThis.AudioContext??globalThis.webkitAudioContext;if(typeof n!="function")return!1;try{jc||(jc=new n);const s=jc;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=Tk(e,t.combo),l=()=>{const o=Number(s.currentTime)||0;for(const c of i.notes){const u=s.createOscillator(),f=s.createGain();u.type=c.type,u.frequency.setValueAtTime(c.freq,o+c.at),f.gain.setValueAtTime(1e-4,o+c.at),f.gain.exponentialRampToValueAtTime(Math.max(2e-4,c.gain),o+c.at+.012),f.gain.exponentialRampToValueAtTime(1e-4,o+c.at+c.dur),u.connect(f),f.connect(s.destination),u.start(o+c.at),u.stop(o+c.at+c.dur+.02)}};return s.state==="suspended"&&r?r.then(l,()=>{}):l(),!0}catch{return!1}}const io="hm.vibe",as="dopamine",Jd="(prefers-reduced-motion: reduce)",Oo=2e4,Ak=99,Rk="hm:vibe",Ou="hm:fx-burst",Vh=["approve","stamp","fastTrack","launch"],Pk={allClear:[10,30,16,30,40],receipt:[10,30,16,30,40],approve:"success",stamp:"success",fastTrack:"success",launch:"success",combo:"action",tap:"tap"},Ik={allClear:"success",receipt:"success",approve:"success",stamp:"success",fastTrack:"success",launch:"success",combo:"action",tap:"tap"};function Ci(){try{return globalThis.localStorage??null}catch{return null}}function _k(e){if(e)return e;try{return globalThis.document??null}catch{return null}}function qd(e){if(e)return e;try{return globalThis.window??null}catch{return null}}function Mk(){try{const e=globalThis.window;if(typeof(e==null?void 0:e.matchMedia)=="function")return t=>e.matchMedia(t)}catch{}return null}function ks(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 Do(e){try{let t=e??Mk();if(typeof t=="function"&&(t=t(Jd)),t&&typeof t.matches=="boolean")return t.matches}catch{}return!1}function Lk(e=Ci(),t){let n=null;try{n=ks(e==null?void 0:e.getItem(io))}catch{n=null}return n||(Do(t)?"serotonin":as)}function Du(e,t){const n=ks(e)??as,s=_k(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 la=null;const $u=new Set;let As=null;function Kg(e){for(const t of[...$u])try{t(e)}catch{}}function Qg(e){return $u.add(e),()=>$u.delete(e)}function fs(){return la||(la=Lk()),la}function Kh(e,t=Ci(),n,s){const r=ks(e)??as;Du(r,n),la=r;try{t==null||t.setItem(io,r)}catch{}Kg(r);const i=qd(s);try{typeof(i==null?void 0:i.dispatchEvent)=="function"&&typeof globalThis.CustomEvent=="function"&&i.dispatchEvent(new globalThis.CustomEvent(Rk,{detail:{vibe:r}}))}catch{}return r}function Ok(e={}){const t=e.storage??Ci();let n=null;try{n=ks(t==null?void 0:t.getItem(io))}catch{n=null}const s=n??(Do(e.matchMedia)?"serotonin":as);if(Du(s,e.doc),la=s,As||n)return s;const r=qd(e.win);if(typeof(r==null?void 0:r.matchMedia)!="function")return s;try{As=r.matchMedia(Jd);const i=()=>{var o;if(ks((o=Ci())==null?void 0:o.getItem(io)))return;const l=Du(As.matches?"serotonin":as,e.doc);la=l,Kg(l)};typeof As.addEventListener=="function"?As.addEventListener("change",i):typeof As.addListener=="function"&&As.addListener(i)}catch{As=null}return s}function Dk(e,t={}){const n=ks(t.vibe)??as,s=Number(t.now)||0,r=Number(t.windowMs)||Oo;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,Ak):1,at:s}}function $k(e,t={}){if((ks(t.vibe)??as)!=="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)||Oo;return i<r||i-r<=l?s:0}class Fk{constructor(t={}){this.vibe=t.vibe??as,this.now=typeof t.now=="function"?t.now:()=>Date.now(),this.windowMs=Number(t.windowMs)||Oo,this.state={combo:0,at:0},this.lastKind=null}get mode(){return ks(typeof this.vibe=="function"?this.vibe():this.vibe)??as}get combo(){return $k(this.state,{vibe:this.mode,now:this.now(),windowMs:this.windowMs})}bump(t="tap"){return this.lastKind=t,this.state=Dk(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 Qh=new Fk({vibe:()=>fs()});function Bk(e){const t=qd(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(Ou,{detail:n})),!0}catch{return!1}}function Uk(e,t={}){const n=ks(t.vibe)??as,s=Number(t.combo)||0,r={kind:e,vibe:n,combo:s,haptic:null,fx:!1,sound:!1};if(n==="serotonin"){const l=Ik[e]??"tap";return typeof t.hapticFn=="function"&&t.hapticFn(l),r.haptic=l,r}const i=Pk[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=Bk({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 vt(e,t={}){var f,g,h;const n=fs(),s=t.storage??Ci(),r=Vh.includes(e)?Qh.bump(e):Qh.combo,i=r>1&&Vh.includes(e)?"combo":e;let{x:l,y:o,width:c,height:u}=t;if(!Number.isFinite(l)&&!Number.isFinite(o))try{const S=(h=(g=(f=globalThis.document)==null?void 0:f.activeElement)==null?void 0:g.getBoundingClientRect)==null?void 0:h.call(g);S&&S.width>0&&S.height>0&&(l=Math.round(S.left+S.width/2),o=Math.round(S.top+S.height/2),c=Math.round(S.width),u=Math.round(S.height))}catch{}return Uk(e,{vibe:n,combo:r,x:l,y:o,width:c,height:u,sfx:t.sfx,hapticFn:S=>z(S,void 0,s),vibrateFn:S=>kk(S,void 0,s),soundFn:(S,k)=>t.sound===!1||!Gd(s)?!1:Yd(i??S,{combo:k==null?void 0:k.combo,storage:s})})}function Hk({board:e,boards:t,defaultBoard:n,onClose:s,onCreated:r,notify:i}){var y,G;const{t:l}=$e(),[o,c]=d.useState(e??n??null),[u,f]=d.useState(""),[g,h]=d.useState(""),[S,k]=d.useState(!1),[x,N]=d.useState(0),[w,m]=d.useState(""),[v,A]=d.useState(!1),[T,M]=d.useState(!1),_=d.useRef(`${Date.now()}-${Math.random().toString(36).slice(2,10)}`),P=d.useRef(null);d.useEffect(()=>{const F=setTimeout(()=>{var K;return(K=P.current)==null?void 0:K.focus()},150);return()=>clearTimeout(F)},[]);const I=async()=>{const F=u.trim();if(!F){i==null||i(l("capture.needTitle"));return}if(!o){i==null||i(l("capture.needBoard"));return}A(!0);try{const K=await X(`/api/boards/${encodeURIComponent(o)}/tasks`,{method:"POST",body:{title:F,body:g.trim(),priority:x,assignee:w.trim()||null,idempotencyKey:_.current}});if(!(K!=null&&K.ok)){i==null||i((K==null?void 0:K.error)||l("capture.failed"));return}i==null||i(K.created?l("capture.created",{id:K.task.id}):l("capture.already",{id:K.task.id})),z("action"),r==null||r(K.task),s==null||s()}catch(K){i==null||i(K.message)}finally{A(!1)}};return a.jsxs(We,{title:l("capture.title"),onClose:s,children:[a.jsxs("button",{className:"pick-item board-now",onClick:()=>{z("tap"),M(F=>!F)},"aria-expanded":T,"aria-label":l("capture.boardAria"),children:[a.jsx("span",{"aria-hidden":"true",children:((y=(t??[]).find(F=>F.slug===o))==null?void 0:y.icon)??"🗂"}),a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:((G=(t??[]).find(F=>F.slug===o))==null?void 0:G.name)??l("capture.board")}),a.jsx("span",{className:"pick-sub",children:l("capture.boardPick")})]}),a.jsx("span",{className:"pick-meta",children:T?"▴":"▾"})]}),T?a.jsx("div",{className:"pick-list",style:{marginBottom:8},children:(t??[]).map(F=>a.jsxs("button",{className:`pick-item${o===F.slug?" on":""}`,onClick:()=>{c(F.slug),M(!1)},children:[a.jsx("span",{"aria-hidden":"true",children:F.icon}),a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:F.name})}),a.jsx("span",{className:"pick-meta",children:o===F.slug?"✓":""})]},F.slug))}):null,a.jsx("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:a.jsx("input",{ref:P,className:"inp",value:u,onChange:F=>f(F.target.value.slice(0,200)),onKeyDown:F=>{F.key==="Enter"&&!F.nativeEvent.isComposing&&(F.preventDefault(),I())},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:()=>k(F=>!F),children:l(S?"capture.moreClose":"capture.moreOpen")}),S?a.jsxs("div",{style:{marginTop:6},children:[a.jsx("textarea",{className:"inp",rows:3,value:g,onChange:F=>h(F.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(F=>a.jsx("button",{className:`chip${x===F.v?" on":""}`,onClick:()=>N(F.v),children:l(F.key)},F.v))}),a.jsx("input",{className:"inp",style:{marginTop:10},value:w,onChange:F=>m(F.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:I,disabled:v||!u.trim(),"aria-busy":v,style:{marginTop:14},children:[v?a.jsx(vn,{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 Gg=280;function Yg(e){return e<=4351||e>=8192&&e<=8205||e>=8208&&e<=8223||e>=8242&&e<=8247?1:2}function si(e){if(!e)return 0;let t=0;for(const n of String(e))t+=Yg(n.codePointAt(0));return t}function zk(e,t,n="…"){const s=String(e??""),r=Number(t);if(!Number.isFinite(r)||r<=0)return"";if(si(s)<=r)return s;const i=String(n??""),l=si(i);if(l>r)return"";const o=r-l;let c=0,u="";for(const f of s){const g=Yg(f.codePointAt(0));if(c+g>o)break;c+=g,u+=f}return`${u}${i}`}function Wk(e,{limit:t=Gg,joiner:n=`
63
- `,steps:s=[]}={}){const r=(Array.isArray(e)?e:[]).map(u=>String(u??"")),i=String(n??""),l=Number(t),o=u=>u.filter(Boolean).join(i),c=[];for(let u=0;u<s.length&&!(si(o(r))<=l);u+=1){const f=s[u];if(!(!f||typeof f!="object")){if(Number.isInteger(f.drop)){f.drop>=0&&f.drop<r.length&&(r[f.drop]=""),c.push(u);continue}if(Array.isArray(f.set)&&f.set.length===2){const g=Number(f.set[0]);Number.isInteger(g)&&g>=0&&g<r.length&&(r[g]=String(f.set[1]??"")),c.push(u);continue}if(Number.isInteger(f.truncate)){const g=f.truncate;if(g>=0&&g<r.length&&r[g]){const h=r.filter((x,N)=>N!==g&&x),S=h.join(i),k=l-si(S)-(h.length?si(i):0);r[g]=zk(r[g],k)}c.push(u);continue}if(Array.isArray(f.cutAt)&&f.cutAt.length===2){const g=Number(f.cutAt[0]),h=String(f.cutAt[1]??"");Number.isInteger(g)&&g>=0&&g<r.length&&h&&r[g].includes(h)&&(r[g]=r[g].slice(0,r[g].lastIndexOf(h)).trimEnd()),c.push(u)}}}return{text:o(r),applied:c}}const ri=1200,ai=630,ol=2,Vk=["cost","cache","saved","zeroTyping","tests","duration","apiCalls","totalTokens"],Kk=4;function Qk(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 Ie(e,t,n){return Mo(e,t,n)}function us(e,t,n){const s=(t==null?void 0:t.kpi)??{},r=Ie(n,"receipt.value.na");switch(e){case"cost":return s.costUsd===null||s.costUsd===void 0?r:aa(s.costUsd);case"cache":return s.cachePct===null||s.cachePct===void 0?r:`${Ht(s.cachePct,{maximumFractionDigits:1})}%`;case"saved":return s.savedUsd===null||s.savedUsd===void 0?r:`~${aa(s.savedUsd)}`;case"zeroTyping":return s.zeroTypingScore===null||s.zeroTypingScore===void 0?r:`${Ht(s.zeroTypingScore,{maximumFractionDigits:0})}%`;case"tests":return s.tests===null||s.tests===void 0?r:Ht(s.tests,{maximumFractionDigits:0});case"duration":return s.durationMin===null||s.durationMin===void 0?r:s.durationCapped?Ie(n,"receipt.value.over",{h:Ht((t==null?void 0:t.windowHours)??24,{maximumFractionDigits:0})}):Number(s.durationMin)>=60?Ie(n,"receipt.value.hours",{h:Ht(Math.floor(Number(s.durationMin)/60),{maximumFractionDigits:0}),m:Ht(Math.round(Number(s.durationMin)%60),{maximumFractionDigits:0})}):Ie(n,"receipt.value.min",{min:Ht(s.durationMin,{maximumFractionDigits:0})});case"apiCalls":return s.apiCalls===null||s.apiCalls===void 0?r:Ie(n,"receipt.value.calls",{n:Ht(s.apiCalls,{maximumFractionDigits:0})});case"totalTokens":return s.totalTokens===null||s.totalTokens===void 0?r:Qk(s.totalTokens);default:return r}}function Fu(e,t){if(e==null)return null;const n=Number(e);return!Number.isFinite(n)||n<=0?null:n>=60?Ie(t,"receipt.value.hours",{h:Ht(Math.floor(n/60),{maximumFractionDigits:0}),m:Ht(Math.round(n%60),{maximumFractionDigits:0})}):Ie(t,"receipt.value.min",{min:Ht(n,{maximumFractionDigits:0})})}function Jg(e,t){const n=(e==null?void 0:e.kpi)??{};return Vk.map(s=>({key:s,label:Ie(t,`receipt.kpi.${s}`),value:us(s,e,t),note:s==="saved"&&n.savedUsd!==null&&n.savedUsd!==void 0?Ie(t,"receipt.kpi.savedNote",{pct:Math.round((n.savedRatio??.9)*100)}):s==="zeroTyping"&&n.zeroTypingScore!==null&&n.zeroTypingScore!==void 0?Ie(t,"receipt.kpi.zeroTypingNote"):s==="duration"&&(n.durationMin===null||n.durationMin===void 0)?Ie(t,"receipt.kpi.durationNote",{hours:(e==null?void 0:e.windowHours)??24}):s==="duration"&&Fu(n.wallDurationMin,t)?Ie(t,"receipt.kpi.wallNote",{wall:Fu(n.wallDurationMin,t)}):s==="tests"&&(n.tests===null||n.tests===void 0)?Ie(t,"receipt.kpi.testsNote"):s==="apiCalls"&&(n.apiCalls===null||n.apiCalls===void 0)?Ie(t,"receipt.kpi.apiCallsNote"):s==="apiCalls"?Ie(t,"receipt.kpi.apiCallsScope"):s==="totalTokens"&&(n.totalTokens===null||n.totalTokens===void 0)?Ie(t,"receipt.kpi.totalTokensNote"):s==="totalTokens"?Ie(t,"receipt.kpi.totalTokensScope"):""}))}function Xd(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 lo(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 Gk(e,t={}){return Yk(e,t).text}function Yk(e,t={}){const n=t.lang,s=(e==null?void 0:e.kpi)??{},r=Number(s.batchesDone)||0,i=Number(s.batchesTotal)||r,l=lo(e)??"—",o=Ie(n,"receipt.share.batches",{batches:l,done:r,total:i}),c=`🏆 ${Ie(n,"receipt.share.title")} — ${Xd(e)}`,u=Fu(s.wallDurationMin,n),f=u?` (${Ie(n,"receipt.share.wall",{wall:u})})`:"",g=v=>[`✅ ${o}`,`⏱ ${us("duration",e,n)}${v?f:""}`,`🧪 ${us("tests",e,n)} ${Ie(n,"receipt.share.testsSuffix")}`,`🔌 ${us("apiCalls",e,n)}`,`🪙 ${us("totalTokens",e,n)} ${Ie(n,"receipt.share.tokensSuffix")}`].join(" · "),h=g(!0),S=g(!1),k=`💰 ${us("cost",e,n)} · 💎 ${us("cache",e,n)} ${Ie(n,"receipt.share.cacheSuffix")} · ✨ ${us("saved",e,n)} ${Ie(n,"receipt.share.savedSuffix")}`,x=`👆 ${Ht(s.humanTaps??0)} ${Ie(n,"receipt.share.tapsSuffix")} · 🖊 ${Ht(s.redlines??0)} ${Ie(n,"receipt.share.redlinesSuffix")} · ⌨️ ${Ht(s.typedChars??0)} ${Ie(n,"receipt.share.typedSuffix")} · ${us("zeroTyping",e,n)} ${Ie(n,"receipt.share.zeroSuffix")}`,N=Ie(n,"receipt.share.footer"),w=[{drop:4},{drop:3},{drop:2},{set:[1,S]},{truncate:0},{cutAt:[0," — "]}],m=Number.isFinite(Number(t.limit))?Number(t.limit):Gg;return Wk([c,h,k,x,N],{limit:m,steps:w})}function Jk(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 Cc(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 qk(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 Xk(e,t,n={}){const s=n.lang,i=(n.vibe==="serotonin"?"serotonin":"dopamine")==="dopamine",l=ri,o=ai,c=Jg(t,s),u=i?"#06202a":"#14161c",f=i?"#0b3440":"#1b1e26";let g=f;if(typeof e.createLinearGradient=="function"){const _=e.createLinearGradient(0,0,l,o);_.addColorStop(0,u),_.addColorStop(1,f),g=_}e.fillStyle=g,e.fillRect(0,0,l,o),e.lineWidth=3,e.strokeStyle=i?"#e8c47a":"#3a3f4b",Cc(e,24,24,l-48,o-48,26),e.stroke();const h=(_,P,I,{font:y,color:G,align:F="left",maxWidth:K}={})=>{e.font=y,e.fillStyle=G,e.textAlign=F,e.fillText(K?qk(e,_,K):String(_??""),P,I)},S="ui-monospace, SFMono-Regular, Menlo, monospace",k='-apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif',x=i?k:S,N=i?"SSR":Ie(s,"receipt.badge.audit");Cc(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(N,60+(i?46:84),86,{font:`600 17px ${S}`,color:i?"#e8c47a":"#c9ced8",align:"center"}),h(i?Ie(s,"receipt.canvas.titleDopamine"):Ie(s,"receipt.canvas.titleSerotonin"),60,158,{font:`700 42px ${x}`,color:"#ffffff",maxWidth:l-120}),h(Xd(t),60,200,{font:`500 24px ${k}`,color:i?"#8fe3d6":"#aab2c0",maxWidth:l-120});const w=[t!=null&&t.spec?String(t.spec):null,Ie(s,"receipt.canvas.window",{hours:(t==null?void 0:t.windowHours)??24}),lo(t)?Ie(s,"receipt.canvas.batches",{batches:lo(t)}):null].filter(Boolean).join(" · ");h(w,60,236,{font:`400 18px ${S}`,color:"#8b95a5",maxWidth:l-120});const m=20,v=Kk,A=(l-120-m*(v-1))/v,T=128,M=272;return c.forEach((_,P)=>{const I=P%v,y=Math.floor(P/v),G=60+I*(A+m),F=M+y*(T+m);Cc(e,G,F,A,T,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(_.label,G+18,F+34,{font:`500 15px ${k}`,color:"#93a0b1",maxWidth:A-36}),h(_.value,G+18,F+86,{font:`700 32px ${i?k:S}`,color:i?"#ffd98a":"#f2f5fa",maxWidth:A-36})}),h(Ie(s,"receipt.canvas.footer"),60,o-54,{font:`400 18px ${S}`,color:"#7d8798",maxWidth:l-120}),h(Ie(s,"receipt.canvas.size"),l-60,o-54,{font:`400 16px ${S}`,color:"#5f6a7b",align:"right"}),{width:l,height:o,kpis:c}}function Gh(){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 Yh(e,t){if(typeof document>"u")return null;const n=document.createElement("canvas");n.width=ri*ol,n.height=ai*ol;const s=n.getContext("2d");if(!s)return null;s.scale(ol,ol),Xk(s,e,t);const r=document.createElement("canvas");r.width=ri,r.height=ai;const i=r.getContext("2d");return i?(i.drawImage(n,0,0,ri,ai),new Promise(l=>{try{r.toBlob(o=>l(o??null),"image/png")}catch{l(null)}})):null}function Zd({board:e=null,spec:t=null,hours:n=24,onClose:s,notify:r}){var y,G,F,K;const{t:i,lang:l}=$e(),[o,c]=d.useState(null),[u,f]=d.useState(null),[g,h]=d.useState(!0),[S,k]=d.useState(!1),[x,N]=d.useState(Gh),[w,m]=d.useState(null);d.useEffect(()=>{const D=()=>N(Gh());return window.addEventListener("hm:vibe",D),()=>window.removeEventListener("hm:vibe",D)},[]),d.useEffect(()=>{let D=!0;const ae=new URLSearchParams({hours:String(n)});return e&&ae.set("board",e),t&&ae.set("spec",t),h(!0),X(`/api/telemetry/receipt?${ae}`).then(fe=>{D&&(c(fe),f(null))}).catch(fe=>{D&&f((fe==null?void 0:fe.message)??i("receipt.failed"))}).finally(()=>{D&&h(!1)}),()=>{D=!1}},[e,t,n]),d.useEffect(()=>{if(!o)return;let D=!0,ae=null;return Yh(o,{lang:l,vibe:x}).then(fe=>{!D||!fe||(ae=URL.createObjectURL(fe),m(ae))}).catch(()=>{}),()=>{D=!1,ae&&URL.revokeObjectURL(ae)}},[o,l,x]);const v=o?Jg(o,l):[],A=o?Gk(o,{lang:l}):"",T=Array.isArray(o==null?void 0:o.missing)?o.missing:[],M=(o==null?void 0:o.scope)??null,_=M?[i("receipt.scope.usage",{sessions:Number(((y=M.usage)==null?void 0:y.sessionIds)??((G=o==null?void 0:o.kpi)==null?void 0:G.sessions)??0),tasks:Number(M.tasks??0)}),(F=M.usage)!=null&&F.fallback?i("receipt.scope.fallback"):null].filter(Boolean).join(" · "):"",P=d.useCallback(async()=>{var D;if(!(!o||S)){z("tap"),k(!0);try{const ae=await Yh(o,{lang:l,vibe:x});if(!ae)throw new Error(i("receipt.failed"));const fe=Jk(o),te=typeof File=="function"?new File([ae],fe,{type:"image/png"}):null;if(te&&((D=navigator.canShare)!=null&&D.call(navigator,{files:[te]})))try{await navigator.share({files:[te],title:i("receipt.title"),text:A}),z("success");return}catch{}const Y=URL.createObjectURL(ae),E=document.createElement("a");E.href=Y,E.download=fe,document.body.appendChild(E),E.click(),E.remove(),setTimeout(()=>URL.revokeObjectURL(Y),4e3),z("success"),r==null||r(fe)}catch(ae){z("error"),r==null||r((ae==null?void 0:ae.message)??i("receipt.failed"))}finally{k(!1)}}},[o,S,l,x,A,r,i]),I=d.useCallback(async()=>{var D;if(A){z("tap");try{if((D=navigator.clipboard)!=null&&D.writeText)await navigator.clipboard.writeText(A);else{const ae=document.createElement("textarea");ae.value=A,ae.setAttribute("readonly",""),ae.style.position="fixed",ae.style.opacity="0",document.body.appendChild(ae),ae.select(),document.execCommand("copy"),ae.remove()}z("success"),r==null||r(i("receipt.copied"))}catch{z("error"),r==null||r(i("receipt.copyFailed"))}}},[A,r,i]);return a.jsx(We,{title:i("receipt.title"),onClose:s,children:a.jsx("div",{className:`receipt-sheet is-${x}`,children:g?a.jsx(Qn,{label:i("receipt.loading")}):u?a.jsx("div",{className:"empty",children:u}):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:Xd(o)}),a.jsx("span",{className:"receipt-head-sub",children:[lo(o),o.spec,i("receipt.canvas.window",{hours:o.windowHours??n}),Je(o.generatedAt)].filter(Boolean).join(" · ")})]})]}),w?a.jsx("img",{className:"receipt-preview",src:w,width:ri,height:ai,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))}),_?a.jsx("div",{className:"receipt-note receipt-scope",children:_}):null,a.jsxs("div",{className:"receipt-actions",children:[a.jsx("button",{type:"button",className:"receipt-btn primary",onClick:P,disabled:S,children:i(S?"receipt.saving":"receipt.savePng")}),a.jsx("button",{type:"button",className:"receipt-btn",onClick:I,children:i("receipt.copyShare")})]}),a.jsx("div",{className:"receipt-note",children:i("receipt.shareNote")}),T.length?a.jsx("div",{className:"receipt-note warn",children:i("receipt.partial",{sources:T.join(", ")})}):null,a.jsx("div",{className:"receipt-note",children:i("receipt.savedNote",{pct:Math.round((((K=o==null?void 0:o.kpi)==null?void 0:K.savedRatio)??.9)*100)})})]}):a.jsx("div",{className:"empty",children:i("receipt.failed")})})})}function qg({data:e,hours:t=24,onClose:n,board:s=null,spec:r=null}){const{t:i}=$e(),l=e==null?void 0:e.totals,o=!!(e!=null&&e.ok),[c,u]=d.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx(We,{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:()=>{z("tap"),u(!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:aa(l.cost)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.input")}),a.jsx("b",{children:Ts(l.input)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.output")}),a.jsx("b",{children:Ts(l.output)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.cacheRead")}),a.jsxs("b",{children:[Ts(l.cacheRead)," (",Ox(e.cacheHitRate),")"]})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:i("usage.apiCalls")}),a.jsx("b",{children:Ht(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(f=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:f.model}),a.jsx("span",{className:"row-sub",children:i("usage.modelLine",{input:Ts(f.input),output:Ts(f.output),cache:Ts(f.cacheRead),calls:f.calls})})]}),a.jsx("span",{className:"mono",style:{fontSize:12},children:aa(f.cost)})]},f.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(f=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:f.title}),a.jsx("span",{className:"row-sub",children:i("usage.sessionLine",{source:f.source||"—",profile:f.profile&&f.profile!=="default"?` ・ ${f.profile}`:"",input:Ts(f.input),output:Ts(f.output),at:Je(f.at)})})]}),a.jsx("span",{className:"mono",style:{fontSize:12},children:aa(f.cost)})]},`${f.profile??"default"}:${f.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(Zd,{board:s,spec:r,hours:t,onClose:()=>u(!1)}):null]})}const ii=4e3,Zk=["feature","ux","bug"],Xg=Object.freeze(["zero-stop","visual-gate"]),oo="zero-stop";function ep(e){const t=String(e??"").trim().toLowerCase();return Xg.includes(t)?t:oo}function eb(e){return ep(e)==="visual-gate"?"seed.policyVisualGate":"seed.policyZeroStop"}function tb(e){return ep(e)==="visual-gate"?"seed.policyVisualGateHint":"seed.policyZeroStopHint"}function Jh(e){const t=String(e??"").trim();return t.length>0&&t.length<=ii}function Zg({seedText:e,autoStart:t=!1,executionPolicy:n=oo,board:s,repo:r=null,chat:i=null,lang:l="ja"}){const o={seedText:String(e??"").trim().slice(0,ii),autoStart:!!t,executionPolicy:ep(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 nb(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 sb=Object.freeze(["running","awaiting_review","awaiting_spec","failed"]);function rb(e){const t=String((e==null?void 0:e.queueState)??"");return t==="queued"?"seed.queueQueued":t==="running"?"seed.queueRunning":null}function tp(e){return String((e==null?void 0:e.queueState)??"")==="queued"}function ab(e){return tp(e)?"seed.statusQueued":nb(e==null?void 0:e.status)}function qh(e){return`/api/architect/jobs/${encodeURIComponent(String(e??""))}/dismiss`}const Xh=4e3,ib=2e4;function ev(e,t=[],n=""){const s=(Array.isArray(e)?e:[]).filter(c=>c&&sb.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,u)=>{const f=l?o(c)-o(u):0;if(f)return f;const g=(Number(u.createdAt)||0)-(Number(c.createdAt)||0);return g||(c.status==="failed"?0:1)-(u.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 cb(e){return e?String(e.status)==="failed"?!0:!!e.stalled:!1}function ub(e){return(Array.isArray(e)?e:[]).filter(t=>t&&!t.dismissed&&["running","awaiting_spec"].includes(String(t.status))).length}function tv(e){const t=String((e==null?void 0:e.status)??"");return tp(e)||t==="running"||t==="awaiting_spec"?Xh:ib}function db(){return"seed.runnerHermes"}function pb(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 nv({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}=$e(),[u,f]=d.useState(s),[g,h]=d.useState(!1),[S,k]=d.useState(oo),[x,N]=d.useState(!1),[w,m]=d.useState(null),v=d.useRef(null);d.useEffect(()=>{const M=setTimeout(()=>{var _;return(_=v.current)==null?void 0:_.focus()},150);return()=>clearTimeout(M)},[]);const A=d.useCallback(M=>{var P;const _=o(`seed.tpl.${M}Text`);f(I=>{const y=String(I??"");return y.startsWith(_)?y:`${_}${y}`.slice(0,ii)}),(P=v.current)==null||P.focus()},[o]),T=d.useCallback(async()=>{if(!(x||!Jh(u))){N(!0),m(null);try{const M=await X("/api/architect/seed",{method:"POST",body:Zg({seedText:u,autoStart:g,executionPolicy:S,board:e,repo:t,chat:n,lang:c})});try{vt("launch")}catch{}l==null||l(o("seed.toast")),i==null||i(M),r==null||r()}catch(M){m((M==null?void 0:M.message)??o("seed.failed")),N(!1)}}},[g,e,x,n,S,c,l,r,i,t,o,u]);return a.jsxs(We,{title:`📝 ${o("seed.title")}`,onClose:()=>!x&&(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:u,maxLength:ii,placeholder:o("seed.placeholder"),onChange:M=>f(M.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:[u.length,"/",ii]})]}),a.jsx("div",{className:"chips seed-templates",children:Zk.map(M=>a.jsx("button",{type:"button",className:"chip",onClick:()=>A(M),children:o(`seed.tpl.${M}`)},M))}),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:Xg.map(M=>a.jsxs("button",{type:"button",className:`seed-seg-btn${S===M?" on":""}`,"aria-pressed":S===M,onClick:()=>k(M),children:[a.jsx("span",{className:"seed-seg-name",children:o(eb(M))}),M===oo?a.jsx("span",{className:"seed-seg-tag",children:o("seed.policyDefault")}):null]},M))}),a.jsx("p",{className:"seed-hint seed-policy-hint",children:o(tb(S))}),a.jsxs("label",{className:"seed-toggle",children:[a.jsx("input",{type:"checkbox",checked:g,onChange:M=>{h(M.target.checked),M.target.checked&&vt("approve")}}),a.jsxs("span",{children:[o("seed.autoStart"),a.jsx("br",{}),a.jsx("span",{className:"seed-hint",children:o("seed.autoStartHint")})]})]}),w?a.jsx("div",{className:"seed-error",children:w}):null,a.jsx("button",{type:"button",className:"seed-submit",disabled:x||!Jh(u),onClick:T,children:x?o("seed.submitting"):`✨ ${o("seed.submit")}`})]})}const hb=[{id:"feature",key:"brainstorm.angleFeature"},{id:"ux",key:"brainstorm.angleUx"},{id:"edge",key:"brainstorm.angleEdge"}],mb=[{id:"css",key:"refactor.scopeCss"},{id:"code",key:"refactor.scopeCode"},{id:"rules",key:"refactor.scopeRules"},{id:"perf",key:"refactor.scopePerf"}];function Ec(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 fb({initialSeed:e="",board:t="",repo:n=null,onClose:s,notify:r}){const{t:i}=$e(),[l,o]=d.useState(e),[c,u]=d.useState(["feature","ux"]),[f,g]=d.useState(()=>e?Ec(e,["feature","ux"],i):[]),[h,S]=d.useState(!1),k=m=>{u(v=>v.includes(m)?v.length>1?v.filter(A=>A!==m):v:[...v,m])},x=()=>{l.trim()&&(g(Ec(l,c,i)),vt("approve"))},N=async()=>{if(!(!l.trim()&&!f.length)){S(!0);try{const m=f.length?f:Ec(l,c,i);await X("/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")),vt("launch"),r==null||r(i("brainstorm.saved")),s==null||s()}catch(m){r==null||r((m==null?void 0:m.message)||"Error")}finally{S(!1)}}},w=()=>{const m=f.map(A=>`- [ ] ${A.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(We,{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:hb.map(m=>a.jsx("button",{type:"button",className:`chip${c.includes(m.id)?" on":""}`,onClick:()=>k(m.id),children:i(m.key)},m.id))}),a.jsx("button",{type:"button",className:"btn",style:{width:"100%",marginTop:10},disabled:!l.trim(),onClick:x,children:i("brainstorm.generate")}),f.length?a.jsx("div",{className:"memo-checklist",style:{marginTop:10},children:f.map(m=>a.jsxs("button",{type:"button",className:`memo-check-row${m.done?" done":""}`,onClick:()=>g(v=>v.map(A=>A.id===m.id?{...A,done:!A.done}:A)),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()&&!f.length,onClick:N,children:i("brainstorm.saveMemo")}),a.jsx("button",{type:"button",className:"btn",disabled:!l.trim()&&!f.length,onClick:w,children:i("brainstorm.sendChat")})]})]})}function gb({board:e="",onClose:t,notify:n}){const{t:s}=$e(),[r,i]=d.useState(["css","code","rules"]),[l,o]=d.useState(""),[c,u]=d.useState(!1),[f,g]=d.useState(null),h=k=>{i(x=>x.includes(k)?x.length>1?x.filter(N=>N!==k):x:[...x,k])},S=async()=>{if(!(c||!e)){u(!0),g(null);try{const k=r.map(N=>s(`refactor.scope${N.charAt(0).toUpperCase()}${N.slice(1)}`)),x=[`Scopes: ${k.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 X(`/api/boards/${encodeURIComponent(e)}/tasks`,{method:"POST",body:{title:`[REFACTOR] ${k[0]}${l.trim()?` (${l.trim()})`:""}`,body:x,priority:1}}),vt("launch"),n==null||n(s("refactor.launched")),t==null||t()}catch(k){g((k==null?void 0:k.message)||s("refactor.failed")),u(!1)}}};return a.jsxs(We,{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:mb.map(k=>a.jsx("button",{type:"button",className:`chip${r.includes(k.id)?" on":""}`,onClick:()=>h(k.id),children:s(k.key)},k.id))}),a.jsx("input",{type:"text",className:"memo-input",style:{marginTop:10},value:l,placeholder:s("refactor.targetPh"),onChange:k=>o(k.target.value)}),f?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:f}):null,a.jsx("button",{type:"button",className:"btn primary",style:{width:"100%",marginTop:12},disabled:c||!e,onClick:S,children:s("refactor.launch")})]})}function rv({banner:e,onFile:t,busy:n=!1,onDismiss:s,onPreview:r}){const{t:i}=$e();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:()=>{z("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:()=>{z("tap"),r(e)},children:`📄 ${i("seed.bannerPreview")}`}):null]}),s?a.jsx("button",{type:"button",className:"attach-x","aria-label":i("seed.bannerLater"),onClick:()=>{z("tap"),s(e)},children:"×"}):null]})}const vb=["http:","https:","mailto:"],yb=/[\u0000-\u0020\u00a0\u1680\u2000-\u200f\u2028\u2029\u202f\u205f\u3000\ufeff]/g;function wb(e){const t=String(e??"").trim();if(!t)return null;const n=t.replace(yb,"");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 Bu="`",Zh=new RegExp(`^\\s{0,3}(${Bu}{3,}|~{3,})\\s*([A-Za-z0-9_+#.-]*)\\s*$`),em=/^\s{0,3}(#{1,6})\s+(.*)$/,Tc=/^\s{0,3}>\s?(.*)$/,cl=/^\s{0,3}[-*+]\s+(.*)$/,Ac=/^\s{0,3}(\d{1,9})[.)]\s+(.*)$/,xb=new RegExp('^\\[([^\\][\\n]*)\\]\\(([^)\\s]+)(?:\\s+"[^"]*")?\\)'),El=/^\s{0,3}\|.*\|\s*$/,kb=/^\s*:?-{2,}:?\s*$/;function Tl(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function Rc(e){if(!El.test(e))return!1;const t=Tl(e);return t.length>0&&t.every(n=>kb.test(n))}function ar(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===Bu){const o=t.indexOf(Bu,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:ar(t.slice(i+2,o))}),i=o+2;continue}}else if(l==="["){const o=xb.exec(t.slice(i));if(o){r();const c=wb(o[2]);n.push({type:"link",href:c,bare:c?null:o[2],children:ar(o[1])}),i+=o[0].length;continue}}s+=l,i+=1}return r(),n}function av(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=Zh.exec(r);if(i){const u=i[1],f=[];for(s+=1;s<t.length;){if(t[s].trim().startsWith(u)){s+=1;break}f.push(t[s]),s+=1}n.push({type:"code",lang:i[2]||"code",value:f.join(`
71
- `)});continue}const l=em.exec(r);if(l){n.push({type:"heading",level:Math.min(l[1].length,3),children:ar(l[2].replace(/\s+#+\s*$/,""))}),s+=1;continue}if(El.test(r)&&Rc(t[s+1]??"")){const u=Tl(r).map(h=>ar(h)),f=Tl(t[s+1]).map(h=>h.startsWith(":")&&h.endsWith(":")?"center":h.endsWith(":")?"right":h.startsWith(":")?"left":null);s+=2;const g=[];for(;s<t.length&&El.test(t[s])&&!Rc(t[s]);){const h=Tl(t[s]),S=u.map((k,x)=>ar(h[x]??""));g.push(S),s+=1}n.push({type:"table",head:u,aligns:f,rows:g});continue}if(Tc.test(r)){const u=[];for(;s<t.length;){const f=Tc.exec(t[s]);if(!f)break;u.push(f[1]),s+=1}n.push({type:"quote",blocks:av(u.join(`
72
- `))});continue}if(cl.test(r)||Ac.test(r)){const u=!cl.test(r),f=u?Ac:cl,g=[];for(;s<t.length;){const h=f.exec(t[s]);if(!h)break;g.push({children:ar(u?h[2]:h[1])}),s+=1}n.push({type:"list",ordered:u,items:g});continue}const o=[];for(;s<t.length;){const u=t[s];if(!u.trim()||Zh.test(u)||em.test(u)||El.test(u)&&Rc(t[s+1]??"")||Tc.test(u)||cl.test(u)||Ac.test(u))break;o.push(u),s+=1}o.length||(o.push(r),s+=1);const c=[];o.forEach((u,f)=>{f&&c.push({type:"br"}),c.push(...ar(u.trim()))}),n.push({type:"paragraph",children:c})}return n}function ir(e,t="i"){return(e??[]).map((n,s)=>{const r=`${t}-${s}`;if(n.type==="code")return Ue.createElement("code",{key:r,className:"md-code"},n.value);if(n.type==="strong")return Ue.createElement("strong",{key:r},ir(n.children,r));if(n.type==="br")return Ue.createElement("br",{key:r});if(n.type==="link"){const i=ir(n.children,r);return n.href?Ue.createElement("a",{key:r,className:"md-link",href:n.href,target:"_blank",rel:"noopener noreferrer"},...i):Ue.createElement("span",{key:r,className:"md-link-bare"},...i,n.bare?` (${n.bare})`:"")}return n.value})}function iv(e,t,n){const s=`b-${t}`,{onCopyCode:r,copyLabel:i}=n;if(e.type==="code"){const l=Ue.createElement("div",{className:"code-head"},Ue.createElement("span",null,e.lang),r?Ue.createElement("button",{type:"button",className:"code-copy",onClick:o=>{o.stopPropagation(),r(e.value)}},i):null);return Ue.createElement("div",{key:s,className:"code-block"},l,Ue.createElement("pre",null,Ue.createElement("code",null,e.value)))}if(e.type==="heading"){const l=`h${e.level}`;return Ue.createElement(l,{key:s,className:`md-h${e.level}`},ir(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 Ue.createElement("div",{key:s,className:"md-table-wrap"},Ue.createElement("table",{className:"md-table",style:{"--md-cols":e.head.length}},Ue.createElement("thead",null,Ue.createElement("tr",null,e.head.map((o,c)=>Ue.createElement("th",{key:`${s}-h-${c}`,style:l(c)},ir(o,`${s}-h-${c}`))))),Ue.createElement("tbody",null,e.rows.map((o,c)=>Ue.createElement("tr",{key:`${s}-r-${c}`},o.map((u,f)=>Ue.createElement("td",{key:`${s}-r-${c}-${f}`,style:l(f)},ir(u,`${s}-r-${c}-${f}`))))))))}if(e.type==="quote")return Ue.createElement("blockquote",{key:s,className:"md-quote"},e.blocks.map((l,o)=>iv(l,o,n)));if(e.type==="list"){const l=e.ordered?"ol":"ul";return Ue.createElement(l,{key:s,className:"md-list"},e.items.map((o,c)=>Ue.createElement("li",{key:`${s}-${c}`},ir(o.children,`${s}-${c}`))))}return Ue.createElement("p",{key:s,className:"md-p"},ir(e.children,s))}function li(e,t={}){const n=av(e),s={onCopyCode:t.onCopyCode??null,copyLabel:t.copyLabel??"Copy"};return Ue.createElement("div",{className:"md-body"},n.map((r,i)=>iv(r,i,s)))}function lv({board:e=null,repo:t=null,path:n,title:s=null,onClose:r}){const{t:i}=$e(),[l,o]=d.useState({loading:!0,data:null,error:null}),[c,u]=d.useState(!1);d.useEffect(()=>{let h=!0;o({loading:!0,data:null,error:null});const S=new URLSearchParams;return e&&S.set("board",e),t&&S.set("repo",t),n&&S.set("path",n),X(`/api/specs/content?${S.toString()}`).then(k=>{h&&o({loading:!1,data:k,error:null})}).catch(k=>{h&&o({loading:!1,data:null,error:(k==null?void 0:k.message)??i("tasks.specMdFailed")})}),()=>{h=!1}},[e,t,n,i]);const f=d.useCallback(async h=>{var S,k,x;try{await((x=(k=(S=globalThis.navigator)==null?void 0:S.clipboard)==null?void 0:k.writeText)==null?void 0:x.call(k,h)),z("tap"),u(!0),setTimeout(()=>u(!1),1600)}catch{}},[]),g=l.data;return a.jsxs(We,{title:i("tasks.specMdTitle"),onClose:r,children:[a.jsxs("div",{className:"spec-md-meta",children:[a.jsx("span",{className:"spec-md-path mono",title:(g==null?void 0:g.path)??n,children:(g==null?void 0:g.path)??n}),a.jsx("span",{className:"spec-md-sub",children:[g!=null&&g.batchCount?i("tasks.specBatchCount",{n:g.batchCount}):null,g!=null&&g.mtime?i("tasks.specUpdated",{when:Je(g.mtime)}):null].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:"spec-md-actions",children:[a.jsx("button",{type:"button",className:"btn spec-md-copy",disabled:!(g!=null&&g.markdown),onClick:()=>{z("action"),f((g==null?void 0:g.markdown)??"")},children:i(c?"tasks.specMdCopied":"tasks.specMdCopy")}),a.jsx("button",{type:"button",className:"btn spec-md-close",onClick:()=>{z("tap"),r==null||r()},children:i("tasks.specMdBack")})]}),g!=null&&g.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(Qn,{label:i("tasks.specMdLoading")}):null,l.error?a.jsx("div",{className:"spec-md-error",children:l.error}):null,g!=null&&g.markdown?li(g.markdown,{onCopyCode:f,copyLabel:i("tasks.specMdCopyCode")}):null]})]})}function bb(e){const t=String(e??"").trim();return t.length>40?`${t.slice(0,40)}…`:t}function ov({job:e,board:t="",repo:n=null,chat:s=null,onRetried:r,onDismiss:i,onInspect:l,notify:o}){const{t:c,lang:u}=$e(),[f,g]=d.useState(()=>Date.now()),[h,S]=d.useState(!1),[k,x]=d.useState(null),N=String((e==null?void 0:e.status)??""),w=N==="running"||N==="awaiting_spec",m=tp(e),v=rb(e),A=lb(e),T=ob(e),M=!!(e!=null&&e.stalled),_=cb(e);d.useEffect(()=>{if(!w)return;g(Date.now());const K=setInterval(()=>g(Date.now()),1e3);return()=>clearInterval(K)},[w,e==null?void 0:e.id]),d.useEffect(()=>{x(null)},[e==null?void 0:e.id]);const P=d.useMemo(()=>{const K=Number((e==null?void 0:e.startedAt)??(e==null?void 0:e.createdAt)??0);if(!w||!K)return null;const D=pb(f-K);return m?D.h>0?c("seed.elapsedWaitingHour",D):c("seed.elapsedWaiting",D):D.h>0?c("seed.elapsedHour",D):c("seed.elapsed",D)},[w,m,e==null?void 0:e.startedAt,e==null?void 0:e.createdAt,f,c]),I=d.useCallback(()=>{z("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=d.useCallback(()=>{if(e){if(z("tap"),l){l(e);return}try{const K=e.taskId?"hm:open-task":"hm:open-live";window.dispatchEvent(new CustomEvent(K,{detail:{taskId:e.taskId??null,board:e.board??t??null,jobId:e.id??null}}))}catch{}}},[e,t,l]),G=d.useCallback(async()=>{if(!e)return;z("tap");const K=String(e.id);try{await X(qh(K),{method:"POST"})}catch{}i==null||i(K)},[e,i]),F=d.useCallback(async()=>{if(!(h||!e)){z("action"),S(!0),x(null);try{await X("/api/architect/seed",{method:"POST",body:Zg({seedText:e.seed,autoStart:!!e.autoStart,executionPolicy:e.executionPolicy,board:t||e.board,repo:n,chat:s??e.chat??null,lang:u})});try{await X(qh(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(K){x((K==null?void 0:K.message)??c("seed.retryFailed"))}finally{S(!1)}}},[h,e,t,n,s,u,o,r,i,c]);return e?w?a.jsxs("div",{className:`job-bar${m?" queued":""}${M?" 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(vn,{size:14}),a.jsx("span",{className:"job-bar-title",children:c(ab(e))}),v?a.jsx("span",{className:`job-bar-state${m?" queued":" running"}`,children:c(v)}):null,P?a.jsx("span",{className:"job-bar-elapsed",children:P}):null,a.jsx("span",{className:"job-bar-runner",children:c(db())})]}),A||T?a.jsxs("div",{className:"job-bar-row job-bar-meta",children:[A?a.jsx("span",{className:"job-bar-phase","aria-label":c("seed.phaseAria"),children:c(A)}):null,T?a.jsx("span",{className:"job-bar-file",title:String(e.sheetPath??""),children:c("seed.sheetLabel",{name:T})}):null]}):null,e.seed?a.jsx("div",{className:"job-bar-sub",children:bb(e.seed)}):null,M?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")]}),_?a.jsx("button",{type:"button",className:"job-bar-btn",disabled:h,onClick:F,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:G,children:"×"}):null]}),k?a.jsx("div",{className:"job-bar-sub job-bar-error",children:k}):null]}):N==="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:I,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${M?" 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")]}),A?a.jsx("span",{className:"job-bar-phase",children:c(A)}):null]}),a.jsx("div",{className:"job-bar-sub job-bar-error",children:k??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:F,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:G,children:"×"}):null]})]}):null}function ul(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 Sb={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 Nb(e,t){const n=Sb[String(t??"")];return n?e(n):String(t??"—")}function jb(e){const t=String(e??"").split(`
73
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,72):""}function Cb(e){return e.stalled?"blocked":e.status==="awaiting_review"?"ready":e.status==="failed"?"failed":"running"}function cv({onClose:e,notify:t,onAbortTask:n}){const{t:s}=$e(),[r,i]=d.useState(null),[l,o]=d.useState(!1),c=d.useCallback(async()=>{try{const N=await X("/api/live");i(N)}catch(N){i({ok:!1,reason:N.message,turns:[],tasks:[]})}},[]);d.useEffect(()=>{c();const N=setInterval(()=>document.visibilityState==="visible"&&c(),5e3);return()=>clearInterval(N)},[c]);const u=async N=>{o(!0);try{await X(`/api/boards/${encodeURIComponent(N.board)}/tasks/${encodeURIComponent(N.id)}/abort`,{method:"POST",body:{reason:s("live.abortReason")}}),t==null||t(s("live.aborted",{id:N.id})),await c(),n==null||n()}catch(w){t==null||t(w.message)}finally{o(!1)}},f=(r==null?void 0:r.turns)??[],g=(r==null?void 0:r.tasks)??[],h=(r==null?void 0:r.architect)??[],S=N=>{window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:N.reviewTaskId??null,board:N.reviewBoard??N.board??null}})),e==null||e()},k=N=>{window.dispatchEvent(new CustomEvent("hm:open-task",{detail:{board:N.board??null,taskId:N.taskId}})),e==null||e()},x=async N=>{if(N!=null&&N.id){o(!0);try{await X(`/api/architect/jobs/${encodeURIComponent(N.id)}/dismiss`,{method:"POST"}),t==null||t(s("live.architectDismissed",{id:N.id})),await c()}catch(w){t==null||t(w.message)}finally{o(!1)}}};return a.jsxs(We,{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 ${f.length?"warn":""}`,children:[a.jsx("span",{className:"stat-k",children:s("live.turns")}),a.jsx("span",{className:"stat-v",children:f.length})]}),a.jsxs("div",{className:`stat ${g.length?"warn":""}`,children:[a.jsx("span",{className:"stat-k",children:s("live.tasks")}),a.jsx("span",{className:"stat-v",children:g.length})]}),h.length?a.jsxs("div",{className:`stat ${h.some(N=>N.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(N=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${Cb(N)}`}),a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:jb(N.seed)||N.runnerLabel||N.board||N.id}),a.jsx("span",{className:"row-sub",children:[N.runnerLabel,N.board,Nb(s,N.phase),ul(N.elapsedSec)].filter(Boolean).join(" ・ ")}),N.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:[N.status==="awaiting_review"?a.jsx("button",{className:"chip on",onClick:()=>S(N),children:s("live.architectQuickReview")}):null,N.taskId?a.jsx("button",{className:"chip",onClick:()=>k(N),children:s("live.architectOpenTask")}):null,a.jsx("button",{className:"chip",disabled:l,onClick:()=>x(N),children:s("live.architectDismiss")})]})]})]},N.id??`${N.board}:${N.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:[f.map(N=>{var w;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:N.title}),a.jsxs("span",{className:"row-sub",children:[N.platform||N.source||"—",N.profile&&N.profile!=="default"?` ・ ${N.profile}`:""," ・ ",ul(N.elapsedSec),N.lastTool?` ・ tool: ${N.lastTool.name}`:N.lastActivity?` ・ ${N.lastActivity}`:""]}),(w=N.lastTool)!=null&&w.at?a.jsxs("span",{className:"row-sub",style:{opacity:.75},children:[s("live.lastTool",{time:Je(N.lastTool.at)}),N.expiresInSec!=null?` ・ ${s("live.lease",{time:ul(N.expiresInSec)})}`:""]}):null]}),N.discordUrl?a.jsx("button",{className:"link",onClick:()=>window.open(N.discordUrl,"_blank","noopener"),"aria-label":s("live.openInDiscord"),children:"#"}):null]},`${N.profile??"default"}:${N.sessionId}`)}),f.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:[g.map(N=>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:N.title}),a.jsxs("span",{className:"row-sub",children:[N.boardName||N.board," ・ ",ul(N.elapsedSec),N.workerPid?` ・ pid ${N.workerPid}`:""]})]})]},`${N.board}:${N.id}`)),g.length?null:a.jsx("div",{className:"empty",children:s("live.noTasks")})]}),g.length?a.jsx("div",{style:{marginTop:12},children:a.jsx(ts,{label:s("live.abortAll",{count:g.length}),sub:s("live.abortAllSub"),tone:"danger",disabled:l,onFire:async()=>{for(const N of g)await u(N)}})}):null,a.jsx("div",{className:"row-sub",style:{padding:"12px 2px 18px",lineHeight:1.7},children:s("live.note")})]})}function uv({board:e,taskId:t,note:n="",notify:s,onClosed:r,label:i}){const{t:l}=$e(),[o,c]=d.useState(!1),[u,f]=d.useState(null),g=async h=>{f(h);try{const S=await X(`/api/boards/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/close`,{method:"POST",body:{action:h,note:String(n??"").slice(0,400)}}),k=S!=null&&S.noop?l("close.alreadyDone"):l("close.done"),x=S!=null&&S.noop?l("close.alreadyCancelled"):l("close.cancelled");s==null||s(h==="done"?k:x),c(!1),r==null||r(S)}catch(S){s==null||s(S.message)}finally{f(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(ts,{tone:"safe",label:l("close.doneLabel"),sub:l("close.doneSub"),disabled:!!u,onFire:()=>g("done")}),a.jsx(ts,{tone:"danger",label:l("close.cancelLabel"),sub:l("close.cancelSub"),disabled:!!u,onFire:()=>g("cancel")})]})]}):null]})}const tm={needs_input:"inbox.kind.needsInput",dependency:"inbox.kind.dependency",failure:"inbox.kind.failure",untyped:"inbox.kind.untyped"};function Eb({onClose:e,notify:t,onChanged:n,focusTaskId:s=null}){const{t:r}=$e(),[i,l]=d.useState(null),[o,c]=d.useState({}),[u,f]=d.useState(null),[g,h]=d.useState(!1),S=d.useCallback(async()=>{try{l(await X("/api/inbox"))}catch(y){l({ok:!1,items:[],reason:y.message})}},[]);d.useEffect(()=>{S();const y=setInterval(()=>document.visibilityState==="visible"&&S(),15e3);return()=>clearInterval(y)},[S]);const k=async y=>{const G=(o[y.id]??"").trim();if(!G){t==null||t(r("inbox.needComment"));return}f(y.id);try{await X(`/api/boards/${encodeURIComponent(y.board)}/tasks/${encodeURIComponent(y.id)}/comment`,{method:"POST",body:{body:G}}),c(F=>({...F,[y.id]:""})),t==null||t(r("inbox.commented")),await S(),n==null||n()}catch(F){t==null||t(F.message)}finally{f(null)}},x=async y=>{const G=(o[y.id]??"").trim();f(y.id);try{await X(`/api/boards/${encodeURIComponent(y.board)}/tasks/${encodeURIComponent(y.id)}/unblock`,{method:"POST",body:{note:G}}),c(F=>({...F,[y.id]:""})),t==null||t(r("inbox.reopened",{id:y.id})),await S(),n==null||n()}catch(F){t==null||t(F.message)}finally{f(null)}},N=(i==null?void 0:i.items)??[],w=N.filter(Iu),m=N.filter(y=>!Iu(y)),v=y=>s?[...y].sort((G,F)=>G.id===s?-1:F.id===s?1:0):y,A=v(m),T=v(w),M=!!s&&N.some(y=>y.id===s),_=g||M&&T.some(y=>y.id===s),P=w.length?r("inbox.titleWithAnswered",{pending:A.length,answered:w.length}):r("inbox.title",{pending:A.length}),I=(y,G)=>a.jsxs("div",{className:"card",style:{marginBottom:10,opacity:G?.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," ・ ",tm[y.blockKind??"untyped"]?r(tm[y.blockKind??"untyped"]):y.blockKind,y.recurrences?` ・ ${r("inbox.recurrences",{n:y.recurrences})}`:"",y.blockedAt?` ・ ${Je(y.blockedAt)}`:"",G?` ・ ${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:Je(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(G?"inbox.placeholderAnswered":"inbox.placeholder"),value:o[y.id]??"",onChange:F=>c(K=>({...K,[y.id]:F.target.value.slice(0,2e3)}))}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8,width:"100%"},disabled:u===y.id||!(o[y.id]??"").trim(),"aria-busy":u===y.id,onClick:()=>{z("action"),k(y)},children:[u===y.id?a.jsx(vn,{size:14}):null,a.jsx("span",{children:u===y.id?r("inbox.sending"):r("inbox.sendComment")})]}),a.jsxs("button",{className:"btn primary hm-btn-inner",style:{marginTop:6,width:"100%"},disabled:u===y.id,"aria-busy":u===y.id,onClick:()=>{z("action"),x(y)},children:[u===y.id?a.jsx(vn,{size:14}):null,a.jsx("span",{children:(o[y.id]??"").trim()?r("inbox.answerResume"):r("inbox.resume")})]}),a.jsx(uv,{board:y.board,taskId:y.id,note:o[y.id]??"",notify:t,onClosed:async()=>{c(F=>({...F,[y.id]:""})),await S(),n==null||n()}})]},`${y.board}:${y.id}`);return a.jsxs(We,{title:P,onClose:e,children:[i&&!i.ok?a.jsx("div",{className:"empty",children:i.reason??r("inbox.failed")}):null,!N.length&&(i!=null&&i.ok)?a.jsx("div",{className:"empty",children:r("inbox.empty")}):null,M?a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:r("inbox.focused")}):null,A.map(y=>I(y,!1)),!A.length&&w.length&&(i!=null&&i.ok)?a.jsx("div",{className:"empty",children:r("inbox.allAnswered",{n:w.length})}):null,w.length?a.jsx("button",{className:"btn",style:{width:"100%",marginBottom:10},onClick:()=>h(y=>!y),children:_?r("inbox.hideAnswered"):r("inbox.showAnswered",{n:w.length})}):null,_?T.map(y=>I(y,!0)):null,a.jsx("div",{className:"row-sub",style:{padding:"6px 2px 18px",lineHeight:1.7},children:r("inbox.note")})]})}const Tb=/^\[([^\]]+)\]/;function dv(e){var t;return((t=Tb.exec(String(e??"")))==null?void 0:t[1])??null}const Ab=new Set(["done","archived"]);function nm(e,t){const n=new Map;for(const l of Array.isArray(t)?t:[]){const o=dv(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 Ab.has(String(((o=n.get(l))==null?void 0:o.status)??""))});return{byId:n,allFiled:r,allDone:i}}const Rb=680,Pb=820;function pv(e){return"(min-width: "+e+"px)"}const Uu=pv(Rb),Hu=pv(Pb);function co(e){try{return typeof window>"u"||typeof window.matchMedia!="function"?!1:!!window.matchMedia(e).matches}catch{return!1}}function Ib(){return co(Uu)}function _b(){return co(Hu)}function hv(){const[e,t]=d.useState(()=>({split:Ib(),wide:_b()}));return d.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=[];for(const i of[Uu,Hu])try{n.push(window.matchMedia(i))}catch{}const s=()=>t(i=>{const l={split:co(Uu),wide:co(Hu)};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 Mb(e){return String((e==null?void 0:e.kind)??"")}function Lb(e=[]){const t=[];let n=null;for(const s of e??[]){if(!s)continue;const r=Number(s.at??0);if(Mb(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 zu=[{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."}],dl={x0:.35,y0:.35,x1:.65,y1:.65},sm=1e3,Ob=new Map(zu.map(e=>[e.id,e]));function mv(e){return Ob.get(String(e??""))||null}function Db(e){const t=mv(e);return t?{id:t.id,label:t.key,instruction:t.instruction}:null}function rm(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 $b(e,t,n){const s=Array.isArray(e)?e:[],r=Db(t);if(!r)return{strokes:s,stroke:null,stamp:null,created:!1};const i=s[s.length-1];if(i){const f={...i,stamp:r};return{strokes:[...s.slice(0,-1),f],stroke:f,stamp:r,created:!1}}const l=Number(n==null?void 0:n.w)>0?Number(n.w):sm,o=Number(n==null?void 0:n.h)>0?Number(n.h):sm,c=f=>Math.round(f*10)/10,u={tool:"rect",auto:!0,points:[[c(dl.x0*l),c(dl.y0*o)],[c(dl.x1*l),c(dl.y1*o)]],stamp:r};return{strokes:[...s,u],stroke:u,stamp:r,created:!0}}function Fb(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 fv(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=mv(r.id))==null?void 0:n.emoji)??"🏷️"})}return t}function Bb(e){return fv(e).map(t=>`#${t.index} ${t.emoji} ${t.stamp.instruction}`)}const Ub="[Stamps]";function Hb(e,t){const n=String(e??"").trim(),s=Bb(t);if(!s.length)return n;const r=[Ub,...s].join(`
74
- `);return n?`${n}
75
- ${r}`:r}const np="hm.snippetBars.v1",gv=Object.freeze(["chat","annotation","term"]),Al=Object.freeze({chat:!0,annotation:!0,term:!0}),uo="hm:snippet-bars";function vv(e){if(e)return e;try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function sp(e){const t={...Al};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const n of gv){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 xa(e){const t=vv(e);if(!t)return{...Al};try{const n=t.getItem(np);return n?sp(JSON.parse(n)):{...Al}}catch{return{...Al}}}function zb(e,t){const n=vv(t),s=xa(n),r=e&&typeof e=="object"&&!Array.isArray(e)?{...s,...e}:s,i=sp(r);try{n==null||n.setItem(np,JSON.stringify(i))}catch{}return i}function Wb(e,t,n={}){if(!gv.includes(e))return xa(n.storage);const s=zb({[e]:t!==!1},n.storage);return Vb(s,n.target),s}function Vb(e,t){const n=t??(typeof window<"u"?window:null);if(!n||typeof n.dispatchEvent!="function")return;let s;try{s=new CustomEvent(uo,{detail:e})}catch{s={type:uo,detail:e}}n.dispatchEvent(s)}function yv(e,t){const n=typeof window<"u"?window:null;if(!n||typeof n.addEventListener!="function")return()=>{};const s=i=>e(sp(i==null?void 0:i.detail)),r=i=>{i&&i.key&&i.key!==np||e(xa())};return n.addEventListener(uo,s),n.addEventListener("storage",r),()=>{n.removeEventListener(uo,s),n.removeEventListener("storage",r)}}const Kb=[{id:"pen",key:"annot.tool.pen",icon:"✏️"},{id:"arrow",key:"annot.tool.arrow",icon:"↗"},{id:"rect",key:"annot.tool.rect",icon:"▭"}],am="#e11d48",Qb="#f59e0b",Gb="#231603",Yb=560;function im({item:e,onClose:t,onSubmitted:n,notify:s}){var ct,Qt;const{t:r}=$e(),i=d.useRef(null),l=d.useRef(null),o=d.useRef(null),c=d.useRef([]),[u,f]=d.useState("pen"),[g,h]=d.useState(!1),[S,k]=d.useState(!1),[x,N]=d.useState(null),[w,m]=d.useState(""),[v,A]=d.useState(0),[T,M]=d.useState(null),[_,P]=d.useState(!1),[I,y]=d.useState(!1),[G,F]=d.useState(!1),[K,D]=d.useState(()=>xa());d.useEffect(()=>yv(D),[]);const[ae,fe]=d.useState(!1),[te,Y]=d.useState(!1),E=d.useRef(null),O=`/api/review/${e.id}/image`,B=_?`${O}?compare=1`:O,J=d.useCallback(()=>{const W=l.current,ue=i.current;if(!W||!ue||!W.naturalWidth)return null;const pe=ue.parentElement.clientWidth,H=ue.parentElement.clientHeight,oe=Math.min(pe/W.naturalWidth,H/W.naturalHeight);return{w:Math.round(W.naturalWidth*oe),h:Math.round(W.naturalHeight*oe),ratio:oe}},[]),ce=d.useCallback(()=>{const W=i.current,ue=l.current,pe=J();if(!W||!ue||!pe)return;const H=window.devicePixelRatio||1;W.style.width=`${pe.w}px`,W.style.height=`${pe.h}px`,W.width=Math.round(pe.w*H),W.height=Math.round(pe.h*H);const oe=W.getContext("2d");oe.setTransform(1,0,0,1,0,0),oe.clearRect(0,0,W.width,W.height),oe.scale(H,H),oe.drawImage(ue,0,0,pe.w,pe.h);for(const Ae of c.current)qb(oe,Ae);Jb(oe,c.current,pe.w,pe.h)},[J]);d.useRef(0);const me=d.useCallback((W=0)=>{const ue=i.current,pe=ue==null?void 0:ue.parentElement;if(!J()||!pe||pe.clientWidth===0||pe.clientHeight===0){W<20&&requestAnimationFrame(()=>me(W+1));return}ce()},[J]);d.useEffect(()=>{var oe;const W=new Image;l.current=W,h(!1),W.onload=()=>{h(!0),requestAnimationFrame(()=>me())},W.onerror=()=>{h(!1),N(r("annot.loadFailed"))},W.src=B;const ue=()=>me();window.addEventListener("resize",ue);const pe=(oe=i.current)==null?void 0:oe.parentElement,H=pe&&typeof ResizeObserver<"u"?new ResizeObserver(()=>me()):null;return H&&pe&&H.observe(pe),()=>{window.removeEventListener("resize",ue),H&&H.disconnect()}},[B,me]),d.useEffect(()=>{const W=E.current;if(!W)return;const ue=()=>fe(W.clientWidth>=Yb);if(ue(),typeof ResizeObserver>"u")return;const pe=new ResizeObserver(ue);return pe.observe(W),()=>pe.disconnect()},[]);function ye(W){const pe=i.current.getBoundingClientRect();return[W.clientX-pe.left,W.clientY-pe.top]}function Ne(W){var ue,pe;if(!(!g||S)){W.preventDefault();try{(pe=(ue=i.current)==null?void 0:ue.setPointerCapture)==null||pe.call(ue,W.pointerId)}catch{}o.current={tool:u,points:[ye(W)]},c.current.push(o.current),ce()}}function ke(W){const ue=o.current;ue&&(W.preventDefault(),ue.points.push(ye(W)),ce())}function Ge(W){const ue=o.current;ue&&(W.preventDefault(),o.current=null,ue.points.length<2?c.current.pop():(ue.points=ue.points.filter((pe,H)=>H%2===0||H===ue.points.length-1),A(c.current.length)),M(rm(c.current)),ce())}function Kt(){c.current.pop(),A(c.current.length),M(rm(c.current)),ce()}function ht(W){if(!g||S)return;z("tap");const ue=J(),pe=$b(c.current,W,ue?{w:ue.w,h:ue.h}:null);pe.stamp&&(c.current=pe.strokes,A(pe.strokes.length),M(pe.stamp.id),N(null),ce())}function wt(){const W=i.current,ue=Math.max(W.width,W.height),pe=Math.min(1,1600/ue),H=document.createElement("canvas");H.width=Math.round(W.width*pe),H.height=Math.round(W.height*pe);const oe=H.getContext("2d");return oe.fillStyle="#000",oe.fillRect(0,0,H.width,H.height),oe.drawImage(W,0,0,H.width,H.height),H.toDataURL("image/jpeg",.85)}async function xt(){if(!c.current.length){N(r("annot.needMarks"));return}k(!0),N(null);try{const W=i.current,ue=window.devicePixelRatio||1,pe=Fb(c.current,{width:W.width/ue,height:W.height/ue}),H=await X(`/api/review/${e.id}/annotation`,{method:"POST",body:{annotated_image:wt(),note:Hb(w,c.current),marks:pe,by:"mobile",chat:An()}});s==null||s(H!=null&&H.duplicate?r("annot.duplicate"):r("annot.sent")),n==null||n(H)}catch(W){N((W==null?void 0:W.message)||r("annot.sendFailed"))}finally{k(!1)}}async function rt(){if(!I){y(!0),N(null);try{z("success");const W=await X(`/api/review/${e.id}/approve`,{method:"POST",body:{by:"mobile",note:w,chat:An()}});s==null||s((W==null?void 0:W.moved)==="done"?r("annot.approved"):r("annot.approvedResume")),n==null||n(W)}catch(W){N((W==null?void 0:W.message)||r("annot.approveFailed"))}finally{y(!1)}}}async function _e(){if(!te){Y(!0),N(null);try{const W=e.board||"mobile",ue=await X(`/api/boards/${encodeURIComponent(W)}/tasks/${encodeURIComponent(e.id)}/close`,{method:"POST",body:{action:"cancel",note:String(w??"").slice(0,400)}});s==null||s(ue!=null&&ue.noop?r("close.alreadyCancelled"):r("close.cancelled")),n==null||n({closed:!0})}catch(W){N((W==null?void 0:W.message)||r("annot.approveFailed"))}finally{Y(!1)}}}return a.jsxs("div",{ref:E,className:`ak-anno${ae?" wide":""}`,children:[a.jsxs("header",{className:"ak-anno-head",children:[a.jsx("button",{className:"ak-anno-close",type:"button",onClick:()=>{z("tap"),t()},"aria-label":r("common.close"),children:"✕"}),a.jsxs("div",{className:"ak-anno-title",children:[((ct=e.review)==null?void 0:ct.title)||e.title,a.jsx("span",{children:r("annot.instruction")})]}),a.jsx("button",{className:"ak-anno-send",type:"button",disabled:S,onClick:()=>{z("action"),xt()},children:r(S?"annot.sending":"annot.submit")})]}),a.jsxs("div",{className:"ak-anno-body",children:[a.jsxs("div",{className:"ak-anno-canvas-wrap",children:[(Qt=e.review)!=null&&Qt.hasCompare?a.jsx("button",{className:`ak-compare-pill${_?" on":""}`,type:"button","aria-pressed":_,title:r("annot.compareAria"),onClick:()=>{z("tap"),P(W=>!W)},children:r(_?"annot.compareBefore":"annot.compareAfter")}):null,a.jsx("div",{className:"ak-anno-stage",children:a.jsx("canvas",{ref:i,className:"ak-anno-canvas",onPointerDown:Ne,onPointerMove:ke,onPointerUp:Ge,onPointerCancel:Ge})})]}),a.jsxs("div",{className:"ak-anno-side",children:[K.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:zu.map(W=>a.jsxs("button",{type:"button",className:`ak-anno-stamp${T===W.id?" on":""}`,"aria-pressed":T===W.id,"aria-label":r(W.key),title:`${r(W.key)} — ${W.instruction}`,disabled:!g||S,onClick:()=>ht(W.id),children:[a.jsx("span",{"aria-hidden":"true",children:W.emoji}),r(W.key)]},W.id))}),a.jsx("button",{className:"ak-anno-more",type:"button",onClick:()=>{z("tap"),F(!0)},"aria-label":r("annot.stampsMore"),children:"+"})]}):null,x?a.jsx("div",{className:"ak-error ak-anno-error",children:x}):null,a.jsxs("div",{className:"ak-anno-tools",children:[Kb.map(W=>a.jsx("button",{type:"button",className:`ak-anno-tool${u===W.id?" on":""}`,onClick:()=>{z("tap"),f(W.id)},"aria-pressed":u===W.id,"aria-label":r(W.key),title:r(W.key),children:a.jsx("span",{"aria-hidden":"true",children:W.icon})},W.id)),a.jsx("button",{type:"button",className:"ak-anno-tool",onClick:()=>{z("tap"),Kt()},disabled:!v,"aria-label":r("annot.undo"),title:r("annot.undo"),children:a.jsx("span",{"aria-hidden":"true",children:"↩"})}),K.annotation?null:a.jsx("button",{type:"button",className:"ak-anno-tool",onClick:()=>{z("tap"),F(!0)},disabled:!g||S,"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:w,onChange:W=>m(W.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:I||S||te,"aria-busy":I,onClick:rt,children:r(I?"annot.sending":"annot.doneShort")}),a.jsx(ts,{tone:"danger",ms:800,label:r("annot.archiveShort"),hint:r("annot.holdHint"),disabled:S||te,onFire:_e})]}):null]})]}),G?a.jsxs(We,{title:r("annot.stampSheetTitle"),onClose:()=>F(!1),children:[a.jsx("div",{className:"list",children:zu.map(W=>a.jsxs("button",{className:"list-item",onClick:()=>{ht(W.id),F(!1)},children:[a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{className:"row-title",style:{display:"block"},children:[W.emoji," ",r(W.key)]}),a.jsx("span",{className:"row-sub",style:{display:"block"},children:W.instruction})]}),a.jsx("span",{"aria-hidden":"true",className:"ak-anno-more-chev",children:"›"})]},W.id))}),a.jsx("div",{className:"row-sub",style:{padding:"12px 6px 18px",lineHeight:1.7},children:r("annot.stampsHint")})]}):null]})}function Jb(e,t,n,s){var i;const r=fv(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,u]=o[o.length-1]||[0,0],f=`#${l.index} ${l.emoji}`,g=6,h=e.measureText(f).width+g*2,S=18,k=S/2,x=Math.max(1,Math.min(c-h/2,n-h-1)),N=Math.max(1,Math.min(u+8,s-S-1));e.beginPath(),e.moveTo(x+k,N),e.arcTo(x+h,N,x+h,N+S,k),e.arcTo(x+h,N+S,x,N+S,k),e.arcTo(x,N+S,x,N,k),e.arcTo(x,N,x+h,N,k),e.closePath(),e.fillStyle=Qb,e.fill(),e.strokeStyle="rgba(0, 0, 0, .35)",e.lineWidth=1,e.stroke(),e.fillStyle=Gb,e.fillText(f,x+g,N+S/2+.5)}e.restore()}}function qb(e,t){const n=t.points;if(!(!n||n.length<2)){if(e.save(),e.strokeStyle=am,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),u=Math.abs(i-s),f=Math.abs(l-r);e.fillRect(o,c,u,f),e.strokeRect(o,c,u,f)}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=am,e.fill()}e.restore()}}const Xb="補足:",Zb="全体へのレビュー:",e0="(未選択",t0=new RegExp("^Q(\\d+)\\.\\s*(.*?):\\s*(.*)$"),n0=new RegExp(`^(.*?)(?:\\s*\\/\\s*${Xb}\\s*(.*))?$`),s0=new RegExp(`^${Zb}\\s*(.*)$`);function lm(e){const t={answers:[],global:""},n=String(e||"").split(`
76
- `);let s=!1;for(const r of n){const i=t0.exec(r);if(i){const o=i[3],c=n0.exec(o),u=((c==null?void 0:c[1])||"").trim();t.answers.push({id:`q${i[1]}`,choice:u.startsWith(e0)?null:u,note:((c==null?void 0:c[2])||"").trim()}),s=!1;continue}const l=s0.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 om(e,t,n,s,r){const{head:i,sub:l}=Fg(`Q${n+1}`,t,s==null?void 0:s.text);return{src:`/api/review/${e}/thumb/${r}`,head:i,sub:l}}const po={review:"review.status.review",ready:"review.status.ready",running:"review.status.running",blocked:"review.status.blocked",done:"review.status.done"},r0=[{id:"waiting",key:"review.tab.waiting"},{id:"active",key:"review.tab.active"},{id:"done",key:"review.tab.done"}];function cm(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 rp({tone:e,children:t}){return a.jsx("span",{className:`ak-chip ${e||""}`,children:t})}function Pc({item:e,onOpen:t}){const{t:n}=$e(),s=e.review||{},r=sn(e),i=e.completedAt||e.createdAt?Je(e.completedAt||e.createdAt):"";return a.jsxs("button",{className:"ak-row",onClick:()=>{z("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,Zx(s.mode)?a.jsx("span",{children:s.mode}):null,a.jsx("span",{children:i})]}),cm(e)?a.jsx("div",{className:"ak-row-phase",children:cm(e)}):null]}),a.jsx("div",{className:"ak-row-side",children:a.jsx(rp,{tone:r?"warn":e.status==="done"?"good":"",children:r?n("review.progress.waiting"):po[e.status]?n(po[e.status]):e.status})})]})}function wv({taskId:e,open:t=!1,endpoint:n=null}){var g;const{t:s}=$e(),[r,i]=d.useState(null),[l,o]=d.useState(null),c=Ue.useRef(null),u=n||`/api/review/${e}/worker?limit=30`;d.useEffect(()=>{let h=!0;const S=async()=>{try{const x=await X(u);if(!h)return;i(x),o(null)}catch(x){h&&o((x==null?void 0:x.message)||s("review.loadFailed"))}};S();const k=t?setInterval(()=>{document.visibilityState==="visible"&&S()},5e3):null;return()=>{h=!1,k&&clearInterval(k)}},[t,e,u]),d.useEffect(()=>{const h=c.current;h&&(h.scrollTop=h.scrollHeight)},[r]);const f=(((g=r==null?void 0:r.feed)==null?void 0:g.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}):"",f.length?s("review.workerSteps",{n:f.length}):""]}),l?a.jsx("div",{className:"ak-error",children:l}):null,!l&&!f.length?a.jsx("div",{className:"ak-worker-empty",children:s("review.workerEmpty")}):null,a.jsx("div",{className:"ak-worker-log",ref:c,children:f.map(h=>{const S=Og(h.at),k=h.role==="tool"?h.toolName||"tool":"agent",x=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:S}),a.jsx("span",{className:"ak-worker-tag",children:k}),a.jsx("span",{className:"ak-worker-text",children:x})]},h.id)})})]})}function a0({item:e,data:t,onSubmitted:n}){const{t:s}=$e(),r=t.questions||[],[i,l]=d.useState(()=>{const m={};for(const v of r)m[v.id]={choice:null,note:""};return m}),[o,c]=d.useState(""),[u,f]=d.useState(!1),[g,h]=d.useState(null),[S,k]=d.useState(null),x=(m,v)=>l(A=>({...A,[m]:{...A[m],choice:v}})),N=(m,v)=>l(A=>({...A,[m]:{...A[m],note:v}}));async function w(){f(!0),h(null);try{const m={answers:r.map(A=>{var T,M;return{id:A.id,choice:((T=i[A.id])==null?void 0:T.choice)??null,note:((M=i[A.id])==null?void 0:M.note)??""}}),global:o,by:"mobile",chat:An()},v=await X(`/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{f(!1)}}return a.jsxs("div",{className:"ak-form",children:[r.map((m,v)=>{var A;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(T=>{var _;const M=((_=i[m.id])==null?void 0:_.choice)===T.id;return a.jsxs("button",{type:"button",className:`ak-opt${M?" on":""}`,onClick:()=>x(m.id,M?null:T.id),children:[a.jsxs("span",{className:"ak-opt-head",children:[a.jsx("b",{children:T.id}),a.jsx("span",{children:T.label}),T.recommended?a.jsx(rp,{tone:"rec",children:s("review.recommended")}):null,a.jsx("span",{className:"ak-opt-check","aria-hidden":"true",children:"✓"})]}),T.detail?a.jsx("span",{className:"ak-opt-detail",children:T.detail}):null,T.thumb?a.jsx("span",{className:"ak-thumb-btn",role:"button",tabIndex:0,"aria-label":s("review.thumbZoomAria",{head:Fg(`Q${v+1}`,T).head}),onClick:P=>{P.preventDefault(),P.stopPropagation(),k(om(e.id,T,v,m,T.thumb))},onKeyDown:P=>{P.key!=="Enter"&&P.key!==" "||(P.preventDefault(),P.stopPropagation(),k(om(e.id,T,v,m,T.thumb)))},children:a.jsx("img",{className:"ak-opt-thumb",src:`/api/review/${e.id}/thumb/${T.thumb}`,alt:""})}):null]},T.id)})}),a.jsx("input",{className:"ak-note",value:((A=i[m.id])==null?void 0:A.note)||"",onChange:T=>N(m.id,T.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})]}),g?a.jsx("div",{className:"ak-error",children:g}):null,a.jsx("div",{className:"ak-actions",children:a.jsxs("button",{className:"btn primary hm-btn-inner",type:"button",disabled:u,"aria-busy":u,onClick:()=>{z("action"),w()},children:[u?a.jsx(vn,{size:15}):null,a.jsx("span",{children:s(u?"review.sending":"review.submitAnswer")})]})}),a.jsx("p",{className:"ak-hint",children:s("review.formHint")}),S?Hd.createPortal(a.jsxs("div",{className:"ak-zoom",role:"dialog","aria-modal":"true","aria-label":s("review.thumbAlt",{head:S.head}),onClick:()=>k(null),children:[a.jsxs("figure",{onClick:m=>m.stopPropagation(),children:[a.jsx("img",{src:S.src,alt:s("review.thumbAlt",{head:S.head})}),a.jsxs("figcaption",{children:[a.jsx("b",{children:S.head}),S.sub?a.jsx("span",{children:S.sub}):null]})]}),a.jsx("button",{className:"ak-zoom-close",type:"button",onClick:()=>k(null),children:s("common.close")})]}),document.body):null]})}function i0({item:e,onSubmitted:t,notify:n}){const{t:s}=$e(),[r,i]=d.useState(""),[l,o]=d.useState(!1),[c,u]=d.useState(null);d.useEffect(()=>{const g=async h=>{const S=h.data;if(!(!S||S.type!=="review:reply"&&S.type!=="akapen:reply"||String(S.taskId)!==String(e.id))){o(!0),u(null);try{const k=lm(S.text),x=await X(`/api/review/${e.id}/answer`,{method:"POST",body:{...k,by:"mobile",chat:An()}});n==null||n(x!=null&&x.duplicate?s("review.duplicate"):s("review.receivedFromSheet")),t==null||t(x)}catch(k){u((k==null?void 0:k.message)||s("review.sendFailed"))}finally{o(!1)}}};return window.addEventListener("message",g),()=>window.removeEventListener("message",g)},[e.id]);async function f(){if(r.trim()){o(!0),u(null);try{const g=lm(r),h=await X(`/api/review/${e.id}/answer`,{method:"POST",body:{...g,by:"mobile",chat:An()}});t==null||t(h)}catch(g){u((g==null?void 0:g.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:g=>i(g.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:()=>{z("action"),f()},children:[l?a.jsx(vn,{size:15}):null,a.jsx("span",{children:s(l?"review.sending":"review.submitPasted")})]})]})]})}function l0({item:e}){const{t}=$e();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 o0({item:e,data:t,answer:n,notify:s,onStartAnnotation:r,onReopened:i,onOpenChat:l}){const{t:o}=$e(),c=e.review||{},u=po[e.status]?o(po[e.status]):e.status,f=c.answeredAt?Je(Date.parse(c.answeredAt)):null,[g,h]=d.useState(null),[S,k]=d.useState(!1),[x,N]=d.useState(!1),[w,m]=d.useState(""),[v,A]=d.useState(!1);d.useEffect(()=>{if(h(null),k(!1),N(!1),m(""),c.mode!=="annotation")return;let I=!0;return X(`/api/review/${e.id}/annotation`).then(y=>I&&h((y==null?void 0:y.data)??null)).catch(()=>I&&h(null)),()=>{I=!1}},[e.id,c.mode]);async function T(){if(!v){A(!0);try{const I=await X(`/api/review/${e.id}/reopen`,{method:"POST",body:{reason:w.trim()||o("review.reopenReasonDefault")}});if(!(I!=null&&I.ok))throw new Error(o("review.reopenFailed"));s==null||s(o("review.reopened")),i==null||i()}catch(I){s==null||s((I==null?void 0:I.message)||o("review.reopenFailed"))}finally{A(!1)}}}const M=Jx(t,n),_=M.rows.some(I=>I.choice||I.note)||!!M.global,P=c.image?`/api/review/${e.id}/image${x?"?compare=1":"?annotated=1"}`:null;return a.jsxs("div",{className:"ak-form",children:[a.jsxs("div",{className:"ak-readonly",children:[a.jsx(rp,{tone:e.status==="done"?"good":"",children:u}),a.jsx("span",{className:"ak-label",children:c.label||e.id}),c.repo?a.jsx("span",{children:Mu(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,f?a.jsx("span",{children:o("review.answeredAtLabel",{time:f})}):null,e.completedAt?a.jsx("span",{children:o("review.completedLabel",{time:Je(e.completedAt)})}):null]}),a.jsxs("p",{className:"ak-hint",children:[o("review.readonlyHint",{label:u}),e.result?a.jsxs(a.Fragment,{children:[a.jsx("br",{}),e.result]}):null]}),P?a.jsxs("div",{className:"ak-anno-preview",children:[c.hasCompare?a.jsx("button",{className:`ak-compare-pill${x?" on":""}`,type:"button","aria-pressed":x,title:o("annot.compareAria"),onClick:()=>{z("tap"),N(I=>!I)},children:o(x?"annot.compareBefore":"annot.compareAfter")}):null,a.jsx("button",{type:"button",className:"ak-anno-preview-btn",onClick:()=>{z("tap"),k(!0)},children:a.jsx("img",{src:P,alt:o("review.imageAlt",{title:c.title||e.title})})}),g?a.jsxs("div",{className:"ak-anno-preview-meta",children:[a.jsx("span",{children:o("review.annotationMeta",{n:Array.isArray(g.marks)?g.marks.length:0})}),g.note?a.jsx("span",{children:o("review.annotationNote",{note:g.note})}):null]}):null]}):null,_?a.jsxs("details",{className:"ak-answers",children:[a.jsx("summary",{children:o("review.answersSummary")}),a.jsx("ol",{className:"ak-answer-list",children:M.rows.map((I,y)=>a.jsxs("li",{children:[a.jsx("div",{className:"ak-answer-q",children:I.question||I.id}),a.jsx("div",{className:"ak-answer-a",children:I.choice?`${I.choice}. ${I.label}`:o("review.delegated")}),I.note?a.jsx("div",{className:"ak-answer-note",children:I.note}):null]},I.id||y))}),M.global?a.jsx("div",{className:"ak-answer-global",children:o("review.globalNote",{text:M.global})}):null]}):null,a.jsxs("div",{className:"ak-followup",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>{z("tap"),r==null||r(c.target||"")},children:o("review.addAnnotation")}),c.chat?a.jsx("button",{type:"button",className:"btn ghost",onClick:()=>{z("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:w,onChange:I=>m(I.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:()=>{z("action"),T()},children:[v?a.jsx(vn,{size:14}):null,a.jsx("span",{children:o(v?"review.sending":"review.reopenSubmit")})]})]}):null,S&&P?Hd.createPortal(a.jsxs("div",{className:"ak-zoom",role:"dialog","aria-modal":"true","aria-label":o("review.zoomAria"),onClick:()=>k(!1),children:[a.jsxs("figure",{onClick:I=>I.stopPropagation(),children:[a.jsx("img",{src:P,alt:o("review.zoomAlt",{title:c.title||e.title})}),a.jsxs("figcaption",{children:[a.jsx("b",{children:c.title||e.title}),g!=null&&g.note?a.jsx("span",{children:g.note}):null]})]}),a.jsx("button",{className:"ak-zoom-close",type:"button",onClick:()=>k(!1),children:o("common.close")})]}),document.body):null]})}function c0(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),u=document.createElement("canvas");u.width=o,u.height=c,u.getContext("2d").drawImage(r,0,0,o,c),URL.revokeObjectURL(s),t(u.toDataURL("image/jpeg",.85))},r.onerror=()=>{URL.revokeObjectURL(s),n(new Error(C("review.imageLoadFailed")))},r.src=s})}let oi=null,Xr=null;function u0(){return Promise.allSettled([X("/api/review/library?limit=36").then(e=>(oi=e.items||[],oi)),X("/api/review/targets").then(e=>(Xr=e.targets||[],Xr))])}function d0({onCreated:e,onClose:t,notify:n,initialTarget:s=""}){const{t:r}=$e(),[i,l]=d.useState(()=>oi),[o,c]=d.useState(()=>Xr||[]),[u,f]=d.useState(()=>{var y;const P=Xr||[],I=s?P.find(G=>G.path.toLowerCase()===String(s).toLowerCase()):null;return(I==null?void 0:I.path)||((y=P[0])==null?void 0:y.path)||""}),[g,h]=d.useState(!!s),[S,k]=d.useState(!1),[x,N]=d.useState(null),[w,m]=d.useState(!1),v=Ue.useRef(null);d.useEffect(()=>{let P=!0;return X("/api/review/library?limit=36").then(I=>{const y=I.items||[];oi=y,P&&l(y)}).catch(I=>{P&&(oi||l([]),N((I==null?void 0:I.message)||r("review.listFailed")))}),X("/api/review/targets").then(I=>{const y=I.targets||[];if(Xr=y,!P)return;c(y);const G=s?y.find(F=>F.path.toLowerCase()===String(s).toLowerCase()):null;f(F=>{var K;return F||(G==null?void 0:G.path)||((K=y[0])==null?void 0:K.path)||""})}).catch(()=>{P&&!Xr&&c([])}),()=>{P=!1}},[s]);async function A(P){k(!0),N(null);try{const I=An(),y=await X("/api/review/annotation/new",{method:"POST",body:{...P,chat:I}});if(!(y!=null&&y.ok))throw new Error((y==null?void 0:y.message)||r("review.createFailed"));n==null||n(r("review.createdAnno",{image:y.image})),e==null||e(y)}catch(I){N((I==null?void 0:I.message)||r("review.createFailed"))}finally{k(!1)}}async function T(P){var y;const I=(y=P.target.files)==null?void 0:y[0];if(I){k(!0),N(null);try{const G=await c0(I);await A({source:"upload",image:G,title:I.name.replace(/\.[a-z]+$/i,""),slug:I.name,target:u})}catch(G){N((G==null?void 0:G.message)||r("review.importFailed")),k(!1)}}}const M=o.find(P=>P.path===u)||null,_=g&&M&&i?i.filter(P=>{var I;return((I=P.repo)==null?void 0:I.id)===M.id}):i;return a.jsx(We,{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:S,onClick:()=>{var P;return(P=v.current)==null?void 0:P.click()},children:r("review.pickFromDevice")}),a.jsx("input",{ref:v,type:"file",accept:"image/*",hidden:!0,onChange:T}),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?w:void 0,onClick:()=>{o.length<=1||(z("tap"),m(P=>!P))},children:[a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:M?r("review.targetOption",{label:M.label,id:M.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:w?"▴":"▾"}):null]})]}),w&&o.length>1?a.jsx("div",{className:"pick-list spec-accordion",role:"listbox","aria-label":r("review.target"),children:o.filter(P=>P.path!==u).map(P=>a.jsxs("button",{type:"button",className:"pick-item",onClick:()=>{z("tap"),f(P.path),m(!1)},children:[a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:r("review.targetOption",{label:P.label,id:P.id})})}),a.jsx("span",{className:"pick-meta","aria-hidden":"true",children:"›"})]},P.path))}):null]}):null,a.jsx("div",{className:"list-head",style:{marginTop:4},children:r("review.sourceLibrary")}),M&&(i!=null&&i.length)?a.jsxs("div",{className:"chips",style:{padding:0},children:[a.jsx("button",{type:"button",className:`chip${g?" on":""}`,onClick:()=>{z("tap"),h(!0)},children:r("review.onlyRepo",{id:M.id})}),a.jsx("button",{type:"button",className:`chip${g?"":" on"}`,onClick:()=>{z("tap"),h(!1)},children:r("review.all")})]}):null,x?a.jsx("div",{className:"ak-error",children:x}):null,a.jsx("div",{className:"ak-new-sub",children:r("review.librarySub",{n:_?_.length:"…"})}),_&&!_.length?a.jsx("div",{className:"ak-worker-empty",children:r(g?"review.repoEmpty":"review.libraryEmpty")}):null,a.jsx("div",{className:"ak-new-grid",children:(_||[]).map(P=>a.jsxs("button",{type:"button",className:"ak-new-item",disabled:S,onClick:()=>A({source:P.source==="capture"?"capture":"library",path:P.path,title:P.name.replace(/^\d{8}-\d{4}-/,"").replace(/\.[a-z]+$/i,""),target:u}),children:[a.jsxs("span",{className:"ak-new-thumb",children:[a.jsx("img",{src:`/api/review/library/file?path=${encodeURIComponent(P.path)}`,alt:"",loading:"lazy"}),a.jsx("span",{className:"ak-new-tag",children:P.source})]}),a.jsxs("span",{className:"ak-new-cap",children:[a.jsx("span",{className:"ak-new-when",children:qx(P.mtime)}),a.jsx("span",{className:"ak-new-repo",title:`${Mu(P.repo)} · ${P.path}`,children:Mu(P.repo)})]})]},P.path))}),a.jsx("p",{className:"ak-hint",children:r("review.newAnnoHint")})]})})}function p0({notify:e,focusRequest:t=null,onConsumedFocus:n,active:s=!0}){var ct,Qt,W,ue,pe;const{t:r}=$e(),[i,l]=d.useState({loading:!0,items:[],error:null}),[o,c]=d.useState("waiting"),[u,f]=d.useState(null),[g,h]=d.useState(!1),[S,k]=d.useState(""),[x,N]=d.useState(null),[w,m]=d.useState(null),[v,A]=d.useState(null),[T,M]=d.useState(!1),[_,P]=d.useState(""),[I,y]=d.useState(!1),[G,F]=d.useState(!1),[K,D]=d.useState(!1),[ae,fe]=d.useState([]),te=d.useRef(0),Y=d.useRef(!0),E=d.useCallback(async()=>{try{const oe=(await X("/api/review")).items||[];Y.current=!0,l({loading:!1,items:oe,error:null});try{window.dispatchEvent(new CustomEvent("hm:review-items",{detail:{items:oe}}))}catch{}return u0(),oe}catch(H){return Y.current=!1,l({loading:!1,items:[],error:(H==null?void 0:H.message)||r("review.loadFailed")}),[]}},[]),O=d.useCallback(async()=>(await E(),Y.current),[E]);d.useEffect(()=>{E();const H=setInterval(()=>{document.visibilityState==="visible"&&E()},15e3);return()=>clearInterval(H)},[E]);const B=d.useMemo(()=>Vx(i.items,I?Number.MAX_SAFE_INTEGER:ni),[i.items,I]),J={waiting:B.waiting.length,active:B.active.length},ce=d.useMemo(()=>sk(x),[x]),me=u?B.waiting.findIndex(H=>H.id===u.id)+1:0,ye=d.useCallback(async H=>{f(H),N(null),m(null),A(null),P(""),M(!1);const oe=H.review||{};if(Xx(oe)){M(!0);try{const Ae=await X(`/api/review/${H.id}/data`);N(Ae.data),m(Ae.answer??null)}catch(Ae){sn(H)&&A((Ae==null?void 0:Ae.message)||r("review.sheetMissing"))}finally{M(!1)}}},[]);d.useEffect(()=>{if(!t||i.loading)return;if(t.openNewAnnotation){k(t.target||""),h(!0),n==null||n();return}const H=i.items.find(oe=>{var Ae;return t.taskId&&oe.id===t.taskId||t.label&&((Ae=oe.review)==null?void 0:Ae.label)===t.label});H?(c(sn(H)?"waiting":H.status==="done"?"done":"active"),ye(H)):c("done"),n==null||n()},[t,i.loading,i.items,ye,n]);function Ne(){f(null),N(null),m(null),A(null),M(!1)}const ke=d.useCallback(async()=>{try{const H=await X("/api/review/feed?limit=6"),oe=Array.isArray(H.items)?H.items:[];fe(oe);const Ae=Date.now();try{localStorage.setItem("hm.reviewSeenAt",String(Ae))}catch{}try{window.dispatchEvent(new CustomEvent("hm:review-seen",{detail:{at:Ae}}))}catch{}const Nt=oe.filter(mt=>mt.kind==="done"||/^✅/.test(String(mt.text||""))),Ye=Nt[Nt.length-1];Ye&&Ye.at>te.current&&(te.current&&(e==null||e(r("review.feedNotice",{text:String(Ye.text).replace(/^✅\s*/,"")}))),te.current=Ye.at)}catch{}},[e]);d.useEffect(()=>{if(!s)return;ke();const H=setInterval(()=>document.visibilityState==="visible"&&ke(),15e3);return()=>clearInterval(H)},[ke,s]);async function Ge(H,oe,Ae){var kt,jt;const Nt=oe!=null&&oe.duplicate?null:Ae||((kt=oe==null?void 0:oe.files)!=null&&kt.approval?"stamp":"approve");Nt&&vt(Nt);const Ye=await E(),mt=oe!=null&&oe.duplicate?r("review.duplicate"):(jt=oe==null?void 0:oe.files)!=null&&jt.approval?r("annot.approved"):r("review.answerSent"),Pt=Kx(Ye,H);if(Pt){D(!1),await ye(Pt),e==null||e(r("review.nextOpened",{head:mt}));return}c("waiting"),Ne(),D(!0),vt("allClear"),e==null||e(r("review.noneLeft",{head:mt}))}async function Kt(){if(!(!u||G||!ce.canFastTrack)){F(!0);try{const H=await X(`/api/review/${u.id}/answer`,{method:"POST",body:{answers:ce.answers,global:"",by:"mobile",chat:An()}});await Ge(u.id,H,"fastTrack")}catch(H){e==null||e((H==null?void 0:H.message)||r("review.fastTrackFailed"))}finally{F(!1)}}}const ht=i.items.length>0,{split:wt}=hv(),xt=!!(u&&((ct=u.review)==null?void 0:ct.mode)==="annotation"&&sn(u)),rt=u?(((Qt=u.review)==null?void 0:Qt.title)||u.title)+"":"",_e=u?a.jsxs(a.Fragment,{children:[sn(u)&&me>0&&J.waiting>1?a.jsx("div",{className:"ak-wait-bar",children:a.jsx("span",{className:"ak-wait-pill",children:r("review.waitPill",{i:me,n:J.waiting})})}):null,sn(u)&&ce.canFastTrack&&((W=x==null?void 0:x.questions)!=null&&W.length)?a.jsxs("div",{className:"ak-fasttrack",children:[a.jsx("button",{className:"btn fast-track",type:"button",disabled:G,"aria-busy":G,onClick:Kt,children:G?r("review.sending"):r("review.fastTrack",{summary:ce.summary})}),a.jsx("p",{className:"ak-fasttrack-hint",children:r("review.fastTrackHint")})]}):null,((ue=u.review)==null?void 0:ue.mode)!=="annotation"?a.jsx(l0,{item:u}):null,sn(u)?a.jsxs(a.Fragment,{children:[v?a.jsx("div",{className:"ak-error",children:r("review.openSheetDirectly",{error:v})}):null,(pe=x==null?void 0:x.questions)!=null&&pe.length?a.jsx(a0,{item:u,data:x,onSubmitted:H=>Ge(u.id,H)}):T?a.jsx(Qn,{label:r("common.loading")}):a.jsx(i0,{item:u,onSubmitted:H=>Ge(u.id,H)})]}):T&&!x?a.jsx(Qn,{label:r("common.loading")}):a.jsx(o0,{item:u,data:x,answer:w,notify:e,onStartAnnotation:H=>{Ne(),k(H||""),h(!0)},onReopened:async()=>{await E(),Ne()},onOpenChat:H=>{Ne(),window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:H}}))}}),sn(u)?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:_,onChange:H=>P(H.target.value.slice(0,400)),placeholder:r("review.closeReasonPlaceholder")}),a.jsx(uv,{board:u.board||"mobile",taskId:u.id,note:_,notify:e,onClosed:()=>{P(""),E(),setTimeout(()=>f(null),600)}})]}):null,a.jsx(wv,{taskId:u.id,open:["running","ready"].includes(u.status)})]}):null;return a.jsxs("div",{className:wt?"pane ak-page split-layout review":"pane ak-page",children:[a.jsxs("div",{className:wt?"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:J.waiting?r("review.waitingSub",{n:J.waiting}):r("review.noneWaiting")})]}),a.jsxs("span",{className:"ak-head-actions",children:[a.jsx("button",{className:"btn ak-new-btn",type:"button",onClick:()=>{z("tap"),k(""),h(!0)},children:r("review.newAnnotation")}),a.jsx(yr,{onRefresh:O})]})]}),K?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:()=>{z("tap"),D(!1)},children:a.jsx(Oe,{name:"close",size:16})})]}):null,ae.length?a.jsx("div",{className:"ak-feed","aria-live":"polite",children:ae.slice(-3).map((H,oe)=>a.jsxs("div",{className:"ak-feed-row",children:[a.jsx("span",{className:"ak-feed-at",children:Og(H.at)}),a.jsx("span",{className:"ak-feed-text",children:H.text})]},`${H.at}-${oe}`))}):null,a.jsx("div",{className:"chips ak-tabs",role:"tablist",children:r0.map(H=>a.jsxs("button",{type:"button",role:"tab","aria-selected":o===H.id,className:`chip${o===H.id?" on":""}`,onClick:()=>{o!==H.id&&z("tap"),c(H.id)},children:[r(H.key),H.id!=="done"&&J[H.id]?` ${J[H.id]}`:null]},H.id))}),i.error?a.jsx("div",{className:"ak-error",children:i.error}):null,i.loading?a.jsx(Qn,{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"?B.waiting.length?a.jsx("section",{className:"ak-group",children:B.waiting.map(H=>a.jsx(Pc,{item:H,onOpen:ye},H.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:J.active,done:B.doneTotal})})]}):null,!i.loading&&ht&&o==="active"?B.active.length?a.jsx("section",{className:"ak-group",children:B.active.map(H=>a.jsx(Pc,{item:H,onOpen:ye},H.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:I?r("review.allDone",{n:B.doneTotal}):Yx(B.doneTotal)}),B.done.length?a.jsx("section",{className:"ak-group",children:B.done.map(H=>a.jsx(Pc,{item:H,onOpen:ye},H.id))}):null,B.doneTotal>B.done.length?a.jsx("button",{className:"btn ghost",style:{width:"100%",marginTop:8},onClick:()=>y(!0),children:r("review.showAllDone",{n:B.doneTotal-B.done.length})}):I&&B.doneTotal>ni?a.jsx("button",{className:"btn ghost",style:{width:"100%",marginTop:8},onClick:()=>y(!1),children:r("review.showRecentOnly",{n:ni})}):null]}):null]}),g?a.jsx(d0,{notify:e,initialTarget:S,onClose:()=>h(!1),onCreated:async H=>{h(!1),await E(),f({id:H.taskId,title:H.label,status:"blocked",review:{mode:"annotation",label:H.label}})}}):null,!wt&&xt?a.jsx(im,{item:u,notify:e,onClose:()=>f(null),onSubmitted:H=>Ge(u.id,H)}):null,!wt&&u&&!xt?a.jsx(We,{title:rt,onClose:Ne,children:_e}):null,wt?a.jsx("div",{className:"split-detail",children:u?xt?a.jsx(im,{item:u,notify:e,onClose:()=>f(null),onSubmitted:H=>Ge(u.id,H)}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"split-detail-head",children:[a.jsx("span",{className:"split-detail-title",children:rt}),a.jsx("button",{className:"icon-btn",onClick:Ne,"aria-label":r("common.close"),children:a.jsx(Oe,{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 h0=5e3,Lr={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"},m0={"zero-stop":"tasks.modeZeroStop","fast-track-review":"tasks.modeFastTrack","visual-gate":"tasks.modeVisualGate"};function um({batch:e,t}){const n=m0[e==null?void 0:e.mode];return n?a.jsx("span",{className:`spec-mode is-${e.mode}`,children:t(n)}):null}function dm({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:Je(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:()=>{z("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:()=>{z("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 xv="hm.board";function f0(){try{return localStorage.getItem(xv)}catch{return null}}function g0({overview:e,refresh:t,notify:n,initialInbox:s=null,focusBoard:r=null,onConsumedFocusBoard:i,taskToolRequest:l=null,onConsumedTaskTool:o,active:c=!0}){var Aa,Bi,Nn,Ui;const{t:u}=$e(),[f,g]=d.useState([]),[h,S]=d.useState(null),[k,x]=d.useState([]),[N,w]=d.useState(null),[m,v]=d.useState(null),[A,T]=d.useState(!1),[M,_]=d.useState(""),[P,I]=d.useState(!1),[y,G]=d.useState(!0),[F,K]=d.useState(null),[D,ae]=d.useState(null),[fe,te]=d.useState(!1),[Y,E]=d.useState(!1),[O,B]=d.useState(null),[J,ce]=d.useState(!1),[me,ye]=d.useState(null),[Ne,ke]=d.useState(!1),[Ge,Kt]=d.useState(0),[ht,wt]=d.useState(0),[xt,rt]=d.useState(!1),[_e,ct]=d.useState(null),[Qt,W]=d.useState(!1),[ue,pe]=d.useState(null),[H,oe]=d.useState([]),[Ae,Nt]=d.useState(!1),[Ye,mt]=d.useState(!1),[Pt,kt]=d.useState(!1),[jt,$]=d.useState(null),[je,ut]=d.useState([]),[Mn,ft]=d.useState(!1),[de,Yn]=d.useState(""),[Me,Dt]=d.useState(!1),[Ss,Ln]=d.useState(""),[Gt,un]=d.useState(!1);d.useEffect(()=>{l&&(l.kind==="brainstorm"?(Ln(l.seed||""),Dt(!0)):l.kind==="seed"&&(Yn(l.seed||""),ft(!0)),o==null||o())},[l,o]);const[Be,dn]=d.useState(null),[Yt,is]=d.useState(!1),[we,Jn]=d.useState([]),[$t,Q]=d.useState([]),[q,ve]=d.useState(null),Ce="#inbox",Xe=d.useRef(!1),Re=d.useCallback((b=null)=>{ve(b??null),rt(!0),window.location.hash.startsWith(Ce)||(window.history.pushState({hmSheet:"inbox"},"",b?`${Ce}:${b}`:Ce),Xe.current=!0)},[]),be=d.useCallback(()=>{if(rt(!1),Xe.current&&window.location.hash.startsWith(Ce)){Xe.current=!1,window.history.back();return}window.location.hash.startsWith(Ce)&&window.history.replaceState({},"",window.location.pathname+window.location.search)},[]);d.useEffect(()=>{const b=()=>{window.location.hash.startsWith(Ce)||(Xe.current=!1,rt(!1))};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[]);const xe=d.useRef(!1);d.useEffect(()=>{const b=U=>{var re;return Re(((re=U==null?void 0:U.detail)==null?void 0:re.task)??null)};return window.addEventListener("hm:open-inbox",b),()=>window.removeEventListener("hm:open-inbox",b)},[]),d.useEffect(()=>{!s||xe.current||(xe.current=!0,Re(s.task??null))},[s,Re]);const Le=d.useCallback(async()=>{try{const U=(await X("/api/boards")).boards??[];g(U),S(re=>{var Ze,at,en;if(re)return re;const ge=f0();return ge&&U.some(Et=>Et.slug===ge)?ge:((Ze=U.find(Et=>Et.current))==null?void 0:Ze.slug)??((at=U.find(Et=>!Et.archived))==null?void 0:at.slug)??((en=U[0])==null?void 0:en.slug)??null})}catch(b){n(b.message)}finally{G(!1)}},[n]);d.useEffect(()=>{try{h&&localStorage.setItem(xv,h)}catch{}},[h]);const Pe=d.useCallback(async b=>{if(!b)return!1;try{const U=await X(`/api/boards/${encodeURIComponent(b)}/tasks?limit=60`);return x(U.tasks??[]),!0}catch(U){return x([]),n(U.message),!1}},[n]);d.useEffect(()=>{Le()},[Le]),d.useEffect(()=>{if(!c)return;let b=!0;const U=()=>X("/api/usage?hours=24").then(ge=>b&&B(ge)).catch(()=>{});U();const re=setInterval(()=>document.visibilityState==="visible"&&U(),6e4);return()=>{b=!1,clearInterval(re)}},[c]),d.useEffect(()=>{if(!c)return;let b=!0;const U=()=>X("/api/live").then(ge=>{var at;if(!b)return;const Ze=Number(((at=ge==null?void 0:ge.counts)==null?void 0:at.turns)??0);Kt(Ze);try{window.dispatchEvent(new CustomEvent("hm:live-turns",{detail:{turns:Ze,items:Array.isArray(ge==null?void 0:ge.turns)?ge.turns:[]}}))}catch{}}).catch(()=>{});U();const re=setInterval(()=>document.visibilityState==="visible"&&U(),1e4);return()=>{b=!1,clearInterval(re)}},[c]);const Ve=d.useCallback(async()=>{try{const b=await X("/api/inbox"),U=(b==null?void 0:b.items)??[];wt(_u(U));try{window.dispatchEvent(new CustomEvent("hm:inbox-items",{detail:{items:U}}))}catch{}}catch{}},[]);d.useEffect(()=>{if(!c)return;Ve();const b=setInterval(()=>document.visibilityState==="visible"&&Ve(),15e3);return()=>clearInterval(b)},[Ve,c]);const Jt=d.useCallback(async b=>{if(!b){ct(null);return}try{const U=await X(`/api/specs?board=${encodeURIComponent(b)}`),re=(Array.isArray(U==null?void 0:U.specs)?U.specs:[]).filter(ge=>(ge.batches??[]).length>0);ct(re.length?{repo:U.repo??null,path:U.path??null,specs:re}:null),pe(ge=>{var Ze;return ge&&re.some(at=>at.path===ge)?ge:((Ze=re[0])==null?void 0:Ze.path)??null})}catch{ct(null)}},[]);d.useEffect(()=>{Jt(h)},[h,Jt]);const ka=d.useCallback(async()=>(await Promise.all([h?Pe(h):Promise.resolve(!0),Ve(),Jt(h),t?t():Promise.resolve(!0)]))[0]!==!1,[h,Pe,Ve,Jt,t]);d.useEffect(()=>{if(!h||!c)return;Pe(h);const b=setInterval(()=>document.visibilityState==="visible"&&Pe(h),5e3);return()=>clearInterval(b)},[h,Pe,c]);const qn=d.useCallback(async()=>{if(!h){dn(null);return}try{const b=await X(`/api/architect/jobs?board=${encodeURIComponent(h)}`);b!=null&&b.ok&&dn(b)}catch{dn(null)}},[h]),Ns=d.useMemo(()=>ev((Be==null?void 0:Be.jobs)??[],$t,h??""),[Be,$t,h]),ba=tv(Ns),qs=d.useMemo(()=>ub((Be==null?void 0:Be.jobs)??[]),[Be]);d.useEffect(()=>{if(!c)return;qn();const b=setInterval(()=>document.visibilityState==="visible"&&qn(),ba);return()=>clearInterval(b)},[qn,ba,c]);const Sa=d.useMemo(()=>{const b=(Be==null?void 0:Be.specReady)??[],U=(Be==null?void 0:Be.pending)??[];return[...b.map(re=>`r:${re==null?void 0:re.spec}:${re==null?void 0:re.batchCount}:${re!=null&&re.launched?1:0}`),...U.map(re=>`p:${re==null?void 0:re.path}:${re==null?void 0:re.pendingCount}`)].join("|")},[Be]);d.useEffect(()=>{Sa&&Jt(h)},[Sa,h,Jt]);const _i=d.useMemo(()=>{const b=nv({specReady:(Be==null?void 0:Be.specReady)??[],pending:(Be==null?void 0:Be.pending)??[]});return!b||we.includes(b.path)?null:b},[Be,we]),Fo=d.useCallback(async b=>{if(!(!b||Yt||!h)){is(!0);try{const U=An(globalThis.localStorage),re=await X("/api/specs/launch",{method:"POST",body:{board:h,specRelPath:b.path,batchIds:b.ids,...U?{chat:U}:{}}});n(u("seed.bannerFiled",{n:((re==null?void 0:re.created)??[]).length}));try{vt("launch")}catch{}await Promise.all([qn(),Pe(h),Jt(h)])}catch(U){n((U==null?void 0:U.message)??u("seed.failed"))}finally{is(!1)}}},[Yt,h,n,u,qn,Pe,Jt]),Mi=!k.some(b=>b.status==="running"||b.status==="ready"||b.status==="todo");d.useEffect(()=>{if(!h){w(null);return}if(!h||!c)return;let b=!0;const U=()=>X(`/api/specs/reports?board=${encodeURIComponent(h)}&limit=1`).then(ge=>{if(!b)return;const Ze=Array.isArray(ge==null?void 0:ge.reports)?ge.reports:Array.isArray(ge==null?void 0:ge.items)?ge.items:[];w(Ze[0]??null)}).catch(()=>{b&&w(null)});U();const re=setInterval(()=>document.visibilityState==="visible"&&U(),3e4);return()=>{b=!1,clearInterval(re)}},[h,Mi,c]);const kr=d.useMemo(()=>{const b=sr(N==null?void 0:N.at);return!!b&&Date.now()-b<24*60*60*1e3},[N]),On=d.useMemo(()=>N!=null&&N.markdown?li(N.markdown):null,[N]),Li=d.useCallback(()=>{if(N){z("tap");try{window.dispatchEvent(new CustomEvent("hm:discuss-pipeline",{detail:{sessionId:N.sessionId??null,repoPath:N.repoPath??null,board:N.board??h,prompt:Fr(N,""),title:N.label??null}}))}catch{}}},[N,h]);d.useEffect(()=>{if(!(r!=null&&r.board)||!f.length)return;f.some(U=>U.slug===r.board)&&S(r.board);const b=String(r.taskId??"").trim();b&&br({id:b,title:""},r.board),i==null||i()},[r,f,i]);const br=async(b,U=h)=>{const re=String(U??h??"").trim();v({loading:!0,board:re,...b}),K(null),ae(null);try{const ge=await X(`/api/boards/${encodeURIComponent(re)}/tasks/${encodeURIComponent(b.id)}`);v({...ge,board:re})}catch(ge){n(ge.message),v(null)}};d.useEffect(()=>{const b=m==null?void 0:m.id,U=m==null?void 0:m.status;if(!b||!(U==="running"||U==="ready"))return;const re=String((m==null?void 0:m.board)??h??"");let ge=!0;const Ze=setInterval(async()=>{if(document.visibilityState==="visible")try{const at=await X(`/api/boards/${encodeURIComponent(re)}/tasks/${encodeURIComponent(b)}`);if(!ge)return;v(en=>en&&en.id===b?{...en,...at,board:re,loading:!1}:en)}catch{}},h0);return()=>{ge=!1,clearInterval(Ze)}},[m==null?void 0:m.id,m==null?void 0:m.status,m==null?void 0:m.board,h]);const qt=String((m==null?void 0:m.board)??h??""),xn=b=>{const U=String((b==null?void 0:b.taskId)??"").trim(),re=String((b==null?void 0:b.board)??h??"").trim();if(!U||!re){ke(!0);return}z("tap"),re!==h&&f.some(Ze=>Ze.slug===re)&&S(re);const ge=String((b==null?void 0:b.seed)??"").trim();br({id:U,title:ge?ge.slice(0,40):U},re)},Sr=async b=>{if(!(F!=null&&F.files)){K({loading:!0});try{const U=await X(`/api/boards/${encodeURIComponent(qt)}/tasks/${encodeURIComponent(b)}/diff`);K(U)}catch(U){K({ok:!1,reason:U.message})}}},Na=async(b,U)=>{if((D==null?void 0:D.path)===U){ae(null);return}ae({path:U,loading:!0});try{const re=await X(`/api/boards/${encodeURIComponent(qt)}/tasks/${encodeURIComponent(b)}/diff?file=${encodeURIComponent(U)}`);ae({...re,path:U})}catch(re){ae({path:U,ok:!1,reason:re.message})}},Nr=async b=>{I(!0);try{const U=String((b==null?void 0:b.board)??qt).trim(),re=await X(`/api/boards/${encodeURIComponent(U)}/tasks/${encodeURIComponent(b.id)}/abort`,{method:"POST",body:{reason:u("tasks.abortReason")}});n(u("tasks.aborted",{reclaim:re.reclaimed,block:re.blocked})),v(null),Pe(U)}catch(U){n(U.message)}finally{I(!1)}},kn=async b=>{I(!0);try{const U=await X(`/api/gateway/${b}`,{method:"POST",body:{confirm:b.toUpperCase()}});return n(u("tasks.actionRan",{action:b})),T(!1),_(""),t==null||t(),U}catch(U){n(U.message)}finally{I(!1)}},ja=async()=>{I(!0);try{await X("/api/gateway/pause",{method:"POST",body:{confirm:"PAUSE",reason:"mobile"}}),n(u("tasks.pausedDone")),t==null||t()}catch(b){n(b.message)}finally{I(!1)}},Dn=async()=>{I(!0);try{await X("/api/gateway/resume",{method:"POST",body:{confirm:"RESUME"}}),n(u("tasks.resumed")),t==null||t()}catch(b){n(b.message)}finally{I(!1)}},bn=e==null?void 0:e.bridge,Ca=(Aa=e==null?void 0:e.system)==null?void 0:Aa.memory,Ea=(Bi=e==null?void 0:e.system)==null?void 0:Bi.disk,jr=k.filter(b=>b.status==="running").length,ls=(e==null?void 0:e.paused)??{engaged:!1},{split:Sn}=hv(),os=(_e==null?void 0:_e.specs)??[],De=os.find(b=>b.path===ue)??os[0]??null,Xt=nm((De==null?void 0:De.batches)??[],k),Cr=new Set(Xt.byId.keys()),Ta=new Set(k.filter(b=>b.status!=="done"&&b.status!=="archived").map(b=>dv(b.title)).filter(Boolean)),Zt=Xt.allDone,Er=b=>{var U,re;return[(U=b==null?void 0:b.counts)!=null&&U.running?u("tasks.boardRunning",{n:b.counts.running}):null,(re=b==null?void 0:b.counts)!=null&&re.blocked?u("tasks.boardBlocked",{n:b.counts.blocked}):null,b!=null&&b.archived?u("tasks.boardArchived"):null,b!=null&&b.lastActivityAt?Je(b.lastActivityAt*1e3):null].filter(Boolean).join(" · ")},Ct=f.find(b=>b.slug===h)??null,Oi=()=>((De==null?void 0:De.batches)??[]).filter(b=>!Cr.has(b.id)).map(b=>b.id),Tr=()=>{De&&(z("tap"),oe(Oi()),kt(!1),ut([]),W(!0))},It=()=>{De&&(z("tap"),kt(!1),mt(!0))},$n=(b,U=!1)=>{if(b&&(pe(b.path),kt(!1),ut([]),U)){const re=nm(b.batches??[],k);oe((b.batches??[]).filter(ge=>!re.byId.has(ge.id)).map(ge=>ge.id))}},Ar=b=>{const U=typeof b=="string"?b:b==null?void 0:b.path;U&&(z("tap"),$({path:U,title:typeof b=="string"?null:(b==null?void 0:b.title)??null,board:typeof b=="string"?null:(b==null?void 0:b.board)??null}))},Bo=(b=null)=>{z("tap"),ye({board:(b==null?void 0:b.board)??h??null,spec:(b==null?void 0:b.spec)??(De==null?void 0:De.path)??null})},Di=async()=>{if(!(!De||!H.length||!h)){Nt(!0);try{const b=await X("/api/specs/launch",{method:"POST",body:{board:h,specRelPath:De.path,batchIds:H,assignee:"mobile",chat:An(globalThis.localStorage)||void 0}});vt("launch"),n(u("tasks.specLaunched",{created:(b.created??[]).length,skipped:(b.skipped??[]).length})),W(!1),oe([]),Pe(h)}catch(b){n(b.message)}finally{Nt(!1)}}},$i=m?m.loading?a.jsx(Qn,{label:u("tasks.detailLoading")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:u("tasks.status")}),a.jsxs("b",{children:[Lr[m.status]?u(Lr[m.status]):m.status,m.workerPid?` ・ pid ${m.workerPid}`:""]})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:u("tasks.started")}),a.jsx("b",{children:m.startedAt?Je(m.startedAt):"—"})]}),m.branch?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:u("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,(Nn=m.git)!=null&&Nn.head?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:u("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:u("tasks.message")}),a.jsx("b",{className:"git-msg",children:m.git.subject||"—"})]}),a.jsxs("button",{className:"accordion",onClick:()=>{F!=null&&F.loading||(F?K(null):Sr(m.id))},children:[a.jsxs("span",{className:"acc-title",children:[u("tasks.changedFiles"),F!=null&&F.ok?a.jsxs("span",{className:"diff-sum",children:[a.jsxs("span",{className:"add",children:["+",F.total.add]})," ",a.jsxs("span",{className:"del",children:["−",F.total.del]})]}):null]}),a.jsx("span",{className:"acc-caret",children:F?"▾":"▸"})]}),F?F.loading?a.jsxs("div",{className:"row-sub hm-btn-inner",style:{padding:"6px 4px"},children:[a.jsx(vn,{size:12}),a.jsx("span",{children:u("common.loading")})]}):F.ok?a.jsxs("div",{className:"diff-list",children:[(F.files??[]).map(b=>a.jsxs("div",{children:[a.jsxs("button",{className:`diff-row${(D==null?void 0:D.path)===b.path?" on":""}`,onClick:()=>Na(m.id,b.path),children:[a.jsx("span",{className:"diff-path mono",children:b.path}),a.jsx("span",{className:"diff-nums",children:b.binary?a.jsx("span",{className:"git-dirty",children:"binary"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"add",children:["+",b.add]})," ",a.jsxs("span",{className:"del",children:["−",b.del]})]})})]}),(D==null?void 0:D.path)===b.path?D.loading?a.jsxs("div",{className:"row-sub hm-btn-inner",style:{padding:"6px 10px"},children:[a.jsx(vn,{size:12}),a.jsx("span",{children:u("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]},b.path)),(F.files??[]).length?null:a.jsx("div",{className:"empty",children:u("tasks.noDiff")}),F.truncated?a.jsx("div",{className:"row-sub",children:u("tasks.diffLimit")}):null,F.dirty?a.jsx("div",{className:"row-sub",children:u("tasks.dirtyNote")}):null]}):a.jsx("div",{className:"row-sub",style:{padding:"6px 4px"},children:F.reason}):null]}):null,(Ui=m.discord)!=null&&Ui.url?a.jsx("button",{className:"btn dc-btn",onClick:()=>window.open(m.discord.url,"_blank","noopener"),children:u("tasks.openThread")}):null,m.status==="running"||m.workerPid?a.jsx("div",{style:{marginTop:12},children:a.jsx(ts,{label:u("tasks.abortTask"),sub:u("tasks.abortSub"),tone:"danger",disabled:P,onFire:()=>Nr(m)})}):null,m.sessionId?a.jsx("div",{style:{marginTop:12},children:a.jsx(wv,{taskId:m.id,open:m.status==="running"||m.status==="ready",endpoint:`/api/boards/${encodeURIComponent(qt)}/tasks/${encodeURIComponent(m.id)}/worker?limit=30`})}):null,a.jsx("div",{className:"list-head",style:{marginTop:16},children:a.jsx("span",{children:u("tasks.events")})}),a.jsxs("div",{className:"timeline",children:[Lb(m.events??[]).map((b,U)=>{const re=b.kind==="heartbeat"&&b.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?u("tasks.heartbeatCount",{n:b.count}):b.kind}),a.jsx("span",{className:"row-sub",children:re?u("tasks.heartbeatRange",{first:Je(b.firstAt),last:Je(b.at)}):Je(b.at)})]})]},U)}),(m.events??[]).length?null:a.jsx("div",{className:"empty",children:u("tasks.noEvents")})]})]}):null,Fi=()=>{v(null),_("")};return a.jsxs("div",{className:Sn?"pane split-layout tasks":"pane",children:[a.jsxs("div",{className:Sn?"split-master":void 0,children:[ls.engaged?a.jsxs("div",{className:"banner paused",children:[u("tasks.pausedBanner",{reason:ls.reason?` ・ ${ls.reason}`:""}),a.jsx("button",{onClick:Dn,disabled:P,children:u("tasks.resume")})]}):null,ht?a.jsxs("button",{className:"inbox-bar",onClick:()=>Re(null),children:[a.jsx("span",{children:u("tasks.inboxBar",{n:ht})}),a.jsx("span",{className:"inbox-bar-go",children:u("tasks.inboxBarGo")})]}):null,a.jsx(ov,{job:Ns,board:h??"",repo:(_e==null?void 0:_e.repo)??null,chat:An(globalThis.localStorage)||null,onInspect:xn,onRetried:async()=>{await Promise.all([qn(),Jt(h)])},onDismiss:b=>Q(U=>[...U,b]),notify:n}),a.jsx(rv,{banner:_i,busy:Yt,onFile:Fo,onDismiss:b=>Jn(U=>[...U,b.path]),onPreview:b=>Ar({path:b.path,title:b.title})}),a.jsxs("div",{className:"seed-entry",children:[a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{z("tap"),Yn(""),ft(!0)},"aria-label":u("seed.openAria"),children:["📝 ",u("seed.title")]}),a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{z("tap"),Ln(""),Dt(!0)},children:["🧠 ",u("brainstorm.title")]}),a.jsxs("button",{type:"button",className:"snippet-chip trigger",onClick:()=>{z("tap"),un(!0)},children:["🛠 ",u("refactor.title")]})]}),De?a.jsxs("button",{className:`spec-bar${Zt?" is-done":""}`,onClick:Zt?It:Tr,"aria-label":u(Zt?"tasks.specHistoryAria":"tasks.specBarAria",{name:De.title}),children:[a.jsxs("span",{className:"spec-bar-main",children:[a.jsx("span",{className:"spec-bar-title",children:Zt?`✅ ${u("tasks.specAllDone")}`:`🚀 ${u("tasks.specLaunchpad")}`}),a.jsx("span",{className:"spec-bar-name",children:De.title})]}),a.jsxs("span",{className:"spec-bar-n",children:[u("tasks.specBatchCount",{n:De.batches.length}),a.jsx(Oe,{name:"chevron",size:14})]})]}):null,N&&(Mi||kr)?a.jsxs("details",{className:`pipeline-summary-card${String(N.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(N.status??"")==="halted"?"⚠️":"🎉"}),a.jsx("span",{className:"pipeline-summary-title",children:N.label||u("tasks.pipelineSummary")}),a.jsx("span",{className:"pipeline-summary-sub",children:Vd(N,48)}),a.jsx("span",{className:"pipeline-summary-when",children:Je(sr(N.at)||0)})]}),a.jsxs("div",{className:"pipeline-summary-body",children:[On,a.jsxs("div",{className:"pipeline-summary-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:Li,children:u("tasks.discussReport")}),a.jsx("button",{type:"button",className:"report-card-btn",onClick:()=>Bo(N),children:u("receipt.open")}),a.jsx("button",{type:"button",className:"report-card-btn",onClick:b=>{const U=b.currentTarget.closest("details");U&&(U.open=!1)},children:u("tasks.pipelineCollapse")})]})]})]}):null,a.jsxs("div",{className:"strip",children:[a.jsxs("div",{className:`stat ${(bn==null?void 0:bn.ok)===!1?"bad":bn?"good":""}`,children:[a.jsx("span",{className:"stat-k",children:u("tasks.bridge")}),a.jsx("span",{className:"stat-v",children:bn?bn.ok?u("tasks.ok"):u("tasks.disconnected"):"—"})]}),a.jsxs("button",{className:"stat",onClick:()=>ce(!0),"aria-label":u("tasks.usageAria"),children:[a.jsx("span",{className:"stat-k",children:"24h"}),a.jsx("span",{className:"stat-v",children:O!=null&&O.ok?aa(O.totals.cost):"—"})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-k",children:u("tasks.memory")}),a.jsx("span",{className:"stat-v",children:Ca?`${Ca.percent}%`:"—"})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-k",children:u("tasks.disk")}),a.jsx("span",{className:"stat-v",children:Ea?`${Ea.percent}%`:"—"})]}),a.jsxs("button",{className:`stat ${jr||qs?"warn":""}`,onClick:()=>ke(!0),"aria-label":u("tasks.liveAria"),children:[a.jsxs("span",{className:"stat-k",children:[u("tasks.runningLabel"),Ge||qs?a.jsx("i",{className:"live-dot",title:u("tasks.turnTitle",{n:Ge+qs})}):null]}),a.jsx("span",{className:"stat-v",children:jr+Ge+qs})]})]}),a.jsxs("button",{className:"pick-item board-now",onClick:()=>E(!0),"aria-label":u("tasks.boardOpenAria"),title:u("tasks.boardList"),children:[a.jsxs("span",{className:"pick-main",children:[a.jsxs("span",{className:"pick-title",children:[a.jsx("span",{"aria-hidden":"true",children:(Ct==null?void 0:Ct.icon)??"🗂"})," ",(Ct==null?void 0:Ct.name)??h??u("tasks.board")]}),a.jsx("span",{className:"pick-sub",children:Er(Ct)})]}),a.jsxs("span",{className:"pick-meta",children:[u("tasks.boardCount",{n:f.length}),a.jsx(Oe,{name:"chevron",size:14})]})]}),Y&&a.jsx(We,{title:u("tasks.board"),onClose:()=>E(!1),children:a.jsx("div",{className:"pick-list",children:f.map(b=>a.jsxs("button",{className:`pick-item${h===b.slug?" on":""}`,onClick:()=>{S(b.slug),E(!1)},children:[a.jsx("span",{"aria-hidden":"true",children:b.icon}),a.jsxs("span",{className:"pick-main",children:[a.jsx("span",{className:"pick-title",children:b.name}),a.jsx("span",{className:"pick-sub",children:Er(b)})]}),a.jsx("span",{className:"pick-meta",children:h===b.slug?"✓":""})]},b.slug))})}),Mn?a.jsx(sv,{board:h??"",repo:(_e==null?void 0:_e.repo)??null,chat:An(globalThis.localStorage)||null,initialText:de,notify:n,onClose:()=>{ft(!1),Yn("")},onSeeded:()=>qn()}):null,Me?a.jsx(fb,{initialSeed:Ss,board:h??"",repo:(_e==null?void 0:_e.repo)??null,notify:n,onClose:()=>{Dt(!1),Ln("")}}):null,Gt?a.jsx(gb,{board:h??"",notify:n,onClose:()=>un(!1)}):null,Qt&&De?a.jsxs(We,{title:u("tasks.specSheetTitle"),onClose:()=>!Ae&&W(!1),children:[a.jsxs("div",{className:`spec-context-box${Pt?" is-open":""}`,children:[a.jsx(dm,{specList:os,currentSpec:De,open:Pt,onToggle:()=>kt(b=>!b),onPick:b=>$n(b,!0),t:u}),a.jsx("div",{className:"spec-md-row",children:a.jsx("button",{type:"button",className:"btn spec-md-open",onClick:()=>Ar(De),children:`📄 ${u("tasks.specMdPreview")}`})})]}),a.jsxs("div",{className:"spec-children-section",children:[a.jsx("div",{className:"list-head spec-children-head",children:u("tasks.specBatchesHead",{n:De.batches.length})}),a.jsx("div",{className:"list",children:De.batches.map(b=>{const U=Cr.has(b.id),re=Ta.has(b.id),ge=H.includes(b.id),Ze=je.includes(b.id);return a.jsxs("div",{className:`spec-batch${ge?" on":""}`,children:[a.jsxs("button",{type:"button",className:`list-item${ge?" on":""}`,onClick:()=>{z("tap"),oe(at=>at.includes(b.id)?at.filter(en=>en!==b.id):[...at,b.id])},children:[a.jsx("span",{className:"spec-check","aria-hidden":"true",children:ge?"☑":"☐"}),a.jsxs("span",{style:{flex:"1 1 auto",minWidth:0},children:[a.jsxs("span",{className:"row-title",children:["[",b.id,"] ",b.title]}),a.jsx(um,{batch:b,t:u}),b.objective?a.jsx("span",{className:"row-sub",children:b.objective.slice(0,140)}):null]}),U?a.jsx("span",{className:"spec-taken",children:u(re?"tasks.specAlready":"tasks.specFiledDone")}):null]}),a.jsxs("button",{type:"button",className:"link spec-batch-toggle","aria-expanded":Ze,onClick:()=>{z("tap"),ut(at=>at.includes(b.id)?at.filter(en=>en!==b.id):[...at,b.id])},children:[u("tasks.specDetailToggle")," ",Ze?"▴":"▾"]}),Ze?a.jsx("div",{className:"spec-batch-detail",children:li(b.section||b.title||"")}):null]},b.id)})}),Zt?a.jsx("button",{className:"btn",style:{marginTop:12,width:"100%"},onClick:()=>{W(!1),It()},children:u("tasks.specHistoryTitle")}):a.jsx("button",{className:"btn primary",style:{marginTop:12,width:"100%"},disabled:Ae||!H.length,onClick:Di,children:Ae?u("tasks.specLaunching"):u("tasks.specLaunchBtn",{n:H.length})}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px",lineHeight:1.6},children:u("tasks.specNote")})]})]}):null,Ye&&De?a.jsxs(We,{title:u("tasks.specHistoryTitle"),onClose:()=>mt(!1),children:[a.jsxs("div",{className:`spec-context-box${Pt?" is-open":""}`,children:[a.jsx(dm,{specList:os,currentSpec:De,open:Pt,onToggle:()=>kt(b=>!b),onPick:b=>$n(b,!1),t:u}),a.jsx("div",{className:"spec-md-row",children:a.jsx("button",{type:"button",className:"btn spec-md-open",onClick:()=>Ar(De),children:`📄 ${u("tasks.specMdPreview")}`})})]}),a.jsxs("div",{className:"spec-children-section",children:[a.jsx("div",{className:"list-head spec-children-head",children:u("tasks.specBatchesHead",{n:De.batches.length})}),a.jsx("div",{className:"pick-list",children:De.batches.map(b=>{var at;const U=Xt.byId.get(b.id)??null,re=U&&(U.status==="done"||U.status==="archived"),ge=U?Lr[U.status]?u(Lr[U.status]):U.status:u("tasks.specNotFiled"),Ze=re?U!=null&&U.completedAt?Je(U.completedAt):null:U!=null&&U.startedAt?u("tasks.specStartedAt",{when:Je(U.startedAt)}):null;return a.jsxs("details",{className:"pick-item history-row",children:[a.jsxs("summary",{className:"history-summary",children:[a.jsx("span",{className:`dot ${(U==null?void 0:U.status)??"todo"}`}),a.jsxs("span",{className:"history-title",title:`[${b.id}] ${b.title}`,children:["[",b.id,"] ",b.title]}),a.jsx("span",{className:"history-state",children:re?u("tasks.specDoneBadge"):ge}),a.jsx(Oe,{name:"chevron",size:14})]}),a.jsxs("div",{className:"history-body",children:[a.jsxs("div",{className:"history-head",children:[a.jsx(um,{batch:b,t:u}),a.jsx("span",{className:"history-state-in",children:ge}),Ze?a.jsx("span",{className:"history-when",children:Ze}):null]}),b.objective?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"history-label",children:u("tasks.specObjective")}),a.jsx("div",{className:"history-objective",children:b.objective})]}):null,U!=null&&U.result?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"history-label",children:u("tasks.specResult")}),a.jsx("div",{className:"history-result",children:U.result})]}):null,(at=U==null?void 0:U.git)!=null&&at.head?a.jsxs("div",{className:"git-badge",children:[a.jsx("span",{className:"git-sha",children:U.git.head}),U.git.subject?a.jsx("span",{className:"git-subject",children:U.git.subject}):null]}):null,U?a.jsx("button",{type:"button",className:"btn history-open-task",onClick:()=>{z("action"),mt(!1),br(U)},children:`🔍 ${u("tasks.specOpenTask")}`}):null,a.jsxs("details",{className:"history-sub-details",children:[a.jsx("summary",{children:u("tasks.specSection")}),a.jsx("div",{className:"history-section",children:li(b.section||b.title||"")})]})]})]},b.id)})}),Zt?null:a.jsx("button",{className:"btn",style:{marginTop:12,width:"100%"},onClick:()=>{mt(!1),Tr()},children:u("tasks.specOpenLaunch")}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px",lineHeight:1.6},children:u("tasks.specHistoryNote")})]})]}):null,jt?a.jsx(lv,{board:jt.board??h,repo:(_e==null?void 0:_e.repo)??null,path:jt.path,title:jt.title,onClose:()=>$(null)}):null,a.jsxs("div",{className:"list-head",children:[a.jsx("span",{children:u("tasks.tasks")}),a.jsxs("span",{style:{display:"flex",gap:10,alignItems:"center"},children:[a.jsx("button",{className:"link",onClick:()=>{z("tap"),te(!0)},children:u("tasks.newTask")}),a.jsx(yr,{variant:"link",onRefresh:ka})]})]}),y?a.jsx(Qn,{label:u("common.loading")}):null,!y&&!k.length?a.jsx("div",{className:"empty",children:u("tasks.empty")}):null,a.jsx("div",{className:"list",children:k.map(b=>{var U;return a.jsxs("button",{className:"row",onClick:()=>{z("tap"),br(b)},children:[a.jsx("span",{className:`dot ${b.status}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:b.title}),a.jsxs("span",{className:"row-sub",children:[Lr[b.status]?u(Lr[b.status]):b.status,b.status==="running"&&b.elapsedSec!=null?` ・ ${u("tasks.elapsedMin",{n:Math.floor(b.elapsedSec/60)})}`:"",b.failures?` ・ ${u("tasks.failures",{n:b.failures})}`:"",b.completedAt?` ・ ${Je(b.completedAt)}`:""]}),(U=b.git)!=null&&U.head?a.jsxs("span",{className:"git-badge",children:[a.jsx("span",{className:"git-sha",children:b.git.head}),a.jsx("span",{className:"git-subject",children:b.git.subject||u("tasks.noMessage")}),b.git.dirty?a.jsx("span",{className:"git-dirty",children:u("tasks.uncommitted")}):null,b.discord?a.jsx("span",{className:"git-dc",role:"link",tabIndex:0,title:u("tasks.openInDiscord"),onClick:re=>{re.stopPropagation(),window.open(b.discord.url,"_blank","noopener")},onKeyDown:re=>{re.key==="Enter"&&(re.stopPropagation(),window.open(b.discord.url,"_blank","noopener"))},children:"Discord"}):null]}):null]}),a.jsx(Oe,{name:"chevron",size:16})]},b.id)})}),a.jsxs("button",{className:"kill-open",onClick:()=>T(!0),children:[a.jsx(Oe,{name:"bolt",size:18}),u("tasks.emergency")]}),A?a.jsxs(We,{title:u("tasks.emergencyTitle"),onClose:()=>!P&&T(!1),children:[a.jsx("div",{className:"warn-card",children:u("tasks.emergencyNote",{n:jr})}),a.jsx("div",{className:"warn-card",style:{marginTop:8},children:ls.engaged?u("tasks.pausedNow",{at:ls.engagedAt??u("tasks.unknownTime")}):u("tasks.pauseHelp")}),ls.engaged?a.jsx("button",{className:"btn",style:{marginTop:10,width:"100%"},onClick:Dn,disabled:P,children:u("tasks.resumeEstop")}):a.jsx("div",{className:"hold-grid",style:{marginTop:10},children:a.jsx(ts,{label:u("tasks.pauseLabel"),sub:u("tasks.pauseSub"),tone:"safe",disabled:P,onFire:ja})}),a.jsxs("div",{className:"hold-grid",children:[a.jsx(ts,{label:u("tasks.drainLabel"),sub:u("tasks.drainSub"),tone:"safe",disabled:P,onFire:()=>kn("drain")}),a.jsx(ts,{label:u("tasks.restartLabel"),sub:u("tasks.restartSub"),tone:"danger",disabled:P,onFire:()=>kn("restart")}),a.jsx(ts,{label:u("tasks.stopLabel"),sub:u("tasks.stopSub"),tone:"danger",disabled:P,onFire:()=>kn("stop")}),a.jsx(ts,{label:u("tasks.startLabel"),sub:u("tasks.startSub"),tone:"safe",disabled:P,onFire:()=>kn("start")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 4px"},children:u("tasks.auditNote")})]}):null,fe?a.jsx(Hk,{board:h,boards:f,notify:n,onClose:()=>te(!1),onCreated:b=>{h&&(b==null?void 0:b.board)===h?Pe(h):b!=null&&b.board&&S(b.board)}}):null,J?a.jsx(qg,{data:O,hours:24,board:h,spec:(De==null?void 0:De.path)??null,onClose:()=>ce(!1)}):null,me?a.jsx(Zd,{board:me.board,spec:me.spec,onClose:()=>ye(null),notify:n}):null,xt?a.jsx(Eb,{notify:n,onClose:be,onChanged:Ve,focusTaskId:q}):null,Ne?a.jsx(cv,{notify:n,onClose:()=>ke(!1),onAbortTask:()=>h&&Pe(h)}):null]}),m&&!Sn?a.jsx(We,{title:m.title??m.id,onClose:Fi,children:$i}):null,Sn?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:Fi,"aria-label":u("common.close"),children:a.jsx(Oe,{name:"close",size:18})})]}),a.jsx("div",{className:"split-detail-body",children:$i})]}):a.jsxs("div",{className:"split-placeholder",children:[a.jsx("b",{children:u("tasks.selectPlaceholder")}),a.jsx("span",{children:u("tasks.selectHint")})]})}):null]})}function v0({onEvent:e,onReady:t,onState:n}){const[s,r]=d.useState("connecting"),[i,l]=d.useState(!1),o=d.useRef(null),c=d.useRef(new Map),u=d.useRef(1),f=d.useRef(0),g=d.useRef(null),h=d.useRef(!1),S=d.useRef(Date.now()),k=d.useRef(e),x=d.useRef(t),N=d.useRef(n);k.current=e,x.current=t,N.current=n,d.useEffect(()=>{const T=setInterval(()=>{const M=S.current;l(!!M&&Date.now()-M>2e3)},400);return()=>clearInterval(T)},[]);const w=d.useCallback(T=>{for(const[M,_]of c.current)_({id:M,error:{message:T}});c.current.clear()},[]),m=d.useCallback((T,M={},_=2e4)=>{const P=o.current,I=u.current++;return new Promise(y=>{if(!P||P.readyState!==WebSocket.OPEN){y({id:I,error:{message:C("socket.notConnected")}});return}const G=setTimeout(()=>{c.current.delete(I),y({id:I,error:{message:"timeout"}})},_);c.current.set(I,F=>{clearTimeout(G),y(F)}),P.send(JSON.stringify({jsonrpc:"2.0",id:I,method:T,params:M}))})},[]),v=d.useCallback(()=>{var M;if(o.current&&o.current.readyState<=WebSocket.OPEN)return;r("connecting"),(M=N.current)==null||M.call(N,"connecting"),S.current||(S.current=Date.now());const T=zx("/ws/chat");o.current=T,T.onopen=()=>{f.current=0},T.onmessage=_=>{var y,G,F,K;let P;try{P=JSON.parse(_.data)}catch{return}if(P.id&&c.current.has(P.id)){c.current.get(P.id)(P),c.current.delete(P.id);return}((y=P==null?void 0:P.params)==null?void 0:y.type)==="gateway.ready"&&(S.current=null,l(!1),r("ready"),(G=N.current)==null||G.call(N,"ready"),(F=x.current)==null||F.call(x)),(K=k.current)==null||K.call(k,P)},T.onerror=()=>{var _;r("error"),(_=N.current)==null||_.call(N,"error")},T.onclose=()=>{var P;if(o.current=null,S.current||(S.current=Date.now()),r("closed"),(P=N.current)==null||P.call(N,"closed"),w(C("socket.disconnected")),h.current)return;const _=Math.min(15e3,1e3*2**f.current);f.current+=1,clearTimeout(g.current),g.current=setTimeout(()=>v(),_)}},[w]),A=d.useCallback(()=>{var T;if(f.current=0,!o.current||o.current.readyState!==WebSocket.OPEN){try{(T=o.current)==null||T.close()}catch{}o.current=null,v()}},[v]);return d.useEffect(()=>{h.current=!1,v();const T=()=>{if(document.visibilityState!=="visible")return;const _=o.current;(!_||_.readyState!==WebSocket.OPEN)&&A()},M=()=>A();return document.addEventListener("visibilitychange",T),window.addEventListener("online",M),window.addEventListener("pageshow",T),()=>{var _;h.current=!0,document.removeEventListener("visibilitychange",T),window.removeEventListener("online",M),window.removeEventListener("pageshow",T),clearTimeout(g.current);try{(_=o.current)==null||_.close()}catch{}o.current=null}},[v,A]),{rpc:m,state:s,reconnectNow:A,showBanner:i}}const lt="mobile",Wu="hm.storedProfile",pm="hm.defaultProfile";function y0(e=globalThis.localStorage){try{return!e||e.getItem(pm)===lt?!1:(e.removeItem(Wu),e.setItem(pm,lt),!0)}catch{return!1}}const kv="hm.repo",bv="hm.repoRecent",Sv="hm.board",Vu="hm.pendingRepo",Nv=6,w0=4;function hm(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 x0(e){const t=Array.isArray(e)?e.filter(n=>n&&n.slug):[];return t.length?t.find(n=>n.current)??t[0]:null}function jv(e=globalThis.localStorage){try{const t=e==null?void 0:e.getItem(bv),n=JSON.parse(t??"[]");return Array.isArray(n)?n.filter(s=>typeof s=="string"&&s).slice(0,Nv):[]}catch{return[]}}function k0(e=globalThis.localStorage){try{return(e==null?void 0:e.getItem(kv))||null}catch{return null}}function b0(e=[],t=[],n=w0){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 Ua(e){return String((e==null?void 0:e.label)??(e==null?void 0:e.id)??"")}function S0(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(kv,n),s&&e.setItem(Sv,s),n){const i=[n,...jv(e).filter(l=>l!==n)].slice(0,Nv);e.setItem(bv,JSON.stringify(i))}return{repo:n||null,board:s||null}}catch{return{repo:n||null,board:s||null}}}function N0(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 mm(e=globalThis.localStorage){try{const t=e==null?void 0:e.getItem(Vu);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 pl(e=globalThis.localStorage,t=null){var n;if(e)try{t!=null&&t.repoId?e.setItem(Vu,JSON.stringify({repoId:t.repoId,profile:t.profile||""})):(n=e.removeItem)==null||n.call(e,Vu)}catch{}}function j0({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 fm(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 C0(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}function E0(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 Rl=56,gm=400;function ap(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 vm(e,t=0){const n=String(e??"").trim();if(!n)return"";let s=n;if(n.startsWith("{")||n.startsWith("[")){const i=A0(n);if(i!==void 0){const l=Pl(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=R0(o[1]))}}const r=P0(s);return r?t>0&&r.length>t?`${r.slice(0,t-1)}…`:r:""}const T0=["error","output","stdout","stderr","result","content","message","status","text"];function A0(e){try{return JSON.parse(e)}catch{return}}function R0(e){try{return JSON.parse(`"${e}"`)}catch{return e}}function Pl(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=>Pl(s,t+1)).filter(Boolean).join(`
78
- `);if(!e||typeof e!="object")return"";for(const n of T0)if(n in e){const s=Pl(e[n],t+1);if(s)return s}return t>=2?"":Object.entries(e).slice(0,4).map(([n,s])=>{const r=Pl(s,t+1);return r?`${n}: ${r}`:""}).filter(Boolean).join(" · ")}function P0(e){for(const t of String(e??"").split(`
79
- `)){const n=t.replace(/\s+/g," ").trim();if(n)return n}return""}function Cv(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 Ev(e,t){const n=Cv(e,t);return n.length>gm?`${n.slice(0,gm-1)}…`:n}function Tv(e,t){const n=Cv(e,t);return n?e==="write_file"||e==="patch"||e==="read_file"||!/\s/.test(n)&&n.includes("/")?ap(n,Rl):n.length>Rl?`${n.slice(0,Rl-1)}…`:n:""}function I0(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:Tv(t.name,t.args),full:Ev(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 Ic(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?Tv(o,l.toolArgs):"",u=l.toolArgs?Ev(o,l.toolArgs):"",f=ap(vm(l.text),Rl),g=String(l.text??""),h=vm(l.text,300);s.push({id:String(l.id??i),name:o,detail:c||f,full:u&&h?`${u}
80
- → ${h}`:u||h||g.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 _0({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 M0({key:e="",shiftKey:t=!1,isComposing:n=!1}={}){return e!=="Enter"||n?!1:!!t}const hl="hm.session.seen.v1";function Av(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 Pn(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=Av(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 L0(e){if(e&&typeof e=="object")return Pn(e);const t=String(e??"").trim();if(!t)return{};try{const n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{}:Pn(n)}catch{return{}}}function _c(e){return JSON.stringify(Pn(e))}function O0(e,t,n){const s=Pn(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 Pn(s)}function D0(e,t,n,s){const r=String(t??"").trim();if(!r)return Pn(e);const i=Number(n),l=Number(s)>0?Math.floor(Number(s)):Date.now(),o=Pn(e),c=o[r],u=(c==null?void 0:c.count)??0;return o[r]={count:Number.isFinite(i)&&i>=0?Math.max(u,Math.floor(i)):u,at:l,opened:!0},Pn(o)}function $0(e,t,n,s){const r=String(n??"").trim(),i=Pn(e);if(!r)return i;const l=(Array.isArray(t)?t:[]).find(u=>String((u==null?void 0:u.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 u=Number(s)>0?Math.floor(Number(s)):Date.now();i[r]={count:Math.max((o==null?void 0:o.count)??0,c),at:u,opened:!0}}return Pn(i)}function F0(e,t,n){var i,l;const s=Pn(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 Pn(s)}function B0(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 U0(e,t){return e?typeof e.has=="function"?e.has(t):Array.isArray(e)?e.some(n=>String(n??"")===t):!1:!1}function H0({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)||U0(r,i),c=B0(t,i),u=n&&typeof n=="object"?Av(n[i]):null,f=Math.max(0,Math.floor(Number(e==null?void 0:e.message_count)||0)),g=(u==null?void 0:u.opened)===!0,h=!l&&g&&f>u.count?Math.max(1,f-u.count):0;return{isActive:l,isRunning:o,unreadReports:c,unreadReplies:h}}function z0(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 W0(e){const t=Math.floor(Number(e)||0);return t<=0?"":t>1?`+${t}`:"NEW"}function Mc(e,t=120){e&&(e.style.height="auto",e.style.height=`${_0({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,offsetHeight:e.offsetHeight,cap:t})}px`)}function V0(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 Rv({text:e,onCopyCode:t,copyLabel:n}){return d.useMemo(()=>li(e,{onCopyCode:t,copyLabel:n}),[e,t,n])}function K0({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:_o(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:Je(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(Rv,{text:c,onCopyCode:i,copyLabel:C("chat.copy")})}):a.jsx("div",{className:"report-card-summary",children:Vd(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 Lc({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,u=!!(r.full&&r.full!==r.detail);return a.jsxs("li",{className:`${r.done?"done":"run"}${o?" expanded":""}${u?" tappable":""}`,onClick:u?f=>{f.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 Q0=1500;function G0({notify:e,chatReports:t=[],reviewItems:n=[],liveTurns:s=[],active:r=!1,openRequest:i=null,onConsumedOpen:l,discussRequest:o=null,onConsumedDiscuss:c}){var wp,xp,kp,bp;const{lang:u}=$e(),[f,g]=d.useState([]),[h,S]=d.useState(null),[k,x]=d.useState(null),[N,w]=d.useState(""),[m,v]=d.useState([]),[A,T]=d.useState(null),[M,_]=d.useState(""),[P,I]=d.useState(!1),[y,G]=d.useState(null),[F,K]=d.useState(Date.now()),[D,ae]=d.useState([]),[fe,te]=d.useState({}),[Y,E]=d.useState(!1),[O,B]=d.useState(!0),[J,ce]=d.useState(null),[me,ye]=d.useState(null),[Ne,ke]=d.useState(!1),[Ge,Kt]=d.useState(!1),[ht,wt]=d.useState(""),[xt,rt]=d.useState(null),[_e,ct]=d.useState({}),[Qt,W]=d.useState({}),[ue,pe]=d.useState(null),[H,oe]=d.useState(null),[Ae,Nt]=d.useState(!1),[Ye,mt]=d.useState(null),[Pt,kt]=d.useState(!1),[jt,$]=d.useState([]),[je,ut]=d.useState(null),[Mn,ft]=d.useState([]),[de,Yn]=d.useState(null),[Me,Dt]=d.useState(lt),[Ss,Ln]=d.useState(lt),[Gt,un]=d.useState([]),[Be,dn]=d.useState(!1),[Yt,is]=d.useState([]),[we,Jn]=d.useState(null),[$t,Q]=d.useState(lt),[q,ve]=d.useState(null),[Ce,Xe]=d.useState(!1),[Re,be]=d.useState(!1),[xe,Le]=d.useState([]),[Pe,Ve]=d.useState(!1),[Jt,ka]=d.useState(!1),[qn,Ns]=d.useState({}),ba=d.useRef(null),qs=d.useRef(null),Sa=d.useRef(null),[_i,Fo]=d.useState([]),[Mi,kr]=d.useState(!1),On=d.useRef({}),[Li,br]=d.useState(()=>xa());d.useEffect(()=>yv(br),[]);const qt=d.useRef(null),xn=d.useRef(null),Sr=d.useRef(lt),Na=d.useRef(null),Nr=d.useRef([]),kn=d.useRef([]),ja=d.useRef([]);ja.current=Array.isArray(t)?t:[];const Dn=d.useRef(null),bn=d.useRef(null),Ca=d.useRef(0),Ea=d.useRef(0),jr=d.useRef(new WeakMap),ls=d.useRef(0),Sn=d.useRef(null),os=d.useRef(!0),De=d.useRef([]),Xt=d.useRef(null);De.current=D;const Cr=d.useRef(!1),Ta=d.useRef(new Set);d.useEffect(()=>{const p=Ta.current;return()=>{for(const j of p)URL.revokeObjectURL(j);p.clear()}},[]),qt.current=h,xn.current=k,Sr.current=Ss,Na.current=we,Nr.current=Yt;const Zt=d.useCallback(async()=>{if(Nr.current.length)return Nr.current;try{const p=await X("/api/repos"),j=Array.isArray(p==null?void 0:p.repos)?p.repos:[];return is(j),j}catch{return[]}},[]),Er=d.useCallback(async p=>{const j=String(p??"").trim().toLowerCase();if(!j)return null;const R=V=>(Array.isArray(V)?V:[]).find(se=>(se==null?void 0:se.path)&&String(se.path).trim().toLowerCase()===j)??null,L=R(Nr.current);if(L)return L;try{return R(await Zt())}catch{return null}},[Zt]),Ct=d.useCallback(async p=>{var L;try{const V=await X("/api/sessions?limit=40"),se=(V.sessions??[]).map(ne=>({id:ne.id,title:ne.title,source:ne.source,profile:ne.profile??"default",message_count:ne.messages??0,is_active:ne.active,started_at:ne.lastActive?Math.floor(ne.lastActive/1e3):null}));if(Array.isArray(V.profiles)&&V.profiles.length&&un(V.profiles),se.length)return kn.current=se,g(se),se}catch{}const j=await p("session.list",{}),R=((L=j==null?void 0:j.result)==null?void 0:L.sessions)??[];return kn.current=R,g(R),R},[]),Oi=d.useRef(u);Oi.current=u;const Tr=d.useCallback(async()=>{const p=u;try{const j=await X(`/api/snippets?lang=${encodeURIComponent(p)}`);if(Oi.current!==p)return;Fo(j.snippets??[])}catch{}},[u]);d.useEffect(()=>{Tr();const p=()=>Tr();return window.addEventListener("hm:snippets",p),window.addEventListener("hm:lang",p),()=>{window.removeEventListener("hm:snippets",p),window.removeEventListener("hm:lang",p)}},[Tr]);const It=((xp=(wp=we==null?void 0:we.boards)==null?void 0:wp[0])==null?void 0:xp.slug)??"",$n=d.useCallback(async()=>{try{const p=It?`?board=${encodeURIComponent(It)}`:"",j=await X(`/api/architect/jobs${p}`);j!=null&&j.ok&&mt(j)}catch{mt(null)}},[It]),Ar=d.useMemo(()=>ev((Ye==null?void 0:Ye.jobs)??[],Mn,It),[Ye,Mn,It]),Bo=d.useCallback(p=>{if(p){z("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??It??null,jobId:p.id??null}}))}catch{}}},[It]),Di=tv(Ar);d.useEffect(()=>{if(!r&&!Ae)return;$n();const p=setInterval($n,Di);return()=>clearInterval(p)},[r,Ae,$n,Di]);const $i=d.useMemo(()=>{const p=nv({specReady:(Ye==null?void 0:Ye.specReady)??[],pending:(Ye==null?void 0:Ye.pending)??[]});return!p||jt.includes(p.path)?null:p},[Ye,jt]),Fi=d.useCallback(async p=>{if(!(!p||Pt)){kt(!0);try{const j=await X("/api/specs/launch",{method:"POST",body:{...It?{board:It}:{},specRelPath:p.path,batchIds:p.ids,...h?{chat:h}:{}}});e(C("seed.bannerFiled",{n:((j==null?void 0:j.created)??[]).length}));try{vt("launch")}catch{}await $n()}catch(j){e((j==null?void 0:j.message)??C("seed.failed"))}finally{kt(!1)}}},[It,Pt,h,e,C,$n]),Aa=d.useCallback(async(p,j="default")=>{if(!p)return;const R=j&&j!=="default"?j:null;try{const L=new URLSearchParams({limit:"300",tools:"1"});R&&L.set("profile",R);const V=await X(`/api/sessions/${encodeURIComponent(p)}/transcript?${L}`);if(!(V!=null&&V.ok)||!Array.isArray(V.messages)||xn.current!==p&&qt.current!==p)return;T({sessionId:p,profile:R,hasMore:!!V.hasMore,oldestId:V.oldestId??null,loadingMore:!1});const{blocks:se}=Ic(V.messages,sr);if(!se.length)return;v(ne=>{const ee=ne[ne.length-1];return ee!=null&&ee.open?ne:se})}catch{}},[]),Bi=d.useCallback(async()=>{const p=A;if(!(p!=null&&p.sessionId)||!p.hasMore||!p.oldestId||p.loadingMore)return;const j=Dn.current,R=j==null?void 0:j.querySelector("[data-mid]");bn.current=R?{mid:R.getAttribute("data-mid"),top:R.getBoundingClientRect().top}:null,os.current=!1,T(L=>L&&{...L,loadingMore:!0});try{const L=new URLSearchParams({limit:"250",before:String(p.oldestId),tools:"1"});p.profile&&p.profile!=="default"&&L.set("profile",p.profile);const V=await X(`/api/sessions/${encodeURIComponent(p.sessionId)}/transcript?${L}`);if(!(V!=null&&V.ok)){e((V==null?void 0:V.reason)??C("chat.cannotOpen")),bn.current=null,T(ne=>ne&&{...ne,loadingMore:!1});return}const{blocks:se}=Ic(V.messages??[],sr);v(ne=>{const ee=new Set(ne.filter(Se=>Se.mid!=null).map(Se=>`m${Se.mid}`)),ie=se.filter(Se=>Se.mid==null||!ee.has(`m${Se.mid}`));return ie.length?[...ie,...ne]:ne}),T({sessionId:p.sessionId,profile:p.profile??null,hasMore:!!V.hasMore,oldestId:V.oldestId??null,loadingMore:!1})}catch(L){e((L==null?void 0:L.message)||C("chat.cannotOpen")),bn.current=null,T(V=>V&&{...V,loadingMore:!1})}},[A,e]);d.useLayoutEffect(()=>{const p=bn.current;if(!p)return;bn.current=null;const j=Dn.current;if(!j)return;const R=j.querySelector(`[data-mid="${p.mid}"]`);if(!R)return;const L=R.getBoundingClientRect().top-p.top;L&&(j.scrollTop=Math.max(0,j.scrollTop+L))},[m]);const Nn=d.useCallback(async(p,j,R="default")=>{var L,V,se;be(!0);try{const ne=await p("session.resume",{session_id:j,...R&&R!=="default"?{profile:R}:{}}),ee=ne==null?void 0:ne.result;if(!(ee!=null&&ee.session_id))return{ok:!1,sid:null,error:(ne==null?void 0:ne.error)??null};pl(globalThis.localStorage,null),S(ee.session_id);const ie=ee.resumed??j;x(ie),Dt(R||"default");const Se=((L=ee.info)==null?void 0:L.cwd)??ee.cwd??"";Se?Zt().then(he=>{qt.current===ee.session_id&&Jn(N0(he,Se))}):Jn(null);const Ee=Array.isArray(ee.messages)?ee.messages:[];return(se=Xt.current)==null||se.call(Xt,ie,Math.max(Number((V=kn.current.find(he=>String(he.id)===String(ie)))==null?void 0:V.message_count)||0,Ee.length)),v(Ee.filter(he=>he.role==="user"||he.role==="assistant").map(he=>({role:he.role==="user"?"user":"assistant",text:String(he.text??""),at:sr(he.at??he.timestamp??he.created_at)})).filter(he=>he.text.trim().length>0)),Aa(ie,R),{ok:!0,sid:ee.session_id}}finally{be(!1)}},[Zt,Aa]),Ui=d.useCallback(p=>{var V,se,ne,ee;const j=(V=p==null?void 0:p.params)==null?void 0:V.type,R=((se=p==null?void 0:p.params)==null?void 0:se.payload)??{},L=(ne=p==null?void 0:p.params)==null?void 0:ne.session_id;if(!(L&&qt.current&&L!==qt.current)){if(j==="tool.start"||j==="tool.complete"){const ie=R.args&&typeof R.args=="object"?R.args:{};ae(Se=>I0(Se,{kind:j==="tool.start"?"start":"complete",id:R.tool_id||R.tool_call_id||R.name||"",name:R.name||R.tool_name||"tool",args:ie,duration_ms:R.duration_ms}));return}if(j==="message.start"){const ie=De.current;I(!0),G(Date.now()),wt(""),E(!1),ae([]),v(Se=>{const Ee=ie.length?V0(Se,ie):Se,he=Ee[Ee.length-1];return(he==null?void 0:he.role)==="assistant"&&he.open&&!he.text?Ee:[...Ee,{role:"assistant",text:"",open:!0,at:Date.now()}]});return}if(j==="thinking.delta"){wt(ie=>(ie+(R.text??"")).slice(-400));return}if(j==="message.delta"){const ie=R.text??"";if(!ie)return;v(Se=>{const Ee=[...Se],he=Ee[Ee.length-1];return(he==null?void 0:he.role)==="assistant"&&he.open?Ee[Ee.length-1]={...he,text:he.text+ie}:Ee.push({role:"assistant",text:ie,open:!0,at:Date.now()}),Ee});return}if(j==="message.complete"){const ie=De.current;G(null),I(!1),wt(""),E(!1),ae([]),ye(R.usage??null),v(Se=>{const Ee=[...Se],he=Ee[Ee.length-1],nn=ie.map(Ir=>({...Ir,done:!0}));return(he==null?void 0:he.role)==="assistant"?Ee[Ee.length-1]={...he,text:R.text??he.text,open:!1,tools:nn.length?[...he.tools??[],...nn]:he.tools}:nn.length&&Ee.push({role:"assistant",text:String(R.text??""),open:!1,tools:nn,at:Date.now()}),Ee});{const Se=xn.current??qt.current;Se&&Ct((ee=b.current)==null?void 0:ee.rpc).then(Ee=>{var nn;const he=(Array.isArray(Ee)?Ee:[]).find(Ir=>String(Ir.id)===String(Se));he&&((nn=Xt.current)==null||nn.call(Xt,he.id,he.message_count))}).catch(()=>{})}return}j==="session.title"&&R.title&&w(R.title)}},[]),b=d.useRef(null),U=d.useRef(null),re=d.useRef(null),ge=d.useRef("idle"),Ze=d.useCallback(async()=>{var L,V;const p=(L=b.current)==null?void 0:L.rpc;if(!p)return;Cr.current&&(Cr.current=!1,e(C("chat.reconnected"))),await Ct(p);const j=re.current;if(re.current=null,j){await((V=U.current)==null?void 0:V.call(U,j.id,j.focusId??null,j.profile??"default"));return}if(!xn.current&&mm())return;const R=j0({storedSid:xn.current,sessions:kn.current,profile:Sr.current});if(R)if(R.from==="recent"&&x(R.sid),!(await Nn(p,R.sid,Sr.current)).ok)S(null),e(C("chat.previousChatFailed"));else{const ne=kn.current.find(ee=>ee.id===R.sid);ne!=null&&ne.title&&w(ne.title)}},[Ct,e,Nn]),at=d.useCallback(p=>{(p==="closed"||p==="error")&&(I(!1),Cr.current=!0)},[]),en=v0({onEvent:Ui,onReady:Ze,onState:at});b.current=en;const{rpc:Et,showBanner:Fv,state:Hi}=en;ge.current=Hi,d.useEffect(()=>{try{y0();const p=localStorage.getItem("hm.storedSid");p&&!xn.current&&x(p);const j=localStorage.getItem(Wu);j&&Ln(j);const R=p?null:mm();R&&(R.profile&&(Dt(R.profile),Ln(R.profile)),Zt().then(L=>{if(qt.current||xn.current)return;const V=L.find(se=>se.id===R.repoId);V&&Jn(V)}))}catch{}},[]),d.useEffect(()=>{try{k?(localStorage.setItem("hm.storedSid",k),localStorage.setItem(Bg,k)):localStorage.removeItem("hm.storedSid"),localStorage.setItem(Wu,Ss||lt)}catch{}},[k,Ss]);const Xs=(de==null?void 0:de.sessionId)||h||k||null,Fn=d.useMemo(()=>de!=null&&de.sessionId?[String(de.sessionId)]:[k,h].filter(Boolean).map(String),[de==null?void 0:de.sessionId,k,h]),tn=d.useMemo(()=>s.find(p=>(p==null?void 0:p.sessionId)&&Fn.includes(String(p.sessionId)))??null,[s,Fn]),dt=d.useMemo(()=>{const p=(n??[]).filter(L=>L&&L.status!=="done"),j=p.find(L=>{var V;return((V=L.review)==null?void 0:V.chat)&&Fn.includes(String(L.review.chat))});if(j)return j;if(!we)return null;const R=we.path?String(we.path).toLowerCase():"";return p.find(L=>{var V,se,ne;return!((V=L.review)!=null&&V.chat)&&(((se=L.review)==null?void 0:se.repo)===we.id||R&&((ne=L.review)==null?void 0:ne.target)&&String(L.review.target).toLowerCase().startsWith(R))})??null},[n,Fn,we]),jn=!!(P||tn),Uo=d.useRef(!1),[Bv,ip]=d.useState(!1);d.useEffect(()=>{if(Uo.current&&!jn){ip(!0);const p=setTimeout(()=>ip(!1),240);return Uo.current=jn,()=>clearTimeout(p)}Uo.current=jn},[jn]);const lp=d.useMemo(()=>yk(Fn,t,de?"":(we==null?void 0:we.path)??""),[Fn,t,de,we==null?void 0:we.path]),Zs=d.useMemo(()=>fk(t,lp),[t,lp]),Ho=d.useMemo(()=>wk(m,Zs),[m,Zs]),Uv=Zs.length?Zs[Zs.length-1].key:"";d.useEffect(()=>{if(!jn)return;const p=setInterval(()=>K(Date.now()),1e3);return()=>clearInterval(p)},[jn]);const zo=dt&&(dt.status==="running"||dt.status==="ready")?dt.id:null;d.useEffect(()=>{if(!zo){ce(null);return}let p=!0;const j=async()=>{try{const L=await X(`/api/review/${encodeURIComponent(zo)}/worker?limit=8`);p&&ce(L)}catch{}};j();const R=setInterval(()=>{document.visibilityState==="visible"&&j()},4e3);return()=>{p=!1,clearInterval(R)}},[zo]),d.useEffect(()=>{const p=Dn.current;p&&(de!=null&&de.focusId||os.current&&(p.scrollTop=p.scrollHeight))},[m,jn,D,ht,dt,J,de==null?void 0:de.focusId,Uv]);const Ra=d.useCallback(p=>{const j=Dn.current;if(!j||!p)return;const R=j.querySelector(`[data-mid="${p}"]`);if(!R)return;const L=R.getBoundingClientRect().top-j.getBoundingClientRect().top;j.scrollTop=Math.max(0,j.scrollTop+L-10)},[]);d.useEffect(()=>{if(!(de!=null&&de.focusId))return;const p=setTimeout(()=>Ra(de.focusId),120),j=setTimeout(()=>Ra(de.focusId),500);return()=>{clearTimeout(p),clearTimeout(j)}},[de==null?void 0:de.focusId,m.length,Ra]),d.useEffect(()=>{const p=k??h;if(!p){rt(null);return}let j=!0;return X(`/api/discord/session?session_id=${encodeURIComponent(p)}`).then(R=>j&&rt(R.link??null)).catch(()=>j&&rt(null)),()=>{j=!1}},[k,h]),d.useEffect(()=>{try{ct(ro(localStorage.getItem(ia))),Ns(L0(localStorage.getItem(hl)))}catch{ct({}),Ns({})}},[]);const cs=d.useCallback(p=>{if(!p)return;const j=gk(ja.current,p);ct(R=>{const L=Hg(R,p,Math.max(Date.now(),j));try{localStorage.setItem(ia,JSON.stringify(L))}catch{}return L})},[]),Hv=d.useCallback((p,j)=>{p&&Ns(R=>{const L=D0(R,p,j,Date.now());try{localStorage.setItem(hl,_c(L))}catch{}return L})},[]);Xt.current=Hv,d.useEffect(()=>{f.length&&Ns(p=>{const j=Date.now(),R=O0(p,f,j),L=r&&Xs?$0(R,f,Xs,j):R;try{localStorage.setItem(hl,_c(L))}catch{}return L})},[f,r,Xs]),d.useEffect(()=>{const p=()=>{var R;const j=(R=b.current)==null?void 0:R.rpc;j&&Ct(j)};return window.addEventListener("hm:wake-sync",p),()=>window.removeEventListener("hm:wake-sync",p)},[Ct]);const Pa=d.useCallback(async({force:p=!1}={})=>{var R;const j=Date.now();if(!p&&j-Ca.current<Q0)return!0;Ca.current=j;try{window.dispatchEvent(new CustomEvent("hm:refresh-reports"));const L=(R=b.current)==null?void 0:R.rpc;if(ge.current==="ready"&&L){Kt(!0);try{await Ct(L)}finally{Kt(!1)}}return!0}catch{return!1}},[Ct]),zv=d.useCallback(()=>{ke(!0),Pa()},[Pa]);d.useEffect(()=>{const p=Array.isArray(s)?s.length:0,j=Ea.current;Ea.current=p,j>0&&p<j&&Pa({force:!0})},[s,Pa]);const Wv=d.useCallback(()=>{const p=Date.now();Ns(j=>{const R=F0(j,f,p);try{localStorage.setItem(hl,_c(R))}catch{}return R}),ct(j=>{const R=vk(j,ja.current,p);try{localStorage.setItem(ia,JSON.stringify(R))}catch{}return R})},[f]),op=d.useMemo(()=>mk(t,_e),[t,_e]),Bn=d.useMemo(()=>Ug(t,_e,Fn),[t,_e,Fn]),cp=d.useMemo(()=>dk(t),[t]),up=d.useMemo(()=>Lu(t,_e),[t,_e]),Vv=d.useMemo(()=>pk(up,(f??[]).map(p=>p.id)),[up,f]),dp=d.useMemo(()=>new Set(cp.map(p=>String(p.sessionId))),[cp]),pp=d.useMemo(()=>{const p={};for(const j of Array.isArray(t)?t:[]){const R=String((j==null?void 0:j.sessionId)??""),L=Number(j==null?void 0:j.at);!R||!Number.isFinite(L)||L<=(Number(_e[R])||0)||(p[R]=(p[R]||0)+1)}return p},[t,_e]),Wo=d.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}`]=H0({session:R,unreadReportMap:pp,seenMap:qn,activeDrawerSid:Xs,liveSessionIds:p});return j},[f,pp,qn,Xs,s]),Rr=d.useMemo(()=>z0(Object.values(Wo)),[Wo]);d.useEffect(()=>{try{window.dispatchEvent(new CustomEvent("hm:chat-unread",{detail:{count:Bn.length}}))}catch{}},[Bn.length]),d.useEffect(()=>{try{window.dispatchEvent(new CustomEvent("hm:chat-streaming",{detail:{streaming:jn}}))}catch{}},[jn]);const Vo=d.useCallback(p=>{te(j=>({...j,[p]:!j[p]}))},[]),hp=d.useCallback(async p=>{var j;try{if(!((j=navigator.clipboard)!=null&&j.writeText))throw new Error(C("chat.copyUnsupported"));await navigator.clipboard.writeText(p),z("tap"),e(C("chat.copied"))}catch(R){e((R==null?void 0:R.message)||C("chat.copyFailed"))}},[e]),er=d.useCallback(p=>{const j=String(p??"").trim();if(!j)return;_(j);const R=()=>{const L=Sn.current;if(L){try{L.focus({preventScroll:!1})}catch{L.focus()}L.style.height="auto",Mc(L);try{L.setSelectionRange(j.length,j.length)}catch{}}};requestAnimationFrame(R),setTimeout(R,150)},[]),Kv=d.useCallback(p=>{z("tap"),er(Fr(p,C("chat.discussFallback")))},[er]),Qv=d.useCallback(p=>{if(p){z("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:Fr(p,C("chat.discussFallback")),title:p.label??null}}))}catch{}ke(!1)}},[cs,er]),Gv=d.useCallback(p=>{z("tap");try{window.dispatchEvent(new CustomEvent("hm:open-board",{detail:{board:(p==null?void 0:p.board)??null}}))}catch{}},[]),Yv=d.useCallback(p=>{z("tap"),pe({board:(p==null?void 0:p.board)??null,spec:(p==null?void 0:p.spec)??null})},[]);d.useEffect(()=>{if(!(!r||!Fn.length))for(const p of Fn)op.includes(p)&&cs(p)},[r,Fn,op,cs]);const Jv=async(p,j=1600)=>{var R,L,V;if(!((R=p.type)!=null&&R.startsWith("image/"))||p.type==="image/gif")return p;try{const se=await createImageBitmap(p),ne=Math.min(1,j/Math.max(se.width,se.height));if(ne>=.999&&p.size<6e5)return(L=se.close)==null||L.call(se),p;const ee=document.createElement("canvas");ee.width=Math.round(se.width*ne),ee.height=Math.round(se.height*ne),ee.getContext("2d").drawImage(se,0,0,ee.width,ee.height),(V=se.close)==null||V.call(se);const ie=await new Promise(Se=>ee.toBlob(Se,"image/webp",.9));return!ie||ie.size>=p.size?p:new File([ie],`${p.name.replace(/\.[^.]+$/,"")||"image"}.webp`,{type:"image/webp"})}catch{return p}},Pr=d.useCallback(async p=>{const j=[...p??[]].filter(Boolean);if(!j.length)return;const R=6-xe.length;if(R<=0){e(C("chat.maxAttachments"));return}for(const L of j.slice(0,R)){const V=(L.type||"").startsWith("image/"),se=V?10*1024*1024:25*1024*1024;if(L.size>se){e(C("chat.tooLarge",{name:L.name||C("chat.fileFallback"),mb:Math.round(se/1048576)}));continue}try{const ne=V?await Jv(L):L,ee=V?URL.createObjectURL(ne):null;ee&&Ta.current.add(ee),Le(ie=>[...ie,{id:`${Date.now()}-${Math.random().toString(36).slice(2,7)}`,kind:V?"image":"file",name:L.name||(V?"image":"file"),bytes:ne.size,file:ne,preview:ee}])}catch(ne){e(ne.message)}}},[xe.length,e]),qv=d.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 L of j){const V=(L.types??[]).find(ee=>ee.startsWith("image/"));if(!V)continue;const se=await L.getType(V),ne=V==="image/jpeg"?"jpg":V.split("/")[1];R.push(new File([se],`clipboard-${Date.now()}.${ne}`,{type:V}))}if(!R.length)throw new Error(C("chat.clipNoImage"));await Pr(R),Ve(!1)}catch(j){e(j.message)}},[Pr,e]),mp=p=>new Promise((j,R)=>{const L=new FileReader;L.onload=()=>j(String(L.result)),L.onerror=()=>R(new Error(C("chat.readFailed"))),L.readAsDataURL(p)}),Ko=d.useCallback(async(p,j,R)=>{var V;const L=[];for(const se of R)if(se.kind==="image"){const ee=(await mp(se.file)).split(",")[1]??"",ie=await p("image.attach_bytes",{session_id:j,content_base64:ee,filename:se.name});if(ie!=null&&ie.error)throw new Error(C("chat.attachImageFailed",{message:ie.error.message}))}else{const ne=await mp(se.file),ee=await p("file.attach",{session_id:j,data_url:ne,name:se.name});if(ee!=null&&ee.error)throw new Error(C("chat.attachFailed",{message:ee.error.message}));(V=ee==null?void 0:ee.result)!=null&&V.ref_text&&L.push(ee.result.ref_text)}return L},[]),Ia=d.useCallback(async p=>{var nn,Ir,Sp;const j=String(p??M).trim();if(!j&&!xe.length||P)return;const R=xe,L=R.filter(et=>et.kind==="image"),V=R.filter(et=>et.kind==="file"),se=j||(R.length?C("chat.checkAttachments"):"");p==null&&(_(""),Sn.current&&(Sn.current.style.height="")),Le([]),I(!0);const ne=Date.now();v(et=>[...et,{role:"user",text:se,at:ne,images:L.map(pn=>({url:pn.preview,name:pn.name})),files:V.map(pn=>({name:pn.name,bytes:pn.bytes}))},{role:"assistant",text:"",open:!0,at:ne+1}]);const ee=et=>{I(!1),e(et),v(pn=>[...pn,{role:"notice",text:et,at:Date.now()}])};let ie=h;if(!ie){const et=await Et("session.create",{title:se.slice(0,24),...Me&&Me!=="default"?{profile:Me}:{},...(nn=Na.current)!=null&&nn.path?{cwd:Na.current.path}:{}});if(ie=(Ir=et==null?void 0:et.result)==null?void 0:Ir.session_id,x(((Sp=et==null?void 0:et.result)==null?void 0:Sp.stored_session_id)??null),Ln(Me||lt),!ie)return ee(C("chat.sessionCreateFailed"));pl(globalThis.localStorage,null),S(ie),w(se.slice(0,24))}const Se=et=>et.length?`${se}${C("chat.attachmentsHeader")}${et.map(pn=>`- ${pn}`).join(`
81
- `)}${C("chat.attachInstruction")}`:se;let Ee=[];if(R.length){ka(!0);try{Ee=await Ko(Et,ie,R)}catch(et){return ka(!1),ee(et.message)}ka(!1)}let he=await Et("prompt.submit",{session_id:ie,text:Se(Ee)});if(he!=null&&he.error&&/session not found/i.test(he.error.message??"")){const et=xn.current;if(et){const pn=await Nn(Et,et,Sr.current);if(pn.ok&&pn.sid){ie=pn.sid;let Yo=Ee;if(R.length)try{Yo=await Ko(Et,ie,R)}catch{Yo=[]}he=await Et("prompt.submit",{session_id:ie,text:Se(Yo)})}}}he!=null&&he.error&&ee(C("chat.sendFailed",{message:he.error.message})),z("action"),vt("send",{sfx:C("fx.sfx.send")})},[M,xe,P,h,Et,e,Ko,Nn,Me]),fp=d.useCallback(()=>Ia(),[Ia]),Xv=d.useCallback(async()=>{h&&(await Et("session.interrupt",{session_id:h}),I(!1),wt(""),e(C("chat.interrupted")))},[h,Et,e]),js=d.useCallback((p=lt,j=null,R=null)=>{const L=p||lt,V=j!=null&&j.path?j:null,se=(R==null?void 0:R.slug)??"";S(null),x(null),w(""),v([]),T(null),ye(null),Yn(null),Dt(L),Ln(L),Jn(V),ve(null),ke(!1),dn(!1),V?(S0(globalThis.localStorage,{id:V.id,board:se?{slug:se}:null}),pl(globalThis.localStorage,{repoId:V.id,profile:L}),e(C("chat.newChatWith",{target:`${Ua(V)}${se?` ・ ${se}`:""}`}))):pl(globalThis.localStorage,null)},[e]),zi=d.useCallback(async(p,j,R,L=null)=>{var V,se;be(!0);try{const ne=new URLSearchParams({limit:"300",tools:"1"});L&&L!=="default"&&ne.set("profile",L);const ee=await X(`/api/sessions/${encodeURIComponent(p)}/transcript?${ne}`);if(!ee.ok)return e(ee.reason??C("chat.cannotOpen")),!1;S(null),Yn({sessionId:p,focusId:j??null,title:ee.title??R??"",profile:L&&L!=="default"?L:null});const{blocks:ie}=Ic(ee.messages??[],sr);return(se=Xt.current)==null||se.call(Xt,p,Math.max(Number((V=kn.current.find(Se=>String(Se.id)===String(p)))==null?void 0:V.message_count)||0,Array.isArray(ee.messages)?ee.messages.length:0)),v(ie),T({sessionId:p,profile:L&&L!=="default"?L:null,hasMore:!!ee.hasMore,oldestId:ee.oldestId??null,loadingMore:!1}),(ee.title||R)&&w(ee.title||R),j&&requestAnimationFrame(()=>Ra(j)),!0}catch(ne){return e(ne.message),!1}finally{be(!1)}},[e,Ra]),Zv=d.useCallback(async(p,j=null,R="default")=>{var ne;ke(!1),v([]),T(null),ye(null),Yn(null),Dt(R||"default");const L=f.find(ee=>ee.id===p&&(ee.profile??"default")===(R||"default")),V=(L==null?void 0:L.title)??((ne=f.find(ee=>ee.id===p))==null?void 0:ne.title)??"";w(V);const se=await Nn(Et,p,R);if(!se.ok){const ee=se.error;if((ee==null?void 0:ee.code)===4132||/Kanban worker transcript/i.test((ee==null?void 0:ee.message)??"")){await zi(p,j,V,R);return}S(null),x(null),e(ee!=null&&ee.message?C("chat.openFailed",{message:ee.message}):C("chat.resumeFailed"))}},[Et,Nn,f,e,zi]);U.current=Zv;const Cs=d.useCallback((p,j=null,R="default")=>{var L;p&&(cs(p),ge.current==="ready"?(L=U.current)==null||L.call(U,p,j,R):re.current={id:p,focusId:j,profile:R})},[cs]);d.useEffect(()=>{const p=j=>{var R,L,V;return Cs((R=j==null?void 0:j.detail)==null?void 0:R.id,((L=j==null?void 0:j.detail)==null?void 0:L.messageId)??null,((V=j==null?void 0:j.detail)==null?void 0:V.profile)||"default")};return window.addEventListener("hm:open-session",p),()=>window.removeEventListener("hm:open-session",p)},[Cs]),d.useEffect(()=>{i!=null&&i.id&&(Cs(i.id,i.messageId??null,i.profile||"default"),l==null||l())},[i,Cs,l]),d.useEffect(()=>{if(!o)return;let p=!0;const j=String(o.sessionId??"").trim();return(async()=>{if(j&&j!==ur){const L=kn.current.find(V=>String(V.id)===j);Cs(j,null,(L==null?void 0:L.profile)||Me||lt)}else{const L=await Er(o.repoPath);if(!p)return;js(Me||lt,L??null,o.board?{slug:o.board}:null)}er(Fr({followUpPrompt:o.prompt},C("chat.discussFallback"))),c==null||c()})(),()=>{p=!1}},[o,Cs,js,er,c,Me,Er]);const Qo=d.useCallback((p,j=!1)=>{if(kr(!1),z("tap"),(p==null?void 0:p.action)==="seed"){Nt(!0);return}if(j){Ia(p.text);return}const R=Sn.current,L=M??"",V=(R==null?void 0:R.selectionStart)??L.length,se=(R==null?void 0:R.selectionEnd)??L.length,ne=L.slice(0,V),ee=L.slice(se),ie=ne&&!/\s$/.test(ne)?" ":"";_(`${ne}${ie}${p.text}${ee}`),requestAnimationFrame(()=>{const Se=Sn.current;if(!Se)return;Se.focus();const Ee=ne.length+ie.length,he=/\{\{[^}]*\}\}/.exec(p.text);he?Se.setSelectionRange(Ee+he.index,Ee+he.index+he[0].length):Se.setSelectionRange(Ee+p.text.length,Ee+p.text.length),Se.style.height="auto",Mc(Se)})},[M,Ia]),ey=d.useCallback(async()=>{var R,L,V,se;if(window.dispatchEvent(new CustomEvent("hm:refresh-reports")),ge.current!=="ready")return(L=(R=b.current)==null?void 0:R.reconnectNow)==null||L.call(R),!0;const p=(V=b.current)==null?void 0:V.rpc;if(!p)return!1;if(await Ct(p),P)return!0;if(de!=null&&de.sessionId)return await zi(de.sessionId,de.focusId,de.title,de.profile||"default");const j=xn.current??qt.current;if(j){const ne=await Nn(p,j,Me||lt);if(!(ne!=null&&ne.ok))return e((se=ne==null?void 0:ne.error)!=null&&se.message?C("chat.updateFailed",{message:ne.error.message}):C("chat.updateChatFailed")),!1}return!0},[Ct,P,de,zi,Nn,Me,e]),Go=d.useCallback(()=>{ke(!1),dn(!0),ve(null),Q(Me||lt),Zt()},[Me,Zt]),gp=d.useCallback(p=>{var j;if(p){if(!((j=p.boards)!=null&&j.length)){ve({kind:"create",repo:p});return}if(p.boards.length>1){ve({kind:"board",repo:p});return}js($t,p,x0(p.boards))}},[$t]),ty=d.useCallback(async()=>{const p=q==null?void 0:q.repo;if(!(!p||Ce)){Xe(!0);try{const j=await X(`/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})),is(R=>R.map(L=>L.id===p.id?{...L,boards:[{slug:j.board.slug,name:j.board.name??j.board.slug}]}:L)),js($t,p,{slug:j.board.slug,name:j.board.name??j.board.slug})}catch(j){e(j.message)}finally{Xe(!1)}}},[q,Ce,$t,e,js]),vp=_i.filter(p=>p.hot).slice(0,8),ny=d.useMemo(()=>E0(Gt,f,lt),[Gt,f]),yp=d.useMemo(()=>k0(),[Be]),Wi=d.useMemo(()=>b0(Yt,jv()),[Yt,Be]);return a.jsxs("div",{className:"pane chat","data-conn":Hi,children:[a.jsxs("div",{className:"chat-head",children:[a.jsxs("button",{className:"icon-btn",onClick:()=>{z("tap"),zv()},"aria-label":Rr?C("chat.sessionsAria",{n:Rr}):C("chat.sessions"),children:[a.jsx(Oe,{name:"grid",size:18}),Rr?a.jsx("span",{className:"drawer-btn-badge","aria-hidden":"true",children:Rr}):null,!Rr&&Bn.length?a.jsx("span",{className:"nav-dot done","aria-hidden":"true"}):null]}),a.jsx("span",{className:"chat-title",children:N||C("chat.title")}),a.jsx("span",{className:`prof-chip${Me!==lt?" on":""}`,title:C("chat.profileTitle",{profile:Me}),children:Me}),we?a.jsx("button",{className:"prof-chip repo-chip",title:C("chat.repoTitle",{id:we.id,path:we.path}),"aria-label":C("chat.repoTitleShort",{id:we.id}),onClick:()=>{z("tap"),Go()},children:we.id}):null,xt!=null&&xt.url?a.jsx("button",{className:"icon-btn dc-icon",title:`Discord: ${xt.chatName??""}`,"aria-label":C("chat.discordAria"),onClick:()=>{z("tap"),window.open(xt.url,"_blank","noopener")},children:a.jsx("span",{"aria-hidden":"true",children:"#"})}):null,a.jsx(yr,{variant:"icon",ariaLabel:C("chat.refreshChatAria"),onRefresh:ey}),a.jsx("button",{className:"icon-btn",onClick:()=>{z("tap"),Go()},"aria-label":C("chat.newChatAria"),children:a.jsx(Oe,{name:"plus",size:18})})]}),Fv?a.jsx("div",{className:"banner",children:C("chat.recovering")}):null,Bn.length?a.jsxs("div",{className:"chat-report-banner",role:"status",children:[a.jsx("span",{className:"chat-report-banner-text",children:C("chat.otherReport",{label:Bn[0].label||Bn[0].taskId||Vd(Bn[0],40)||String(Bn[0].text??"").slice(0,28)})}),a.jsx("button",{type:"button",className:"chat-report-btn primary",onClick:()=>{z("tap");const p=Bn[0];if(p.sessionId===ur){if(xn.current??qt.current){cs(ur),requestAnimationFrame(()=>{const L=Dn.current;L&&(L.scrollTop=L.scrollHeight)});return}cs(ur),er(Fr(p,C("chat.discussFallback"))),Er(p.repoPath).then(L=>{js(Me||lt,L??null,p.board?{slug:p.board}:null)});return}const j=f.find(R=>String(R.id)===p.sessionId);Cs(p.sessionId,null,(j==null?void 0:j.profile)||Me||lt),er(Fr(p,""))},children:C("chat.open")}),a.jsx("button",{type:"button",className:"chat-report-btn",onClick:()=>{z("tap"),cs(Bn[0].sessionId)},children:C("chat.seen")})]}):null,de?a.jsxs("div",{className:"banner ro",children:[C("chat.readonly"),de.profile?C("chat.readonlyProfileSuffix",{profile:de.profile}):C("chat.readonlyBoardSuffix")]}):null,a.jsxs("div",{className:"chat-body",children:[a.jsxs("div",{className:"chat-scroll",ref:Dn,onScroll:()=>{const p=Dn.current;if(!p)return;const j=p.scrollHeight-p.scrollTop-p.clientHeight<80;os.current=j,B(j)},children:[!m.length&&(Re||Hi==="connecting")?a.jsx(Qn,{label:C(Hi==="connecting"?"chat.connecting":"chat.loadingChat")}):m.length?null:a.jsxs("div",{className:"empty",children:[a.jsx("div",{children:C("chat.sendToStart")}),fm(f,Me,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")}),fm(f,Me,2).map(p=>a.jsxs("button",{type:"button",className:"empty-recent-row",title:p.title||p.id,onClick:async()=>{var R;const j=await Nn((R=b.current)==null?void 0:R.rpc,p.id,p.profile||Me);j!=null&&j.ok&&x(p.id)},children:[a.jsx("span",{className:"empty-recent-title",children:p.title||p.id}),a.jsx("span",{className:"empty-recent-when",children:Je(sr(p.updated_at??p.started_at))}),a.jsx("span",{className:"empty-recent-mark","aria-hidden":"true",children:"›"})]},p.id))]}):null]}),A!=null&&A.hasMore&&(A!=null&&A.oldestId)?a.jsx("button",{type:"button",className:"chat-older",disabled:A.loadingMore,onClick:()=>{z("tap"),Bi()},children:A.loadingMore?C("chat.loadingOlder"):C("chat.loadOlder")}):null,Ho.map((p,j)=>{var se,ne,ee;if(p.kind==="report"){const ie=p.report;if(Wd(ie)){const Ee=Zs.findIndex(nn=>nn.key===ie.key)===Zs.length-1,he=ie.key in Qt?!!Qt[ie.key]:Ee;return a.jsx(K0,{report:ie,open:he,onToggle:()=>{z("tap"),W(nn=>({...nn,[ie.key]:!he}))},onDiscuss:()=>Kv(ie),onReceipt:()=>Yv(ie),onOpenBoard:()=>Gv(ie),onCopyCode:hp},ie.key)}return a.jsxs("div",{className:"msg report",title:_o(ie.at),children:[a.jsxs("span",{className:"report-body",children:["🖊 ",ie.text]}),a.jsx("button",{type:"button",className:"report-link",onClick:()=>{z("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:ie.taskId,label:ie.label}}))},children:C("chat.reviewAndAnnotate")})]},ie.key)}const R=p.block,L=p.index;let V=R.mid!=null&&R.mid!==""?`mid-${R.mid}`:jr.current.get(R);return V||(ls.current+=1,V=`at-${R.at||L}-${ls.current}`,jr.current.set(R,V)),R.role==="user"?a.jsx("div",{"data-mid":R.mid,className:`msg user${de!=null&&de.focusId&&R.mid===de.focusId?" hit":""}`,children:a.jsxs("div",{className:"bubble",children:[(se=R.images)!=null&&se.length?a.jsx("div",{className:"bubble-imgs",children:R.images.map((ie,Se)=>ie.url?a.jsx("span",{className:"bubble-img",children:a.jsx("img",{src:ie.url,alt:ie.name??C("chat.attachedImage")})},Se):null)}):null,(ne=R.files)!=null&&ne.length?a.jsx("div",{className:"bubble-files",children:R.files.map((ie,Se)=>a.jsxs("span",{className:"file-chip",children:["📎 ",ie.name,ie.bytes?a.jsx("span",{className:"file-size",children:Cl(ie.bytes)}):null]},Se))}):null,R.text,R.text?a.jsx("button",{type:"button",className:"bubble-menu-btn","aria-label":C("chat.bubbleMenuAria"),onClick:ie=>{ie.stopPropagation(),z("tap"),oe({text:R.text,role:"user",mid:R.mid??null})},children:a.jsx(Oe,{name:"more",size:14})}):null]})},V):R.role==="assistant"?a.jsx("div",{"data-mid":R.mid,className:`msg bot${de!=null&&de.focusId&&R.mid===de.focusId?" hit":""}`,children:a.jsxs("div",{className:`bubble${Bv&&j===Ho.length-1?" vibe-settle-flash":""}`,children:[(ee=R.tools)!=null&&ee.length?a.jsxs("details",{className:"msg-tools",children:[a.jsx("summary",{children:C("chat.toolsRan",{count:R.tools.length})}),a.jsx(Lc,{rows:R.tools,prefix:V,expandedMap:fe,onToggle:Vo})]}):null,R.text?a.jsxs(a.Fragment,{children:[a.jsx(Rv,{text:R.text,onCopyCode:hp,copyLabel:C("chat.copy")}),a.jsx("button",{type:"button",className:"bubble-menu-btn","aria-label":C("chat.bubbleMenuAria"),onClick:ie=>{ie.stopPropagation(),z("tap"),oe({text:R.text,role:"assistant",mid:R.mid??null})},children:a.jsx(Oe,{name:"more",size:14})})]}):R.open?a.jsx("span",{className:"dots",children:"…"}):""]})},V):a.jsx("div",{className:"msg notice",children:R.text},V)}),jn?(()=>{var ie,Se;const p=y||(tn==null?void 0:tn.startedAt),j=p?Math.max(0,Math.floor((F-p)/1e3)):0,R=String(Math.floor(j/60)).padStart(2,"0"),L=String(j%60).padStart(2,"0"),V=!D.length&&((ie=tn==null?void 0:tn.lastTool)!=null&&ie.name)?[{id:"live-last",name:tn.lastTool.name,detail:tn.lastActivity||"",full:tn.lastActivity||"",done:!1}]:[],se=D.length?D:V,ne=ht?ht.trim().split(`
82
- `):[],ee=Y?ht.trim():ne.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,":",L]}),a.jsx("span",{className:"working-meta",children:D.length?C("chat.toolProgress",{n:D.length}):(Se=tn==null?void 0:tn.lastTool)!=null&&Se.name?C("chat.lastTool",{name:tn.lastTool.name}):C("chat.thinking")})]}),se.length?a.jsx(Lc,{rows:se,prefix:"live",expandedMap:fe,onToggle:Vo}):null,ee?a.jsx("div",{className:`thinking-text${Y?" expanded":""}`,onClick:()=>E(Ee=>!Ee),children:ee}):null]})})():null,dt?sn(dt)?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:((kp=dt.review)==null?void 0:kp.title)||dt.title})}),a.jsx("button",{type:"button",className:"chat-report-btn primary",onClick:()=>{var p;z("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:dt.id,label:(p=dt.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":dt.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:dt.status==="running"?C("chat.workerRunning"):C("chat.workerQueued")}),a.jsx("button",{type:"button",className:"chat-report-btn",onClick:()=>{var p;z("tap"),window.dispatchEvent(new CustomEvent("hm:open-review",{detail:{taskId:dt.id,label:(p=dt.review)==null?void 0:p.label}}))},children:C("chat.watchProgress")})]}),a.jsx("div",{className:"chat-live-sub",children:((bp=dt.review)==null?void 0:bp.title)||dt.title}),(()=>{var j;const p=(((j=J==null?void 0:J.feed)==null?void 0:j.messages)||[]).filter(R=>R.role!=="user").slice(-4);return p.length?a.jsx(Lc,{rows:p.map((R,L)=>{const V=String(R.text||"").replace(/\s+/g," ").trim();return{id:String(R.id??L),name:R.role==="tool"?R.toolName||"tool":"agent",detail:ap(V,56),full:V.slice(0,300),done:L<p.length-1}}),prefix:`worker-${dt.id}`,expandedMap:fe,onToggle:Vo}):null})()]}):null,me?a.jsxs("div",{className:"usage",children:["in ",me.input??0," / out ",me.output??0,me.cache_read?` / cache ${me.cache_read}`:""]}):null]}),!O&&Ho.length>0?a.jsx("button",{type:"button",className:`chat-jump-bottom${jn||dt?" active":""}`,onClick:()=>{z("tap");const p=Dn.current;p&&(p.scrollTop=p.scrollHeight,os.current=!0,B(!0))},children:C(jn||dt?"chat.jumpLatest":"chat.jumpBottomPlain")}):null]}),xe.length?a.jsx("div",{className:"attach-rail",children:xe.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),Ta.current.delete(p.preview)),Le(j=>j.filter(R=>R.id!==p.id))},children:"×"})]},p.id))}):null,a.jsx(ov,{job:Ar,board:It,repo:(we==null?void 0:we.id)??null,chat:h??Xs??null,onInspect:Bo,onRetried:()=>$n(),onDismiss:async p=>{ft(j=>[...j,p]),await $n()},notify:e}),a.jsx(rv,{banner:$i,busy:Pt,onFile:Fi,onDismiss:p=>$(j=>[...j,p.path]),onPreview:p=>ut({path:p.path,title:p.title,board:p.board??null})}),je?a.jsx(lv,{board:je.board??It,repo:(we==null?void 0:we.id)??null,path:je.path,title:je.title,onClose:()=>ut(null)}):null,Li.chat&&(vp.length||!de)?a.jsxs("div",{className:"action-bar",children:[a.jsx("div",{className:"chips-scroll",children:vp.map(p=>a.jsx("button",{className:`snippet-chip${p.trigger?" trigger":""}`,disabled:P,title:p.text,onPointerDown:()=>{var j;clearTimeout((j=On.current)==null?void 0:j.timer),On.current={fired:!1},On.current.timer=setTimeout(()=>{On.current.fired=!0,Qo(p,!0)},550)},onPointerUp:()=>{var j;return clearTimeout((j=On.current)==null?void 0:j.timer)},onPointerLeave:()=>{var j;return clearTimeout((j=On.current)==null?void 0:j.timer)},onPointerCancel:()=>{var j;return clearTimeout((j=On.current)==null?void 0:j.timer)},onClick:()=>{var j;if((j=On.current)!=null&&j.fired){On.current.fired=!1;return}Qo(p)},children:p.label},p.id))}),a.jsx("button",{className:"snippet-chip add",onClick:()=>kr(!0),"aria-label":C("chat.snippetListAria"),children:a.jsx("span",{className:"snippet-chip-add-glyph",children:"+"})})]}):null,de?a.jsx("div",{className:"composer-ro",children:C("chat.readonlyComposer")}):null,a.jsxs("div",{className:"composer",style:de?{display:"none"}:void 0,children:[a.jsx("button",{className:"plus","aria-label":C("chat.attachAria"),onClick:()=>Ve(!0),disabled:P,children:a.jsx("span",{"aria-hidden":"true",children:"+"})}),a.jsx("textarea",{ref:Sn,rows:1,value:M,placeholder:C("chat.composerPlaceholder"),onChange:p=>{_(p.target.value),Mc(p.target)},onPaste:p=>{var R;const j=[...((R=p.clipboardData)==null?void 0:R.items)??[]].filter(L=>L.kind==="file"&&(L.type||"").startsWith("image/")).map(L=>L.getAsFile()).filter(Boolean);j.length&&(p.preventDefault(),Pr(j))},onKeyDown:p=>{var j;M0({key:p.key,shiftKey:p.shiftKey,isComposing:(j=p.nativeEvent)==null?void 0:j.isComposing})&&(p.preventDefault(),fp())}}),P?a.jsx("button",{className:"send stop",onClick:Xv,"aria-label":C("chat.interrupt"),children:a.jsx(Oe,{name:"stop",size:18})}):a.jsx("button",{className:"send",onClick:fp,disabled:!M.trim()&&!xe.length||Jt,"aria-label":C("chat.sendAria"),children:a.jsx(Oe,{name:"send",size:18})})]}),a.jsx("input",{ref:ba,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,hidden:!0,onChange:p=>{Pr(p.target.files),p.target.value=""}}),a.jsx("input",{ref:qs,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:p=>{Pr(p.target.files),p.target.value=""}}),a.jsx("input",{ref:Sa,type:"file",multiple:!0,hidden:!0,onChange:p=>{Pr(p.target.files),p.target.value=""}}),Pe?a.jsxs(We,{title:C("chat.attachSheetTitle"),onClose:()=>Ve(!1),children:[a.jsxs("div",{className:"list",children:[a.jsxs("button",{className:"list-item",onClick:()=>{var p;Ve(!1),(p=ba.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(Oe,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:()=>{var p;Ve(!1),(p=qs.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(Oe,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:()=>{var p;Ve(!1),(p=Sa.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(Oe,{name:"chevron"})]}),a.jsxs("button",{className:"list-item",onClick:qv,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(Oe,{name:"chevron"})]}),Li.chat?null:a.jsxs("button",{className:"list-item",onClick:()=>{Ve(!1),kr(!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(Oe,{name:"chevron"})]})]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 6px 18px",lineHeight:1.7},children:C("chat.attachNote")})]}):null,Ae?a.jsx(sv,{board:It,repo:(we==null?void 0:we.id)??null,chat:h??Xs??null,notify:e,onClose:()=>Nt(!1),onSeeded:()=>$n()}):null,Mi?a.jsxs(We,{title:C("chat.snippetsTitle"),onClose:()=>kr(!1),children:[a.jsx("div",{className:"list",children:_i.map(p=>a.jsxs("button",{className:"list-item",onClick:()=>Qo(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(Oe,{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,Be?a.jsxs(We,{title:(q==null?void 0:q.kind)==="board"?C("chat.chooseBoard"):(q==null?void 0:q.kind)==="create"?C("chat.createBoard"):(q==null?void 0:q.kind)==="all"?C("chat.allRepos"):C("chat.newChat"),onClose:()=>q?ve(null):dn(!1),children:[q?null:a.jsxs(a.Fragment,{children:[ny.map(p=>a.jsxs("button",{className:`row${$t===p?" on":""}`,onClick:()=>Q(p),"aria-pressed":$t===p,children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[p,p===lt?a.jsx("span",{className:"prof-chip",children:C("chat.defaultChip")}):null,$t===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===lt?C("chat.thisDeviceDefault"):C("chat.profileSuffix",{p})})]}),a.jsx(Oe,{name:$t===p?"check":"chevron",size:16})]},p)),a.jsx("div",{className:"sec",children:C("chat.repoSection")}),Wi.rows.map(p=>a.jsxs("button",{className:`row${yp===p.id?" on":""}`,onClick:()=>gp(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:[Ua(p),yp===p.id?a.jsx("span",{className:"prof-chip",children:C("chat.lastChip")}):null]}),a.jsxs("span",{className:"row-sub",children:[hm(p.boards),p.boards.length>1?" ›":""]})]}),a.jsx(Oe,{name:"chevron",size:16})]},p.id)),Yt.length?null:a.jsx("div",{className:"row-sub",style:{padding:"6px 6px 10px",lineHeight:1.7},children:C("chat.reposLoading")}),Wi.hidden>0?a.jsxs("button",{className:"row",onClick:()=>ve({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:Wi.hidden,total:Wi.total})})]}),a.jsx(Oe,{name:"chevron",size:16})]}):null,a.jsxs("button",{className:"row",onClick:()=>js($t,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(Oe,{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")]})]}),(q==null?void 0:q.kind)==="all"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sec",children:C("chat.allReposSection",{n:Yt.length})}),Yt.map(p=>a.jsxs("button",{className:"row",onClick:()=>gp(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:Ua(p)}),a.jsxs("span",{className:"row-sub",children:[hm(p.boards),p.boards.length>1?" ›":""]})]}),a.jsx(Oe,{name:"chevron",size:16})]},p.id))]}):null,(q==null?void 0:q.kind)==="board"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sec",children:C("chat.repoBoards",{repo:Ua(q.repo)})}),(q.repo.boards??[]).map(p=>a.jsxs("button",{className:"row",onClick:()=>js($t,q.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(Oe,{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:q.repo.boards.length})})]}):null,(q==null?void 0:q.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:Ua(q.repo)})}),a.jsxs("button",{className:"row",onClick:ty,disabled:Ce,"aria-busy":Ce,children:[a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:Ce?C("chat.creating"):C("chat.createBoardRow",{id:q.repo.id})}),a.jsx("span",{className:"row-sub",children:q.repo.path})]}),a.jsx(Oe,{name:"check",size:16})]}),a.jsxs("button",{className:"row",onClick:()=>ve(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(Oe,{name:"chevron",size:16})]})]}):null]}):null,Ne?a.jsxs(We,{title:C("chat.drawerTitle"),onClose:()=>ke(!1),children:[a.jsxs("div",{className:"drawer-actions",children:[a.jsx(yr,{variant:"btn",label:C("chat.drawerRefresh"),busy:Ge,onRefresh:()=>Pa({force:!0})}),a.jsxs("button",{type:"button",className:"btn drawer-mark-read",disabled:!Rr&&!Bn.length,onClick:()=>{z("tap"),Wv()},children:[a.jsx("span",{"aria-hidden":"true",children:"✓"})," ",C("chat.markAllRead")]})]}),Vv.map(p=>a.jsxs("button",{className:"row drawer-report-row",title:C("chat.unreadReportTitle"),onClick:()=>Qv(p),children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[a.jsx("span",{"aria-hidden":"true",children:"📋"})," ",p.label||C("chat.pipelineReport")]}),a.jsxs("span",{className:"row-sub",children:[p.board?`${p.board} · `:"",C("chat.reportNoSession")]})]}),a.jsx("span",{className:"row-badge done","aria-hidden":"true",children:"!"})]},`report:${p.sessionId}`)),a.jsxs("button",{className:"row",onClick:Go,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(Oe,{name:"plus",size:16})]}),f.map(p=>{const j=p.profile&&p.profile!==lt,R=`${p.profile??"default"}:${p.id}`,L=Wo[R]??{isActive:!1,isRunning:!1,unreadReports:0,unreadReplies:0},V=C0(p,de==null?void 0:de.sessionId),se=W0(L.unreadReplies);return a.jsxs("button",{className:`row${L.isActive?" on":""}${V?" ro":""}${L.unreadReports||dp.has(String(p.id))?" has-report":""}`,title:L.unreadReports?C("chat.unreadReportTitle"):C(se?"chat.newReplyTitle":V?"chat.readonlyTitle":"chat.resumableTitle"),onClick:()=>Cs(p.id,null,p.profile??"default"),children:[a.jsxs("span",{className:"row-main",children:[a.jsxs("span",{className:"row-title",children:[dp.has(String(p.id))?a.jsx("span",{className:"row-report-mark",title:C("chat.pipelineReport"),"aria-label":C("chat.pipelineReport"),children:"📋"}):null,p.title||p.id]}),a.jsxs("span",{className:"row-sub session-meta",children:[a.jsx("span",{className:`row-mode ${V?"ro":"resumable"}`,title:C(V?"chat.readonlyTitle":"chat.resumableTitle"),children:C(V?"chat.readonlyShort":"chat.resumableShort")}),j?a.jsx("span",{className:"prof-chip on",children:p.profile}):null,a.jsxs("span",{children:[p.source??"cli"," ・ ",p.message_count??0," msg ・ ",Je((p.started_at??0)*1e3),p.is_active?C("chat.runningSuffix"):""]})]})]}),L.isRunning?a.jsx("span",{className:"row-dot running",title:C("chat.runningTitle"),"aria-label":C("chat.runningTitle")}):null,L.unreadReports?a.jsx("span",{className:"row-badge done",title:C("chat.unreadReportTitle"),"aria-label":C("chat.reportAria"),children:L.unreadReports}):null,se?a.jsx("span",{className:"row-badge new",title:C("chat.newReplyTitle"),children:se}):null,a.jsx(Oe,{name:"chevron",size:16})]},R)})]}):null,ue?a.jsx(Zd,{board:ue.board,spec:ue.spec,onClose:()=>pe(null),notify:e}):null,H?a.jsxs(We,{title:C("chat.bubbleMenuTitle"),onClose:()=>oe(null),children:[a.jsx("div",{className:"bubble-menu-preview",children:H.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,H.text)),e==null||e(C("chat.bubbleCopied"))}catch{e==null||e(C("chat.bubbleCopied"))}oe(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=H.text.split(`
84
- `).map(j=>j.trim()).find(Boolean)||"";await X("/api/memos",{method:"POST",body:{title:p.slice(0,60),body:H.text,tags:["clip"],kind:"clip",color:H.role==="user"?"teal":"default",source:{chatId:h||void 0,chatTitle:N||void 0,board:(we==null?void 0:we.board)||void 0,repo:(we==null?void 0:we.id)||void 0,mid:H.mid?String(H.mid):void 0}}}),window.dispatchEvent(new CustomEvent("hm:memos-changed")),vt("approve"),e==null||e(C("chat.bubbleSavedMemo")),oe(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=H.text.slice(0,600);oe(null),window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:p,repo:we==null?void 0:we.path,board:we==null?void 0:we.board}}))},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleToSeed")})})})]}),de?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=H.text.slice(0,600).replace(/\n+/g,`
85
- > `);oe(null),Ia(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=H.text.slice(0,320).replace(/\n+/g,`
86
- > `);_(j=>j?`${j}
87
- > ${p}
88
-
89
- `:`> ${p}
90
-
91
- `),oe(null),setTimeout(()=>{var j;return(j=Sn.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 _s=null;const ho=new Set;typeof window<"u"&&(window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),_s=e,ho.forEach(t=>t())}),window.addEventListener("appinstalled",()=>{_s=null,ho.forEach(e=>e())}));function Y0(){const[e,t]=d.useState(!!_s),[n,s]=d.useState(!1);return d.useEffect(()=>{var o;const r=()=>t(!!_s);ho.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)),()=>{ho.delete(r),i.forEach(clearTimeout)}},[]),{available:e,installed:n,prompt:async()=>{if(!_s)return null;_s.prompt();const r=await _s.userChoice;return _s=null,t(!1),(r==null?void 0:r.outcome)??null}}}function J0(){try{return"serviceWorker"in navigator?navigator.serviceWorker.controller?C("install.swControlled"):C("install.swWaiting"):C("install.swUnsupported")}catch{return"—"}}async function q0(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 X0(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 Z0(){var m;const e=[],t=(v,A,T)=>e.push({label:v,ok:A,detail:T}),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 q0(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,u=c==null?null:new URL(c,s).href;t("start_url",!0,l),t("scope",!0,o),t("id",!0,u??C("diag.idUnset")),t(C("diag.startInScope"),l.startsWith(o),`${l} ⊂ ${o}`),t(C("diag.idSameOrigin"),!u||new URL(u).origin===location.origin,u??"-");const f=i.display??"browser",g=["standalone","fullscreen","minimal-ui"].includes(f);t("display",g,f);const h=i.icons??[];t(C("diag.iconCount"),h.length>0,C("diag.iconCountValue",{count:h.length}));let S=!1,k=!1,x=!1;for(const v of h){const A=new URL(v.src,s).href,T=await X0(A),M=v.sizes??"",_=v.purpose??"any",P=Math.max(T.w,T.h);T.ok&&P>=192&&_.split(" ").includes("any")&&(S=!0),T.ok&&P>=512&&_.split(" ").includes("any")&&(k=!0),T.ok&&_.split(" ").includes("maskable")&&(x=!0);const I=!M||M==="any"||M.split(" ").includes(`${T.w}x${T.h}`);t(`icon ${v.src.split("/").pop()}`,T.ok&&I,T.ok?C("diag.iconLine",{w:T.w,h:T.h,bytes:T.bytes,purpose:_,declared:M}):`${T.why}`)}t(C("diag.any192"),S,C(S?"diag.present":"diag.missingInstall")),t(C("diag.any512"),k,C(k?"diag.present":"diag.missingInstall")),t(C("diag.maskable"),x,C(x?"diag.present":"diag.maskableMissing"));const N=(m=navigator.serviceWorker)==null?void 0:m.controller;t(C("diag.swControl"),!!N,N?N.scriptURL:C("diag.swNone"));try{const A=(await navigator.serviceWorker.getRegistrations()).find(T=>l.startsWith(T.scope));t(C("diag.swCovering"),!!A,A?A.scope:C("diag.none"))}catch(v){t(C("diag.swCovering"),!1,v.message)}const w=["standalone","minimal-ui","fullscreen","browser"];return t(C("diag.viewMode"),!0,w.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 Pv="hm.theme",ga="dark",eS=["dark","light"],tS={dark:"#051319",light:"#f4f7f8"},Iv="(prefers-color-scheme: dark)";function $o(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 nS(e){try{if(typeof window<"u"&&typeof window.matchMedia=="function")return!!window.matchMedia(Iv).matches}catch{}return!0}function sS(e,t){const n=$o(e)??ga;return n==="system"?(t&&typeof t.systemDark=="boolean"?t.systemDark:nS())?"dark":"light":n}function rS(){try{const e=typeof localStorage>"u"?null:localStorage.getItem(Pv);return $o(e)??ga}catch{return ga}}let Ei=ga,mo="dark";const Ku=new Set;let Bt=null;function aS(){for(const e of[...Ku])try{e(mo,Ei)}catch{}}function iS(e){const t=eS.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=tS[t];s&&s.getAttribute("content")!==r&&s.setAttribute("content",r)}catch{}return t}function Qu(e,t){const n=$o(e)??ga,s=sS(n,t),r=n!==Ei||s!==mo;return Ei=n,mo=s,iS(s),r&&!(t!=null&&t.silent)&&aS(),s}function lS(e){const t=$o(e)??ga;try{typeof localStorage<"u"&&localStorage.setItem(Pv,t)}catch{}return Qu(t),t}function oS(){return Ei}function Il(){return mo}function ym(e){return Ku.add(e),()=>Ku.delete(e)}function _v(){if(Qu(rS(),{silent:!0}),Bt||typeof window>"u"||typeof window.matchMedia!="function")return()=>{};try{Bt=window.matchMedia(Iv);const e=()=>{Ei==="system"&&Qu("system")};return typeof Bt.addEventListener=="function"?Bt.addEventListener("change",e):typeof Bt.addListener=="function"&&Bt.addListener(e),()=>{try{typeof(Bt==null?void 0:Bt.removeEventListener)=="function"?Bt.removeEventListener("change",e):typeof(Bt==null?void 0:Bt.removeListener)=="function"&&Bt.removeListener(e)}catch{}Bt=null}}catch{return()=>{}}}let Rs=null;function Mv(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 Lv(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=Rs==null?void 0:Rs.cancel)==null||r.call(Rs)}catch{}const l=i.animate(e,t);return Rs=l,l.onfinish=()=>{Rs===l&&(Rs=null)},l}catch{return null}}function cS(e,t){var f,g,h,S,k,x;if(fs()===e||Do()||typeof document>"u")return Kh(e);const{x:s,y:r}=Mv(t),i=Number((f=globalThis.window)==null?void 0:f.innerWidth)||390,l=Number((g=globalThis.window)==null?void 0:g.innerHeight)||844,o=Math.ceil(Math.hypot(Math.max(s,i-s),Math.max(r,l-r)));let c=e;const u=()=>{c=Kh(e),c==="dopamine"&&(vt("vibeWarp",{x:s,y:r,sound:!1}),Yd("approve"))};if(typeof document.startViewTransition=="function")try{return(x=(k=(S=(h=document.startViewTransition(u).ready)==null?void 0:h.then)==null?void 0:S.call(h,()=>{var w,m,v,A;c==="dopamine"?(m=(w=document.documentElement)==null?void 0:w.animate)==null||m.call(w,{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)"}):(A=(v=document.documentElement)==null?void 0:v.animate)==null||A.call(v,{opacity:[0,1]},{duration:240,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})}))==null?void 0:k.catch)==null||x.call(k,()=>{}),c}catch{}return u(),Lv([{opacity:.78},{opacity:1}],{duration:220,easing:"ease-out"}),c}function uS(e,t,n){var u,f,g,h,S,k;if(typeof t!="function")return;const s=Il();if(Do()||typeof document>"u"){t(e);return}const{x:r,y:i}=Mv(n),l=Number((u=globalThis.window)==null?void 0:u.innerWidth)||390,o=Number((f=globalThis.window)==null?void 0:f.innerHeight)||844,c=Math.ceil(Math.hypot(Math.max(r,l-r),Math.max(i,o-i)));if(typeof document.startViewTransition=="function")try{(k=(S=(h=(g=document.startViewTransition(()=>{t(e)}).ready)==null?void 0:g.then)==null?void 0:h.call(g,()=>{var N,w;Il()!==s&&((w=(N=document.documentElement)==null?void 0:N.animate)==null||w.call(N,{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:S.catch)==null||k.call(S,()=>{});return}catch{}t(e),Il()!==s&&Lv([{opacity:.76},{opacity:1}],{duration:220,easing:"ease-out"})}const wm=8;function dS(e,{limit:t=wm,expanded:n=!1}={}){const s=Array.isArray(e)?e:[],r=Number.isFinite(t)&&t>0?Math.floor(t):wm,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 pS(){const e=d.useSyncExternalStore(ym,oS,()=>"dark"),t=d.useSyncExternalStore(ym,Il,()=>"dark"),n=d.useCallback(s=>{lS(s)},[]);return{pref:e,resolved:t,setPref:n}}function hS({notify:e,board:t=""}){var m,v,A;const{t:n}=$e(),[s,r]=d.useState(null),[i,l]=d.useState(!1),[o,c]=d.useState(null),[u,f]=d.useState(!1),[g,h]=d.useState(null),S=d.useCallback(async()=>{try{const T=await X("/api/pipeline/status");T!=null&&T.ok?(r(T),l(!1)):l(!0)}catch{l(!0)}try{const T=t?`?board=${encodeURIComponent(t)}`:"",M=await X(`/api/architect/jobs${T}`);M!=null&&M.ok&&c(M)}catch{c(null)}},[t]);d.useEffect(()=>{S()},[S]);const k=d.useCallback(async()=>{if(!u){f(!0),h(null),z("action");try{const T=await X("/api/pipeline/optimize",{method:"POST",body:{}});T!=null&&T.ok?(r(T.status??s),e==null||e(n("settings.pipelineOptimized"))):h((T==null?void 0:T.error)??n("settings.pipelineUnavailable"))}catch(T){h((T==null?void 0:T.code)==="UNKNOWN_ENDPOINT"?n("settings.pipelineUnavailable"):(T==null?void 0:T.message)??"")}finally{f(!1),S()}}},[u,S,e,s,n]),x=!!((m=s==null?void 0:s.soul)!=null&&m.applied),N=Array.isArray((v=s==null?void 0:s.hermes)==null?void 0:v.present)?s.hermes.present.length:0,w=Array.isArray((A=s==null?void 0:s.bundled)==null?void 0:A.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(x?"settings.pipelineApplied":"settings.pipelineMissing")})]}),w?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSkills")}),a.jsxs("b",{children:[N,"/",w]})]}):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:u||i,onClick:k,children:n(u?"settings.pipelineOptimizing":"settings.pipelineOptimize")}),g?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:g}):null]})}function mS(){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 fS=[{value:"auto",key:"settings.languageAuto"},...Dx.map(e=>({value:e,key:e==="ja"?"settings.languageJa":"settings.languageEn"}))],gS=[{value:"dark",key:"settings.themeDark"},{value:"light",key:"settings.themeLight"},{value:"system",key:"settings.themeSystem"}],vS=[{value:"dopamine",key:"settings.vibeDopamine"},{value:"serotonin",key:"settings.vibeSerotonin"}],yS=[{id:"chat",key:"settings.barChat"},{id:"annotation",key:"settings.barAnnotation"},{id:"term",key:"settings.barTerm"}];function wS({rows:e,margin:t=4,size:n=300}){const s=Ue.useRef(null);return d.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,u=Math.round(l*o);r.width=c*o,r.height=c*o,r.style.width=`${c}px`,r.style.height=`${c}px`;const f=r.getContext("2d");f.imageSmoothingEnabled=!1,f.fillStyle="#ffffff",f.fillRect(0,0,r.width,r.height),f.fillStyle="#000000";for(let g=0;g<e.length;g+=1)for(let h=0;h<e[g].length;h+=1)e[g][h]==="1"&&f.fillRect((h+t)*u,(g+t)*u,u,u)},[e,t,n]),a.jsx("canvas",{ref:s,className:"pair-qr-canvas",role:"img","aria-label":"Pairing QR"})}function xS({notify:e,lang:t}){const{t:n}=$e(),[s,r]=d.useState("chat"),[i,l]=d.useState({chat:null,term:null}),[o,c]=d.useState({label:"",text:"",hot:!1,run:!0}),[u,f]=d.useState(null),[g,h]=d.useState(!1),S=s==="term"?"/api/snippets/term":"/api/snippets",k=s==="term"?"hm:term-snippets":"hm:snippets",x=i[s],N=(x==null?void 0:x.overrides)??{},w=(x==null?void 0:x.custom)??[],m=(x==null?void 0:x.customMax)??16,v=((x==null?void 0:x.allSnippets)??[]).filter(D=>!D.custom),A=((x==null?void 0:x.allSnippets)??[]).filter(D=>D.custom),T=d.useCallback(async()=>{try{const D=await X(`${S}?lang=${encodeURIComponent(t)}`);l(ae=>({...ae,[s]:D}))}catch(D){e(D.message)}},[S,s,t,e]);d.useEffect(()=>{T()},[T]);const M=d.useCallback(async(D,ae)=>{h(!0);try{const fe=await X(S,{method:"PUT",body:D});return l(te=>({...te,[s]:fe})),window.dispatchEvent(new Event(k)),ae&&e(ae),!0}catch(fe){return e(fe.message),!1}finally{h(!1)}},[S,s,k,e]),_=D=>M({overrides:{...N,[D.id]:{...N[D.id]??{},hot:!D.hot}}}),P=D=>M({overrides:{...N,[D.id]:{...N[D.id]??{},hidden:!D.hidden}}}),I=(D,ae)=>M({custom:D},ae),y=D=>I(w.map(ae=>ae.id===D.id?{...ae,hot:!ae.hot}:ae)),G=async()=>{const D=o.label.trim(),ae=o.text.trim();if(!D||!ae)return e(n("settings.needNameAndText"));if(w.length>=m)return e(n("settings.snippetLimit",{max:m}));const fe={label:D,text:ae,hot:o.hot};s==="term"&&(fe.run=o.run),await I([...w,fe],n("settings.saved"))&&c({label:"",text:"",hot:!1,run:!0})},F=async()=>{if(!u)return;const D=u.label.trim(),ae=u.text.trim();if(!D||!ae)return e(n("settings.needNameAndText"));const fe=w.map(Y=>Y.id===u.id?{...Y,label:D,text:ae,hot:u.hot,...s==="term"?{run:u.run}:{}}:Y);await I(fe,n("settings.saved"))&&f(null)},K=async()=>{h(!0);try{const[D,ae]=await Promise.all([X("/api/snippets",{method:"PUT",body:{reset:!0}}),X("/api/snippets/term",{method:"PUT",body:{reset:!0}})]);l({chat:D,term:ae}),f(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:g,onClick:K,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:g,onClick:()=>_(D),"aria-label":`${n("settings.snippetHot")} ${D.label}`,children:n("settings.snippetHot")}),a.jsx("button",{className:`chip${D.hidden?"":" on"}`,disabled:g,onClick:()=>P(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:w.length,max:m})})}),a.jsxs("div",{className:"list",children:[A.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:g,onClick:()=>y(D),children:n("settings.snippetHot")}),a.jsx("button",{className:"link",disabled:g,onClick:()=>f({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:g,onClick:()=>I(w.filter(ae=>ae.id!==D.id)),children:n("settings.delete")})]},D.id)),A.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),u?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:u.label,onChange:D=>f({...u,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:u.text,onChange:D=>f({...u,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:u.hot,onChange:D=>f({...u,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:u.run,onChange:D=>f({...u,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsxs("div",{className:"row",style:{marginTop:10},children:[a.jsx("button",{className:"btn",disabled:g,onClick:F,children:n("settings.snippetSave")}),a.jsx("button",{className:"link",style:{marginLeft:10},onClick:()=>f(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:G,disabled:g||w.length>=m,style:{marginTop:10},children:n(g?"settings.saving":"settings.snippetAdd")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 6px 0",lineHeight:1.7},children:n("settings.snippetHint")})]})}const kS=[{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 Or({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 bS({overview:e,notify:t,refresh:n}){var mt,Pt,kt,jt;const{lang:s,t:r,pref:i,setPref:l}=$e(),{pref:o,setPref:c}=pS(),u=Y0(),[f,g]=d.useState(null),[h,S]=d.useState(!1),[k,x]=d.useState(null),[N,w]=d.useState(!1),[m,v]=d.useState(null),[A,T]=d.useState("gateway"),[M,_]=d.useState([]),[P,I]=d.useState(()=>Kd()),[y,G]=d.useState(()=>fs()),[F,K]=d.useState(()=>Gd()),[D,ae]=d.useState(()=>xa());d.useEffect(()=>Qg(G),[]);const[fe,te]=d.useState([]),[Y,E]=d.useState([]),[O,B]=d.useState(""),[J,ce]=d.useState(""),[me,ye]=d.useState(!1),[Ne,ke]=d.useState(null),[Ge,Kt]=d.useState(!1),ht=d.useCallback(async()=>{z("tap"),Kt(!0);try{const $=await X("/api/auth/pairing");ke($)}catch($){t==null||t($.message)}finally{Kt(!1)}},[t]),wt=d.useCallback(async $=>{try{await navigator.clipboard.writeText($),t==null||t(r("settings.pairingCopied"))}catch{t==null||t($)}},[t,r]),xt=d.useCallback(async()=>{try{const $=await X("/api/repos");return te(Array.isArray($==null?void 0:$.repos)?$.repos:[]),E(Array.isArray($==null?void 0:$.scanDirs)?$.scanDirs:[]),!0}catch($){return t($.message),!1}},[t]),rt=d.useCallback(async({method:$="POST",path:je="/api/repos",body:ut,done:Mn})=>{ye(!0);try{const ft=await X(je,{method:$,body:ut});return te(Array.isArray(ft==null?void 0:ft.repos)?ft.repos:[]),Array.isArray(ft==null?void 0:ft.scanDirs)&&E(ft.scanDirs),t(Mn),!0}catch(ft){return t(ft.message),!1}finally{ye(!1)}},[t]),_e=d.useCallback(async()=>{try{const $=await X("/api/audit?lines=80");return x($.lines??[]),!0}catch($){return t($.message),!1}},[t]);d.useEffect(()=>{_e(),xt(),X("/api/sessions?limit=5").then($=>_($.sessions??[])).catch(()=>{})},[_e,xt]);const ct=async $=>{try{const je=await X(`/api/logs?file=${encodeURIComponent($)}&lines=200`);v({name:je.file,text:je.text})}catch(je){t(je.message)}},Qt=d.useCallback($=>{var ut;z("tap");const je=typeof document<"u"?document.getElementById($):null;(ut=je==null?void 0:je.scrollIntoView)==null||ut.call(je,{behavior:"smooth",block:"start"})},[]),W=(mt=e==null?void 0:e.system)==null?void 0:mt.memory,ue=(Pt=e==null?void 0:e.system)==null?void 0:Pt.disk,pe=e==null?void 0:e.bridge,H=e==null?void 0:e.kanban,oe=Array.isArray(k)?k.slice().reverse():[],Ae=dS(oe,{expanded:N}),Nt=mS(),Ye=Nt==="standalone"?r("settings.standalone"):Nt==="browser"?r("settings.browser"):Nt==="webapk"?"WebAPK":"—";return a.jsxs("div",{className:"pane center-readable",children:[a.jsx("nav",{className:"settings-nav","aria-label":r("settings.sections"),children:kS.map($=>a.jsxs("button",{type:"button",className:"settings-nav-chip",onClick:()=>Qt($.id),children:[a.jsx("span",{"aria-hidden":"true",children:$.icon}),a.jsx("span",{children:r($.key)})]},$.id))}),a.jsxs("section",{id:"sec-appearance",className:"card settings-card",children:[a.jsx(Or,{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:fS.map($=>a.jsx("button",{type:"button",className:`chip${i===$.value?" on":""}`,"aria-pressed":i===$.value,onClick:()=>{z("tap"),l($.value)},children:r($.key)},$.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:gS.map($=>a.jsx("button",{type:"button",className:`chip${o===$.value?" on":""}`,"aria-pressed":o===$.value,onClick:je=>{z("tap"),uS($.value,c,je)},children:r($.key)},$.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:vS.map($=>a.jsx("button",{type:"button",className:`chip vibe-chip${y===$.value?" on":""}`,"aria-pressed":y===$.value,onClick:je=>{z("tap");const ut=cS($.value,je);G(ut),t==null||t(r("settings.vibeSwitched",{mode:r($.key)}))},children:r($.key)},$.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":P,"aria-label":r("settings.haptics"),className:`hm-switch${P?" on":""}`,onClick:()=>{const $=xk(!P);I($),$&&z("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":F,"aria-label":r("settings.sound"),className:`hm-switch${F?" on":""}`,onClick:()=>{const $=Ck(!F);K($),z("tap"),$&&Yd("approve")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.bars")})}),yS.map($=>a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsx("span",{children:r($.key)}),a.jsx("button",{type:"button",role:"switch","aria-checked":D[$.id]!==!1,"aria-label":r($.key),"data-bar":$.id,className:`hm-switch${D[$.id]!==!1?" on":""}`,onClick:()=>{z("tap"),ae(Wb($.id,D[$.id]===!1))},children:a.jsx("span",{className:"hm-switch-knob"})})]},$.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(Or,{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:Ge,onClick:ht,children:[Ge?a.jsx(vn,{size:14}):null,a.jsx("span",{children:r(Ge?"settings.pairingLoading":"settings.showPairingQr")})]})]}),a.jsx("section",{id:"sec-snippets",className:"card settings-card",children:a.jsx(xS,{notify:t,lang:s})}),a.jsxs("section",{id:"sec-pipeline",className:"card settings-card",children:[a.jsx(Or,{icon:"🏗️",title:r("settings.secPipeline")}),a.jsx(hS,{notify:t,board:(()=>{try{return localStorage.getItem(Sv)??""}catch{return""}})()})]}),a.jsxs("section",{id:"sec-repos",className:"card settings-card",children:[a.jsx(Or,{icon:"📁",title:r("settings.repos",{count:fe.length}),action:a.jsx("button",{className:"link",disabled:me,onClick:async()=>{z("tap"),await rt({path:"/api/repos/scan",done:r("settings.rescanned")})},children:r("settings.rescan")})}),a.jsxs("div",{className:"list",children:[fe.map($=>{var je;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:[$.label,$.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:$.path,source:$.source,count:((je=$.boards)==null?void 0:je.length)??0})})]}),a.jsx("button",{className:"link",disabled:me,onClick:()=>rt({method:"DELETE",path:`/api/repos/${encodeURIComponent($.id)}`,done:r("settings.hidden")}),children:r("settings.hide")})]},$.id)}),fe.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:[Y.map($=>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:$})}),a.jsx("button",{className:"link",disabled:me,onClick:()=>rt({body:{scanDirs:Y.filter(je=>je!==$)},done:r("settings.removed")}),children:r("settings.delete")})]},$)),Y.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:O,onChange:$=>B($.target.value)}),a.jsx("button",{className:"btn",disabled:me||!O.trim(),style:{marginTop:8},onClick:async()=>{const $=[...Y,O.trim()];await rt({body:{scanDirs:$},done:r("settings.scanDirAdded")})&&B("")},children:r("settings.addScanDir")}),a.jsx("input",{className:"inp",placeholder:r("settings.repoPathPlaceholder"),maxLength:300,value:J,onChange:$=>ce($.target.value),style:{marginTop:8}}),a.jsx("button",{className:"btn",disabled:me||!J.trim(),style:{marginTop:8},onClick:async()=>{await rt({body:{path:J.trim()},done:r("settings.repoAdded")})&&ce("")},children:r("settings.addRepo")})]}),a.jsxs("section",{id:"sec-audit",className:"card settings-card",children:[a.jsx(Or,{icon:"🛡️",title:r("settings.secAudit"),action:a.jsx(yr,{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($=>a.jsxs("button",{className:"chip",onClick:()=>{z("tap"),ct($)},style:{marginRight:6},children:[$,".log"]},$))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.audit")})}),a.jsxs("div",{className:"list",children:[Ae.visible.map(($,je)=>a.jsx("div",{className:"row static",children:a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:$.kind}),a.jsxs("span",{className:"row-sub",children:[_o($.at),$.task?` ・ ${$.task}`:"",$.action?` ・ ${$.action}`:"",$.ok===!1?` ・ ${r("settings.auditFailed")}`:""]})]})},`${$.at??"x"}-${$.kind??""}-${je}`)),Ae.visible.length?null:a.jsx("div",{className:"empty",children:r("settings.auditEmpty")})]}),Ae.canExpand?a.jsx("button",{type:"button",className:"btn settings-audit-more","aria-expanded":Ae.expanded,style:{marginTop:8},onClick:()=>{z("tap"),w($=>!$)},children:Ae.expanded?r("settings.auditCollapse"):r("settings.auditShowMore",{count:Ae.hiddenCount})}):null]}),a.jsxs("section",{id:"sec-status",className:"card settings-card",children:[a.jsx(Or,{icon:"🩺",title:r("settings.secStatus")}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Hermes"}),a.jsx("b",{children:((kt=e==null?void 0:e.hermes)==null?void 0:kt.version)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.model")}),a.jsx("b",{children:((jt=e==null?void 0:e.hermes)==null?void 0:jt.model)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.memory")}),a.jsx("b",{children:W?r("settings.memoryValue",{used:Cl(W.used),total:Cl(W.total),percent:W.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.disk")}),a.jsx("b",{children:ue?r("settings.diskValue",{free:Cl(ue.free),percent:ue.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.bridge")}),a.jsx("b",{className:(pe==null?void 0:pe.ok)===!1?"bad-text":"",children:pe?pe.ok?r("settings.bridgeOk",{uptime:pe.uptimeSec}):r("settings.disconnected"):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.reviewWaiting")}),a.jsx("b",{children:H?r("settings.kanbanValue",{waiting:H.reviewWaiting,running:H.running}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.lastChecked")}),a.jsx("b",{children:Je(e==null?void 0:e.checkedAt)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.launchSource")}),a.jsx("b",{children:Ye})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.installability")}),a.jsx("b",{children:u.available?r("settings.installPossible"):u.installed?r("settings.installDone"):r("settings.installNo")})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Service Worker"}),a.jsx("b",{children:J0()})]}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8},disabled:h,"aria-busy":h,onClick:async()=>{z("tap"),S(!0);try{const $=await Z0();g($),X("/api/client-error",{method:"POST",body:{kind:"pwa-diag",href:location.href,referrer:document.referrer||"",displayMode:["standalone","minimal-ui","fullscreen","browser"].filter(je=>matchMedia(`(display-mode: ${je})`).matches).join(","),rows:$}}).catch(()=>{})}finally{S(!1)}},children:[h?a.jsx(vn,{size:14}):null,a.jsx("span",{children:r(h?"settings.diagRunning":"settings.diagRun")})]}),f&&a.jsx("div",{className:"diag",style:{marginTop:10,fontSize:12,lineHeight:1.5},children:f.map($=>a.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0"},children:[a.jsx("span",{style:{color:$.ok?"#4ade80":"#f87171",flex:"0 0 auto"},children:$.ok?"✓":"✗"}),a.jsx("span",{style:{flex:"1 1 auto",color:$.ok?"var(--text)":"#fca5a5"},children:$.label}),a.jsx("span",{style:{flex:"1 1 50%",color:"var(--muted)",wordBreak:"break-all",textAlign:"right"},children:$.detail})]},$.label))}),u.available&&a.jsx("button",{className:"btn primary",style:{marginTop:8},onClick:async()=>{const $=await u.prompt();t==null||t(r($==="accepted"?"settings.installPromptAccepted":"settings.installPromptCancelled"))},children:r("settings.installApp")}),a.jsx(yr,{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:[M.map($=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${$.active?"running":"done"}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:$.title??$.id}),a.jsxs("span",{className:"row-sub",children:[$.source," ・ ",$.messages," msg ・ ",$.lastActivity??""]})]})]},$.id)),M.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.0"})," ",a.jsx("span",{className:"mono",children:"~/.hermes/plugin-data/hermes-pilot/token"})]})]}),m?a.jsx(We,{title:m.name,onClose:()=>v(null),children:a.jsx("pre",{className:"logbox",children:m.text})}):null,Ne?a.jsxs(We,{title:r("settings.pairingTitle"),onClose:()=>ke(null),children:[a.jsx("div",{className:"row-sub",style:{lineHeight:1.6},children:r("settings.pairingScanHint")}),Ne.qrPng?a.jsx("div",{className:"pair-qr",children:a.jsx("img",{className:"pair-qr-img",src:Ne.qrPng,width:287,height:287,alt:"Pairing QR"})}):Ne.qrRows?a.jsx("div",{className:"pair-qr",children:a.jsx(wS,{rows:Ne.qrRows,margin:Ne.qrMargin??4,size:Math.min(320,Math.max(220,(typeof window<"u"?window.innerWidth:390)-70))})}):Ne.qrSvg?a.jsx("div",{className:"pair-qr",dangerouslySetInnerHTML:{__html:Ne.qrSvg}}):a.jsx("div",{className:"empty",children:r("settings.pairingEmpty")}),a.jsx("div",{className:"list",style:{marginTop:10},children:(Ne.targets??[]).map($=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:$.label}),a.jsx("span",{className:"row-sub mono",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$.url})]}),a.jsx("button",{className:"link",onClick:()=>wt($.url),children:r("settings.pairingCopy")})]},$.url))}),a.jsx("div",{className:"row-sub",style:{marginTop:10,lineHeight:1.6},children:r("settings.pairingNote")})]}):null]})}function SS({onClose:e,onOpenSession:t,notify:n}){const{t:s}=$e(),[r,i]=d.useState(""),[l,o]=d.useState(null),[c,u]=d.useState(!1),f=d.useRef(null),g=d.useRef(0);d.useEffect(()=>{const k=setTimeout(()=>{var x;return(x=f.current)==null?void 0:x.focus()},120);return()=>clearTimeout(k)},[]);const h=d.useCallback(async k=>{const x=k.trim();if(!x){o(null);return}const N=++g.current;u(!0);try{const w=await X(`/api/search?q=${encodeURIComponent(x)}&limit=30`);N===g.current&&o(w)}catch(w){N===g.current&&(o({ok:!1,reason:w.message,hits:[]}),n==null||n(w.message))}finally{N===g.current&&u(!1)}},[n]);d.useEffect(()=>{const k=setTimeout(()=>h(r),280);return()=>clearTimeout(k)},[r,h]);const S=(l==null?void 0:l.hits)??[];return a.jsxs(We,{title:s("search.title"),onClose:e,children:[a.jsx("input",{ref:f,className:"inp",value:r,onChange:k=>i(k.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(vn,{size:12}),a.jsx("span",{children:s("search.searching")})]}):l!=null&&l.ok?s("search.resultCount",{count:S.length,ms:Math.round(l.tookMs)}):(l==null?void 0:l.reason)??s("search.hint")}),a.jsxs("div",{className:"list",children:[S.map(k=>a.jsx("button",{className:"list-item",onClick:()=>{z("tap"),t==null||t(k),e==null||e()},children:a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsx("span",{className:"row-title",style:{fontSize:12.5},children:k.snippet||s("search.emptySnippet")}),a.jsxs("span",{className:"row-sub",children:[k.role==="user"?s("search.you"):k.role==="assistant"?"Hermes":k.role,` ・ ${Je(k.at)}`,k.sessionTitle?` ・ ${String(k.sessionTitle).slice(0,28)}`:"",k.profile&&k.profile!=="default"?` ・ ${k.profile}`:"",k.source?` ・ ${k.source}`:""]})]})},`${k.profile??"default"}:${k.messageId}`)),!c&&(l!=null&&l.ok)&&!S.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 NS=["default","teal","amber","violet"];function jS(e){return String(e??"").split(/[,、\s]+/).map(t=>t.trim().replace(/^#+/,"")).filter(Boolean)}function CS({notify:e,onOpenChat:t}){const{t:n}=$e(),[s,r]=d.useState([]),[i,l]=d.useState([]),[o,c]=d.useState(!0),[u,f]=d.useState(""),[g,h]=d.useState("all"),[S,k]=d.useState(""),[x,N]=d.useState(null),[w,m]=d.useState(""),[v,A]=d.useState(!1),T=d.useCallback(async()=>{var E,O;try{const[B,J]=await Promise.allSettled([X("/api/memos"),X("/api/chat-reports?limit=20")]);B.status==="fulfilled"&&Array.isArray((E=B.value)==null?void 0:E.memos)&&r(B.value.memos),J.status==="fulfilled"&&Array.isArray((O=J.value)==null?void 0:O.reports)&&l(J.value.reports)}finally{c(!1)}},[]);d.useEffect(()=>{T();const E=()=>T();return window.addEventListener("hm:memos-changed",E),()=>window.removeEventListener("hm:memos-changed",E)},[T]);const M=d.useMemo(()=>{const E=new Set;for(const O of s)for(const B of O.tags||[])E.add(B);return[...E].slice(0,12)},[s]),_=d.useMemo(()=>{var O;const E=new Set;for(const B of s)(O=B.source)!=null&&O.reportKey&&E.add(B.source.reportKey);return E},[s]),P=d.useMemo(()=>{const E=u.trim().toLowerCase();return s.filter(O=>{if(g==="pinned"&&!O.pinned||g==="report"&&O.kind!=="report")return!1;if(g.startsWith("tag:")){const J=g.slice(4).toLowerCase();if(!(O.tags||[]).some(ce=>ce.toLowerCase()===J))return!1}return E?[O.title,O.body,...O.tags||[],...(O.checklist||[]).map(J=>J.text)].join(`
92
- `).toLowerCase().includes(E):!0})},[s,g,u]),I=d.useCallback(async()=>{const E=S.trim();if(!(!E||v)){A(!0);try{const O=await X("/api/memos",{method:"POST",body:{title:"",body:E,tags:["idea"],kind:"note",color:"default"}});O!=null&&O.memo&&r(B=>[O.memo,...B]),k(""),vt("approve"),e==null||e(n("notes.saved"))}catch(O){e==null||e((O==null?void 0:O.message)||"Error")}finally{A(!1)}}},[S,v,e,n]),y=d.useCallback(async(E,O)=>{var ce;(ce=O==null?void 0:O.stopPropagation)==null||ce.call(O),z("tap");const B=!E.pinned;r(me=>me.map(ye=>ye.id===E.id?{...ye,pinned:B}:ye));const J=await X(`/api/memos/${encodeURIComponent(E.id)}`,{method:"PATCH",body:{pinned:B}});J!=null&&J.memo&&T()},[T]),G=d.useCallback(async(E,O,B)=>{var me;(me=B==null?void 0:B.stopPropagation)==null||me.call(B),z("tap");const J=(E.checklist||[]).find(ye=>ye.id===O);J&&!J.done&&vt("spark",{x:B==null?void 0:B.clientX,y:B==null?void 0:B.clientY,sound:!1});const ce=(E.checklist||[]).map(ye=>ye.id===O?{...ye,done:!ye.done}:ye);r(ye=>ye.map(Ne=>Ne.id===E.id?{...Ne,checklist:ce}:Ne)),await X(`/api/memos/${encodeURIComponent(E.id)}`,{method:"PATCH",body:{checklist:ce}})},[]),F=d.useCallback(async E=>{const O=E.key||`${E.at||""}:${E.title||""}`;if(!_.has(O))try{const B=await X("/api/memos",{method:"POST",body:{title:E.title||E.specTitle||"Report",body:E.summary||E.body||"",tags:["report"],kind:"report",color:"amber",source:{chatId:E.chat||void 0,board:E.board||void 0,reportKey:O}}});B!=null&&B.memo&&(r(J=>[B.memo,...J]),vt("approve"),e==null||e(n("notes.inboxSaved")))}catch(B){e==null||e((B==null?void 0:B.message)||"Error")}},[_,e,n]),K=(E=null)=>{z("tap"),m(""),N(E?{id:E.id,title:E.title||"",body:E.body||"",tagsText:(E.tags||[]).join(", "),pinned:!!E.pinned,color:E.color||"default",kind:E.kind||"note",checklist:[...E.checklist||[]]}:{id:null,title:"",body:"",tagsText:"idea",pinned:!1,color:"default",kind:"note",checklist:[]})},D=async()=>{if(!x||v)return;const E=jS(x.tagsText);if(!(!x.title.trim()&&!x.body.trim()&&!x.checklist.length)){A(!0);try{if(x.id){const O=await X(`/api/memos/${encodeURIComponent(x.id)}`,{method:"PATCH",body:{title:x.title,body:x.body,tags:E,pinned:x.pinned,color:x.color,checklist:x.checklist}});O!=null&&O.memo&&(T(),vt("approve"),e==null||e(n("notes.saved")))}else{const O=await X("/api/memos",{method:"POST",body:{title:x.title,body:x.body,tags:E,pinned:x.pinned,color:x.color,kind:"note",checklist:x.checklist}});O!=null&&O.memo&&(T(),vt("approve"),e==null||e(n("notes.saved")))}N(null)}catch(O){e==null||e((O==null?void 0:O.message)||"Error")}finally{A(!1)}}},ae=async()=>{if(!(!(x!=null&&x.id)||v)){A(!0);try{await X(`/api/memos/${encodeURIComponent(x.id)}`,{method:"DELETE"}),r(E=>E.filter(O=>O.id!==x.id)),N(null),e==null||e(n("notes.deleted"))}catch(E){e==null||e((E==null?void 0:E.message)||"Error")}finally{A(!1)}}},fe=(E,O)=>{var J;(J=O==null?void 0:O.stopPropagation)==null||J.call(O),z("tap");const B=[E.title,E.body].filter(Boolean).join(`
93
- `).trim();window.dispatchEvent(new CustomEvent("hm:open-brainstorm",{detail:{seed:B,memoId:E.id}}))},te=(E,O)=>{var J,ce,me;(J=O==null?void 0:O.stopPropagation)==null||J.call(O),z("tap");const B=[E.title,E.body,...(E.checklist||[]).map(ye=>`- [${ye.done?"x":" "}] ${ye.text}`)].filter(Boolean).join(`
94
- `).trim();window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:B,repo:(ce=E.source)==null?void 0:ce.repo,board:(me=E.source)==null?void 0:me.board}}))},Y=d.useMemo(()=>i.filter(E=>{const O=E.key||`${E.at||""}:${E.title||""}`;return!_.has(O)}),[i,_]);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:()=>K(null),children:n("notes.newBtn")}),a.jsx(yr,{variant:"icon",onRefresh:T})]})]}),a.jsxs("div",{className:"memos-quick-bar",children:[a.jsx("input",{type:"text",className:"memos-quick-input",value:S,placeholder:n("notes.quickPlaceholder"),onChange:E=>k(E.target.value),onKeyDown:E=>{var O;E.key==="Enter"&&!((O=E.nativeEvent)!=null&&O.isComposing)&&(E.preventDefault(),I())}}),a.jsx("button",{type:"button",className:"btn",disabled:!S.trim()||v,onClick:I,children:n("notes.addChecklistBtn")})]}),a.jsx("div",{className:"memos-search-row",children:a.jsx("input",{type:"search",className:"memos-search-input",value:u,placeholder:n("notes.searchPlaceholder"),onChange:E=>f(E.target.value)})}),a.jsxs("div",{className:"chips memos-filter-chips",children:[a.jsx("button",{type:"button",className:`chip${g==="all"?" on":""}`,onClick:()=>h("all"),children:n("notes.filterAll")}),a.jsx("button",{type:"button",className:`chip${g==="pinned"?" on":""}`,onClick:()=>h("pinned"),children:n("notes.filterPinned")}),a.jsx("button",{type:"button",className:`chip${g==="report"?" on":""}`,onClick:()=>h("report"),children:n("notes.filterReports")}),M.map(E=>a.jsxs("button",{type:"button",className:`chip${g===`tag:${E}`?" on":""}`,onClick:()=>h(g===`tag:${E}`?"all":`tag:${E}`),children:["#",E]},E))]}),Y.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:Y.length})]}),a.jsx(Oe,{name:"chevron",size:14})]}),a.jsx("div",{className:"memos-inbox-list",children:Y.slice(0,6).map((E,O)=>a.jsxs("div",{className:"memos-inbox-row",children:[a.jsxs("div",{className:"memos-inbox-main",children:[a.jsx("div",{className:"row-title",children:E.title||E.specTitle||"Report"}),E.summary?a.jsx("div",{className:"row-sub",children:E.summary}):null]}),a.jsx("button",{type:"button",className:"btn",onClick:()=>F(E),children:n("notes.inboxSave")})]},E.key||O))})]}):null,o?a.jsx(Qn,{label:n("common.loading")}):null,!o&&!P.length?a.jsx("div",{className:"empty",children:n("notes.empty")}):null,a.jsx("div",{className:"memos-grid",children:P.map(E=>{var B,J,ce,me,ye,Ne;const O=[(B=E.source)==null?void 0:B.chatTitle,(J=E.source)==null?void 0:J.repo,(ce=E.source)==null?void 0:ce.board].filter(Boolean).join(" · ");return a.jsxs("article",{className:`card memo-card color-${E.color||"default"}${E.pinned?" is-pinned":""}`,onClick:()=>K(E),children:[a.jsxs("div",{className:"memo-card-head",children:[a.jsx("div",{className:"memo-card-title",children:E.title||(E.kind==="report"?"📬 Report":"💡")}),a.jsx("button",{type:"button",className:`memo-pin-btn${E.pinned?" on":""}`,"aria-label":E.pinned?n("notes.unpin"):n("notes.pin"),onClick:ke=>y(E,ke),children:"📌"})]}),E.body?a.jsx("div",{className:"memo-card-body",children:E.body}):null,(me=E.checklist)!=null&&me.length?a.jsx("div",{className:"memo-checklist",children:E.checklist.map(ke=>a.jsxs("button",{type:"button",className:`memo-check-row${ke.done?" done":""}`,onClick:Ge=>G(E,ke.id,Ge),children:[a.jsx("span",{"aria-hidden":"true",children:ke.done?"☑":"☐"}),a.jsx("span",{children:ke.text})]},ke.id))}):null,(ye=E.tags)!=null&&ye.length?a.jsx("div",{className:"memo-tags",children:E.tags.map(ke=>a.jsxs("span",{className:"memo-tag",children:["#",ke]},ke))}):null,O?a.jsx("div",{className:"memo-source-meta",children:n("notes.sourceMeta",{meta:O})}):null,a.jsxs("div",{className:"memo-card-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn",onClick:ke=>fe(E,ke),children:n("notes.brainstorm")}),a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:ke=>te(E,ke),children:n("notes.toSeed")}),(Ne=E.source)!=null&&Ne.chatId&&t?a.jsx("button",{type:"button",className:"report-card-btn",onClick:ke=>{ke.stopPropagation(),z("tap"),t(E.source.chatId)},children:n("notes.openChat")}):null]})]},E.id)})}),x?a.jsx(We,{title:x.id?n("notes.editTitle"):n("notes.createTitle"),onClose:()=>N(null),children:a.jsxs("div",{className:"memo-editor",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:x.title,placeholder:n("notes.fieldTitlePh"),onChange:E=>N(O=>({...O,title:E.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:x.body,placeholder:n("notes.fieldBodyPh"),onChange:E=>N(O=>({...O,body:E.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:[x.checklist.map(E=>a.jsxs("div",{className:"memo-editor-check-item",children:[a.jsx("input",{type:"checkbox",checked:E.done,onChange:()=>N(O=>({...O,checklist:O.checklist.map(B=>B.id===E.id?{...B,done:!B.done}:B)}))}),a.jsx("span",{className:E.done?"done":"",children:E.text}),a.jsx("button",{type:"button",className:"link",onClick:()=>N(O=>({...O,checklist:O.checklist.filter(B=>B.id!==E.id)})),children:"✕"})]},E.id)),a.jsxs("div",{className:"memo-check-add-row",children:[a.jsx("input",{type:"text",className:"memo-input",value:w,placeholder:n("notes.addChecklistPh"),onChange:E=>m(E.target.value)}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{const E=w.trim();E&&(N(O=>({...O,checklist:[...O.checklist,{id:`c_${Date.now()}`,text:E,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:x.tagsText,placeholder:n("notes.fieldTagsPh"),onChange:E=>N(O=>({...O,tagsText:E.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:NS.map(E=>a.jsx("button",{type:"button",className:`chip${x.color===E?" on":""}`,onClick:()=>N(O=>({...O,color:E})),children:E},E))})]}),a.jsxs("div",{className:"memo-editor-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v||!x.title.trim()&&!x.body.trim()&&!x.checklist.length,onClick:D,children:n("notes.save")}),x.id?a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:ae,children:n("notes.delete")}):null]})]})}):null]})}const ES={allClear:18,receipt:18,vibeWarp:18,launch:16,fastTrack:16,approve:12,stamp:12,combo:10,send:5,spark:4},TS=720,AS=1800,RS=2400,xm=".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",PS=".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",IS=".hm-switch, .seed-toggle",_S=".seed-seg-btn, .chip, .prof-chip, .snippet-chip.trigger, .settings-nav-chip",MS={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 Oc(){var e,t,n;try{return!!((n=(t=(e=globalThis.window)==null?void 0:e.matchMedia)==null?void 0:t.call(e,Jd))!=null&&n.matches)}catch{return!1}}function Ov(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 LS(e,t=0){const n=ES[e]??12,{hues:s}=Ov(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 km({kind:e,x:t,y:n,width:s,height:r,sfxText:i,combo:l=0}){var M,_;const o=((M=globalThis.window)==null?void 0:M.innerWidth)||390,c=((_=globalThis.window)==null?void 0:_.innerHeight)||844,u=Number.isFinite(t)?t:o*.5,f=Number.isFinite(n)?n:c*.38,g=Number.isFinite(s)&&s>0?s:84,h=Number.isFinite(r)&&r>0?r:36,S=Ov(l),k=e==="approve"||e==="fastTrack"||e==="launch"||e==="vibeWarp"||e==="allClear"||e==="receipt"||e==="tapImpact",x=e==="tap"||e==="toggle",N=k?10:x?6:e==="spark"||e==="send"?4:6,w=Array.from({length:N},(P,I)=>({angle:Math.PI*2*I/N+(Math.random()-.5)*.25,inner:(x?10:12)+Math.random()*8,outer:(k?54:x?36:30)+Math.random()*24,color:I%2===0?S.primary:S.secondary})),m=e==="spark"||e==="send"?0:k?5:3,v=Array.from({length:m},(P,I)=>{const y=I%2===0?-1:1;return{ox:u+y*(g*.34+Math.random()*12),oy:f+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:(k?16:12)+Math.random()*8}}),A=e==="spark"?3:e==="send"?4:k?8:5,T=Array.from({length:A},(P,I)=>{const y=Math.PI*2*I/A+Math.random()*.4,G=(e==="spark"?40:x?72:85)+Math.random()*65;return{x:u,y:f,vx:Math.cos(y)*G,vy:Math.sin(y)*G-35,rot:Math.random()*Math.PI*2,vrot:(Math.random()-.5)*10,size:(x?3:3.5)+Math.random()*3,color:I%2===0?S.primary:S.secondary}});return{start:performance.now(),duration:e==="vibeWarp"?440:k?520:380,cx:u,cy:f,h,hasImpact:k||x,irisRing:e==="vibeWarp"?{maxR:Math.ceil(Math.hypot(Math.max(u,o-u),Math.max(f,c-f)))}:null,trail:e==="send"?{x:u,y:f,dy:-165}:null,rays:w,smokes:v,chips:T,sfxText:i||null,sfxTilt:(Math.random()-.5)*.22,vw:o,vh:c}}function OS(){const{t:e}=$e(),[t,n]=d.useState(()=>fs()),[s,r]=d.useState([]),[i,l]=d.useState(null),[o,c]=d.useState(null),[u,f]=d.useState(null),g=d.useRef(0),h=d.useRef([]),S=d.useRef(null),k=d.useRef([]),x=d.useRef(0),N=d.useRef(0),w=d.useRef(e);w.current=e;const m=()=>{for(const _ of h.current)clearTimeout(_);h.current=[]},v=(_,P)=>{const I=setTimeout(_,P);return h.current.push(I),I},A=()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0),k.current=[];const _=S.current;if(_){const P=_.getContext("2d");P&&P.clearRect(0,0,_.width,_.height)}},T=()=>{if(x.current||Oc())return;const _=P=>{if(fs()!=="dopamine"||document.visibilityState==="hidden"){A();return}const I=S.current;if(!I){x.current=0;return}const y=I.getContext("2d");if(!y){x.current=0;return}const G=Math.min(window.devicePixelRatio||1,2),F=window.innerWidth,K=window.innerHeight,D=Math.round(F*G),ae=Math.round(K*G);(I.width!==D||I.height!==ae)&&(I.width=D,I.height=ae),y.setTransform(G,0,0,G,0,0),y.clearRect(0,0,F,K);const fe=[];for(const te of k.current){const Y=P-te.start,E=Y/te.duration;if(E>=1)continue;fe.push(te);const O=1-Math.pow(1-E,3);if(te.irisRing){const B=Math.max(8,te.irisRing.maxR*O);y.save(),y.globalAlpha=Math.max(0,(1-E)*.92),y.strokeStyle="#22d3ee",y.lineWidth=Math.max(1.5,5*(1-E)),y.beginPath(),y.arc(te.cx,te.cy,B,0,Math.PI*2),y.stroke(),y.strokeStyle="#fde68a",y.lineWidth=Math.max(1,2*(1-E)),y.beginPath(),y.arc(te.cx,te.cy,Math.max(4,B-4),0,Math.PI*2),y.stroke(),y.restore()}if(te.hasImpact&&E<.7){const B=E/.7,J=1-Math.pow(1-B,2);y.save(),y.globalAlpha=Math.max(0,1-B)*.75,y.strokeStyle="#fbbf24",y.lineWidth=2*(1-B)+.5,y.beginPath(),y.arc(te.cx,te.cy,12+J*46,0,Math.PI*2),y.stroke();for(const ce of te.rays){const me=ce.inner+J*14,ye=ce.inner+(ce.outer-ce.inner)*J;y.strokeStyle=ce.color,y.lineWidth=2.2*(1-B),y.beginPath(),y.moveTo(te.cx+Math.cos(ce.angle)*me,te.cy+Math.sin(ce.angle)*me),y.lineTo(te.cx+Math.cos(ce.angle)*ye,te.cy+Math.sin(ce.angle)*ye),y.stroke()}y.restore()}if(te.trail){const B=te.trail.y+te.trail.dy*O,J=te.trail.y+te.trail.dy*Math.max(0,O-.35),ce=y.createLinearGradient(te.trail.x,J,te.trail.x,B);ce.addColorStop(0,"rgba(34, 211, 238, 0)"),ce.addColorStop(.6,"rgba(45, 212, 191, 0.85)"),ce.addColorStop(1,"rgba(251, 191, 36, 0.95)"),y.save(),y.globalAlpha=Math.max(0,1-E),y.strokeStyle=ce,y.lineWidth=2.5,y.lineCap="round",y.beginPath(),y.moveTo(te.trail.x,J),y.lineTo(te.trail.x,B),y.stroke(),y.restore()}if(te.smokes.length){y.save();for(const B of te.smokes){const J=B.ox+B.vx*O,ce=B.oy+B.vy*O,me=B.r0+(B.r1-B.r0)*O;y.globalAlpha=Math.max(0,(1-E)*.36),y.fillStyle="#d1fae5",y.beginPath(),y.arc(J,ce,me,0,Math.PI*2),y.fill()}y.restore()}if(te.chips.length){const B=Y/1e3;y.save();for(const J of te.chips){const ce=J.x+J.vx*B,me=J.y+J.vy*B+140*B*B;y.save(),y.translate(ce,me),y.rotate(J.rot+J.vrot*B),y.globalAlpha=Math.max(0,1-E),y.fillStyle=J.color,y.beginPath(),y.moveTo(0,-J.size),y.lineTo(J.size*.7,0),y.lineTo(0,J.size),y.lineTo(-J.size*.7,0),y.closePath(),y.fill(),y.restore()}y.restore()}if(te.sfxText){const B=Math.min(1,E*1.15),J=B<.25?.6+B/.25*.5:1.1-Math.min(1,(B-.25)/.25)*.1,ce=B>.65?Math.max(0,1-(B-.65)/.35):1,me=Math.max(44,Math.min(F-44,te.cx)),ye=Math.max(30,Math.min(K-28,te.cy-te.h*.55-14-O*14));y.save(),y.translate(me,ye),y.rotate(te.sfxTilt),y.scale(J,J),y.globalAlpha=ce,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(te.sfxText,0,0),y.fillStyle="#fde68a",y.fillText(te.sfxText,0,0),y.restore()}}k.current=fe,fe.length>0?x.current=requestAnimationFrame(_):(x.current=0,y.clearRect(0,0,F,K))};x.current=requestAnimationFrame(_)};d.useEffect(()=>Qg(n),[]),d.useEffect(()=>{const _=P=>{if(fs()!=="dopamine")return;const I=(P==null?void 0:P.detail)??{},y=String(I.kind??"combo"),G=g.current+=1,F=Number(I.combo)||0;if(r(K=>[...K,{id:G,kind:y,x:I.x,y:I.y,particles:LS(y,F)}].slice(-4)),v(()=>r(K=>K.filter(D=>D.id!==G)),TS),!Oc()&&document.visibilityState!=="hidden"){const K=MS[y],D=I.sfx||(K?w.current(K):null),ae=performance.now();if(D)for(const te of k.current)te.fromClick&&ae-te.start<120&&(te.sfxText=null);const fe=km({kind:y,x:I.x,y:I.y,width:I.width,height:I.height,sfxText:D,combo:F});k.current=[...k.current,fe].slice(-6),T(),(y==="launch"||y==="vibeWarp")&&(f({id:G}),v(()=>f(te=>(te==null?void 0:te.id)===G?null:te),440))}F>=2&&(l({n:F,id:G}),v(()=>l(K=>(K==null?void 0:K.id)===G?null:K),AS)),F>=1&&(document.documentElement.dataset.combo=F>=3?"3":String(F),clearTimeout(N.current),N.current=setTimeout(()=>{delete document.documentElement.dataset.combo},Oo)),(y==="allClear"||y==="receipt")&&(c({kind:y,id:G}),v(()=>c(K=>(K==null?void 0:K.id)===G?null:K),RS))};return window.addEventListener(Ou,_),()=>window.removeEventListener(Ou,_)},[]),d.useEffect(()=>{const _=P=>{var y,G;const I=(G=(y=P.target)==null?void 0:y.closest)==null?void 0:G.call(y,xm);!I||I.disabled||z("tap")};return document.addEventListener("click",_,{passive:!0,capture:!0}),()=>document.removeEventListener("click",_,{capture:!0})},[]),d.useEffect(()=>{if(t!=="dopamine"||Oc())return;const _=P=>{var G,F;if(fs()!=="dopamine")return;const I=(F=(G=P.target)==null?void 0:G.closest)==null?void 0:F.call(G,xm);if(!I||I.disabled)return;if(!I.matches(PS)){I.classList.remove("fx-sakuga-lite"),I.offsetWidth,I.classList.add("fx-sakuga-lite"),v(()=>I.classList.remove("fx-sakuga-lite"),180);return}if(I.classList.remove("fx-sakuga-pop"),I.offsetWidth,I.classList.add("fx-sakuga-pop"),v(()=>I.classList.remove("fx-sakuga-pop"),340),document.visibilityState!=="hidden"){const K=I.getBoundingClientRect();if(K.width>0&&K.height>0){const D=I.matches(IS),ae=!D&&I.matches(_S),fe=I.classList.contains("send")&&!I.classList.contains("stop"),te=I.classList.contains("primary")||I.classList.contains("fast-track")||I.classList.contains("seed-submit")||I.classList.contains("ak-empty-btn")||I.classList.contains("ak-new-btn")||I.classList.contains("spec-banner-btn")&&!I.classList.contains("ghost")||fe,Y=D||ae?"toggle":te?"tapImpact":"tap",E=D?w.current("fx.sfx.toggle"):ae?w.current("fx.sfx.tick"):fe?w.current("fx.sfx.send"):te?w.current("fx.sfx.tapImpact"):null,O=km({kind:Y,x:K.left+K.width/2,y:K.top+K.height/2,width:K.width,height:K.height,sfxText:E});O.fromClick=!0,k.current=[...k.current,O].slice(-6),T()}}};return document.addEventListener("click",_,{passive:!0,capture:!0}),()=>document.removeEventListener("click",_,{capture:!0})},[t]),d.useEffect(()=>{const _=()=>{document.visibilityState==="hidden"&&A()};return document.addEventListener("visibilitychange",_),()=>document.removeEventListener("visibilitychange",_)},[]),d.useEffect(()=>{t!=="dopamine"&&(m(),clearTimeout(N.current),delete document.documentElement.dataset.combo,A(),r([]),l(null),c(null),f(null))},[t]),d.useEffect(()=>()=>{m(),clearTimeout(N.current),delete document.documentElement.dataset.combo,A()},[]);const M=t==="dopamine";return a.jsxs("div",{className:`fx-layer${M?"":" off"}`,"aria-hidden":"true",children:[a.jsx("canvas",{ref:S,className:"fx-canvas","aria-hidden":"true"}),M?s.map(_=>a.jsx("div",{className:`fx-burst fx-${_.kind}`,style:{left:_.x==null?"50%":`${_.x}px`,top:_.y==null?"38%":`${_.y}px`},children:_.particles.map(P=>a.jsx("i",{className:`fx-particle ${P.hue}`,style:{"--fx-dx":`${P.dx}px`,"--fx-dy":`${P.dy}px`,"--fx-rot":`${P.rot}deg`,animationDelay:`${P.delay}ms`}},P.id))},_.id)):null,M&&i?a.jsx("div",{className:"fx-combo-pill",children:e("fx.combo",{n:i.n})},`c${i.id}`):null,M&&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,M&&u?a.jsx("div",{className:"fx-scan-sweep"},`s${u.id}`):null]})}const fo=["token","pair"],Dv=/^[0-9a-f]{32,}$/i;function $v(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 fo){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 fo){const l=r.get(i);if(l&&String(l).trim())return String(l).trim()}return null}return Dv.test(s)?s:null}function DS(e=globalThis.location,t=globalThis.history){var i;if(!$v(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 fo)n.searchParams.has(l)&&(n.searchParams.delete(l),s=!0);const r=n.hash.replace(/^#/,"");if(r){if(Dv.test(r))n.hash="",s=!0;else if(r.includes("=")){const l=new URLSearchParams(r);let o=!1;for(const c of fo)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 $S(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 FS({loc:e=globalThis.location,historyObj:t=globalThis.history,fetchImpl:n=globalThis.fetch}={}){const s=$v(e);if(!s)return{handled:!1,ok:!1};const r=await $S(s,n);return r.ok?(DS(e,t),{handled:!0,ok:!0}):{handled:!0,ok:!1,error:r.error}}const BS=d.lazy(()=>ay(()=>import("./TermPane-U500JD2P.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TermPane}))),US=[{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 Dr({active:e,children:t}){const n=d.useRef(null);return d.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 HS({error:e,onRetry:t}){const{t:n}=$e();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 $r extends Ue.Component{constructor(t){super(t),this.state={error:null}}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{}}render(){return this.state.error?a.jsx(HS,{error:this.state.error,onRetry:()=>this.setState({error:null})}):this.props.children}}function zS(){const{t:e}=$e(),[t]=d.useState(()=>Ix());d.useEffect(()=>_v(),[]),d.useEffect(()=>{Ok()},[]);const[n,s]=d.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]=d.useState(null),[l,o]=d.useState("ok"),[c,u]=d.useState(!1),[f,g]=d.useState(""),[h,S]=d.useState(null),[k,x]=d.useState(!0),[N,w]=d.useState(!1),[m,v]=d.useState(()=>({[n]:!0})),A=!!m.chat,[T,M]=d.useState(0),[_,P]=d.useState(0),[I,y]=d.useState(0),[G,F]=d.useState(0),K=d.useRef(0),[D,ae]=d.useState([]),[fe,te]=d.useState(0),[Y,E]=d.useState(0),[O,B]=d.useState(0),[J,ce]=d.useState(0),[me,ye]=d.useState([]),[Ne,ke]=d.useState(0),[Ge,Kt]=d.useState([]),[ht,wt]=d.useState(!1),[xt,rt]=d.useState(null),[_e,ct]=d.useState(null),[Qt,W]=d.useState(null);d.useEffect(()=>{const Q=ve=>{W({kind:"brainstorm",...(ve==null?void 0:ve.detail)||{}}),s("tasks")},q=ve=>{W({kind:"seed",...(ve==null?void 0:ve.detail)||{}}),s("tasks")};return window.addEventListener("hm:open-brainstorm",Q),window.addEventListener("hm:open-seed",q),()=>{window.removeEventListener("hm:open-brainstorm",Q),window.removeEventListener("hm:open-seed",q)}},[]);const[ue,pe]=d.useState(null),[H,oe]=d.useState(null),[Ae,Nt]=d.useState(null),[Ye,mt]=d.useState(!1),[Pt,kt]=d.useState(!1),jt=d.useRef(A);jt.current=A;const $=d.useRef(0),je=d.useRef(null),ut=d.useRef(n);ut.current=n,d.useEffect(()=>{try{$.current=Number(localStorage.getItem(Bh))||0}catch{$.current=0}},[]),d.useEffect(()=>{if(!(n!=="tasks"||!fe))try{const Q=ro(localStorage.getItem(ia)),q=Date.now(),ve={...Q};for(const Ce of Lu(D,Q))ve[Ce.sessionId]=Math.max(q,Number(Ce.at)||0);localStorage.setItem(ia,JSON.stringify(ve)),te(0)}catch{}},[n,fe,D]);const Mn=d.useCallback(()=>{const Q=Date.now();$.current=Q,E(0);try{localStorage.setItem(Bh,String(Q))}catch{}},[]),ft=1500,de=d.useRef([]),Yn=d.useRef(0),Me=d.useCallback(Q=>(de.current.push(Q),()=>{de.current=de.current.filter(q=>q!==Q)}),[]),Dt=d.useCallback(({force:Q=!1}={})=>{const q=Date.now();if(!(!Q&&q-Yn.current<ft)){Yn.current=q;for(const ve of de.current)try{Promise.resolve(ve()).catch(()=>{})}catch{}try{window.dispatchEvent(new CustomEvent("hm:wake-sync"))}catch{}}},[ft]);d.useEffect(()=>{const Q=()=>{document.visibilityState==="visible"&&Dt()},q=()=>Dt(),ve=()=>Dt({force:!0});return document.addEventListener("visibilitychange",Q),window.addEventListener("focus",q),window.addEventListener("online",ve),()=>{document.removeEventListener("visibilitychange",Q),window.removeEventListener("focus",q),window.removeEventListener("online",ve)}},[Dt]),d.useEffect(()=>{Dt({force:!0})},[n,Dt]),d.useEffect(()=>{n==="chat"&&Mn()},[n,Mn]),d.useEffect(()=>{const Q=Le=>{var Pe;return B(Number((Pe=Le.detail)==null?void 0:Pe.count)||0)},q=Le=>{var Pe;return wt(!!((Pe=Le.detail)!=null&&Pe.streaming))},ve=Le=>{s("review"),rt({...Le.detail||{},nonce:Date.now()})},Ce=Le=>{s("chat"),!jt.current&&Le.detail&&ct(Le.detail)},Xe=Le=>{s("chat"),pe({...Le.detail||{},nonce:Date.now()})},Re=Le=>{var Pe;s("tasks"),oe({board:((Pe=Le.detail)==null?void 0:Pe.board)??null,nonce:Date.now()})},be=()=>kt(!0),xe=Le=>{var Pe,Ve,Jt;s("tasks"),oe({board:((Pe=Le.detail)==null?void 0:Pe.board)??null,taskId:((Ve=Le.detail)==null?void 0:Ve.taskId)??((Jt=Le.detail)==null?void 0:Jt.id)??null,nonce:Date.now()})};return window.addEventListener("hm:chat-unread",Q),window.addEventListener("hm:chat-streaming",q),window.addEventListener("hm:open-review",ve),window.addEventListener("hm:open-session",Ce),window.addEventListener("hm:discuss-pipeline",Xe),window.addEventListener("hm:open-board",Re),window.addEventListener("hm:open-live",be),window.addEventListener("hm:open-task",xe),()=>{window.removeEventListener("hm:chat-unread",Q),window.removeEventListener("hm:chat-streaming",q),window.removeEventListener("hm:open-review",ve),window.removeEventListener("hm:open-session",Ce),window.removeEventListener("hm:discuss-pipeline",Xe),window.removeEventListener("hm:open-board",Re),window.removeEventListener("hm:open-live",be),window.removeEventListener("hm:open-task",xe)}},[]),d.useEffect(()=>{let Q=!0;const q=async()=>{try{const Re=await X("/api/review/chat-reports?limit=200");if(!Q)return;const be=Array.isArray(Re.items)?Re.items:[];ut.current==="chat"&&Mn(),ae(be),E(hk(be,$.current).length);try{const Pe=ro(localStorage.getItem(ia));if(te(Lu(be,Pe).length),!jt.current){const Ve=An(localStorage);B(Ug(be,Pe,Ve?[Ve]:[]).length)}}catch{}const xe=be.reduce((Pe,Ve)=>Number(Ve==null?void 0:Ve.at)>Number((Pe==null?void 0:Pe.at)??-1)?Ve:Pe,null),Le=Number(xe==null?void 0:xe.at)||0;if(je.current===null)je.current=Le;else if(ut.current==="chat"&&Le>je.current){je.current=Le;const Pe=xe.label||xe.taskId||"";Gt(Pe?C("app.reviewDoneLabel",{label:Pe}):C("app.reviewDone"))}else Le>je.current&&(je.current=Le)}catch{}};q();const ve=Me(q),Ce=setInterval(()=>{document.visibilityState==="visible"&&q()},15e3),Xe=()=>q();return window.addEventListener("hm:refresh-reports",Xe),()=>{Q=!1,clearInterval(Ce),ve(),window.removeEventListener("hm:refresh-reports",Xe)}},[Mn,Me]),d.useEffect(()=>{try{K.current=Number(localStorage.getItem("hm.reviewSeenAt"))||0}catch{K.current=0}},[]),d.useEffect(()=>{if(k||(t==null?void 0:t.open)!=="inbox")return;const Q=setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:t.task}}))},200);return()=>clearTimeout(Q)},[k,t]),d.useEffect(()=>{const Q=()=>{const q=window.location.hash.replace(/^#/,"");if(!q.startsWith("inbox"))return;const ve=q.includes(":")?q.split(":")[1]:null;window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:ve}}))};return window.addEventListener("hashchange",Q),()=>window.removeEventListener("hashchange",Q)},[]);const Ss=d.useRef(null);d.useEffect(()=>{v(Q=>Q[n]?Q:{...Q,[n]:!0})},[n]);const Ln=d.useRef(null);d.useEffect(()=>{var q;const Q=(q=Ln.current)==null?void 0:q.querySelector(".nav-item.on");Q&&typeof Q.scrollIntoView=="function"&&Q.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})},[n]);const Gt=d.useCallback(Q=>{S({msg:Q,at:Date.now()}),clearTimeout(Ss.current),Ss.current=setTimeout(()=>S(null),2600)},[]),un=d.useCallback(async()=>{try{const Q=await X("/api/overview");return i(Q),o("ok"),u(!1),Q}catch(Q){return Q.status===401?(u(!0),null):(o(Q.code==="OFFLINE"?"offline":"error"),null)}},[]);d.useEffect(()=>{let Q=!0;(async()=>{try{await FS()}catch{}Q&&(await un(),Q&&x(!1))})();const q=setInterval(()=>{Q&&document.visibilityState==="visible"&&un()},5e3),ve=Me(un);return()=>{Q=!1,clearInterval(q),ve()}},[un,Me]);const Be=Gx({reviewWaiting:T,inboxPending:_});d.useEffect(()=>{var Q,q;try{Be>0?(Q=navigator.setAppBadge)==null||Q.call(navigator,Be):(q=navigator.clearAppBadge)==null||q.call(navigator)}catch{}},[Be]),d.useEffect(()=>{let Q=!0;const q=async()=>{try{const Re=await X("/api/review");if(!Q)return;const be=Array.isArray(Re.items)?Re.items:[];Kt(be),M(Fh(be)),y(Sc(be))}catch{}},ve=Re=>{var xe;const be=Array.isArray((xe=Re.detail)==null?void 0:xe.items)?Re.detail.items:[];Kt(be),M(Fh(be)),y(Sc(be))};q();const Ce=setInterval(()=>{document.visibilityState==="visible"&&ut.current!=="review"&&q()},15e3);window.addEventListener("hm:review-items",ve);const Xe=Me(q);return()=>{Q=!1,clearInterval(Ce),Xe(),window.removeEventListener("hm:review-items",ve)}},[Me]),d.useEffect(()=>{let Q=!0;const q=async()=>{try{const be=await X("/api/review/feed?limit=20");Q&&F(Qx(be.items,K.current).length)}catch{}},ve=be=>{var xe;Q&&y(Sc((xe=be.detail)==null?void 0:xe.items))},Ce=be=>{var Le;const xe=Number((Le=be.detail)==null?void 0:Le.at)||Date.now();K.current=xe,F(0);try{localStorage.setItem("hm.reviewSeenAt",String(xe))}catch{}};q();const Xe=setInterval(()=>{document.visibilityState==="visible"&&ut.current!=="review"&&q()},15e3);window.addEventListener("hm:review-items",ve),window.addEventListener("hm:review-seen",Ce);const Re=Me(q);return()=>{Q=!1,clearInterval(Xe),Re(),window.removeEventListener("hm:review-items",ve),window.removeEventListener("hm:review-seen",Ce)}},[Me]),d.useEffect(()=>{let Q=!0;const q=async()=>{try{const Re=await X("/api/inbox");Q&&P(_u(Re.items))}catch{}},ve=Re=>{var be;return P(_u((be=Re.detail)==null?void 0:be.items))};q();const Ce=setInterval(()=>{document.visibilityState==="visible"&&ut.current!=="tasks"&&q()},15e3);window.addEventListener("hm:inbox-items",ve);const Xe=Me(q);return()=>{Q=!1,clearInterval(Ce),Xe(),window.removeEventListener("hm:inbox-items",ve)}},[Me]),d.useEffect(()=>{let Q=!0;const q=async()=>{var Re,be;try{const xe=await X("/api/live");if(!Q)return;ce(Number(((Re=xe==null?void 0:xe.counts)==null?void 0:Re.turns)??0)),ye(Array.isArray(xe==null?void 0:xe.turns)?xe.turns:[]),ke(Number(((be=xe==null?void 0:xe.counts)==null?void 0:be.architect)??0))}catch{}},ve=Re=>{var be,xe,Le;Q&&(ce(Number(((be=Re.detail)==null?void 0:be.turns)??0)),Array.isArray((xe=Re.detail)==null?void 0:xe.items)&&ye(Re.detail.items),((Le=Re.detail)==null?void 0:Le.architect)!==void 0&&ke(Number(Re.detail.architect)||0))};q();const Ce=setInterval(()=>{document.visibilityState==="visible"&&q()},15e3);window.addEventListener("hm:live-turns",ve);const Xe=Me(q);return()=>{Q=!1,clearInterval(Ce),Xe(),window.removeEventListener("hm:live-turns",ve)}},[Me]),d.useEffect(()=>{let Q=!0;const q=async()=>{try{const Ce=await X("/api/usage?hours=24");Q&&Nt(Ce)}catch{}};q();const ve=setInterval(()=>document.visibilityState==="visible"&&q(),6e4);return()=>{Q=!1,clearInterval(ve)}},[]);const dn=lk({conn:l,bridge:(r==null?void 0:r.bridge)??null}),Yt=T+_,is=ik({tasksRunning:r==null?void 0:r.runningTasks,turns:J,architectRunning:Ne}),we=ak(me),Jn=rk(Ae==null?void 0:Ae.cacheHitRate),$t=d.useCallback(()=>{z("tap");const Q=ok({reviewItems:Ge,inboxPending:_});if(Q){if(Q.kind==="review"){s("review"),rt({taskId:Q.taskId,nonce:Date.now()});return}s("tasks"),setTimeout(()=>window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:null}})),120)}},[Ge,_]);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:f,onChange:Q=>g(Q.target.value),placeholder:"~/.hermes/plugin-data/hermes-pilot/token",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("button",{onClick:()=>{const Q=f.trim();Q&&(location.href=`/auth?t=${encodeURIComponent(Q)}`)},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:Q=>{if(fs()!=="dopamine")return;const q=Q.currentTarget.getBoundingClientRect();vt("allClear",{x:Math.round(q.left+q.width/2),y:Math.round(q.bottom+8),width:Math.round(q.width),height:Math.round(q.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:()=>{z("tap"),w(!0)},children:a.jsx(Oe,{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 ${dn}`,onClick:()=>{z("tap"),un()},"aria-label":e(dn==="ok"?"app.gwOkAria":"app.gwDownAria"),title:e(dn==="ok"?"app.connected":"app.bridgeOffline"),children:dn==="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(dn==="offline"?"status.offline":"app.gwError")]})}),Yt>0?a.jsxs("button",{className:"t-pill warn pill-warn-pulse",onClick:$t,"aria-label":e("app.jumpWaitingAria",{n:Yt}),children:["🔔 ",e("status.reviewWaiting",{n:Yt})]}):null,is>0?a.jsxs("button",{className:"t-pill run",onClick:()=>{z("tap"),kt(!0)},"aria-label":e("app.jumpRunningAria",{n:is}),children:[a.jsx("i",{className:"t-dot live","aria-hidden":"true"}),"⚡ ",e("status.running",{n:is}),we?a.jsxs("span",{className:"t-tool",children:[" · ",we]}):null]}):null,Jn!==null?a.jsxs("button",{className:"t-pill gem",onClick:()=>{z("tap"),mt(!0)},"aria-label":e("app.cacheAria",{pct:Jn}),children:["💎 ",Jn,"%"]}):null]}),l!=="ok"?a.jsxs("div",{className:"banner",children:[e("app.bridgeOffline"),a.jsx("button",{onClick:()=>{z("tap"),un()},children:e("common.retry")})]}):null,a.jsx("main",{className:"panes",children:k?a.jsx(Qn,{label:e("common.loading")}):a.jsxs(a.Fragment,{children:[m.tasks?a.jsx(Dr,{active:n==="tasks",children:a.jsx($r,{tab:"tasks",children:a.jsx(g0,{overview:r,refresh:un,notify:Gt,initialInbox:(t==null?void 0:t.open)==="inbox"?t:null,focusBoard:H,onConsumedFocusBoard:()=>oe(null),taskToolRequest:Qt,onConsumedTaskTool:()=>W(null),active:n==="tasks"})})}):null,m.review?a.jsx(Dr,{active:n==="review",children:a.jsx($r,{tab:"review",children:a.jsx(p0,{notify:Gt,focusRequest:xt,onConsumedFocus:()=>rt(null),active:n==="review"})})}):null,m.notes?a.jsx(Dr,{active:n==="notes",children:a.jsx($r,{tab:"notes",children:a.jsx(CS,{notify:Gt,onOpenChat:Q=>{ct({id:Q}),s("chat")}})})}):null,m.term?a.jsx(Dr,{active:n==="term",children:a.jsx($r,{tab:"term",children:a.jsx(d.Suspense,{fallback:a.jsx(Qn,{label:e("app.termLoading")}),children:a.jsx(BS,{notify:Gt,active:n==="term"})})})}):null,m.settings?a.jsx(Dr,{active:n==="settings",children:a.jsx($r,{tab:"settings",children:a.jsx(bS,{overview:r,notify:Gt,refresh:un})})}):null,m.chat?a.jsx(Dr,{active:n==="chat",children:a.jsx($r,{tab:"chat",children:a.jsx(G0,{notify:Gt,chatReports:D,reviewItems:Ge,liveTurns:me,active:n==="chat",openRequest:_e,onConsumedOpen:()=>ct(null),discussRequest:ue,onConsumedDiscuss:()=>pe(null)})})}):null]})}),a.jsx("nav",{className:"nav",ref:Ln,children:US.map(Q=>{const q=e(Q.key),ve=_+fe,Ce=Q.id==="review"?T:Q.id==="tasks"?ve:0,Xe=(Number(r==null?void 0:r.runningTasks)||0)+J+Ne,Re=Q.id==="review"?Nc({waiting:T,unseen:G,running:I}):Q.id==="tasks"?Nc({waiting:ve,running:Xe}):Q.id==="chat"?Nc({unseen:Math.max(Y,O),running:ht?1:0}):null,be=!Ce&&Re==="done"?"done":!Ce&&Re==="running"?"running":null,xe=Ce?e(Q.id==="review"?"app.navWaiting":"app.navApproval",{label:q,n:Ce}):be==="done"?e("app.navDone",{label:q}):be==="running"?e(Q.id==="review"?"app.navReflecting":"app.navRunning",{label:q}):void 0;return a.jsxs("button",{className:`nav-item${n===Q.id?" on":""}`,"aria-current":n===Q.id?"page":void 0,"aria-label":xe,onClick:()=>{n!==Q.id&&z("tap"),s(Q.id)},children:[a.jsxs("span",{className:"nav-icon",children:[a.jsx(Oe,{name:Q.icon}),Ce?a.jsx("span",{className:"nav-badge","aria-hidden":"true",children:Ce}):null,be?a.jsx("span",{className:`nav-dot ${be}`,"aria-hidden":"true"}):null]}),a.jsx("span",{children:q})]},Q.id)})}),h?a.jsx("div",{className:`toast ${n}`,children:h.msg}):null,N?a.jsx(SS,{notify:Gt,onClose:()=>w(!1),onOpenSession:Q=>{s("chat"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:Q.sessionId,messageId:Q.messageId,profile:Q.profile}}))},120)}}):null,Pt?a.jsx(cv,{notify:Gt,onClose:()=>kt(!1)}):null,Ye?a.jsx(qg,{data:Ae,hours:24,onClose:()=>mt(!1)}):null,a.jsx(OS,{})]})}_v();async function WS(){Lg(document.getElementById("root")).render(a.jsx(Sk,{children:a.jsx(zS,{})}))}WS();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{Oe as I,We as S,xa as a,X as b,z as h,a as j,zx as o,d as r,yv as s,$e as u};