@hellcoder/companion 0.104.2-preview.20260618073757.2ec188a → 0.104.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.
@@ -38,15 +38,15 @@ var Zk=Object.defineProperty;var Kk=(e,t,n)=>t in e?Zk(e,t,{enumerable:!0,config
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var Z1;function oj(){if(Z1)return No;Z1=1;var e=aj(),t=kg(),n=z5();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=c(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var m=o.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===o)return h(m),r;if(x===d)return h(m),s;x=x.sibling}throw Error(i(188))}if(o.return!==d.return)o=m,d=x;else{for(var w=!1,C=m.child;C;){if(C===o){w=!0,o=m,d=x;break}if(C===d){w=!0,d=m,o=x;break}C=C.sibling}if(!w){for(C=x.child;C;){if(C===o){w=!0,o=x,d=m;break}if(C===d){w=!0,d=x,o=m;break}C=C.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function A(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var ae=Symbol.for("react.client.reference");function X(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ae?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case j:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case L:return"SuspenseList";case V:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case N:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case D:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H:return s=r.displayName||null,s!==null?s:X(r.type)||"Memo";case U:s=r._payload,r=r._init;try{return X(r(s))}catch{}}return null}var I=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},me=[],R=-1;function B(r){return{current:r}}function Z(r){0>R||(r.current=me[R],me[R]=null,R--)}function M(r,s){R++,me[R]=r.current,r.current=s}var pe=B(null),_e=B(null),Ce=B(null),Te=B(null);function Le(r,s){switch(M(Ce,s),M(_e,r),M(pe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?d1(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=d1(s),r=f1(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(pe),M(pe,r)}function Pe(){Z(pe),Z(_e),Z(Ce)}function rt(r){r.memoizedState!==null&&M(Te,r);var s=pe.current,o=f1(s,r.type);s!==o&&(M(_e,r),M(pe,o))}function be(r){_e.current===r&&(Z(pe),Z(_e)),Te.current===r&&(Z(Te),_o._currentValue=ie)}var ze,gt;function Ut(r){if(ze===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);ze=s&&s[1]||"",gt=-1<o.stack.indexOf(`
41
+ */var Z1;function oj(){if(Z1)return No;Z1=1;var e=aj(),t=kg(),n=z5();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=c(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var m=o.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===o)return h(m),r;if(x===d)return h(m),s;x=x.sibling}throw Error(i(188))}if(o.return!==d.return)o=m,d=x;else{for(var w=!1,C=m.child;C;){if(C===o){w=!0,o=m,d=x;break}if(C===d){w=!0,d=m,o=x;break}C=C.sibling}if(!w){for(C=x.child;C;){if(C===o){w=!0,o=x,d=m;break}if(C===d){w=!0,d=x,o=m;break}C=C.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function A(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var ae=Symbol.for("react.client.reference");function X(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ae?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case j:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case L:return"SuspenseList";case V:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case N:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case D:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H:return s=r.displayName||null,s!==null?s:X(r.type)||"Memo";case U:s=r._payload,r=r._init;try{return X(r(s))}catch{}}return null}var I=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},me=[],R=-1;function B(r){return{current:r}}function Z(r){0>R||(r.current=me[R],me[R]=null,R--)}function M(r,s){R++,me[R]=r.current,r.current=s}var pe=B(null),_e=B(null),Ce=B(null),Te=B(null);function Le(r,s){switch(M(Ce,s),M(_e,r),M(pe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?d1(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=d1(s),r=f1(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(pe),M(pe,r)}function Pe(){Z(pe),Z(_e),Z(Ce)}function rt(r){r.memoizedState!==null&&M(Te,r);var s=pe.current,o=f1(s,r.type);s!==o&&(M(_e,r),M(pe,o))}function be(r){_e.current===r&&(Z(pe),Z(_e)),Te.current===r&&(Z(Te),_o._currentValue=ie)}var ze,gt;function Ft(r){if(ze===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);ze=s&&s[1]||"",gt=-1<o.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
43
43
  `+ze+r+gt}var Dt=!1;function kt(r,s){if(!r||Dt)return"";Dt=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(se){var te=se}Reflect.construct(r,[],ue)}else{try{ue.call()}catch(se){te=se}r.call(ue.prototype)}}else{try{throw Error()}catch(se){te=se}(ue=r())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(se){if(se&&te&&typeof se.stack=="string")return[se.stack,te.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=d.DetermineComponentFrameRoot(),w=x[0],C=x[1];if(w&&C){var q=w.split(`
44
44
  `),ee=C.split(`
45
45
  `);for(m=d=0;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(d===q.length||m===ee.length)for(d=q.length-1,m=ee.length-1;1<=d&&0<=m&&q[d]!==ee[m];)m--;for(;1<=d&&0<=m;d--,m--)if(q[d]!==ee[m]){if(d!==1||m!==1)do if(d--,m--,0>m||q[d]!==ee[m]){var oe=`
46
- `+q[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=m);break}}}finally{Dt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?Ut(o):""}function fn(r,s){switch(r.tag){case 26:case 27:case 5:return Ut(r.type);case 16:return Ut("Lazy");case 13:return r.child!==s&&s!==null?Ut("Suspense Fallback"):Ut("Suspense");case 19:return Ut("SuspenseList");case 0:case 15:return kt(r.type,!1);case 11:return kt(r.type.render,!1);case 1:return kt(r.type,!0);case 31:return Ut("Activity");default:return""}}function it(r){try{var s="",o=null;do s+=fn(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
46
+ `+q[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=m);break}}}finally{Dt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?Ft(o):""}function fn(r,s){switch(r.tag){case 26:case 27:case 5:return Ft(r.type);case 16:return Ft("Lazy");case 13:return r.child!==s&&s!==null?Ft("Suspense Fallback"):Ft("Suspense");case 19:return Ft("SuspenseList");case 0:case 15:return kt(r.type,!1);case 11:return kt(r.type.render,!1);case 1:return kt(r.type,!0);case 31:return Ft("Activity");default:return""}}function it(r){try{var s="",o=null;do s+=fn(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
47
47
  Error generating stack: `+d.message+`
48
- `+d.stack}}var xn=Object.prototype.hasOwnProperty,hn=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,st=e.unstable_requestPaint,qe=e.unstable_now,hr=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,xe=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,fe=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,Ve=e.log,tt=e.unstable_setDisableYieldValue,nt=null,xt=null;function nn(r){if(typeof Ve=="function"&&tt(r),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(nt,r)}catch{}}var ut=Math.clz32?Math.clz32:Fr,vn=Math.log,Sn=Math.LN2;function Fr(r){return r>>>=0,r===0?32:31-(vn(r)/Sn|0)|0}var Mr=256,Rr=262144,ne=4194304;function he(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ge(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var C=d&134217727;return C!==0?(d=C&~x,d!==0?m=he(d):(w&=C,w!==0?m=he(w):o||(o=C&~r,o!==0&&(m=he(o))))):(C=d&~x,C!==0?m=he(C):w!==0?m=he(w):o||(o=d&~r,o!==0&&(m=he(o)))),m===0?0:s!==0&&s!==m&&(s&x)===0&&(x=m&-m,o=s&-s,x>=o||x===32&&(o&4194048)!==0)?s:m}function Ye(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function _t(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rn(){var r=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),r}function pr(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function mt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function qn(r,s,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var C=r.entanglements,q=r.expirationTimes,ee=r.hiddenUpdates;for(o=w&~o;0<o;){var oe=31-ut(o),ue=1<<oe;C[oe]=0,q[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var se=te[oe];se!==null&&(se.lane&=-536870913)}o&=~ue}d!==0&&zs(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~s))}function zs(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-ut(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function Ll(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-ut(o),m=1<<d;m&s|r[d]&s&&(r[d]|=s),o&=~m}}function ba(r,s){var o=s&-s;return o=(o&42)!==0?1:qr(o),(o&(r.suspendedLanes|s))!==0?0:o}function qr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ya(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ci(){var r=P.p;return r!==0?r:(r=window.event,r===void 0?32:z1(r.type))}function Ec(r,s){var o=P.p;try{return P.p=r,s()}finally{P.p=o}}var Hr=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Hr,pn="__reactProps$"+Hr,Lr="__reactContainer$"+Hr,Yi="__reactEvents$"+Hr,Tc="__reactListeners$"+Hr,ui="__reactHandles$"+Hr,Ac="__reactResources$"+Hr,di="__reactMarker$"+Hr;function Qi(r){delete r[Vt],delete r[pn],delete r[Yi],delete r[Tc],delete r[ui]}function bn(r){var s=r[Vt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Lr]||o[Vt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=b1(r);r!==null;){if(o=r[Vt])return o;r=b1(r)}return s}r=o,o=r.parentNode}return null}function Ir(r){if(r=r[Vt]||r[Lr]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function fi(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Vr(r){var s=r[Ac];return s||(s=r[Ac]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Zt(r){r[di]=!0}var Gt=new Set,Mc={};function Gr(r,s){Wi(r,s),Wi(r+"Capture",s)}function Wi(r,s){for(Mc[r]=s,r=0;r<s.length;r++)Gt.add(s[r])}var lf=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Rc={},_a={};function Lc(r){return xn.call(_a,r)?!0:xn.call(Rc,r)?!1:lf.test(r)?_a[r]=!0:(Rc[r]=!0,!1)}function mr(r,s,o){if(Lc(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function Ji(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function sn(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function Kt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function wa(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function of(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Sa(r){if(!r._valueTracker){var s=wa(r)?"checked":"value";r._valueTracker=of(r,s,""+r[s])}}function Dc(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=wa(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function Xi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var zc=/[\n"\\]/g;function Hn(r){return r.replace(zc,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Dl(r,s,o,d,m,x,w,C){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Kt(s)):r.value!==""+Kt(s)&&(r.value=""+Kt(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?zl(r,w,Kt(s)):o!=null?zl(r,w,Kt(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?r.name=""+Kt(C):r.removeAttribute("name")}function Oc(r,s,o,d,m,x,w,C){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),s!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||s!=null)){Sa(r);return}o=o!=null?""+Kt(o):"",s=s!=null?""+Kt(s):o,C||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=C?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Sa(r)}function zl(r,s,o){s==="number"&&Xi(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function hi(r,s,o,d){if(r=r.options,s){s={};for(var m=0;m<o.length;m++)s["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=s.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Kt(o),s=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function Ol(r,s,o){if(s!=null&&(s=""+Kt(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Kt(o):""}function Bc(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(I(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Kt(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),Sa(r)}function Zi(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var Pc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Os(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||Pc.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Bl(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in s)d=s[m],s.hasOwnProperty(m)&&o[m]!==d&&Os(r,m,d)}else for(var x in s)s.hasOwnProperty(x)&&Os(r,x,s[x])}function Pl(r){if(r.indexOf("-")===-1)return!1;switch(r){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 cf=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uf=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ka(r){return uf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Dr(){}var $l=null;function ja(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var pi=null,mi=null;function Y(r){var s=Ir(r);if(s&&(r=s.stateNode)){var o=r[pn]||null;e:switch(r=s.stateNode,s.type){case"input":if(Dl(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Hn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var m=d[pn]||null;if(!m)throw Error(i(90));Dl(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&Dc(d)}break e;case"textarea":Ol(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&hi(r,!!o.multiple,s,!1)}}}var de=!1;function Xe(r,s,o){if(de)return r(s,o);de=!0;try{var d=r(s);return d}finally{if(de=!1,(pi!==null||mi!==null)&&(wu(),pi&&(s=pi,r=mi,mi=pi=null,Y(s),r)))for(s=0;s<r.length;s++)Y(r[s])}}function at(r,s){var o=r.stateNode;if(o===null)return null;var d=o[pn]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var We=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),He=!1;if(We)try{var yn={};Object.defineProperty(yn,"passive",{get:function(){He=!0}}),window.addEventListener("test",yn,yn),window.removeEventListener("test",yn,yn)}catch{He=!1}var er=null,Ki=null,gi=null;function Mn(){if(gi)return gi;var r,s=Ki,o=s.length,d,m="value"in er?er.value:er.textContent,x=m.length;for(r=0;r<o&&s[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&s[o-d]===m[x-d];d++);return gi=m.slice(r,1<d?1-d:void 0)}function Bs(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Na(){return!0}function $c(){return!1}function Rn(r){function s(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var C in r)r.hasOwnProperty(C)&&(o=r[C],this[C]=o?o(x):x[C]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Na:$c,this.isPropagationStopped=$c,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Na)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Na)},persist:function(){},isPersistent:Na}),s}var Yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ul=Rn(Yr),es=v({},Yr,{view:0,detail:0}),Uc=Rn(es),Ca,Qr,ts,Ps=v({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ff,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==ts&&(ts&&r.type==="mousemove"?(Ca=r.screenX-ts.screenX,Qr=r.screenY-ts.screenY):Qr=Ca=0,ts=r),Ca)},movementY:function(r){return"movementY"in r?r.movementY:Qr}}),$s=Rn(Ps),X2=v({},Ps,{dataTransfer:0}),Z2=Rn(X2),K2=v({},es,{relatedTarget:0}),df=Rn(K2),eS=v({},Yr,{animationName:0,elapsedTime:0,pseudoElement:0}),tS=Rn(eS),nS=v({},Yr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),rS=Rn(nS),iS=v({},Yr,{data:0}),mx=Rn(iS),sS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aS={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"},lS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oS(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=lS[r])?!!s[r]:!1}function ff(){return oS}var cS=v({},es,{key:function(r){if(r.key){var s=sS[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=Bs(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?aS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ff,charCode:function(r){return r.type==="keypress"?Bs(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Bs(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),uS=Rn(cS),dS=v({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gx=Rn(dS),fS=v({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ff}),hS=Rn(fS),pS=v({},Yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),mS=Rn(pS),gS=v({},Ps,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),xS=Rn(gS),vS=v({},Yr,{newState:0,oldState:0}),bS=Rn(vS),yS=[9,13,27,32],hf=We&&"CompositionEvent"in window,Fl=null;We&&"documentMode"in document&&(Fl=document.documentMode);var _S=We&&"TextEvent"in window&&!Fl,xx=We&&(!hf||Fl&&8<Fl&&11>=Fl),vx=" ",bx=!1;function yx(r,s){switch(r){case"keyup":return yS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _x(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ea=!1;function wS(r,s){switch(r){case"compositionend":return _x(s);case"keypress":return s.which!==32?null:(bx=!0,vx);case"textInput":return r=s.data,r===vx&&bx?null:r;default:return null}}function SS(r,s){if(Ea)return r==="compositionend"||!hf&&yx(r,s)?(r=Mn(),gi=Ki=er=null,Ea=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return xx&&s.locale!=="ko"?null:s.data;default:return null}}var kS={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 wx(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!kS[r.type]:s==="textarea"}function Sx(r,s,o,d){pi?mi?mi.push(d):mi=[d]:pi=d,s=Tu(s,"onChange"),0<s.length&&(o=new Ul("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var ql=null,Hl=null;function jS(r){s1(r,0)}function Fc(r){var s=fi(r);if(Dc(s))return r}function kx(r,s){if(r==="change")return s}var jx=!1;if(We){var pf;if(We){var mf="oninput"in document;if(!mf){var Nx=document.createElement("div");Nx.setAttribute("oninput","return;"),mf=typeof Nx.oninput=="function"}pf=mf}else pf=!1;jx=pf&&(!document.documentMode||9<document.documentMode)}function Cx(){ql&&(ql.detachEvent("onpropertychange",Ex),Hl=ql=null)}function Ex(r){if(r.propertyName==="value"&&Fc(Hl)){var s=[];Sx(s,Hl,r,ja(r)),Xe(jS,s)}}function NS(r,s,o){r==="focusin"?(Cx(),ql=s,Hl=o,ql.attachEvent("onpropertychange",Ex)):r==="focusout"&&Cx()}function CS(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Fc(Hl)}function ES(r,s){if(r==="click")return Fc(s)}function TS(r,s){if(r==="input"||r==="change")return Fc(s)}function AS(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var tr=typeof Object.is=="function"?Object.is:AS;function Il(r,s){if(tr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!xn.call(s,m)||!tr(r[m],s[m]))return!1}return!0}function Tx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ax(r,s){var o=Tx(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Tx(o)}}function Mx(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Mx(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Rx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Xi(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=Xi(r.document)}return s}function gf(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var MS=We&&"documentMode"in document&&11>=document.documentMode,Ta=null,xf=null,Vl=null,vf=!1;function Lx(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;vf||Ta==null||Ta!==Xi(d)||(d=Ta,"selectionStart"in d&&gf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Vl&&Il(Vl,d)||(Vl=d,d=Tu(xf,"onSelect"),0<d.length&&(s=new Ul("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=Ta)))}function Us(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var Aa={animationend:Us("Animation","AnimationEnd"),animationiteration:Us("Animation","AnimationIteration"),animationstart:Us("Animation","AnimationStart"),transitionrun:Us("Transition","TransitionRun"),transitionstart:Us("Transition","TransitionStart"),transitioncancel:Us("Transition","TransitionCancel"),transitionend:Us("Transition","TransitionEnd")},bf={},Dx={};We&&(Dx=document.createElement("div").style,"AnimationEvent"in window||(delete Aa.animationend.animation,delete Aa.animationiteration.animation,delete Aa.animationstart.animation),"TransitionEvent"in window||delete Aa.transitionend.transition);function Fs(r){if(bf[r])return bf[r];if(!Aa[r])return r;var s=Aa[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Dx)return bf[r]=s[o];return r}var zx=Fs("animationend"),Ox=Fs("animationiteration"),Bx=Fs("animationstart"),RS=Fs("transitionrun"),LS=Fs("transitionstart"),DS=Fs("transitioncancel"),Px=Fs("transitionend"),$x=new Map,yf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yf.push("scrollEnd");function zr(r,s){$x.set(r,s),Gr(s,[r])}var qc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},gr=[],Ma=0,_f=0;function Hc(){for(var r=Ma,s=_f=Ma=0;s<r;){var o=gr[s];gr[s++]=null;var d=gr[s];gr[s++]=null;var m=gr[s];gr[s++]=null;var x=gr[s];if(gr[s++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Ux(o,m,x)}}function Ic(r,s,o,d){gr[Ma++]=r,gr[Ma++]=s,gr[Ma++]=o,gr[Ma++]=d,_f|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function wf(r,s,o,d){return Ic(r,s,o,d),Vc(r)}function qs(r,s){return Ic(r,null,null,s),Vc(r)}function Ux(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&s!==null&&(m=31-ut(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=o|536870912),x):null}function Vc(r){if(50<po)throw po=0,Mh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Ra={};function zS(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(r,s,o,d){return new zS(r,s,o,d)}function Sf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function xi(r,s){var o=r.alternate;return o===null?(o=nr(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Fx(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Gc(r,s,o,d,m,x){var w=0;if(d=r,typeof r=="function")Sf(r)&&(w=1);else if(typeof r=="string")w=Uk(r,o,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case V:return r=nr(31,o,s,m),r.elementType=V,r.lanes=x,r;case k:return Hs(o.children,m,x,s);case E:w=8,m|=24;break;case j:return r=nr(12,o,s,m|2),r.elementType=j,r.lanes=x,r;case z:return r=nr(13,o,s,m),r.elementType=z,r.lanes=x,r;case L:return r=nr(19,o,s,m),r.elementType=L,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case N:w=10;break e;case T:w=9;break e;case D:w=11;break e;case H:w=14;break e;case U:w=16,d=null;break e}w=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=nr(w,o,s,m),s.elementType=r,s.type=d,s.lanes=x,s}function Hs(r,s,o,d){return r=nr(7,r,d,s),r.lanes=o,r}function kf(r,s,o){return r=nr(6,r,null,s),r.lanes=o,r}function qx(r){var s=nr(18,null,null,0);return s.stateNode=r,s}function jf(r,s,o){return s=nr(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var Hx=new WeakMap;function xr(r,s){if(typeof r=="object"&&r!==null){var o=Hx.get(r);return o!==void 0?o:(s={value:r,source:s,stack:it(s)},Hx.set(r,s),s)}return{value:r,source:s,stack:it(s)}}var La=[],Da=0,Yc=null,Gl=0,vr=[],br=0,ns=null,Wr=1,Jr="";function vi(r,s){La[Da++]=Gl,La[Da++]=Yc,Yc=r,Gl=s}function Ix(r,s,o){vr[br++]=Wr,vr[br++]=Jr,vr[br++]=ns,ns=r;var d=Wr;r=Jr;var m=32-ut(d)-1;d&=~(1<<m),o+=1;var x=32-ut(s)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Wr=1<<32-ut(s)+m|o<<m|d,Jr=x+r}else Wr=1<<x|o<<m|d,Jr=r}function Nf(r){r.return!==null&&(vi(r,1),Ix(r,1,0))}function Cf(r){for(;r===Yc;)Yc=La[--Da],La[Da]=null,Gl=La[--Da],La[Da]=null;for(;r===ns;)ns=vr[--br],vr[br]=null,Jr=vr[--br],vr[br]=null,Wr=vr[--br],vr[br]=null}function Vx(r,s){vr[br++]=Wr,vr[br++]=Jr,vr[br++]=ns,Wr=s.id,Jr=s.overflow,ns=r}var kn=null,Ot=null,ht=!1,rs=null,yr=!1,Ef=Error(i(519));function is(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yl(xr(s,r)),Ef}function Gx(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Vt]=r,s[pn]=d,o){case"dialog":ot("cancel",s),ot("close",s);break;case"iframe":case"object":case"embed":ot("load",s);break;case"video":case"audio":for(o=0;o<go.length;o++)ot(go[o],s);break;case"source":ot("error",s);break;case"img":case"image":case"link":ot("error",s),ot("load",s);break;case"details":ot("toggle",s);break;case"input":ot("invalid",s),Oc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ot("invalid",s);break;case"textarea":ot("invalid",s),Bc(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||c1(s.textContent,o)?(d.popover!=null&&(ot("beforetoggle",s),ot("toggle",s)),d.onScroll!=null&&ot("scroll",s),d.onScrollEnd!=null&&ot("scrollend",s),d.onClick!=null&&(s.onclick=Dr),s=!0):s=!1,s||is(r,!0)}function Yx(r){for(kn=r.return;kn;)switch(kn.tag){case 5:case 31:case 13:yr=!1;return;case 27:case 3:yr=!0;return;default:kn=kn.return}}function za(r){if(r!==kn)return!1;if(!ht)return Yx(r),ht=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Gh(r.type,r.memoizedProps)),o=!o),o&&Ot&&is(r),Yx(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ot=v1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ot=v1(r)}else s===27?(s=Ot,vs(r.type)?(r=Xh,Xh=null,Ot=r):Ot=s):Ot=kn?wr(r.stateNode.nextSibling):null;return!0}function Is(){Ot=kn=null,ht=!1}function Tf(){var r=rs;return r!==null&&(Yn===null?Yn=r:Yn.push.apply(Yn,r),rs=null),r}function Yl(r){rs===null?rs=[r]:rs.push(r)}var Af=B(null),Vs=null,bi=null;function ss(r,s,o){M(Af,s._currentValue),s._currentValue=o}function yi(r){r._currentValue=Af.current,Z(Af)}function Mf(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Rf(r,s,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var C=x;x=m;for(var q=0;q<s.length;q++)if(C.context===s[q]){x.lanes|=o,C=x.alternate,C!==null&&(C.lanes|=o),Mf(x.return,o,r),d||(w=null);break e}x=C.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),Mf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Oa(r,s,o,d){r=null;for(var m=s,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var C=m.type;tr(m.pendingProps.value,w.value)||(r!==null?r.push(C):r=[C])}}else if(m===Te.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(_o):r=[_o])}m=m.return}r!==null&&Rf(s,r,o,d),s.flags|=262144}function Qc(r){for(r=r.firstContext;r!==null;){if(!tr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Gs(r){Vs=r,bi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function jn(r){return Qx(Vs,r)}function Wc(r,s){return Vs===null&&Gs(r),Qx(r,s)}function Qx(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},bi===null){if(r===null)throw Error(i(308));bi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else bi=bi.next=s;return o}var OS=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},BS=e.unstable_scheduleCallback,PS=e.unstable_NormalPriority,an={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lf(){return{controller:new OS,data:new Map,refCount:0}}function Ql(r){r.refCount--,r.refCount===0&&BS(PS,function(){r.controller.abort()})}var Wl=null,Df=0,Ba=0,Pa=null;function $S(r,s){if(Wl===null){var o=Wl=[];Df=0,Ba=Bh(),Pa={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Df++,s.then(Wx,Wx),s}function Wx(){if(--Df===0&&Wl!==null){Pa!==null&&(Pa.status="fulfilled");var r=Wl;Wl=null,Ba=0,Pa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function US(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<o.length;m++)(0,o[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var Jx=$.S;$.S=function(r,s){Lv=qe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&$S(r,s),Jx!==null&&Jx(r,s)};var Ys=B(null);function zf(){var r=Ys.current;return r!==null?r:Tt.pooledCache}function Jc(r,s){s===null?M(Ys,Ys.current):M(Ys,s.pool)}function Xx(){var r=zf();return r===null?null:{parent:an._currentValue,pool:r}}var $a=Error(i(460)),Of=Error(i(474)),Xc=Error(i(542)),Zc={then:function(){}};function Zx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Kx(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(Dr,Dr),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,t0(r),r;default:if(typeof s.status=="string")s.then(Dr,Dr);else{if(r=Tt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=d}},function(d){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,t0(r),r}throw Ws=s,$a}}function Qs(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ws=o,$a):o}}var Ws=null;function e0(){if(Ws===null)throw Error(i(459));var r=Ws;return Ws=null,r}function t0(r){if(r===$a||r===Xc)throw Error(i(483))}var Ua=null,Jl=0;function Kc(r){var s=Jl;return Jl+=1,Ua===null&&(Ua=[]),Kx(Ua,r,s)}function Xl(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function eu(r,s){throw s.$$typeof===y?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function n0(r){function s(J,G){if(r){var K=J.deletions;K===null?(J.deletions=[G],J.flags|=16):K.push(G)}}function o(J,G){if(!r)return null;for(;G!==null;)s(J,G),G=G.sibling;return null}function d(J){for(var G=new Map;J!==null;)J.key!==null?G.set(J.key,J):G.set(J.index,J),J=J.sibling;return G}function m(J,G){return J=xi(J,G),J.index=0,J.sibling=null,J}function x(J,G,K){return J.index=K,r?(K=J.alternate,K!==null?(K=K.index,K<G?(J.flags|=67108866,G):K):(J.flags|=67108866,G)):(J.flags|=1048576,G)}function w(J){return r&&J.alternate===null&&(J.flags|=67108866),J}function C(J,G,K,ce){return G===null||G.tag!==6?(G=kf(K,J.mode,ce),G.return=J,G):(G=m(G,K),G.return=J,G)}function q(J,G,K,ce){var Be=K.type;return Be===k?oe(J,G,K.props.children,ce,K.key):G!==null&&(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Qs(Be)===G.type)?(G=m(G,K.props),Xl(G,K),G.return=J,G):(G=Gc(K.type,K.key,K.props,null,J.mode,ce),Xl(G,K),G.return=J,G)}function ee(J,G,K,ce){return G===null||G.tag!==4||G.stateNode.containerInfo!==K.containerInfo||G.stateNode.implementation!==K.implementation?(G=jf(K,J.mode,ce),G.return=J,G):(G=m(G,K.children||[]),G.return=J,G)}function oe(J,G,K,ce,Be){return G===null||G.tag!==7?(G=Hs(K,J.mode,ce,Be),G.return=J,G):(G=m(G,K),G.return=J,G)}function ue(J,G,K){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=kf(""+G,J.mode,K),G.return=J,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return K=Gc(G.type,G.key,G.props,null,J.mode,K),Xl(K,G),K.return=J,K;case _:return G=jf(G,J.mode,K),G.return=J,G;case U:return G=Qs(G),ue(J,G,K)}if(I(G)||A(G))return G=Hs(G,J.mode,K,null),G.return=J,G;if(typeof G.then=="function")return ue(J,Kc(G),K);if(G.$$typeof===N)return ue(J,Wc(J,G),K);eu(J,G)}return null}function te(J,G,K,ce){var Be=G!==null?G.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Be!==null?null:C(J,G,""+K,ce);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return K.key===Be?q(J,G,K,ce):null;case _:return K.key===Be?ee(J,G,K,ce):null;case U:return K=Qs(K),te(J,G,K,ce)}if(I(K)||A(K))return Be!==null?null:oe(J,G,K,ce,null);if(typeof K.then=="function")return te(J,G,Kc(K),ce);if(K.$$typeof===N)return te(J,G,Wc(J,K),ce);eu(J,K)}return null}function se(J,G,K,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return J=J.get(K)||null,C(G,J,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return J=J.get(ce.key===null?K:ce.key)||null,q(G,J,ce,Be);case _:return J=J.get(ce.key===null?K:ce.key)||null,ee(G,J,ce,Be);case U:return ce=Qs(ce),se(J,G,K,ce,Be)}if(I(ce)||A(ce))return J=J.get(K)||null,oe(G,J,ce,Be,null);if(typeof ce.then=="function")return se(J,G,K,Kc(ce),Be);if(ce.$$typeof===N)return se(J,G,K,Wc(G,ce),Be);eu(G,ce)}return null}function Ee(J,G,K,ce){for(var Be=null,vt=null,Me=G,Ze=G=0,ft=null;Me!==null&&Ze<K.length;Ze++){Me.index>Ze?(ft=Me,Me=null):ft=Me.sibling;var bt=te(J,Me,K[Ze],ce);if(bt===null){Me===null&&(Me=ft);break}r&&Me&&bt.alternate===null&&s(J,Me),G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt,Me=ft}if(Ze===K.length)return o(J,Me),ht&&vi(J,Ze),Be;if(Me===null){for(;Ze<K.length;Ze++)Me=ue(J,K[Ze],ce),Me!==null&&(G=x(Me,G,Ze),vt===null?Be=Me:vt.sibling=Me,vt=Me);return ht&&vi(J,Ze),Be}for(Me=d(Me);Ze<K.length;Ze++)ft=se(Me,J,Ze,K[Ze],ce),ft!==null&&(r&&ft.alternate!==null&&Me.delete(ft.key===null?Ze:ft.key),G=x(ft,G,Ze),vt===null?Be=ft:vt.sibling=ft,vt=ft);return r&&Me.forEach(function(Ss){return s(J,Ss)}),ht&&vi(J,Ze),Be}function Ue(J,G,K,ce){if(K==null)throw Error(i(151));for(var Be=null,vt=null,Me=G,Ze=G=0,ft=null,bt=K.next();Me!==null&&!bt.done;Ze++,bt=K.next()){Me.index>Ze?(ft=Me,Me=null):ft=Me.sibling;var Ss=te(J,Me,bt.value,ce);if(Ss===null){Me===null&&(Me=ft);break}r&&Me&&Ss.alternate===null&&s(J,Me),G=x(Ss,G,Ze),vt===null?Be=Ss:vt.sibling=Ss,vt=Ss,Me=ft}if(bt.done)return o(J,Me),ht&&vi(J,Ze),Be;if(Me===null){for(;!bt.done;Ze++,bt=K.next())bt=ue(J,bt.value,ce),bt!==null&&(G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt);return ht&&vi(J,Ze),Be}for(Me=d(Me);!bt.done;Ze++,bt=K.next())bt=se(Me,J,Ze,bt.value,ce),bt!==null&&(r&&bt.alternate!==null&&Me.delete(bt.key===null?Ze:bt.key),G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt);return r&&Me.forEach(function(Xk){return s(J,Xk)}),ht&&vi(J,Ze),Be}function Ct(J,G,K,ce){if(typeof K=="object"&&K!==null&&K.type===k&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case b:e:{for(var Be=K.key;G!==null;){if(G.key===Be){if(Be=K.type,Be===k){if(G.tag===7){o(J,G.sibling),ce=m(G,K.props.children),ce.return=J,J=ce;break e}}else if(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Qs(Be)===G.type){o(J,G.sibling),ce=m(G,K.props),Xl(ce,K),ce.return=J,J=ce;break e}o(J,G);break}else s(J,G);G=G.sibling}K.type===k?(ce=Hs(K.props.children,J.mode,ce,K.key),ce.return=J,J=ce):(ce=Gc(K.type,K.key,K.props,null,J.mode,ce),Xl(ce,K),ce.return=J,J=ce)}return w(J);case _:e:{for(Be=K.key;G!==null;){if(G.key===Be)if(G.tag===4&&G.stateNode.containerInfo===K.containerInfo&&G.stateNode.implementation===K.implementation){o(J,G.sibling),ce=m(G,K.children||[]),ce.return=J,J=ce;break e}else{o(J,G);break}else s(J,G);G=G.sibling}ce=jf(K,J.mode,ce),ce.return=J,J=ce}return w(J);case U:return K=Qs(K),Ct(J,G,K,ce)}if(I(K))return Ee(J,G,K,ce);if(A(K)){if(Be=A(K),typeof Be!="function")throw Error(i(150));return K=Be.call(K),Ue(J,G,K,ce)}if(typeof K.then=="function")return Ct(J,G,Kc(K),ce);if(K.$$typeof===N)return Ct(J,G,Wc(J,K),ce);eu(J,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,G!==null&&G.tag===6?(o(J,G.sibling),ce=m(G,K),ce.return=J,J=ce):(o(J,G),ce=kf(K,J.mode,ce),ce.return=J,J=ce),w(J)):o(J,G)}return function(J,G,K,ce){try{Jl=0;var Be=Ct(J,G,K,ce);return Ua=null,Be}catch(Me){if(Me===$a||Me===Xc)throw Me;var vt=nr(29,Me,null,J.mode);return vt.lanes=ce,vt.return=J,vt}finally{}}}var Js=n0(!0),r0=n0(!1),as=!1;function Bf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ls(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function os(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(yt&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=Vc(r),Ux(r,null,o),s}return Ic(r,d,s,o),Vc(r)}function Zl(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Ll(r,o)}}function $f(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=s:x=x.next=s}else m=x=s;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var Uf=!1;function Kl(){if(Uf){var r=Pa;if(r!==null)throw r}}function eo(r,s,o,d){Uf=!1;var m=r.updateQueue;as=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,C=m.shared.pending;if(C!==null){m.shared.pending=null;var q=C,ee=q.next;q.next=null,w===null?x=ee:w.next=ee,w=q;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,C=oe.lastBaseUpdate,C!==w&&(C===null?oe.firstBaseUpdate=ee:C.next=ee,oe.lastBaseUpdate=q))}if(x!==null){var ue=m.baseState;w=0,oe=ee=q=null,C=x;do{var te=C.lane&-536870913,se=te!==C.lane;if(se?(dt&te)===te:(d&te)===te){te!==0&&te===Ba&&(Uf=!0),oe!==null&&(oe=oe.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Ee=r,Ue=C;te=s;var Ct=o;switch(Ue.tag){case 1:if(Ee=Ue.payload,typeof Ee=="function"){ue=Ee.call(Ct,ue,te);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ue.payload,te=typeof Ee=="function"?Ee.call(Ct,ue,te):Ee,te==null)break e;ue=v({},ue,te);break e;case 2:as=!0}}te=C.callback,te!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[te]:se.push(te))}else se={lane:te,tag:C.tag,payload:C.payload,callback:C.callback,next:null},oe===null?(ee=oe=se,q=ue):oe=oe.next=se,w|=te;if(C=C.next,C===null){if(C=m.shared.pending,C===null)break;se=C,C=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);oe===null&&(q=ue),m.baseState=q,m.firstBaseUpdate=ee,m.lastBaseUpdate=oe,x===null&&(m.shared.lanes=0),hs|=w,r.lanes=w,r.memoizedState=ue}}function i0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function s0(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)i0(o[r],s)}var Fa=B(null),tu=B(0);function a0(r,s){r=Ti,M(tu,r),M(Fa,s),Ti=r|s.baseLanes}function Ff(){M(tu,Ti),M(Fa,Fa.current)}function qf(){Ti=tu.current,Z(Fa),Z(tu)}var rr=B(null),_r=null;function cs(r){var s=r.alternate;M(en,en.current&1),M(rr,r),_r===null&&(s===null||Fa.current!==null||s.memoizedState!==null)&&(_r=r)}function Hf(r){M(en,en.current),M(rr,r),_r===null&&(_r=r)}function l0(r){r.tag===22?(M(en,en.current),M(rr,r),_r===null&&(_r=r)):us()}function us(){M(en,en.current),M(rr,rr.current)}function ir(r){Z(rr),_r===r&&(_r=null),Z(en)}var en=B(0);function nu(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Wh(o)||Jh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var _i=0,Je=null,jt=null,ln=null,ru=!1,qa=!1,Xs=!1,iu=0,to=0,Ha=null,FS=0;function Wt(){throw Error(i(321))}function If(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!tr(r[o],s[o]))return!1;return!0}function Vf(r,s,o,d,m,x){return _i=x,Je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$.H=r===null||r.memoizedState===null?I0:ah,Xs=!1,x=o(d,m),Xs=!1,qa&&(x=c0(s,o,d,m)),o0(r),x}function o0(r){$.H=io;var s=jt!==null&&jt.next!==null;if(_i=0,ln=jt=Je=null,ru=!1,to=0,Ha=null,s)throw Error(i(300));r===null||on||(r=r.dependencies,r!==null&&Qc(r)&&(on=!0))}function c0(r,s,o,d){Je=r;var m=0;do{if(qa&&(Ha=null),to=0,qa=!1,25<=m)throw Error(i(301));if(m+=1,ln=jt=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}$.H=V0,x=s(o,d)}while(qa);return x}function qS(){var r=$.H,s=r.useState()[0];return s=typeof s.then=="function"?no(s):s,r=r.useState()[0],(jt!==null?jt.memoizedState:null)!==r&&(Je.flags|=1024),s}function Gf(){var r=iu!==0;return iu=0,r}function Yf(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function Qf(r){if(ru){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ru=!1}_i=0,ln=jt=Je=null,qa=!1,to=iu=0,Ha=null}function Bn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Je.memoizedState=ln=r:ln=ln.next=r,ln}function tn(){if(jt===null){var r=Je.alternate;r=r!==null?r.memoizedState:null}else r=jt.next;var s=ln===null?Je.memoizedState:ln.next;if(s!==null)ln=s,jt=r;else{if(r===null)throw Je.alternate===null?Error(i(467)):Error(i(310));jt=r,r={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},ln===null?Je.memoizedState=ln=r:ln=ln.next=r}return ln}function su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function no(r){var s=to;return to+=1,Ha===null&&(Ha=[]),r=Kx(Ha,r,s),s=Je,(ln===null?s.memoizedState:ln.next)===null&&(s=s.alternate,$.H=s===null||s.memoizedState===null?I0:ah),r}function au(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return no(r);if(r.$$typeof===N)return jn(r)}throw Error(i(438,String(r)))}function Wf(r){var s=null,o=Je.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=Je.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=su(),Je.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=O;return s.index++,o}function wi(r,s){return typeof s=="function"?s(r):s}function lu(r){var s=tn();return Jf(s,jt,r)}function Jf(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}s.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{s=m.next;var C=w=null,q=null,ee=s,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(dt&ue)===ue:(_i&ue)===ue){var te=ee.revertLane;if(te===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Ba&&(oe=!0);else if((_i&te)===te){ee=ee.next,te===Ba&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(C=q=ue,w=x):q=q.next=ue,Je.lanes|=te,hs|=te;ue=ee.action,Xs&&o(x,ue),x=ee.hasEagerState?ee.eagerState:o(x,ue)}else te={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(C=q=te,w=x):q=q.next=te,Je.lanes|=ue,hs|=ue;ee=ee.next}while(ee!==null&&ee!==s);if(q===null?w=x:q.next=C,!tr(x,r.memoizedState)&&(on=!0,oe&&(o=Pa,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=q,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Xf(r){var s=tn(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=s.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);tr(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),o.lastRenderedState=x}return[x,d]}function u0(r,s,o){var d=Je,m=tn(),x=ht;if(x){if(o===void 0)throw Error(i(407));o=o()}else o=s();var w=!tr((jt||m).memoizedState,o);if(w&&(m.memoizedState=o,on=!0),m=m.queue,eh(h0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||ln!==null&&ln.memoizedState.tag&1){if(d.flags|=2048,Ia(9,{destroy:void 0},f0.bind(null,d,m,o,s),null),Tt===null)throw Error(i(349));x||(_i&127)!==0||d0(d,s,o)}return o}function d0(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=Je.updateQueue,s===null?(s=su(),Je.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function f0(r,s,o,d){s.value=o,s.getSnapshot=d,p0(s)&&m0(r)}function h0(r,s,o){return o(function(){p0(s)&&m0(r)})}function p0(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!tr(r,o)}catch{return!0}}function m0(r){var s=qs(r,2);s!==null&&Qn(s,r,2)}function Zf(r){var s=Bn();if(typeof r=="function"){var o=r;if(r=o(),Xs){nn(!0);try{o()}finally{nn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:r},s}function g0(r,s,o,d){return r.baseState=o,Jf(r,jt,typeof d=="function"?d:wi)}function HS(r,s,o,d,m){if(uu(r))throw Error(i(485));if(r=s.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};$.T!==null?o(!0):x.isTransition=!1,d(x),o=s.pending,o===null?(x.next=s.pending=x,x0(s,x)):(x.next=o.next,s.pending=o.next=x)}}function x0(r,s){var o=s.action,d=s.payload,m=r.state;if(s.isTransition){var x=$.T,w={};$.T=w;try{var C=o(m,d),q=$.S;q!==null&&q(w,C),v0(r,s,C)}catch(ee){Kf(r,s,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),$.T=x}}else try{x=o(m,d),v0(r,s,x)}catch(ee){Kf(r,s,ee)}}function v0(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){b0(r,s,d)},function(d){return Kf(r,s,d)}):b0(r,s,o)}function b0(r,s,o){s.status="fulfilled",s.value=o,y0(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,x0(r,o)))}function Kf(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,y0(s),s=s.next;while(s!==d)}r.action=null}function y0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function _0(r,s){return s}function w0(r,s){if(ht){var o=Tt.formState;if(o!==null){e:{var d=Je;if(ht){if(Ot){t:{for(var m=Ot,x=yr;m.nodeType!==8;){if(!x){m=null;break t}if(m=wr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Ot=wr(m.nextSibling),d=m.data==="F!";break e}}is(d)}d=!1}d&&(s=o[0])}}return o=Bn(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_0,lastRenderedState:s},o.queue=d,o=F0.bind(null,Je,d),d.dispatch=o,d=Zf(!1),x=sh.bind(null,Je,!1,d.queue),d=Bn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,o=HS.bind(null,Je,m,x,o),m.dispatch=o,d.memoizedState=r,[s,o,!1]}function S0(r){var s=tn();return k0(s,jt,r)}function k0(r,s,o){if(s=Jf(r,s,_0)[0],r=lu(wi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=no(s)}catch(w){throw w===$a?Xc:w}else d=s;s=tn();var m=s.queue,x=m.dispatch;return o!==s.memoizedState&&(Je.flags|=2048,Ia(9,{destroy:void 0},IS.bind(null,m,o),null)),[d,x,r]}function IS(r,s){r.action=s}function j0(r){var s=tn(),o=jt;if(o!==null)return k0(s,o,r);tn(),s=s.memoizedState,o=tn();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Ia(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=Je.updateQueue,s===null&&(s=su(),Je.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function N0(){return tn().memoizedState}function ou(r,s,o,d){var m=Bn();Je.flags|=r,m.memoizedState=Ia(1|s,{destroy:void 0},o,d===void 0?null:d)}function cu(r,s,o,d){var m=tn();d=d===void 0?null:d;var x=m.memoizedState.inst;jt!==null&&d!==null&&If(d,jt.memoizedState.deps)?m.memoizedState=Ia(s,x,o,d):(Je.flags|=r,m.memoizedState=Ia(1|s,x,o,d))}function C0(r,s){ou(8390656,8,r,s)}function eh(r,s){cu(2048,8,r,s)}function VS(r){Je.flags|=4;var s=Je.updateQueue;if(s===null)s=su(),Je.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function E0(r){var s=tn().memoizedState;return VS({ref:s,nextImpl:r}),function(){if((yt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function T0(r,s){return cu(4,2,r,s)}function A0(r,s){return cu(4,4,r,s)}function M0(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function R0(r,s,o){o=o!=null?o.concat([r]):null,cu(4,4,M0.bind(null,s,r),o)}function th(){}function L0(r,s){var o=tn();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&If(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function D0(r,s){var o=tn();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&If(s,d[1]))return d[0];if(d=r(),Xs){nn(!0);try{r()}finally{nn(!1)}}return o.memoizedState=[d,s],d}function nh(r,s,o){return o===void 0||(_i&1073741824)!==0&&(dt&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=zv(),Je.lanes|=r,hs|=r,o)}function z0(r,s,o,d){return tr(o,s)?o:Fa.current!==null?(r=nh(r,o,d),tr(r,s)||(on=!0),r):(_i&42)===0||(_i&1073741824)!==0&&(dt&261930)===0?(on=!0,r.memoizedState=o):(r=zv(),Je.lanes|=r,hs|=r,s)}function O0(r,s,o,d,m){var x=P.p;P.p=x!==0&&8>x?x:8;var w=$.T,C={};$.T=C,sh(r,!1,s,o);try{var q=m(),ee=$.S;if(ee!==null&&ee(C,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var oe=US(q,d);ro(r,s,oe,lr(r))}else ro(r,s,d,lr(r))}catch(ue){ro(r,s,{then:function(){},status:"rejected",reason:ue},lr())}finally{P.p=x,w!==null&&C.types!==null&&(w.types=C.types),$.T=w}}function GS(){}function rh(r,s,o,d){if(r.tag!==5)throw Error(i(476));var m=B0(r).queue;O0(r,m,s,ie,o===null?GS:function(){return P0(r),o(d)})}function B0(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:ie},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function P0(r){var s=B0(r);s.next===null&&(s=r.alternate.memoizedState),ro(r,s.next.queue,{},lr())}function ih(){return jn(_o)}function $0(){return tn().memoizedState}function U0(){return tn().memoizedState}function YS(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=lr();r=ls(o);var d=os(s,r,o);d!==null&&(Qn(d,s,o),Zl(d,s,o)),s={cache:Lf()},r.payload=s;return}s=s.return}}function QS(r,s,o){var d=lr();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},uu(r)?q0(s,o):(o=wf(r,s,o,d),o!==null&&(Qn(o,r,d),H0(o,s,d)))}function F0(r,s,o){var d=lr();ro(r,s,o,d)}function ro(r,s,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(uu(r))q0(s,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var w=s.lastRenderedState,C=x(w,o);if(m.hasEagerState=!0,m.eagerState=C,tr(C,w))return Ic(r,s,m,0),Tt===null&&Hc(),!1}catch{}finally{}if(o=wf(r,s,m,d),o!==null)return Qn(o,r,d),H0(o,s,d),!0}return!1}function sh(r,s,o,d){if(d={lane:2,revertLane:Bh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},uu(r)){if(s)throw Error(i(479))}else s=wf(r,o,d,2),s!==null&&Qn(s,r,2)}function uu(r){var s=r.alternate;return r===Je||s!==null&&s===Je}function q0(r,s){qa=ru=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function H0(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Ll(r,o)}}var io={readContext:jn,use:au,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};io.useEffectEvent=Wt;var I0={readContext:jn,use:au,useCallback:function(r,s){return Bn().memoizedState=[r,s===void 0?null:s],r},useContext:jn,useEffect:C0,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,ou(4194308,4,M0.bind(null,s,r),o)},useLayoutEffect:function(r,s){return ou(4194308,4,r,s)},useInsertionEffect:function(r,s){ou(4,2,r,s)},useMemo:function(r,s){var o=Bn();s=s===void 0?null:s;var d=r();if(Xs){nn(!0);try{r()}finally{nn(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Bn();if(o!==void 0){var m=o(s);if(Xs){nn(!0);try{o(s)}finally{nn(!1)}}}else m=s;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=QS.bind(null,Je,r),[d.memoizedState,r]},useRef:function(r){var s=Bn();return r={current:r},s.memoizedState=r},useState:function(r){r=Zf(r);var s=r.queue,o=F0.bind(null,Je,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:th,useDeferredValue:function(r,s){var o=Bn();return nh(o,r,s)},useTransition:function(){var r=Zf(!1);return r=O0.bind(null,Je,r.queue,!0,!1),Bn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=Je,m=Bn();if(ht){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),Tt===null)throw Error(i(349));(dt&127)!==0||d0(d,s,o)}m.memoizedState=o;var x={value:o,getSnapshot:s};return m.queue=x,C0(h0.bind(null,d,x,r),[r]),d.flags|=2048,Ia(9,{destroy:void 0},f0.bind(null,d,x,o,s),null),o},useId:function(){var r=Bn(),s=Tt.identifierPrefix;if(ht){var o=Jr,d=Wr;o=(d&~(1<<32-ut(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=iu++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=FS++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:ih,useFormState:w0,useActionState:w0,useOptimistic:function(r){var s=Bn();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=sh.bind(null,Je,!0,o),o.dispatch=s,[r,s]},useMemoCache:Wf,useCacheRefresh:function(){return Bn().memoizedState=YS.bind(null,Je)},useEffectEvent:function(r){var s=Bn(),o={impl:r};return s.memoizedState=o,function(){if((yt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},ah={readContext:jn,use:au,useCallback:L0,useContext:jn,useEffect:eh,useImperativeHandle:R0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:D0,useReducer:lu,useRef:N0,useState:function(){return lu(wi)},useDebugValue:th,useDeferredValue:function(r,s){var o=tn();return z0(o,jt.memoizedState,r,s)},useTransition:function(){var r=lu(wi)[0],s=tn().memoizedState;return[typeof r=="boolean"?r:no(r),s]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:ih,useFormState:S0,useActionState:S0,useOptimistic:function(r,s){var o=tn();return g0(o,jt,r,s)},useMemoCache:Wf,useCacheRefresh:U0};ah.useEffectEvent=E0;var V0={readContext:jn,use:au,useCallback:L0,useContext:jn,useEffect:eh,useImperativeHandle:R0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:D0,useReducer:Xf,useRef:N0,useState:function(){return Xf(wi)},useDebugValue:th,useDeferredValue:function(r,s){var o=tn();return jt===null?nh(o,r,s):z0(o,jt.memoizedState,r,s)},useTransition:function(){var r=Xf(wi)[0],s=tn().memoizedState;return[typeof r=="boolean"?r:no(r),s]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:ih,useFormState:j0,useActionState:j0,useOptimistic:function(r,s){var o=tn();return jt!==null?g0(o,jt,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:Wf,useCacheRefresh:U0};V0.useEffectEvent=E0;function lh(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:v({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var oh={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=lr(),m=ls(d);m.payload=s,o!=null&&(m.callback=o),s=os(r,m,d),s!==null&&(Qn(s,r,d),Zl(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=lr(),m=ls(d);m.tag=1,m.payload=s,o!=null&&(m.callback=o),s=os(r,m,d),s!==null&&(Qn(s,r,d),Zl(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=lr(),d=ls(o);d.tag=2,s!=null&&(d.callback=s),s=os(r,d,o),s!==null&&(Qn(s,r,o),Zl(s,r,o))}};function G0(r,s,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):s.prototype&&s.prototype.isPureReactComponent?!Il(o,d)||!Il(m,x):!0}function Y0(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&oh.enqueueReplaceState(s,s.state,null)}function Zs(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function Q0(r){qc(r)}function W0(r){console.error(r)}function J0(r){qc(r)}function du(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function X0(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function ch(r,s,o){return o=ls(o),o.tag=3,o.payload={element:null},o.callback=function(){du(r,s)},o}function Z0(r){return r=ls(r),r.tag=3,r}function K0(r,s,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){X0(s,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){X0(s,o,d),typeof m!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var C=d.stack;this.componentDidCatch(d.value,{componentStack:C!==null?C:""})})}function WS(r,s,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&Oa(s,o,m,!0),o=rr.current,o!==null){switch(o.tag){case 31:case 13:return _r===null?Su():o.alternate===null&&Jt===0&&(Jt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===Zc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),Dh(r,d,m)),!1;case 22:return o.flags|=65536,d===Zc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),Dh(r,d,m)),!1}throw Error(i(435,o.tag))}return Dh(r,d,m),Su(),!1}if(ht)return s=rr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==Ef&&(r=Error(i(422),{cause:d}),Yl(xr(r,o)))):(d!==Ef&&(s=Error(i(423),{cause:d}),Yl(xr(s,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=xr(d,o),m=ch(r.stateNode,d,m),$f(r,m),Jt!==4&&(Jt=2)),!1;var x=Error(i(520),{cause:d});if(x=xr(x,o),ho===null?ho=[x]:ho.push(x),Jt!==4&&(Jt=2),s===null)return!0;d=xr(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=ch(o.stateNode,d,r),$f(o,r),!1;case 1:if(s=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ps===null||!ps.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=Z0(m),K0(m,r,o,d),$f(o,m),!1}o=o.return}while(o!==null);return!1}var uh=Error(i(461)),on=!1;function Nn(r,s,o,d){s.child=r===null?r0(s,null,o,d):Js(s,r.child,o,d)}function ev(r,s,o,d,m){o=o.render;var x=s.ref;if("ref"in d){var w={};for(var C in d)C!=="ref"&&(w[C]=d[C])}else w=d;return Gs(s),d=Vf(r,s,o,w,x,m),C=Gf(),r!==null&&!on?(Yf(r,s,m),Si(r,s,m)):(ht&&C&&Nf(s),s.flags|=1,Nn(r,s,d,m),s.child)}function tv(r,s,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Sf(x)&&x.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=x,nv(r,s,x,d,m)):(r=Gc(o.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(x=r.child,!vh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Il,o(w,d)&&r.ref===s.ref)return Si(r,s,m)}return s.flags|=1,r=xi(x,d),r.ref=s.ref,r.return=s,s.child=r}function nv(r,s,o,d,m){if(r!==null){var x=r.memoizedProps;if(Il(x,d)&&r.ref===s.ref)if(on=!1,s.pendingProps=d=x,vh(r,m))(r.flags&131072)!==0&&(on=!0);else return s.lanes=r.lanes,Si(r,s,m)}return dh(r,s,o,d,m)}function rv(r,s,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,s.child=null;return iv(r,s,x,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Jc(s,x!==null?x.cachePool:null),x!==null?a0(s,x):Ff(),l0(s);else return d=s.lanes=536870912,iv(r,s,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(Jc(s,x.cachePool),a0(s,x),us(),s.memoizedState=null):(r!==null&&Jc(s,null),Ff(),us());return Nn(r,s,m,o),s.child}function so(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function iv(r,s,o,d,m){var x=zf();return x=x===null?null:{parent:an._currentValue,pool:x},s.memoizedState={baseLanes:o,cachePool:x},r!==null&&Jc(s,null),Ff(),l0(s),r!==null&&Oa(r,s,d,!0),s.childLanes=m,null}function fu(r,s){return s=pu({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function sv(r,s,o){return Js(s,r.child,null,o),r=fu(s,s.pendingProps),r.flags|=2,ir(s),s.memoizedState=null,r}function JS(r,s,o){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ht){if(d.mode==="hidden")return r=fu(s,d),s.lanes=536870912,so(null,r);if(Hf(s),(r=Ot)?(r=x1(r,yr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ns!==null?{id:Wr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},o=qx(r),o.return=s,s.child=o,kn=s,Ot=null)):r=null,r===null)throw is(s);return s.lanes=536870912,null}return fu(s,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Hf(s),m)if(s.flags&256)s.flags&=-257,s=sv(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(on||Oa(r,s,o,!1),m=(o&r.childLanes)!==0,on||m){if(d=Tt,d!==null&&(w=ba(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,qs(r,w),Qn(d,r,w),uh;Su(),s=sv(r,s,o)}else r=x.treeContext,Ot=wr(w.nextSibling),kn=s,ht=!0,rs=null,yr=!1,r!==null&&Vx(s,r),s=fu(s,d),s.flags|=4096;return s}return r=xi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function hu(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function dh(r,s,o,d,m){return Gs(s),o=Vf(r,s,o,d,void 0,m),d=Gf(),r!==null&&!on?(Yf(r,s,m),Si(r,s,m)):(ht&&d&&Nf(s),s.flags|=1,Nn(r,s,o,m),s.child)}function av(r,s,o,d,m,x){return Gs(s),s.updateQueue=null,o=c0(s,d,o,m),o0(r),d=Gf(),r!==null&&!on?(Yf(r,s,x),Si(r,s,x)):(ht&&d&&Nf(s),s.flags|=1,Nn(r,s,o,x),s.child)}function lv(r,s,o,d,m){if(Gs(s),s.stateNode===null){var x=Ra,w=o.contextType;typeof w=="object"&&w!==null&&(x=jn(w)),x=new o(d,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=oh,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=d,x.state=s.memoizedState,x.refs={},Bf(s),w=o.contextType,x.context=typeof w=="object"&&w!==null?jn(w):Ra,x.state=s.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(lh(s,o,w,d),x.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&oh.enqueueReplaceState(x,x.state,null),eo(s,d,x,m),Kl(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){x=s.stateNode;var C=s.memoizedProps,q=Zs(o,C);x.props=q;var ee=x.context,oe=o.contextType;w=Ra,typeof oe=="object"&&oe!==null&&(w=jn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C||ee!==w)&&Y0(s,x,d,w),as=!1;var te=s.memoizedState;x.state=te,eo(s,d,x,m),Kl(),ee=s.memoizedState,C||te!==ee||as?(typeof ue=="function"&&(lh(s,o,ue,d),ee=s.memoizedState),(q=as||G0(s,o,q,d,te,ee,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=q):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{x=s.stateNode,Pf(r,s),w=s.memoizedProps,oe=Zs(o,w),x.props=oe,ue=s.pendingProps,te=x.context,ee=o.contextType,q=Ra,typeof ee=="object"&&ee!==null&&(q=jn(ee)),C=o.getDerivedStateFromProps,(ee=typeof C=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||te!==q)&&Y0(s,x,d,q),as=!1,te=s.memoizedState,x.state=te,eo(s,d,x,m),Kl();var se=s.memoizedState;w!==ue||te!==se||as||r!==null&&r.dependencies!==null&&Qc(r.dependencies)?(typeof C=="function"&&(lh(s,o,C,d),se=s.memoizedState),(oe=as||G0(s,o,oe,d,te,se,q)||r!==null&&r.dependencies!==null&&Qc(r.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,se,q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,se,q)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),x.props=d,x.state=se,x.context=q,d=oe):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=1024),d=!1)}return x=d,hu(r,s),d=(s.flags&128)!==0,x||d?(x=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,r!==null&&d?(s.child=Js(s,r.child,null,m),s.child=Js(s,null,o,m)):Nn(r,s,o,m),s.memoizedState=x.state,r=s.child):r=Si(r,s,m),r}function ov(r,s,o,d){return Is(),s.flags|=256,Nn(r,s,o,d),s.child}var fh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hh(r){return{baseLanes:r,cachePool:Xx()}}function ph(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=ar),r}function cv(r,s,o){var d=s.pendingProps,m=!1,x=(s.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ht){if(m?cs(s):us(),(r=Ot)?(r=x1(r,yr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ns!==null?{id:Wr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},o=qx(r),o.return=s,s.child=o,kn=s,Ot=null)):r=null,r===null)throw is(s);return Jh(r)?s.lanes=32:s.lanes=536870912,null}var C=d.children;return d=d.fallback,m?(us(),m=s.mode,C=pu({mode:"hidden",children:C},m),d=Hs(d,m,o,null),C.return=s,d.return=s,C.sibling=d,s.child=C,d=s.child,d.memoizedState=hh(o),d.childLanes=ph(r,w,o),s.memoizedState=fh,so(null,d)):(cs(s),mh(s,C))}var q=r.memoizedState;if(q!==null&&(C=q.dehydrated,C!==null)){if(x)s.flags&256?(cs(s),s.flags&=-257,s=gh(r,s,o)):s.memoizedState!==null?(us(),s.child=r.child,s.flags|=128,s=null):(us(),C=d.fallback,m=s.mode,d=pu({mode:"visible",children:d.children},m),C=Hs(C,m,o,null),C.flags|=2,d.return=s,C.return=s,d.sibling=C,s.child=d,Js(s,r.child,null,o),d=s.child,d.memoizedState=hh(o),d.childLanes=ph(r,w,o),s.memoizedState=fh,s=so(null,d));else if(cs(s),Jh(C)){if(w=C.nextSibling&&C.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(i(419)),d.stack="",d.digest=w,Yl({value:d,source:null,stack:null}),s=gh(r,s,o)}else if(on||Oa(r,s,o,!1),w=(o&r.childLanes)!==0,on||w){if(w=Tt,w!==null&&(d=ba(w,o),d!==0&&d!==q.retryLane))throw q.retryLane=d,qs(r,d),Qn(w,r,d),uh;Wh(C)||Su(),s=gh(r,s,o)}else Wh(C)?(s.flags|=192,s.child=r.child,s=null):(r=q.treeContext,Ot=wr(C.nextSibling),kn=s,ht=!0,rs=null,yr=!1,r!==null&&Vx(s,r),s=mh(s,d.children),s.flags|=4096);return s}return m?(us(),C=d.fallback,m=s.mode,q=r.child,ee=q.sibling,d=xi(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&65011712,ee!==null?C=xi(ee,C):(C=Hs(C,m,o,null),C.flags|=2),C.return=s,d.return=s,d.sibling=C,s.child=d,so(null,d),d=s.child,C=r.child.memoizedState,C===null?C=hh(o):(m=C.cachePool,m!==null?(q=an._currentValue,m=m.parent!==q?{parent:q,pool:q}:m):m=Xx(),C={baseLanes:C.baseLanes|o,cachePool:m}),d.memoizedState=C,d.childLanes=ph(r,w,o),s.memoizedState=fh,so(r.child,d)):(cs(s),o=r.child,r=o.sibling,o=xi(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=o,s.memoizedState=null,o)}function mh(r,s){return s=pu({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function pu(r,s){return r=nr(22,r,null,s),r.lanes=0,r}function gh(r,s,o){return Js(s,r.child,null,o),r=mh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function uv(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),Mf(r.return,s,o)}function xh(r,s,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function dv(r,s,o){var d=s.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=en.current,C=(w&2)!==0;if(C?(w=w&1|2,s.flags|=128):w&=1,M(en,w),Nn(r,s,d,o),d=ht?Gl:0,!C&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&uv(r,o,s);else if(r.tag===19)uv(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=s.child,m=null;o!==null;)r=o.alternate,r!==null&&nu(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=s.child,s.child=null):(m=o.sibling,o.sibling=null),xh(s,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&nu(r)===null){s.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}xh(s,!0,o,null,x,d);break;case"together":xh(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function Si(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),hs|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(Oa(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=xi(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=xi(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function vh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Qc(r)))}function XS(r,s,o){switch(s.tag){case 3:Le(s,s.stateNode.containerInfo),ss(s,an,r.memoizedState.cache),Is();break;case 27:case 5:rt(s);break;case 4:Le(s,s.stateNode.containerInfo);break;case 10:ss(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Hf(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(cs(s),s.flags|=128,null):(o&s.child.childLanes)!==0?cv(r,s,o):(cs(s),r=Si(r,s,o),r!==null?r.sibling:null);cs(s);break;case 19:var m=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(Oa(r,s,o,!1),d=(o&s.childLanes)!==0),m){if(d)return dv(r,s,o);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(en,en.current),d)break;return null;case 22:return s.lanes=0,rv(r,s,o,s.pendingProps);case 24:ss(s,an,r.memoizedState.cache)}return Si(r,s,o)}function fv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)on=!0;else{if(!vh(r,o)&&(s.flags&128)===0)return on=!1,XS(r,s,o);on=(r.flags&131072)!==0}else on=!1,ht&&(s.flags&1048576)!==0&&Ix(s,Gl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Qs(s.elementType),s.type=r,typeof r=="function")Sf(r)?(d=Zs(r,d),s.tag=1,s=lv(null,s,r,d,o)):(s.tag=0,s=dh(null,s,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===D){s.tag=11,s=ev(null,s,r,d,o);break e}else if(m===H){s.tag=14,s=tv(null,s,r,d,o);break e}}throw s=X(r)||r,Error(i(306,s,""))}}return s;case 0:return dh(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,m=Zs(d,s.pendingProps),lv(r,s,d,m,o);case 3:e:{if(Le(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var x=s.memoizedState;m=x.element,Pf(r,s),eo(s,d,null,o);var w=s.memoizedState;if(d=w.cache,ss(s,an,d),d!==x.cache&&Rf(s,[an],o,!0),Kl(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){s=ov(r,s,d,o);break e}else if(d!==m){m=xr(Error(i(424)),s),Yl(m),s=ov(r,s,d,o);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Ot=wr(r.firstChild),kn=s,ht=!0,rs=null,yr=!0,o=r0(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Is(),d===m){s=Si(r,s,o);break e}Nn(r,s,d,o)}s=s.child}return s;case 26:return hu(r,s),r===null?(o=S1(s.type,null,s.pendingProps,null))?s.memoizedState=o:ht||(o=s.type,r=s.pendingProps,d=Au(Ce.current).createElement(o),d[Vt]=s,d[pn]=r,Cn(d,o,r),Zt(d),s.stateNode=d):s.memoizedState=S1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return rt(s),r===null&&ht&&(d=s.stateNode=y1(s.type,s.pendingProps,Ce.current),kn=s,yr=!0,m=Ot,vs(s.type)?(Xh=m,Ot=wr(d.firstChild)):Ot=m),Nn(r,s,s.pendingProps.children,o),hu(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ht&&((m=d=Ot)&&(d=Ck(d,s.type,s.pendingProps,yr),d!==null?(s.stateNode=d,kn=s,Ot=wr(d.firstChild),yr=!1,m=!0):m=!1),m||is(s)),rt(s),m=s.type,x=s.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,Gh(m,x)?d=null:w!==null&&Gh(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=Vf(r,s,qS,null,null,o),_o._currentValue=m),hu(r,s),Nn(r,s,d,o),s.child;case 6:return r===null&&ht&&((r=o=Ot)&&(o=Ek(o,s.pendingProps,yr),o!==null?(s.stateNode=o,kn=s,Ot=null,r=!0):r=!1),r||is(s)),null;case 13:return cv(r,s,o);case 4:return Le(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Js(s,null,d,o):Nn(r,s,d,o),s.child;case 11:return ev(r,s,s.type,s.pendingProps,o);case 7:return Nn(r,s,s.pendingProps,o),s.child;case 8:return Nn(r,s,s.pendingProps.children,o),s.child;case 12:return Nn(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,ss(s,s.type,d.value),Nn(r,s,d.children,o),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Gs(s),m=jn(m),d=d(m),s.flags|=1,Nn(r,s,d,o),s.child;case 14:return tv(r,s,s.type,s.pendingProps,o);case 15:return nv(r,s,s.type,s.pendingProps,o);case 19:return dv(r,s,o);case 31:return JS(r,s,o);case 22:return rv(r,s,o,s.pendingProps);case 24:return Gs(s),d=jn(an),r===null?(m=zf(),m===null&&(m=Tt,x=Lf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),s.memoizedState={parent:d,cache:m},Bf(s),ss(s,an,m)):((r.lanes&o)!==0&&(Pf(r,s),eo(s,null,null,o),Kl()),m=r.memoizedState,x=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),ss(s,an,d)):(d=x.cache,ss(s,an,d),d!==m.cache&&Rf(s,[an],o,!0))),Nn(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ki(r){r.flags|=4}function bh(r,s,o,d,m){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if($v())r.flags|=8192;else throw Ws=Zc,Of}else r.flags&=-16777217}function hv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!E1(s))if($v())r.flags|=8192;else throw Ws=Zc,Of}function mu(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?rn():536870912,r.lanes|=s,Qa|=s)}function ao(r,s){if(!ht)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Bt(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function ZS(r,s,o){var d=s.pendingProps;switch(Cf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(s),null;case 1:return Bt(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),yi(an),Pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(za(s)?ki(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Tf())),Bt(s),null;case 26:var m=s.type,x=s.memoizedState;return r===null?(ki(s),x!==null?(Bt(s),hv(s,x)):(Bt(s),bh(s,m,null,d,o))):x?x!==r.memoizedState?(ki(s),Bt(s),hv(s,x)):(Bt(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&ki(s),Bt(s),bh(s,m,r,d,o)),null;case 27:if(be(s),o=Ce.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Bt(s),null}r=pe.current,za(s)?Gx(s):(r=y1(m,d,o),s.stateNode=r,ki(s))}return Bt(s),null;case 5:if(be(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Bt(s),null}if(x=pe.current,za(s))Gx(s);else{var w=Au(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Vt]=s,x[pn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=x;e:switch(Cn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ki(s)}}return Bt(s),bh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=Ce.current,za(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,m=kn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Vt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||c1(r.nodeValue,o)),r||is(s,!0)}else r=Au(r).createTextNode(d),r[Vt]=s,s.stateNode=r}return Bt(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=za(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Vt]=s}else Is(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Bt(s),r=!1}else o=Tf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(ir(s),s):(ir(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Bt(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=za(s),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Vt]=s}else Is(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Bt(s),m=!1}else m=Tf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(ir(s),s):(ir(s),null)}return ir(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),mu(s,s.updateQueue),Bt(s),null);case 4:return Pe(),r===null&&Fh(s.stateNode.containerInfo),Bt(s),null;case 10:return yi(s.type),Bt(s),null;case 19:if(Z(en),d=s.memoizedState,d===null)return Bt(s),null;if(m=(s.flags&128)!==0,x=d.rendering,x===null)if(m)ao(d,!1);else{if(Jt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=nu(r),x!==null){for(s.flags|=128,ao(d,!1),r=x.updateQueue,s.updateQueue=r,mu(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Fx(o,r),o=o.sibling;return M(en,en.current&1|2),ht&&vi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&qe()>yu&&(s.flags|=128,m=!0,ao(d,!1),s.lanes=4194304)}else{if(!m)if(r=nu(x),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,mu(s,r),ao(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!ht)return Bt(s),null}else 2*qe()-d.renderingStartTime>yu&&o!==536870912&&(s.flags|=128,m=!0,ao(d,!1),s.lanes=4194304);d.isBackwards?(x.sibling=s.child,s.child=x):(r=d.last,r!==null?r.sibling=x:s.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=qe(),r.sibling=null,o=en.current,M(en,m?o&1|2:o&1),ht&&vi(s,d.treeForkCount),r):(Bt(s),null);case 22:case 23:return ir(s),qf(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(Bt(s),s.subtreeFlags&6&&(s.flags|=8192)):Bt(s),o=s.updateQueue,o!==null&&mu(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&Z(Ys),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),yi(an),Bt(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function KS(r,s){switch(Cf(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return yi(an),Pe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return be(s),null;case 31:if(s.memoizedState!==null){if(ir(s),s.alternate===null)throw Error(i(340));Is()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(ir(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Is()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(en),null;case 4:return Pe(),null;case 10:return yi(s.type),null;case 22:case 23:return ir(s),qf(),r!==null&&Z(Ys),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return yi(an),null;case 25:return null;default:return null}}function pv(r,s){switch(Cf(s),s.tag){case 3:yi(an),Pe();break;case 26:case 27:case 5:be(s);break;case 4:Pe();break;case 31:s.memoizedState!==null&&ir(s);break;case 13:ir(s);break;case 19:Z(en);break;case 10:yi(s.type);break;case 22:case 23:ir(s),qf(),r!==null&&Z(Ys);break;case 24:yi(an)}}function lo(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(C){St(s,s.return,C)}}function ds(r,s,o){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,C=w.destroy;if(C!==void 0){w.destroy=void 0,m=s;var q=o,ee=C;try{ee()}catch(oe){St(m,q,oe)}}}d=d.next}while(d!==x)}}catch(oe){St(s,s.return,oe)}}function mv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{s0(s,o)}catch(d){St(r,r.return,d)}}}function gv(r,s,o){o.props=Zs(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){St(r,s,d)}}function oo(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){St(r,s,m)}}function Xr(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){St(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){St(r,s,m)}else o.current=null}function xv(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){St(r,r.return,m)}}function yh(r,s,o){try{var d=r.stateNode;_k(d,r.type,o,s),d[pn]=s}catch(m){St(r,r.return,m)}}function vv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&vs(r.type)||r.tag===4}function _h(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||vv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&vs(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function wh(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Dr));else if(d!==4&&(d===27&&vs(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(wh(r,s,o),r=r.sibling;r!==null;)wh(r,s,o),r=r.sibling}function gu(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&vs(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(gu(r,s,o),r=r.sibling;r!==null;)gu(r,s,o),r=r.sibling}function bv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);Cn(s,d,o),s[Vt]=r,s[pn]=o}catch(x){St(r,r.return,x)}}var ji=!1,cn=!1,Sh=!1,yv=typeof WeakSet=="function"?WeakSet:Set,_n=null;function ek(r,s){if(r=r.containerInfo,Ih=Bu,r=Rx(r),gf(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,C=-1,q=-1,ee=0,oe=0,ue=r,te=null;t:for(;;){for(var se;ue!==o||m!==0&&ue.nodeType!==3||(C=w+m),ue!==x||d!==0&&ue.nodeType!==3||(q=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(se=ue.firstChild)!==null;)te=ue,ue=se;for(;;){if(ue===r)break t;if(te===o&&++ee===m&&(C=w),te===x&&++oe===d&&(q=w),(se=ue.nextSibling)!==null)break;ue=te,te=ue.parentNode}ue=se}o=C===-1||q===-1?null:{start:C,end:q}}else o=null}o=o||{start:0,end:0}}else o=null;for(Vh={focusedElem:r,selectionRange:o},Bu=!1,_n=s;_n!==null;)if(s=_n,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,_n=r;else for(;_n!==null;){switch(s=_n,x=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=s,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ee=Zs(o.type,m);r=d.getSnapshotBeforeUpdate(Ee,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){St(o,o.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)Qh(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Qh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,_n=r;break}_n=s.return}}function _v(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Ci(r,o),d&4&&lo(5,o);break;case 1:if(Ci(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(w){St(o,o.return,w)}else{var m=Zs(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){St(o,o.return,w)}}d&64&&mv(o),d&512&&oo(o,o.return);break;case 3:if(Ci(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{s0(r,s)}catch(w){St(o,o.return,w)}}break;case 27:s===null&&d&4&&bv(o);case 26:case 5:Ci(r,o),s===null&&d&4&&xv(o),d&512&&oo(o,o.return);break;case 12:Ci(r,o);break;case 31:Ci(r,o),d&4&&kv(r,o);break;case 13:Ci(r,o),d&4&&jv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=ck.bind(null,o),Tk(r,o))));break;case 22:if(d=o.memoizedState!==null||ji,!d){s=s!==null&&s.memoizedState!==null||cn,m=ji;var x=cn;ji=d,(cn=s)&&!x?Ei(r,o,(o.subtreeFlags&8772)!==0):Ci(r,o),ji=m,cn=x}break;case 30:break;default:Ci(r,o)}}function wv(r){var s=r.alternate;s!==null&&(r.alternate=null,wv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Qi(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ft=null,In=!1;function Ni(r,s,o){for(o=o.child;o!==null;)Sv(r,s,o),o=o.sibling}function Sv(r,s,o){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(nt,o)}catch{}switch(o.tag){case 26:cn||Xr(o,s),Ni(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:cn||Xr(o,s);var d=Ft,m=In;vs(o.type)&&(Ft=o.stateNode,In=!1),Ni(r,s,o),vo(o.stateNode),Ft=d,In=m;break;case 5:cn||Xr(o,s);case 6:if(d=Ft,m=In,Ft=null,Ni(r,s,o),Ft=d,In=m,Ft!==null)if(In)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(o.stateNode)}catch(x){St(o,s,x)}else try{Ft.removeChild(o.stateNode)}catch(x){St(o,s,x)}break;case 18:Ft!==null&&(In?(r=Ft,m1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),nl(r)):m1(Ft,o.stateNode));break;case 4:d=Ft,m=In,Ft=o.stateNode.containerInfo,In=!0,Ni(r,s,o),Ft=d,In=m;break;case 0:case 11:case 14:case 15:ds(2,o,s),cn||ds(4,o,s),Ni(r,s,o);break;case 1:cn||(Xr(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&gv(o,s,d)),Ni(r,s,o);break;case 21:Ni(r,s,o);break;case 22:cn=(d=cn)||o.memoizedState!==null,Ni(r,s,o),cn=d;break;default:Ni(r,s,o)}}function kv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{nl(r)}catch(o){St(s,s.return,o)}}}function jv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{nl(r)}catch(o){St(s,s.return,o)}}function tk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new yv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new yv),s;default:throw Error(i(435,r.tag))}}function xu(r,s){var o=tk(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var m=uk.bind(null,r,d);d.then(m,m)}})}function Vn(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=s,C=w;e:for(;C!==null;){switch(C.tag){case 27:if(vs(C.type)){Ft=C.stateNode,In=!1;break e}break;case 5:Ft=C.stateNode,In=!1;break e;case 3:case 4:Ft=C.stateNode.containerInfo,In=!0;break e}C=C.return}if(Ft===null)throw Error(i(160));Sv(x,w,m),Ft=null,In=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Nv(s,r),s=s.sibling}var Or=null;function Nv(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Vn(s,r),Gn(r),d&4&&(ds(3,r,r.return),lo(3,r),ds(5,r,r.return));break;case 1:Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),d&64&&ji&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Or;if(Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[di]||x[Vt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),Cn(x,d,o),x[Vt]=r,Zt(x),d=x;break e;case"link":var w=N1("link","href",m).get(d+(o.href||""));if(w){for(var C=0;C<w.length;C++)if(x=w[C],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(C,1);break t}}x=m.createElement(d),Cn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=N1("meta","content",m).get(d+(o.content||""))){for(C=0;C<w.length;C++)if(x=w[C],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(C,1);break t}}x=m.createElement(d),Cn(x,d,o),m.head.appendChild(x);break;default:throw Error(i(468,d))}x[Vt]=r,Zt(x),d=x}r.stateNode=d}else C1(m,r.type,r.stateNode);else r.stateNode=j1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?C1(m,r.type,r.stateNode):j1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&yh(r,r.memoizedProps,o.memoizedProps)}break;case 27:Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),o!==null&&d&4&&yh(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),r.flags&32){m=r.stateNode;try{Zi(m,"")}catch(Ee){St(r,r.return,Ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,yh(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Sh=!0);break;case 6:if(Vn(s,r),Gn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ee){St(r,r.return,Ee)}}break;case 3:if(Lu=null,m=Or,Or=Mu(s.containerInfo),Vn(s,r),Or=m,Gn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{nl(s.containerInfo)}catch(Ee){St(r,r.return,Ee)}Sh&&(Sh=!1,Cv(r));break;case 4:d=Or,Or=Mu(r.stateNode.containerInfo),Vn(s,r),Gn(r),Or=d;break;case 12:Vn(s,r),Gn(r);break;case 31:Vn(s,r),Gn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 13:Vn(s,r),Gn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(bu=qe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 22:m=r.memoizedState!==null;var q=o!==null&&o.memoizedState!==null,ee=ji,oe=cn;if(ji=ee||m,cn=oe||q,Vn(s,r),cn=oe,ji=ee,Gn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(o===null||q||ji||cn||Ks(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){q=o=s;try{if(x=q.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{C=q.stateNode;var ue=q.memoizedProps.style,te=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;C.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ee){St(q,q.return,Ee)}}}else if(s.tag===6){if(o===null){q=s;try{q.stateNode.nodeValue=m?"":q.memoizedProps}catch(Ee){St(q,q.return,Ee)}}}else if(s.tag===18){if(o===null){q=s;try{var se=q.stateNode;m?g1(se,!0):g1(q.stateNode,!1)}catch(Ee){St(q,q.return,Ee)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,xu(r,o))));break;case 19:Vn(s,r),Gn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 30:break;case 21:break;default:Vn(s,r),Gn(r)}}function Gn(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(vv(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var m=o.stateNode,x=_h(r);gu(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Zi(w,""),o.flags&=-33);var C=_h(r);gu(r,C,w);break;case 3:case 4:var q=o.stateNode.containerInfo,ee=_h(r);wh(r,ee,q);break;default:throw Error(i(161))}}catch(oe){St(r,r.return,oe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Cv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Cv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function Ci(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)_v(r,s.alternate,s),s=s.sibling}function Ks(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:ds(4,s,s.return),Ks(s);break;case 1:Xr(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&gv(s,s.return,o),Ks(s);break;case 27:vo(s.stateNode);case 26:case 5:Xr(s,s.return),Ks(s);break;case 22:s.memoizedState===null&&Ks(s);break;case 30:Ks(s);break;default:Ks(s)}r=r.sibling}}function Ei(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,x=s,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ei(m,x,o),lo(4,x);break;case 1:if(Ei(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){St(d,d.return,ee)}if(d=x,m=d.updateQueue,m!==null){var C=d.stateNode;try{var q=m.shared.hiddenCallbacks;if(q!==null)for(m.shared.hiddenCallbacks=null,m=0;m<q.length;m++)i0(q[m],C)}catch(ee){St(d,d.return,ee)}}o&&w&64&&mv(x),oo(x,x.return);break;case 27:bv(x);case 26:case 5:Ei(m,x,o),o&&d===null&&w&4&&xv(x),oo(x,x.return);break;case 12:Ei(m,x,o);break;case 31:Ei(m,x,o),o&&w&4&&kv(m,x);break;case 13:Ei(m,x,o),o&&w&4&&jv(m,x);break;case 22:x.memoizedState===null&&Ei(m,x,o),oo(x,x.return);break;case 30:break;default:Ei(m,x,o)}s=s.sibling}}function kh(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&Ql(o))}function jh(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ql(r))}function Br(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ev(r,s,o,d),s=s.sibling}function Ev(r,s,o,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:Br(r,s,o,d),m&2048&&lo(9,s);break;case 1:Br(r,s,o,d);break;case 3:Br(r,s,o,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ql(r)));break;case 12:if(m&2048){Br(r,s,o,d),r=s.stateNode;try{var x=s.memoizedProps,w=x.id,C=x.onPostCommit;typeof C=="function"&&C(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(q){St(s,s.return,q)}}else Br(r,s,o,d);break;case 31:Br(r,s,o,d);break;case 13:Br(r,s,o,d);break;case 23:break;case 22:x=s.stateNode,w=s.alternate,s.memoizedState!==null?x._visibility&2?Br(r,s,o,d):co(r,s):x._visibility&2?Br(r,s,o,d):(x._visibility|=2,Va(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&kh(w,s);break;case 24:Br(r,s,o,d),m&2048&&jh(s.alternate,s);break;default:Br(r,s,o,d)}}function Va(r,s,o,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=r,w=s,C=o,q=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Va(x,w,C,q,m),lo(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Va(x,w,C,q,m):co(x,w):(oe._visibility|=2,Va(x,w,C,q,m)),m&&ee&2048&&kh(w.alternate,w);break;case 24:Va(x,w,C,q,m),m&&ee&2048&&jh(w.alternate,w);break;default:Va(x,w,C,q,m)}s=s.sibling}}function co(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,m=d.flags;switch(d.tag){case 22:co(o,d),m&2048&&kh(d.alternate,d);break;case 24:co(o,d),m&2048&&jh(d.alternate,d);break;default:co(o,d)}s=s.sibling}}var uo=8192;function Ga(r,s,o){if(r.subtreeFlags&uo)for(r=r.child;r!==null;)Tv(r,s,o),r=r.sibling}function Tv(r,s,o){switch(r.tag){case 26:Ga(r,s,o),r.flags&uo&&r.memoizedState!==null&&Fk(o,Or,r.memoizedState,r.memoizedProps);break;case 5:Ga(r,s,o);break;case 3:case 4:var d=Or;Or=Mu(r.stateNode.containerInfo),Ga(r,s,o),Or=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=uo,uo=16777216,Ga(r,s,o),uo=d):Ga(r,s,o));break;default:Ga(r,s,o)}}function Av(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function fo(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];_n=d,Rv(d,r)}Av(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Mv(r),r=r.sibling}function Mv(r){switch(r.tag){case 0:case 11:case 15:fo(r),r.flags&2048&&ds(9,r,r.return);break;case 3:fo(r);break;case 12:fo(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,vu(r)):fo(r);break;default:fo(r)}}function vu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];_n=d,Rv(d,r)}Av(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:ds(8,s,s.return),vu(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,vu(s));break;default:vu(s)}r=r.sibling}}function Rv(r,s){for(;_n!==null;){var o=_n;switch(o.tag){case 0:case 11:case 15:ds(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Ql(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,_n=d;else e:for(o=r;_n!==null;){d=_n;var m=d.sibling,x=d.return;if(wv(d),d===o){_n=null;break e}if(m!==null){m.return=x,_n=m;break e}_n=x}}}var nk={getCacheForType:function(r){var s=jn(an),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return jn(an).controller.signal}},rk=typeof WeakMap=="function"?WeakMap:Map,yt=0,Tt=null,lt=null,dt=0,wt=0,sr=null,fs=!1,Ya=!1,Nh=!1,Ti=0,Jt=0,hs=0,ea=0,Ch=0,ar=0,Qa=0,ho=null,Yn=null,Eh=!1,bu=0,Lv=0,yu=1/0,_u=null,ps=null,mn=0,ms=null,Wa=null,Ai=0,Th=0,Ah=null,Dv=null,po=0,Mh=null;function lr(){return(yt&2)!==0&&dt!==0?dt&-dt:$.T!==null?Bh():ci()}function zv(){if(ar===0)if((dt&536870912)===0||ht){var r=Rr;Rr<<=1,(Rr&3932160)===0&&(Rr=262144),ar=r}else ar=536870912;return r=rr.current,r!==null&&(r.flags|=32),ar}function Qn(r,s,o){(r===Tt&&(wt===2||wt===9)||r.cancelPendingCommit!==null)&&(Ja(r,0),gs(r,dt,ar,!1)),mt(r,o),((yt&2)===0||r!==Tt)&&(r===Tt&&((yt&2)===0&&(ea|=o),Jt===4&&gs(r,dt,ar,!1)),Zr(r))}function Ov(r,s,o){if((yt&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||Ye(r,s),m=d?ak(r,s):Lh(r,s,!0),x=d;do{if(m===0){Ya&&!d&&gs(r,s,0,!1);break}else{if(o=r.current.alternate,x&&!ik(o)){m=Lh(r,s,!1),x=!1;continue}if(m===2){if(x=s,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var C=r;m=ho;var q=C.current.memoizedState.isDehydrated;if(q&&(Ja(C,w).flags|=256),w=Lh(C,w,!1),w!==2){if(Nh&&!q){C.errorRecoveryDisabledLanes|=x,ea|=x,m=4;break e}x=Yn,Yn=m,x!==null&&(Yn===null?Yn=x:Yn.push.apply(Yn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){Ja(r,0),gs(r,s,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:gs(d,s,ar,!fs);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=bu+300-qe(),10<m)){if(gs(d,s,ar,!fs),ge(d,0,!0)!==0)break e;Ai=s,d.timeoutHandle=h1(Bv.bind(null,d,o,Yn,_u,Eh,s,ar,ea,Qa,fs,x,"Throttled",-0,0),m);break e}Bv(d,o,Yn,_u,Eh,s,ar,ea,Qa,fs,x,null,-0,0)}}break}while(!0);Zr(r)}function Bv(r,s,o,d,m,x,w,C,q,ee,oe,ue,te,se){if(r.timeoutHandle=-1,ue=s.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Dr},Tv(s,x,ue);var Ee=(x&62914560)===x?bu-qe():(x&4194048)===x?Lv-qe():0;if(Ee=qk(ue,Ee),Ee!==null){Ai=x,r.cancelPendingCommit=Ee(Vv.bind(null,r,s,x,o,d,m,w,C,q,oe,ue,null,te,se)),gs(r,x,w,!ee);return}}Vv(r,s,x,o,d,m,w,C,q)}function ik(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!tr(x(),m))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gs(r,s,o,d){s&=~Ch,s&=~ea,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var x=31-ut(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&zs(r,o,s)}function wu(){return(yt&6)===0?(mo(0),!1):!0}function Rh(){if(lt!==null){if(wt===0)var r=lt.return;else r=lt,bi=Vs=null,Qf(r),Ua=null,Jl=0,r=lt;for(;r!==null;)pv(r.alternate,r),r=r.return;lt=null}}function Ja(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,kk(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),Ai=0,Rh(),Tt=r,lt=o=xi(r.current,null),dt=s,wt=0,sr=null,fs=!1,Ya=Ye(r,s),Nh=!1,Qa=ar=Ch=ea=hs=Jt=0,Yn=ho=null,Eh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var m=31-ut(d),x=1<<m;s|=r[m],d&=~x}return Ti=s,Hc(),o}function Pv(r,s){Je=null,$.H=io,s===$a||s===Xc?(s=e0(),wt=3):s===Of?(s=e0(),wt=4):wt=s===uh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,sr=s,lt===null&&(Jt=1,du(r,xr(s,r.current)))}function $v(){var r=rr.current;return r===null?!0:(dt&4194048)===dt?_r===null:(dt&62914560)===dt||(dt&536870912)!==0?r===_r:!1}function Uv(){var r=$.H;return $.H=io,r===null?io:r}function Fv(){var r=$.A;return $.A=nk,r}function Su(){Jt=4,fs||(dt&4194048)!==dt&&rr.current!==null||(Ya=!0),(hs&134217727)===0&&(ea&134217727)===0||Tt===null||gs(Tt,dt,ar,!1)}function Lh(r,s,o){var d=yt;yt|=2;var m=Uv(),x=Fv();(Tt!==r||dt!==s)&&(_u=null,Ja(r,s)),s=!1;var w=Jt;e:do try{if(wt!==0&&lt!==null){var C=lt,q=sr;switch(wt){case 8:Rh(),w=6;break e;case 3:case 2:case 9:case 6:rr.current===null&&(s=!0);var ee=wt;if(wt=0,sr=null,Xa(r,C,q,ee),o&&Ya){w=0;break e}break;default:ee=wt,wt=0,sr=null,Xa(r,C,q,ee)}}sk(),w=Jt;break}catch(oe){Pv(r,oe)}while(!0);return s&&r.shellSuspendCounter++,bi=Vs=null,yt=d,$.H=m,$.A=x,lt===null&&(Tt=null,dt=0,Hc()),w}function sk(){for(;lt!==null;)qv(lt)}function ak(r,s){var o=yt;yt|=2;var d=Uv(),m=Fv();Tt!==r||dt!==s?(_u=null,yu=qe()+500,Ja(r,s)):Ya=Ye(r,s);e:do try{if(wt!==0&&lt!==null){s=lt;var x=sr;t:switch(wt){case 1:wt=0,sr=null,Xa(r,s,x,1);break;case 2:case 9:if(Zx(x)){wt=0,sr=null,Hv(s);break}s=function(){wt!==2&&wt!==9||Tt!==r||(wt=7),Zr(r)},x.then(s,s);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:Zx(x)?(wt=0,sr=null,Hv(s)):(wt=0,sr=null,Xa(r,s,x,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var C=lt;if(w?E1(w):C.stateNode.complete){wt=0,sr=null;var q=C.sibling;if(q!==null)lt=q;else{var ee=C.return;ee!==null?(lt=ee,ku(ee)):lt=null}break t}}wt=0,sr=null,Xa(r,s,x,5);break;case 6:wt=0,sr=null,Xa(r,s,x,6);break;case 8:Rh(),Jt=6;break e;default:throw Error(i(462))}}lk();break}catch(oe){Pv(r,oe)}while(!0);return bi=Vs=null,$.H=d,$.A=m,yt=o,lt!==null?0:(Tt=null,dt=0,Hc(),Jt)}function lk(){for(;lt!==null&&!Oe();)qv(lt)}function qv(r){var s=fv(r.alternate,r,Ti);r.memoizedProps=r.pendingProps,s===null?ku(r):lt=s}function Hv(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=av(o,s,s.pendingProps,s.type,void 0,dt);break;case 11:s=av(o,s,s.pendingProps,s.type.render,s.ref,dt);break;case 5:Qf(s);default:pv(o,s),s=lt=Fx(s,Ti),s=fv(o,s,Ti)}r.memoizedProps=r.pendingProps,s===null?ku(r):lt=s}function Xa(r,s,o,d){bi=Vs=null,Qf(s),Ua=null,Jl=0;var m=s.return;try{if(WS(r,m,s,o,dt)){Jt=1,du(r,xr(o,r.current)),lt=null;return}}catch(x){if(m!==null)throw lt=m,x;Jt=1,du(r,xr(o,r.current)),lt=null;return}s.flags&32768?(ht||d===1?r=!0:Ya||(dt&536870912)!==0?r=!1:(fs=r=!0,(d===2||d===9||d===3||d===6)&&(d=rr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Iv(s,r)):ku(s)}function ku(r){var s=r;do{if((s.flags&32768)!==0){Iv(s,fs);return}r=s.return;var o=ZS(s.alternate,s,Ti);if(o!==null){lt=o;return}if(s=s.sibling,s!==null){lt=s;return}lt=s=r}while(s!==null);Jt===0&&(Jt=5)}function Iv(r,s){do{var o=KS(r.alternate,r);if(o!==null){o.flags&=32767,lt=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){lt=r;return}lt=r=o}while(r!==null);Jt=6,lt=null}function Vv(r,s,o,d,m,x,w,C,q){r.cancelPendingCommit=null;do ju();while(mn!==0);if((yt&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(x=s.lanes|s.childLanes,x|=_f,qn(r,o,x,w,C,q),r===Tt&&(lt=Tt=null,dt=0),Wa=s,ms=r,Ai=o,Th=x,Ah=m,Dv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,dk(Q,function(){return Jv(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,m=P.p,P.p=2,w=yt,yt|=4;try{ek(r,s,o)}finally{yt=w,P.p=m,$.T=d}}mn=1,Gv(),Yv(),Qv()}}function Gv(){if(mn===1){mn=0;var r=ms,s=Wa,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var d=P.p;P.p=2;var m=yt;yt|=4;try{Nv(s,r);var x=Vh,w=Rx(r.containerInfo),C=x.focusedElem,q=x.selectionRange;if(w!==C&&C&&C.ownerDocument&&Mx(C.ownerDocument.documentElement,C)){if(q!==null&&gf(C)){var ee=q.start,oe=q.end;if(oe===void 0&&(oe=ee),"selectionStart"in C)C.selectionStart=ee,C.selectionEnd=Math.min(oe,C.value.length);else{var ue=C.ownerDocument||document,te=ue&&ue.defaultView||window;if(te.getSelection){var se=te.getSelection(),Ee=C.textContent.length,Ue=Math.min(q.start,Ee),Ct=q.end===void 0?Ue:Math.min(q.end,Ee);!se.extend&&Ue>Ct&&(w=Ct,Ct=Ue,Ue=w);var J=Ax(C,Ue),G=Ax(C,Ct);if(J&&G&&(se.rangeCount!==1||se.anchorNode!==J.node||se.anchorOffset!==J.offset||se.focusNode!==G.node||se.focusOffset!==G.offset)){var K=ue.createRange();K.setStart(J.node,J.offset),se.removeAllRanges(),Ue>Ct?(se.addRange(K),se.extend(G.node,G.offset)):(K.setEnd(G.node,G.offset),se.addRange(K))}}}}for(ue=[],se=C;se=se.parentNode;)se.nodeType===1&&ue.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ue.length;C++){var ce=ue[C];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Bu=!!Ih,Vh=Ih=null}finally{yt=m,P.p=d,$.T=o}}r.current=s,mn=2}}function Yv(){if(mn===2){mn=0;var r=ms,s=Wa,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var d=P.p;P.p=2;var m=yt;yt|=4;try{_v(r,s.alternate,s)}finally{yt=m,P.p=d,$.T=o}}mn=3}}function Qv(){if(mn===4||mn===3){mn=0,st();var r=ms,s=Wa,o=Ai,d=Dv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?mn=5:(mn=0,Wa=ms=null,Wv(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(ps=null),ya(o),s=s.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(nt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=$.T,m=P.p,P.p=2,$.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var C=d[w];x(C.value,{componentStack:C.stack})}}finally{$.T=s,P.p=m}}(Ai&3)!==0&&ju(),Zr(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===Mh?po++:(po=0,Mh=r):po=0,mo(0)}}function Wv(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Ql(s)))}function ju(){return Gv(),Yv(),Qv(),Jv()}function Jv(){if(mn!==5)return!1;var r=ms,s=Th;Th=0;var o=ya(Ai),d=$.T,m=P.p;try{P.p=32>o?32:o,$.T=null,o=Ah,Ah=null;var x=ms,w=Ai;if(mn=0,Wa=ms=null,Ai=0,(yt&6)!==0)throw Error(i(331));var C=yt;if(yt|=4,Mv(x.current),Ev(x,x.current,w,o),yt=C,mo(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(nt,x)}catch{}return!0}finally{P.p=m,$.T=d,Wv(r,s)}}function Xv(r,s,o){s=xr(o,s),s=ch(r.stateNode,s,2),r=os(r,s,2),r!==null&&(mt(r,2),Zr(r))}function St(r,s,o){if(r.tag===3)Xv(r,r,o);else for(;s!==null;){if(s.tag===3){Xv(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ps===null||!ps.has(d))){r=xr(o,r),o=Z0(2),d=os(s,o,2),d!==null&&(K0(o,d,s,r),mt(d,2),Zr(d));break}}s=s.return}}function Dh(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new rk;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(o)||(Nh=!0,m.add(o),r=ok.bind(null,r,s,o),s.then(r,r))}function ok(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Tt===r&&(dt&o)===o&&(Jt===4||Jt===3&&(dt&62914560)===dt&&300>qe()-bu?(yt&2)===0&&Ja(r,0):Ch|=o,Qa===dt&&(Qa=0)),Zr(r)}function Zv(r,s){s===0&&(s=rn()),r=qs(r,s),r!==null&&(mt(r,s),Zr(r))}function ck(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),Zv(r,o)}function uk(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),Zv(r,o)}function dk(r,s){return hn(r,s)}var Nu=null,Za=null,zh=!1,Cu=!1,Oh=!1,xs=0;function Zr(r){r!==Za&&r.next===null&&(Za===null?Nu=Za=r:Za=Za.next=r),Cu=!0,zh||(zh=!0,hk())}function mo(r,s){if(!Oh&&Cu){Oh=!0;do for(var o=!1,d=Nu;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,C=d.pingedLanes;x=(1<<31-ut(42|r)+1)-1,x&=m&~(w&~C),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,n1(d,x))}else x=dt,x=ge(d,d===Tt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Ye(d,x)||(o=!0,n1(d,x));d=d.next}while(o);Oh=!1}}function fk(){Kv()}function Kv(){Cu=zh=!1;var r=0;xs!==0&&Sk()&&(r=xs);for(var s=qe(),o=null,d=Nu;d!==null;){var m=d.next,x=e1(d,s);x===0?(d.next=null,o===null?Nu=m:o.next=m,m===null&&(Za=o)):(o=d,(r!==0||(x&3)!==0)&&(Cu=!0)),d=m}mn!==0&&mn!==5||mo(r),xs!==0&&(xs=0)}function e1(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-ut(x),C=1<<w,q=m[w];q===-1?((C&o)===0||(C&d)!==0)&&(m[w]=_t(C,s)):q<=s&&(r.expiredLanes|=C),x&=~C}if(s=Tt,o=dt,o=ge(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(wt===2||wt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ke(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||Ye(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&ke(d),ya(o)){case 2:case 8:o=xe;break;case 32:o=Q;break;case 268435456:o=Ae;break;default:o=Q}return d=t1.bind(null,r),o=hn(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&ke(d),r.callbackPriority=2,r.callbackNode=null,2}function t1(r,s){if(mn!==0&&mn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(ju()&&r.callbackNode!==o)return null;var d=dt;return d=ge(r,r===Tt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Ov(r,d,s),e1(r,qe()),r.callbackNode!=null&&r.callbackNode===o?t1.bind(null,r):null)}function n1(r,s){if(ju())return null;Ov(r,s,!0)}function hk(){jk(function(){(yt&6)!==0?hn(le,fk):Kv()})}function Bh(){if(xs===0){var r=Ba;r===0&&(r=Mr,Mr<<=1,(Mr&261888)===0&&(Mr=256)),xs=r}return xs}function r1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ka(""+r)}function i1(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function pk(r,s,o,d,m){if(s==="submit"&&o&&o.stateNode===m){var x=r1((m[pn]||null).action),w=d.submitter;w&&(s=(s=w[pn]||null)?r1(s.formAction):w.getAttribute("formAction"),s!==null&&(x=s,w=null));var C=new Ul("action","action",null,d,m);r.push({event:C,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(xs!==0){var q=w?i1(m,w):new FormData(m);rh(o,{pending:!0,data:q,method:m.method,action:x},null,q)}}else typeof x=="function"&&(C.preventDefault(),q=w?i1(m,w):new FormData(m),rh(o,{pending:!0,data:q,method:m.method,action:x},x,q))},currentTarget:m}]})}}for(var Ph=0;Ph<yf.length;Ph++){var $h=yf[Ph],mk=$h.toLowerCase(),gk=$h[0].toUpperCase()+$h.slice(1);zr(mk,"on"+gk)}zr(zx,"onAnimationEnd"),zr(Ox,"onAnimationIteration"),zr(Bx,"onAnimationStart"),zr("dblclick","onDoubleClick"),zr("focusin","onFocus"),zr("focusout","onBlur"),zr(RS,"onTransitionRun"),zr(LS,"onTransitionStart"),zr(DS,"onTransitionCancel"),zr(Px,"onTransitionEnd"),Wi("onMouseEnter",["mouseout","mouseover"]),Wi("onMouseLeave",["mouseout","mouseover"]),Wi("onPointerEnter",["pointerout","pointerover"]),Wi("onPointerLeave",["pointerout","pointerover"]),Gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Gr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="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(" "),xk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(go));function s1(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(s)for(var w=d.length-1;0<=w;w--){var C=d[w],q=C.instance,ee=C.currentTarget;if(C=C.listener,q!==x&&m.isPropagationStopped())break e;x=C,m.currentTarget=ee;try{x(m)}catch(oe){qc(oe)}m.currentTarget=null,x=q}else for(w=0;w<d.length;w++){if(C=d[w],q=C.instance,ee=C.currentTarget,C=C.listener,q!==x&&m.isPropagationStopped())break e;x=C,m.currentTarget=ee;try{x(m)}catch(oe){qc(oe)}m.currentTarget=null,x=q}}}}function ot(r,s){var o=s[Yi];o===void 0&&(o=s[Yi]=new Set);var d=r+"__bubble";o.has(d)||(a1(s,r,2,!1),o.add(d))}function Uh(r,s,o){var d=0;s&&(d|=4),a1(o,r,d,s)}var Eu="_reactListening"+Math.random().toString(36).slice(2);function Fh(r){if(!r[Eu]){r[Eu]=!0,Gt.forEach(function(o){o!=="selectionchange"&&(xk.has(o)||Uh(o,!1,r),Uh(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Eu]||(s[Eu]=!0,Uh("selectionchange",!1,s))}}function a1(r,s,o,d){switch(z1(s)){case 2:var m=Vk;break;case 8:m=Gk;break;default:m=np}o=m.bind(null,s,o,r),m=void 0,!He||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,o,{capture:!0,passive:m}):r.addEventListener(s,o,!0):m!==void 0?r.addEventListener(s,o,{passive:m}):r.addEventListener(s,o,!1)}function qh(r,s,o,d,m){var x=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var C=d.stateNode.containerInfo;if(C===m)break;if(w===4)for(w=d.return;w!==null;){var q=w.tag;if((q===3||q===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;C!==null;){if(w=bn(C),w===null)return;if(q=w.tag,q===5||q===6||q===26||q===27){d=x=w;continue e}C=C.parentNode}}d=d.return}Xe(function(){var ee=x,oe=ja(o),ue=[];e:{var te=$x.get(r);if(te!==void 0){var se=Ul,Ee=r;switch(r){case"keypress":if(Bs(o)===0)break e;case"keydown":case"keyup":se=uS;break;case"focusin":Ee="focus",se=df;break;case"focusout":Ee="blur",se=df;break;case"beforeblur":case"afterblur":se=df;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=$s;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Z2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=hS;break;case zx:case Ox:case Bx:se=tS;break;case Px:se=mS;break;case"scroll":case"scrollend":se=Uc;break;case"wheel":se=xS;break;case"copy":case"cut":case"paste":se=rS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=gx;break;case"toggle":case"beforetoggle":se=bS}var Ue=(s&4)!==0,Ct=!Ue&&(r==="scroll"||r==="scrollend"),J=Ue?te!==null?te+"Capture":null:te;Ue=[];for(var G=ee,K;G!==null;){var ce=G;if(K=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||K===null||J===null||(ce=at(G,J),ce!=null&&Ue.push(xo(G,ce,K))),Ct)break;G=G.return}0<Ue.length&&(te=new se(te,Ee,null,o,oe),ue.push({event:te,listeners:Ue}))}}if((s&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",te&&o!==$l&&(Ee=o.relatedTarget||o.fromElement)&&(bn(Ee)||Ee[Lr]))break e;if((se||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,se?(Ee=o.relatedTarget||o.toElement,se=ee,Ee=Ee?bn(Ee):null,Ee!==null&&(Ct=c(Ee),Ue=Ee.tag,Ee!==Ct||Ue!==5&&Ue!==27&&Ue!==6)&&(Ee=null)):(se=null,Ee=ee),se!==Ee)){if(Ue=$s,ce="onMouseLeave",J="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=gx,ce="onPointerLeave",J="onPointerEnter",G="pointer"),Ct=se==null?te:fi(se),K=Ee==null?te:fi(Ee),te=new Ue(ce,G+"leave",se,o,oe),te.target=Ct,te.relatedTarget=K,ce=null,bn(oe)===ee&&(Ue=new Ue(J,G+"enter",Ee,o,oe),Ue.target=K,Ue.relatedTarget=Ct,ce=Ue),Ct=ce,se&&Ee)t:{for(Ue=vk,J=se,G=Ee,K=0,ce=J;ce;ce=Ue(ce))K++;ce=0;for(var Be=G;Be;Be=Ue(Be))ce++;for(;0<K-ce;)J=Ue(J),K--;for(;0<ce-K;)G=Ue(G),ce--;for(;K--;){if(J===G||G!==null&&J===G.alternate){Ue=J;break t}J=Ue(J),G=Ue(G)}Ue=null}else Ue=null;se!==null&&l1(ue,te,se,Ue,!1),Ee!==null&&Ct!==null&&l1(ue,Ct,Ee,Ue,!0)}}e:{if(te=ee?fi(ee):window,se=te.nodeName&&te.nodeName.toLowerCase(),se==="select"||se==="input"&&te.type==="file")var vt=kx;else if(wx(te))if(jx)vt=TS;else{vt=CS;var Me=NS}else se=te.nodeName,!se||se.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Pl(ee.elementType)&&(vt=kx):vt=ES;if(vt&&(vt=vt(r,ee))){Sx(ue,vt,o,oe);break e}Me&&Me(r,te,ee),r==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&zl(te,"number",te.value)}switch(Me=ee?fi(ee):window,r){case"focusin":(wx(Me)||Me.contentEditable==="true")&&(Ta=Me,xf=ee,Vl=null);break;case"focusout":Vl=xf=Ta=null;break;case"mousedown":vf=!0;break;case"contextmenu":case"mouseup":case"dragend":vf=!1,Lx(ue,o,oe);break;case"selectionchange":if(MS)break;case"keydown":case"keyup":Lx(ue,o,oe)}var Ze;if(hf)e:{switch(r){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Ea?yx(r,o)&&(ft="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(ft="onCompositionStart");ft&&(xx&&o.locale!=="ko"&&(Ea||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Ea&&(Ze=Mn()):(er=oe,Ki="value"in er?er.value:er.textContent,Ea=!0)),Me=Tu(ee,ft),0<Me.length&&(ft=new mx(ft,r,null,o,oe),ue.push({event:ft,listeners:Me}),Ze?ft.data=Ze:(Ze=_x(o),Ze!==null&&(ft.data=Ze)))),(Ze=_S?wS(r,o):SS(r,o))&&(ft=Tu(ee,"onBeforeInput"),0<ft.length&&(Me=new mx("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Me,listeners:ft}),Me.data=Ze)),pk(ue,r,ee,o,oe)}s1(ue,s)})}function xo(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Tu(r,s){for(var o=s+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=at(r,o),m!=null&&d.unshift(xo(r,m,x)),m=at(r,s),m!=null&&d.push(xo(r,m,x))),r.tag===3)return d;r=r.return}return[]}function vk(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function l1(r,s,o,d,m){for(var x=s._reactName,w=[];o!==null&&o!==d;){var C=o,q=C.alternate,ee=C.stateNode;if(C=C.tag,q!==null&&q===d)break;C!==5&&C!==26&&C!==27||ee===null||(q=ee,m?(ee=at(o,x),ee!=null&&w.unshift(xo(o,ee,q))):m||(ee=at(o,x),ee!=null&&w.push(xo(o,ee,q)))),o=o.return}w.length!==0&&r.push({event:s,listeners:w})}var bk=/\r\n?/g,yk=/\u0000|\uFFFD/g;function o1(r){return(typeof r=="string"?r:""+r).replace(bk,`
49
- `).replace(yk,"")}function c1(r,s){return s=o1(s),o1(r)===s}function Nt(r,s,o,d,m,x){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Zi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Zi(r,""+d);break;case"className":Ji(r,"class",d);break;case"tabIndex":Ji(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ji(r,o,d);break;case"style":Bl(r,d,x);break;case"data":if(s!=="object"){Ji(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ka(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(s!=="input"&&Nt(r,s,"name",m.name,m,null),Nt(r,s,"formEncType",m.formEncType,m,null),Nt(r,s,"formMethod",m.formMethod,m,null),Nt(r,s,"formTarget",m.formTarget,m,null)):(Nt(r,s,"encType",m.encType,m,null),Nt(r,s,"method",m.method,m,null),Nt(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ka(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=Dr);break;case"onScroll":d!=null&&ot("scroll",r);break;case"onScrollEnd":d!=null&&ot("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=ka(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":ot("beforetoggle",r),ot("toggle",r),mr(r,"popover",d);break;case"xlinkActuate":sn(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":sn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":sn(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":sn(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":sn(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":sn(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":sn(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":sn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":sn(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":mr(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=cf.get(o)||o,mr(r,o,d))}}function Hh(r,s,o,d,m,x){switch(o){case"style":Bl(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Zi(r,d):(typeof d=="number"||typeof d=="bigint")&&Zi(r,""+d);break;case"onScroll":d!=null&&ot("scroll",r);break;case"onScrollEnd":d!=null&&ot("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Mc.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),s=o.slice(2,m?o.length-7:void 0),x=r[pn]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(s,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):mr(r,o,d)}}}function Cn(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",r),ot("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Nt(r,s,x,w,o,null)}}m&&Nt(r,s,"srcSet",o.srcSet,o,null),d&&Nt(r,s,"src",o.src,o,null);return;case"input":ot("invalid",r);var C=x=w=m=null,q=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var oe=o[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":q=oe;break;case"defaultChecked":ee=oe;break;case"value":x=oe;break;case"defaultValue":C=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,s));break;default:Nt(r,s,d,oe,o,null)}}Oc(r,x,C,q,ee,w,m,!1);return;case"select":ot("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(C=o[m],C!=null))switch(m){case"value":x=C;break;case"defaultValue":w=C;break;case"multiple":d=C;default:Nt(r,s,m,C,o,null)}s=x,o=w,r.multiple=!!d,s!=null?hi(r,!!d,s,!1):o!=null&&hi(r,!!d,o,!0);return;case"textarea":ot("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(C=o[w],C!=null))switch(w){case"value":d=C;break;case"defaultValue":m=C;break;case"children":x=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(i(91));break;default:Nt(r,s,w,C,o,null)}Bc(r,d,m,x);return;case"option":for(q in o)if(o.hasOwnProperty(q)&&(d=o[q],d!=null))switch(q){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Nt(r,s,q,d,o,null)}return;case"dialog":ot("beforetoggle",r),ot("toggle",r),ot("cancel",r),ot("close",r);break;case"iframe":case"object":ot("load",r);break;case"video":case"audio":for(d=0;d<go.length;d++)ot(go[d],r);break;case"image":ot("error",r),ot("load",r);break;case"details":ot("toggle",r);break;case"embed":case"source":case"link":ot("error",r),ot("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Nt(r,s,ee,d,o,null)}return;default:if(Pl(s)){for(oe in o)o.hasOwnProperty(oe)&&(d=o[oe],d!==void 0&&Hh(r,s,oe,d,o,void 0));return}}for(C in o)o.hasOwnProperty(C)&&(d=o[C],d!=null&&Nt(r,s,C,d,o,null))}function _k(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,C=null,q=null,ee=null,oe=null;for(se in o){var ue=o[se];if(o.hasOwnProperty(se)&&ue!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":q=ue;default:d.hasOwnProperty(se)||Nt(r,s,se,null,d,ue)}}for(var te in d){var se=d[te];if(ue=o[te],d.hasOwnProperty(te)&&(se!=null||ue!=null))switch(te){case"type":x=se;break;case"name":m=se;break;case"checked":ee=se;break;case"defaultChecked":oe=se;break;case"value":w=se;break;case"defaultValue":C=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==ue&&Nt(r,s,te,se,d,ue)}}Dl(r,w,C,q,ee,oe,x,m);return;case"select":se=w=C=te=null;for(x in o)if(q=o[x],o.hasOwnProperty(x)&&q!=null)switch(x){case"value":break;case"multiple":se=q;default:d.hasOwnProperty(x)||Nt(r,s,x,null,d,q)}for(m in d)if(x=d[m],q=o[m],d.hasOwnProperty(m)&&(x!=null||q!=null))switch(m){case"value":te=x;break;case"defaultValue":C=x;break;case"multiple":w=x;default:x!==q&&Nt(r,s,m,x,d,q)}s=C,o=w,d=se,te!=null?hi(r,!!o,te,!1):!!d!=!!o&&(s!=null?hi(r,!!o,s,!0):hi(r,!!o,o?[]:"",!1));return;case"textarea":se=te=null;for(C in o)if(m=o[C],o.hasOwnProperty(C)&&m!=null&&!d.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Nt(r,s,C,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":te=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&Nt(r,s,w,m,d,x)}Ol(r,te,se);return;case"option":for(var Ee in o)if(te=o[Ee],o.hasOwnProperty(Ee)&&te!=null&&!d.hasOwnProperty(Ee))switch(Ee){case"selected":r.selected=!1;break;default:Nt(r,s,Ee,null,d,te)}for(q in d)if(te=d[q],se=o[q],d.hasOwnProperty(q)&&te!==se&&(te!=null||se!=null))switch(q){case"selected":r.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Nt(r,s,q,te,d,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in o)te=o[Ue],o.hasOwnProperty(Ue)&&te!=null&&!d.hasOwnProperty(Ue)&&Nt(r,s,Ue,null,d,te);for(ee in d)if(te=d[ee],se=o[ee],d.hasOwnProperty(ee)&&te!==se&&(te!=null||se!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,s));break;default:Nt(r,s,ee,te,d,se)}return;default:if(Pl(s)){for(var Ct in o)te=o[Ct],o.hasOwnProperty(Ct)&&te!==void 0&&!d.hasOwnProperty(Ct)&&Hh(r,s,Ct,void 0,d,te);for(oe in d)te=d[oe],se=o[oe],!d.hasOwnProperty(oe)||te===se||te===void 0&&se===void 0||Hh(r,s,oe,te,d,se);return}}for(var J in o)te=o[J],o.hasOwnProperty(J)&&te!=null&&!d.hasOwnProperty(J)&&Nt(r,s,J,null,d,te);for(ue in d)te=d[ue],se=o[ue],!d.hasOwnProperty(ue)||te===se||te==null&&se==null||Nt(r,s,ue,te,d,se)}function u1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,C=m.duration;if(x&&C&&u1(w)){for(w=0,C=m.responseEnd,d+=1;d<o.length;d++){var q=o[d],ee=q.startTime;if(ee>C)break;var oe=q.transferSize,ue=q.initiatorType;oe&&u1(ue)&&(q=q.responseEnd,w+=oe*(q<C?1:(C-ee)/(q-ee)))}if(--d,s+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Ih=null,Vh=null;function Au(r){return r.nodeType===9?r:r.ownerDocument}function d1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function f1(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Gh(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Yh=null;function Sk(){var r=window.event;return r&&r.type==="popstate"?r===Yh?!1:(Yh=r,!0):(Yh=null,!1)}var h1=typeof setTimeout=="function"?setTimeout:void 0,kk=typeof clearTimeout=="function"?clearTimeout:void 0,p1=typeof Promise=="function"?Promise:void 0,jk=typeof queueMicrotask=="function"?queueMicrotask:typeof p1<"u"?function(r){return p1.resolve(null).then(r).catch(Nk)}:h1;function Nk(r){setTimeout(function(){throw r})}function vs(r){return r==="head"}function m1(r,s){var o=s,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),nl(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")vo(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,vo(o);for(var x=o.firstChild;x;){var w=x.nextSibling,C=x.nodeName;x[di]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&vo(r.ownerDocument.body);o=m}while(o);nl(s)}function g1(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function Qh(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Qh(o),Qi(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function Ck(r,s,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[di])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=wr(r.nextSibling),r===null)break}return null}function Ek(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=wr(r.nextSibling),r===null))return null;return r}function x1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=wr(r.nextSibling),r===null))return null;return r}function Wh(r){return r.data==="$?"||r.data==="$~"}function Jh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Tk(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function wr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var Xh=null;function v1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return wr(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function b1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function y1(r,s,o){switch(s=Au(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function vo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Qi(r)}var Sr=new Map,_1=new Set;function Mu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Mi=P.d;P.d={f:Ak,r:Mk,D:Rk,C:Lk,L:Dk,m:zk,X:Bk,S:Ok,M:Pk};function Ak(){var r=Mi.f(),s=wu();return r||s}function Mk(r){var s=Ir(r);s!==null&&s.tag===5&&s.type==="form"?P0(s):Mi.r(r)}var Ka=typeof document>"u"?null:document;function w1(r,s,o){var d=Ka;if(d&&typeof s=="string"&&s){var m=Hn(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),_1.has(m)||(_1.add(m),r={rel:r,crossOrigin:o,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),Cn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function Rk(r){Mi.D(r),w1("dns-prefetch",r,null)}function Lk(r,s){Mi.C(r,s),w1("preconnect",r,s)}function Dk(r,s,o){Mi.L(r,s,o);var d=Ka;if(d&&r&&s){var m='link[rel="preload"][as="'+Hn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Hn(o.imageSizes)+'"]')):m+='[href="'+Hn(r)+'"]';var x=m;switch(s){case"style":x=el(r);break;case"script":x=tl(r)}Sr.has(x)||(r=v({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),Sr.set(x,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(bo(x))||s==="script"&&d.querySelector(yo(x))||(s=d.createElement("link"),Cn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function zk(r,s){Mi.m(r,s);var o=Ka;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+Hn(d)+'"][href="'+Hn(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=tl(r)}if(!Sr.has(x)&&(r=v({rel:"modulepreload",href:r},s),Sr.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(yo(x)))return}d=o.createElement("link"),Cn(d,"link",r),Zt(d),o.head.appendChild(d)}}}function Ok(r,s,o){Mi.S(r,s,o);var d=Ka;if(d&&r){var m=Vr(d).hoistableStyles,x=el(r);s=s||"default";var w=m.get(x);if(!w){var C={loading:0,preload:null};if(w=d.querySelector(bo(x)))C.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":s},o),(o=Sr.get(x))&&Zh(r,o);var q=w=d.createElement("link");Zt(q),Cn(q,"link",r),q._p=new Promise(function(ee,oe){q.onload=ee,q.onerror=oe}),q.addEventListener("load",function(){C.loading|=1}),q.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Ru(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:C},m.set(x,w)}}}function Bk(r,s){Mi.X(r,s);var o=Ka;if(o&&r){var d=Vr(o).hoistableScripts,m=tl(r),x=d.get(m);x||(x=o.querySelector(yo(m)),x||(r=v({src:r,async:!0},s),(s=Sr.get(m))&&Kh(r,s),x=o.createElement("script"),Zt(x),Cn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Pk(r,s){Mi.M(r,s);var o=Ka;if(o&&r){var d=Vr(o).hoistableScripts,m=tl(r),x=d.get(m);x||(x=o.querySelector(yo(m)),x||(r=v({src:r,async:!0,type:"module"},s),(s=Sr.get(m))&&Kh(r,s),x=o.createElement("script"),Zt(x),Cn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function S1(r,s,o,d){var m=(m=Ce.current)?Mu(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=el(o.href),o=Vr(m).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=el(o.href);var x=Vr(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(bo(r)))&&!x._p&&(w.instance=x,w.state.loading=5),Sr.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Sr.set(r,o),x||$k(m,r,o,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=tl(o),o=Vr(m).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function el(r){return'href="'+Hn(r)+'"'}function bo(r){return'link[rel="stylesheet"]['+r+"]"}function k1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function $k(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),Cn(s,"link",o),Zt(s),r.head.appendChild(s))}function tl(r){return'[src="'+Hn(r)+'"]'}function yo(r){return"script[async]"+r}function j1(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Hn(o.href)+'"]');if(d)return s.instance=d,Zt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Zt(d),Cn(d,"style",m),Ru(d,o.precedence,r),s.instance=d;case"stylesheet":m=el(o.href);var x=r.querySelector(bo(m));if(x)return s.state.loading|=4,s.instance=x,Zt(x),x;d=k1(o),(m=Sr.get(m))&&Zh(d,m),x=(r.ownerDocument||r).createElement("link"),Zt(x);var w=x;return w._p=new Promise(function(C,q){w.onload=C,w.onerror=q}),Cn(x,"link",d),s.state.loading|=4,Ru(x,o.precedence,r),s.instance=x;case"script":return x=tl(o.src),(m=r.querySelector(yo(x)))?(s.instance=m,Zt(m),m):(d=o,(m=Sr.get(x))&&(d=v({},o),Kh(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Zt(m),Cn(m,"link",d),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Ru(d,o.precedence,r));return s.instance}function Ru(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var C=d[w];if(C.dataset.precedence===s)x=C;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function Zh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Kh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Lu=null;function N1(r,s,o){if(Lu===null){var d=new Map,m=Lu=new Map;m.set(o,d)}else m=Lu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[di]||x[Vt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(s)||"";w=r+w;var C=d.get(w);C?C.push(x):d.set(w,[x])}}return d}function C1(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function Uk(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function E1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Fk(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=el(d.href),x=s.querySelector(bo(m));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Du.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=x,Zt(x);return}x=s.ownerDocument||s,d=k1(d),(m=Sr.get(m))&&Zh(d,m),x=x.createElement("link"),Zt(x);var w=x;w._p=new Promise(function(C,q){w.onload=C,w.onerror=q}),Cn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Du.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var ep=0;function qk(r,s){return r.stylesheets&&r.count===0&&Ou(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Ou(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+s);0<r.imgBytes&&ep===0&&(ep=62500*wk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Ou(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>ep?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Du(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ou(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var zu=null;function Ou(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,zu=new Map,s.forEach(Hk,r),zu=null,Du.call(r))}function Hk(r,s){if(!(s.state.loading&4)){var o=zu.get(r);if(o)var d=o.get(null);else{o=new Map,zu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=Du.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var _o={$$typeof:N,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function Ik(r,s,o,d,m,x,w,C,q){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pr(0),this.hiddenUpdates=pr(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function T1(r,s,o,d,m,x,w,C,q,ee,oe,ue){return r=new Ik(r,s,o,w,q,ee,oe,ue,C),s=1,x===!0&&(s|=24),x=nr(3,null,null,s),r.current=x,x.stateNode=r,s=Lf(),s.refCount++,r.pooledCache=s,s.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:s},Bf(x),r}function A1(r){return r?(r=Ra,r):Ra}function M1(r,s,o,d,m,x){m=A1(m),d.context===null?d.context=m:d.pendingContext=m,d=ls(s),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=os(r,d,s),o!==null&&(Qn(o,r,s),Zl(o,r,s))}function R1(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function tp(r,s){R1(r,s),(r=r.alternate)&&R1(r,s)}function L1(r){if(r.tag===13||r.tag===31){var s=qs(r,67108864);s!==null&&Qn(s,r,67108864),tp(r,67108864)}}function D1(r){if(r.tag===13||r.tag===31){var s=lr();s=qr(s);var o=qs(r,s);o!==null&&Qn(o,r,s),tp(r,s)}}var Bu=!0;function Vk(r,s,o,d){var m=$.T;$.T=null;var x=P.p;try{P.p=2,np(r,s,o,d)}finally{P.p=x,$.T=m}}function Gk(r,s,o,d){var m=$.T;$.T=null;var x=P.p;try{P.p=8,np(r,s,o,d)}finally{P.p=x,$.T=m}}function np(r,s,o,d){if(Bu){var m=rp(d);if(m===null)qh(r,s,d,Pu,o),O1(r,d);else if(Qk(m,r,s,o,d))d.stopPropagation();else if(O1(r,d),s&4&&-1<Yk.indexOf(r)){for(;m!==null;){var x=Ir(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=he(x.pendingLanes);if(w!==0){var C=x;for(C.pendingLanes|=2,C.entangledLanes|=2;w;){var q=1<<31-ut(w);C.entanglements[1]|=q,w&=~q}Zr(x),(yt&6)===0&&(yu=qe()+500,mo(0))}}break;case 31:case 13:C=qs(x,2),C!==null&&Qn(C,x,2),wu(),tp(x,2)}if(x=rp(d),x===null&&qh(r,s,d,Pu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else qh(r,s,d,null,o)}}function rp(r){return r=ja(r),ip(r)}var Pu=null;function ip(r){if(Pu=null,r=bn(r),r!==null){var s=c(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=f(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Pu=r,null}function z1(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(hr()){case le:return 2;case xe:return 8;case Q:case fe:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var sp=!1,bs=null,ys=null,_s=null,wo=new Map,So=new Map,ws=[],Yk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function O1(r,s){switch(r){case"focusin":case"focusout":bs=null;break;case"dragenter":case"dragleave":ys=null;break;case"mouseover":case"mouseout":_s=null;break;case"pointerover":case"pointerout":wo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":So.delete(s.pointerId)}}function ko(r,s,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},s!==null&&(s=Ir(s),s!==null&&L1(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function Qk(r,s,o,d,m){switch(s){case"focusin":return bs=ko(bs,r,s,o,d,m),!0;case"dragenter":return ys=ko(ys,r,s,o,d,m),!0;case"mouseover":return _s=ko(_s,r,s,o,d,m),!0;case"pointerover":var x=m.pointerId;return wo.set(x,ko(wo.get(x)||null,r,s,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,So.set(x,ko(So.get(x)||null,r,s,o,d,m)),!0}return!1}function B1(r){var s=bn(r.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,Ec(r.priority,function(){D1(o)});return}}else if(s===31){if(s=f(o),s!==null){r.blockedOn=s,Ec(r.priority,function(){D1(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function $u(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=rp(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);$l=d,o.target.dispatchEvent(d),$l=null}else return s=Ir(o),s!==null&&L1(s),r.blockedOn=o,!1;s.shift()}return!0}function P1(r,s,o){$u(r)&&o.delete(s)}function Wk(){sp=!1,bs!==null&&$u(bs)&&(bs=null),ys!==null&&$u(ys)&&(ys=null),_s!==null&&$u(_s)&&(_s=null),wo.forEach(P1),So.forEach(P1)}function Uu(r,s){r.blockedOn===s&&(r.blockedOn=null,sp||(sp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Wk)))}var Fu=null;function $1(r){Fu!==r&&(Fu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===r&&(Fu=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(ip(d||o)===null)continue;break}var x=Ir(o);x!==null&&(r.splice(s,3),s-=3,rh(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function nl(r){function s(q){return Uu(q,r)}bs!==null&&Uu(bs,r),ys!==null&&Uu(ys,r),_s!==null&&Uu(_s,r),wo.forEach(s),So.forEach(s);for(var o=0;o<ws.length;o++){var d=ws[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<ws.length&&(o=ws[0],o.blockedOn===null);)B1(o),o.blockedOn===null&&ws.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[pn]||null;if(typeof x=="function")w||$1(o);else if(w){var C=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[pn]||null)C=w.formAction;else if(ip(m)!==null)continue}else C=w.action;typeof C=="function"?o[d+1]=C:(o.splice(d,3),d-=3),$1(o)}}}function U1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function ap(r){this._internalRoot=r}qu.prototype.render=ap.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=lr();M1(o,d,r,s,null,null)},qu.prototype.unmount=ap.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;M1(r.current,2,null,r,null,null),wu(),s[Lr]=null}};function qu(r){this._internalRoot=r}qu.prototype.unstable_scheduleHydration=function(r){if(r){var s=ci();r={blockedOn:null,target:r,priority:s};for(var o=0;o<ws.length&&s!==0&&s<ws[o].priority;o++);ws.splice(o,0,r),o===0&&B1(r)}};var F1=t.version;if(F1!=="19.2.7")throw Error(i(527,F1,"19.2.7"));P.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var Jk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hu.isDisabled&&Hu.supportsFiber)try{nt=Hu.inject(Jk),xt=Hu}catch{}}return No.createRoot=function(r,s){if(!l(r))throw Error(i(299));var o=!1,d="",m=Q0,x=W0,w=J0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=T1(r,1,!1,null,null,o,d,null,m,x,w,U1),r[Lr]=s.current,Fh(r),new ap(s)},No.hydrateRoot=function(r,s,o){if(!l(r))throw Error(i(299));var d=!1,m="",x=Q0,w=W0,C=J0,q=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(C=o.onRecoverableError),o.formState!==void 0&&(q=o.formState)),s=T1(r,1,!0,s,o??null,d,m,q,x,w,C,U1),s.context=A1(null),o=s.current,d=lr(),d=qr(d),m=ls(d),m.callback=null,os(o,m,d),o=d,s.current.lanes=o,mt(s,o),Zr(s),r[Lr]=s.current,Fh(r),new qu(s)},No.version="19.2.7",No}var K1;function cj(){if(K1)return cp.exports;K1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),cp.exports=oj(),cp.exports}var uj=cj();const eb=e=>{let t;const n=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},l=()=>t,f={setState:i,getState:l,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,l,f);return f},dj=(e=>e?eb(e):eb),fj=e=>e;function hj(e,t=fj){const n=Iu.useSyncExternalStore(e.subscribe,Iu.useCallback(()=>t(e.getState()),[e,t]),Iu.useCallback(()=>t(e.getInitialState()),[e,t]));return Iu.useDebugValue(n),n}const tb=e=>{const t=dj(e),n=i=>hj(t,i);return Object.assign(n,t),n},pj=(e=>e?tb(e):tb),fm="companion_auth_token";function nb(){return typeof window>"u"?null:localStorage.getItem(fm)||null}const mj=e=>({authToken:nb(),isAuthenticated:nb()!==null,setAuthToken:t=>{localStorage.setItem(fm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(fm),e({authToken:null,isAuthenticated:!1})}});function qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function gj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function xj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function vj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function bj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const yj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:vj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:xj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:bj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const l=new Map(n.messages);return l.has(t.session_id)||l.set(t.session_id,[]),{sessions:i,messages:l}}),updateSession:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c&&l.set(t,{...c,...n}),{sessions:l}}),removeSession:t=>e(n=>{const i=qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:qt(n.sessions,t),connectionStatus:qt(n.connectionStatus,t),cliConnected:qt(n.cliConnected,t),cliReconnecting:qt(n.cliReconnecting,t),sessionStatus:qt(n.sessionStatus,t),previousPermissionMode:qt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:gj(n.recentlyRenamed,t),mcpServers:qt(n.mcpServers,t),prStatus:qt(n.prStatus,t),linkedLinearIssues:qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(l=>l.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:qt(n.messages,t),streaming:qt(n.streaming,t),streamingStartedAt:qt(n.streamingStartedAt,t),streamingOutputTokens:qt(n.streamingOutputTokens,t),pendingPermissions:qt(n.pendingPermissions,t),aiResolvedPermissions:qt(n.aiResolvedPermissions,t),sessionTasks:qt(n.sessionTasks,t),changedFilesTick:qt(n.changedFilesTick,t),gitChangedFilesCount:qt(n.gitChangedFilesCount,t),sessionProcesses:qt(n.sessionProcesses,t),toolProgress:qt(n.toolProgress,t),toolActivity:qt(n.toolActivity,t),diffPanelSelectedFile:qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const l=new Map(i.connectionStatus);return l.set(t,n),{connectionStatus:l}}),setCliConnected:(t,n)=>e(i=>{const l=new Map(i.cliConnected);return l.set(t,n),{cliConnected:l}}),setCliReconnecting:(t,n)=>e(i=>{const l=new Map(i.cliReconnecting);return n?l.set(t,!0):l.delete(t),{cliReconnecting:l}}),setSessionStatus:(t,n)=>e(i=>{const l=new Map(i.sessionStatus);return l.set(t,n),{sessionStatus:l}}),setPreviousPermissionMode:(t,n)=>e(i=>{const l=new Map(i.previousPermissionMode);return l.set(t,n),{previousPermissionMode:l}}),setSessionName:(t,n)=>e(i=>{const l=new Map(i.sessionNames);return l.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(l.entries()))),{sessionNames:l}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const l=new Map(i.prStatus);return l.set(t,n),{prStatus:l}}),setLinkedLinearIssue:(t,n)=>e(i=>{const l=new Map(i.linkedLinearIssues);return n?l.set(t,n):l.delete(t),{linkedLinearIssues:l}}),setMcpServers:(t,n)=>e(i=>{const l=new Map(i.mcpServers);return l.set(t,n),{mcpServers:l}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c?(l.set(t,{...c,...n}),{sessions:l}):{}})}),_j=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const l=i.messages.get(t)||[];if(n.id&&l.some(u=>u.id===n.id))return i;const c=new Map(i.messages);return c.set(t,[...l,n]),{messages:c}}),setMessages:(t,n)=>e(i=>{const l=new Map(i.messages);return l.set(t,n),{messages:l}}),updateLastAssistantMessage:(t,n)=>e(i=>{const l=new Map(i.messages),c=[...l.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return l.set(t,c),{messages:l}}),setStreaming:(t,n)=>e(i=>{const l=new Map(i.streaming);return n===null?l.delete(t):l.set(t,n),{streaming:l}}),setStreamingStats:(t,n)=>e(i=>{const l=new Map(i.streamingStartedAt),c=new Map(i.streamingOutputTokens);return n===null?(l.delete(t),c.delete(t)):(n.startedAt!==void 0&&l.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:l,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(i=>{const l=new Map(i.lastActivityAt);return l.set(t,n),{lastActivityAt:l}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const l=new Map(i.promptSuggestions);return l.set(t,n),{promptSuggestions:l}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),wj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=new Map(l.get(t)||[]);return c.set(n.request_id,n),l.set(t,c),{pendingPermissions:l}}),removePermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}return{pendingPermissions:l}}),addAiResolvedPermission:(t,n)=>e(i=>{const l=new Map(i.aiResolvedPermissions),c=[...l.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),l.set(t,c),{aiResolvedPermissions:l}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),Sj=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const l=new Map(i.sessionTasks),c=[...l.get(t)||[],n];return l.set(t,c),{sessionTasks:l}}),setTasks:(t,n)=>e(i=>{const l=new Map(i.sessionTasks);return l.set(t,n),{sessionTasks:l}}),updateTask:(t,n,i)=>e(l=>{const c=new Map(l.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const l=new Map(i.sessionProcesses),c=[...l.get(t)||[],n];return l.set(t,c),{sessionProcesses:l}}),updateProcess:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const l=new Map(i.sessionBackgroundAgents),c=[...l.get(t)||[],n];return l.set(t,c),{sessionBackgroundAgents:l}}),updateBackgroundAgent:(t,n,i)=>e(l=>{const c=new Map(l.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const l=new Map(i.gitChangedFilesCount);return l.set(t,n),{gitChangedFilesCount:l}}),setToolProgress:(t,n,i)=>e(l=>{const c=new Map(l.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const l=new Map(i.toolProgress);if(n){const c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}}else l.delete(t);return{toolProgress:l}}),setToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity);return n.length===0?l.delete(t):l.set(t,n),{toolActivity:l}}),addToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity),c=[...l.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return l.set(t,c),{toolActivity:l}}),updateToolActivity:(t,n,i)=>e(l=>{const c=new Map(l.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:c}})}),Vi=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],kj=Vi.map(e=>e.id),O5="cc-task-panel-config";function hm(){return{order:[...kj],enabled:Object.fromEntries(Vi.map(e=>[e.id,!0]))}}function jj(){if(typeof window>"u")return hm();try{const e=localStorage.getItem(O5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const l of Vi)n.has(l.id)||(t.order.push(l.id),t.enabled[l.id]=!0);const i=new Set(Vi.map(l=>l.id));return t.order=t.order.filter(l=>i.has(l)),t}}catch{}return hm()}function Vu(e){try{localStorage.setItem(O5,JSON.stringify(e))}catch{}}function Nj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function Cj(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Ej(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function B5(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}const Tj=e=>({darkMode:Nj(),notificationSound:Cj(),notificationDesktop:Ej(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:jj(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:B5(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Vu(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<=0)return n;[i[l-1],i[l]]=[i[l],i[l-1]];const c={...n.taskPanelConfig,order:i};return Vu(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<0||l>=i.length-1)return n;[i[l],i[l+1]]=[i[l+1],i[l]];const c={...n.taskPanelConfig,order:i};return Vu(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=hm();Vu(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),l=(i.get(t)??0)+1;return i.set(t,l),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const l=new Map(i.diffPanelSelectedFile);return n?l.set(t,n):l.delete(t),{diffPanelSelectedFile:l}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function P5(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const Aj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",l=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?l:l+1,f=i?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`:l===1?"Terminal":`Terminal ${l}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),l=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:l,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function Mj(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const Rj=e=>({updateInfo:null,updateDismissedVersion:Mj(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],l=i.findIndex(c=>c.step===t.step);if(l>=0){const c=[...i];return c[l]=t,{creationProgress:c}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),W=pj((...e)=>({...mj(...e),...yj(...e),..._j(...e),...wj(...e),...Sj(...e),...Tj(...e),...Aj(...e),...Rj(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:B5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Lj=Object.freeze(Object.defineProperty({__proto__:null,useStore:W},Symbol.toStringTag,{value:"Module"})),rb=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],ib=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function sb(){const e=rb[Math.floor(Math.random()*rb.length)],t=ib[Math.floor(Math.random()*ib.length)];return`${e} ${t}`}function $5(e){for(let t=0;t<100;t++){const n=sb();if(!e.has(n))return n}return sb()}let hp=null;function Dj(){return hp||(hp=new AudioContext),hp}function zj(){try{const e=Dj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const l=e.createOscillator(),c=e.createGain();l.type="sine",l.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),l.connect(c),c.connect(e.destination),l.start(t+.15),l.stop(t+.5)}catch{}}class U5{diff(t,n,i={}){let l;typeof i=="function"?(l=i,i={}):"callback"in i&&(l=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(c,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,l)}diffWithOptionsObj(t,n,i,l){var c;const u=T=>{if(T=this.postProcess(T,i),l){setTimeout(function(){l(T)},0);return}else return T},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,i);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let k=-1/0,E=1/0;const j=()=>{for(let T=Math.max(k,-p);T<=Math.min(E,p);T+=2){let N;const D=b[T-1],z=b[T+1];D&&(b[T-1]=void 0);let L=!1;if(z){const U=z.oldPos-T;L=z&&0<=U&&U<f}const H=D&&D.oldPos+1<h;if(!L&&!H){b[T]=void 0;continue}if(!H||L&&D.oldPos<z.oldPos?N=this.addToPath(z,!0,!1,0,i):N=this.addToPath(D,!1,!0,1,i),_=this.extractCommon(N,n,t,T,i),N.oldPos+1>=h&&_+1>=f)return u(this.buildValues(N.lastComponent,n,t))||!0;b[T]=N,N.oldPos+1>=h&&(E=Math.min(E,T-1)),_+1>=f&&(k=Math.max(k,T+1))}p++};if(l)(function T(){setTimeout(function(){if(p>g||Date.now()>y)return l(void 0);j()||T()},0)})();else for(;p<=g&&Date.now()<=y;){const T=j();if(T)return T}}addToPath(t,n,i,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,l,c){const u=n.length,f=i.length;let h=t.oldPos,p=h-l,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let f=0,h=0,p=0;for(;f<u;f++){const g=l[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=i[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return l}}function ab(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function lb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function pm(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function mm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Co(e,t){return pm(e,t,"")}function Gu(e,t){return mm(e,t,"")}function ob(e,t){return t.slice(0,Oj(e,t))}function Oj(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const l=Array(i);let c=0;l[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?l[u]=l[c]:l[u]=c;c>0&&t[u]!=t[c];)c=l[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=l[c];e[u]==t[c]&&c++}return c}function F5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const l=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(l)?n[n.length-1]+=l:n.push(l)}return n}function gm(e,t){if(t)return Wo(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function fl(e,t){if(t)return Wo(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Wo(e,t){if(!t)return[fl(e),gm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=F5(e,t),i=n[0],l=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(l)?l:"";return[c,u]}const cb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Bj=new RegExp(`[${cb}]+|\\s+|[^${cb}]`,"ug");class Pj extends U5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=F5(t,u)}else i=t.match(Bj)||[];const l=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?l.push(u):l.push(l.pop()+u):c!=null&&/\s/.test(c)?l[l.length-1]==c?l.push(l.pop()+u):l.push(c+u):l.push(u),c=u}),l}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,l=null,c=null;return t.forEach(u=>{u.added?l=u:u.removed?c=u:((l||c)&&ub(i,c,l,u,n.intlSegmenter),i=u,l=null,c=null)}),(l||c)&&ub(i,c,l,null,n.intlSegmenter),t}}const $j=new Pj;function Uj(e,t,n){return $j.diff(e,t,n)}function ub(e,t,n,i,l){if(t&&n){const[c,u]=Wo(t.value,l),[f,h]=Wo(n.value,l);if(e){const p=ab(c,f);e.value=mm(e.value,f,p),t.value=Co(t.value,p),n.value=Co(n.value,p)}if(i){const p=lb(u,h);i.value=pm(i.value,h,p),t.value=Gu(t.value,p),n.value=Gu(n.value,p)}}else if(n){if(e){const c=fl(n.value,l);n.value=n.value.substring(c.length)}if(i){const c=fl(i.value,l);i.value=i.value.substring(c.length)}}else if(e&&i){const c=fl(i.value,l),[u,f]=Wo(t.value,l),h=ab(c,u);t.value=Co(t.value,h);const p=lb(Co(c,h),f);t.value=Gu(t.value,p),i.value=pm(i.value,c,p),e.value=mm(e.value,c,c.slice(0,c.length-p.length))}else if(i){const c=fl(i.value,l),u=gm(t.value,l),f=ob(u,c);t.value=Gu(t.value,f)}else if(e){const c=gm(e.value,l),u=fl(t.value,l),f=ob(c,u);t.value=Co(t.value,f)}}class Fj extends U5{constructor(){super(...arguments),this.tokenize=Hj}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
48
+ `+d.stack}}var xn=Object.prototype.hasOwnProperty,hn=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,st=e.unstable_requestPaint,qe=e.unstable_now,hr=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,xe=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,fe=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,Ve=e.log,tt=e.unstable_setDisableYieldValue,nt=null,xt=null;function nn(r){if(typeof Ve=="function"&&tt(r),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(nt,r)}catch{}}var ut=Math.clz32?Math.clz32:Fr,vn=Math.log,Sn=Math.LN2;function Fr(r){return r>>>=0,r===0?32:31-(vn(r)/Sn|0)|0}var Mr=256,Rr=262144,ne=4194304;function he(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ge(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var C=d&134217727;return C!==0?(d=C&~x,d!==0?m=he(d):(w&=C,w!==0?m=he(w):o||(o=C&~r,o!==0&&(m=he(o))))):(C=d&~x,C!==0?m=he(C):w!==0?m=he(w):o||(o=d&~r,o!==0&&(m=he(o)))),m===0?0:s!==0&&s!==m&&(s&x)===0&&(x=m&-m,o=s&-s,x>=o||x===32&&(o&4194048)!==0)?s:m}function Ye(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function _t(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rn(){var r=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),r}function pr(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function mt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function qn(r,s,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var C=r.entanglements,q=r.expirationTimes,ee=r.hiddenUpdates;for(o=w&~o;0<o;){var oe=31-ut(o),ue=1<<oe;C[oe]=0,q[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var se=te[oe];se!==null&&(se.lane&=-536870913)}o&=~ue}d!==0&&zs(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~s))}function zs(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-ut(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function Ll(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-ut(o),m=1<<d;m&s|r[d]&s&&(r[d]|=s),o&=~m}}function ba(r,s){var o=s&-s;return o=(o&42)!==0?1:qr(o),(o&(r.suspendedLanes|s))!==0?0:o}function qr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ya(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ci(){var r=P.p;return r!==0?r:(r=window.event,r===void 0?32:z1(r.type))}function Ec(r,s){var o=P.p;try{return P.p=r,s()}finally{P.p=o}}var Hr=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Hr,pn="__reactProps$"+Hr,Lr="__reactContainer$"+Hr,Yi="__reactEvents$"+Hr,Tc="__reactListeners$"+Hr,ui="__reactHandles$"+Hr,Ac="__reactResources$"+Hr,di="__reactMarker$"+Hr;function Qi(r){delete r[Gt],delete r[pn],delete r[Yi],delete r[Tc],delete r[ui]}function bn(r){var s=r[Gt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Lr]||o[Gt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=b1(r);r!==null;){if(o=r[Gt])return o;r=b1(r)}return s}r=o,o=r.parentNode}return null}function Ir(r){if(r=r[Gt]||r[Lr]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function fi(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Vr(r){var s=r[Ac];return s||(s=r[Ac]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Zt(r){r[di]=!0}var Yt=new Set,Mc={};function Gr(r,s){Wi(r,s),Wi(r+"Capture",s)}function Wi(r,s){for(Mc[r]=s,r=0;r<s.length;r++)Yt.add(s[r])}var lf=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Rc={},_a={};function Lc(r){return xn.call(_a,r)?!0:xn.call(Rc,r)?!1:lf.test(r)?_a[r]=!0:(Rc[r]=!0,!1)}function mr(r,s,o){if(Lc(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function Ji(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function sn(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function Kt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function wa(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function of(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Sa(r){if(!r._valueTracker){var s=wa(r)?"checked":"value";r._valueTracker=of(r,s,""+r[s])}}function Dc(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=wa(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function Xi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var zc=/[\n"\\]/g;function Hn(r){return r.replace(zc,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Dl(r,s,o,d,m,x,w,C){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Kt(s)):r.value!==""+Kt(s)&&(r.value=""+Kt(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?zl(r,w,Kt(s)):o!=null?zl(r,w,Kt(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?r.name=""+Kt(C):r.removeAttribute("name")}function Oc(r,s,o,d,m,x,w,C){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),s!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||s!=null)){Sa(r);return}o=o!=null?""+Kt(o):"",s=s!=null?""+Kt(s):o,C||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=C?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Sa(r)}function zl(r,s,o){s==="number"&&Xi(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function hi(r,s,o,d){if(r=r.options,s){s={};for(var m=0;m<o.length;m++)s["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=s.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Kt(o),s=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function Ol(r,s,o){if(s!=null&&(s=""+Kt(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Kt(o):""}function Bc(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(I(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Kt(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),Sa(r)}function Zi(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var Pc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Os(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||Pc.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Bl(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in s)d=s[m],s.hasOwnProperty(m)&&o[m]!==d&&Os(r,m,d)}else for(var x in s)s.hasOwnProperty(x)&&Os(r,x,s[x])}function Pl(r){if(r.indexOf("-")===-1)return!1;switch(r){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 cf=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uf=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ka(r){return uf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Dr(){}var $l=null;function ja(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var pi=null,mi=null;function Y(r){var s=Ir(r);if(s&&(r=s.stateNode)){var o=r[pn]||null;e:switch(r=s.stateNode,s.type){case"input":if(Dl(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Hn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var m=d[pn]||null;if(!m)throw Error(i(90));Dl(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&Dc(d)}break e;case"textarea":Ol(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&hi(r,!!o.multiple,s,!1)}}}var de=!1;function Xe(r,s,o){if(de)return r(s,o);de=!0;try{var d=r(s);return d}finally{if(de=!1,(pi!==null||mi!==null)&&(wu(),pi&&(s=pi,r=mi,mi=pi=null,Y(s),r)))for(s=0;s<r.length;s++)Y(r[s])}}function at(r,s){var o=r.stateNode;if(o===null)return null;var d=o[pn]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var We=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),He=!1;if(We)try{var yn={};Object.defineProperty(yn,"passive",{get:function(){He=!0}}),window.addEventListener("test",yn,yn),window.removeEventListener("test",yn,yn)}catch{He=!1}var er=null,Ki=null,gi=null;function Mn(){if(gi)return gi;var r,s=Ki,o=s.length,d,m="value"in er?er.value:er.textContent,x=m.length;for(r=0;r<o&&s[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&s[o-d]===m[x-d];d++);return gi=m.slice(r,1<d?1-d:void 0)}function Bs(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Na(){return!0}function $c(){return!1}function Rn(r){function s(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var C in r)r.hasOwnProperty(C)&&(o=r[C],this[C]=o?o(x):x[C]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Na:$c,this.isPropagationStopped=$c,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Na)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Na)},persist:function(){},isPersistent:Na}),s}var Yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ul=Rn(Yr),es=v({},Yr,{view:0,detail:0}),Uc=Rn(es),Ca,Qr,ts,Ps=v({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ff,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==ts&&(ts&&r.type==="mousemove"?(Ca=r.screenX-ts.screenX,Qr=r.screenY-ts.screenY):Qr=Ca=0,ts=r),Ca)},movementY:function(r){return"movementY"in r?r.movementY:Qr}}),$s=Rn(Ps),X2=v({},Ps,{dataTransfer:0}),Z2=Rn(X2),K2=v({},es,{relatedTarget:0}),df=Rn(K2),eS=v({},Yr,{animationName:0,elapsedTime:0,pseudoElement:0}),tS=Rn(eS),nS=v({},Yr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),rS=Rn(nS),iS=v({},Yr,{data:0}),mx=Rn(iS),sS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aS={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"},lS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oS(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=lS[r])?!!s[r]:!1}function ff(){return oS}var cS=v({},es,{key:function(r){if(r.key){var s=sS[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=Bs(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?aS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ff,charCode:function(r){return r.type==="keypress"?Bs(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Bs(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),uS=Rn(cS),dS=v({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gx=Rn(dS),fS=v({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ff}),hS=Rn(fS),pS=v({},Yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),mS=Rn(pS),gS=v({},Ps,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),xS=Rn(gS),vS=v({},Yr,{newState:0,oldState:0}),bS=Rn(vS),yS=[9,13,27,32],hf=We&&"CompositionEvent"in window,Fl=null;We&&"documentMode"in document&&(Fl=document.documentMode);var _S=We&&"TextEvent"in window&&!Fl,xx=We&&(!hf||Fl&&8<Fl&&11>=Fl),vx=" ",bx=!1;function yx(r,s){switch(r){case"keyup":return yS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _x(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ea=!1;function wS(r,s){switch(r){case"compositionend":return _x(s);case"keypress":return s.which!==32?null:(bx=!0,vx);case"textInput":return r=s.data,r===vx&&bx?null:r;default:return null}}function SS(r,s){if(Ea)return r==="compositionend"||!hf&&yx(r,s)?(r=Mn(),gi=Ki=er=null,Ea=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return xx&&s.locale!=="ko"?null:s.data;default:return null}}var kS={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 wx(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!kS[r.type]:s==="textarea"}function Sx(r,s,o,d){pi?mi?mi.push(d):mi=[d]:pi=d,s=Tu(s,"onChange"),0<s.length&&(o=new Ul("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var ql=null,Hl=null;function jS(r){s1(r,0)}function Fc(r){var s=fi(r);if(Dc(s))return r}function kx(r,s){if(r==="change")return s}var jx=!1;if(We){var pf;if(We){var mf="oninput"in document;if(!mf){var Nx=document.createElement("div");Nx.setAttribute("oninput","return;"),mf=typeof Nx.oninput=="function"}pf=mf}else pf=!1;jx=pf&&(!document.documentMode||9<document.documentMode)}function Cx(){ql&&(ql.detachEvent("onpropertychange",Ex),Hl=ql=null)}function Ex(r){if(r.propertyName==="value"&&Fc(Hl)){var s=[];Sx(s,Hl,r,ja(r)),Xe(jS,s)}}function NS(r,s,o){r==="focusin"?(Cx(),ql=s,Hl=o,ql.attachEvent("onpropertychange",Ex)):r==="focusout"&&Cx()}function CS(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Fc(Hl)}function ES(r,s){if(r==="click")return Fc(s)}function TS(r,s){if(r==="input"||r==="change")return Fc(s)}function AS(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var tr=typeof Object.is=="function"?Object.is:AS;function Il(r,s){if(tr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!xn.call(s,m)||!tr(r[m],s[m]))return!1}return!0}function Tx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ax(r,s){var o=Tx(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Tx(o)}}function Mx(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Mx(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Rx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Xi(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=Xi(r.document)}return s}function gf(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var MS=We&&"documentMode"in document&&11>=document.documentMode,Ta=null,xf=null,Vl=null,vf=!1;function Lx(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;vf||Ta==null||Ta!==Xi(d)||(d=Ta,"selectionStart"in d&&gf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Vl&&Il(Vl,d)||(Vl=d,d=Tu(xf,"onSelect"),0<d.length&&(s=new Ul("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=Ta)))}function Us(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var Aa={animationend:Us("Animation","AnimationEnd"),animationiteration:Us("Animation","AnimationIteration"),animationstart:Us("Animation","AnimationStart"),transitionrun:Us("Transition","TransitionRun"),transitionstart:Us("Transition","TransitionStart"),transitioncancel:Us("Transition","TransitionCancel"),transitionend:Us("Transition","TransitionEnd")},bf={},Dx={};We&&(Dx=document.createElement("div").style,"AnimationEvent"in window||(delete Aa.animationend.animation,delete Aa.animationiteration.animation,delete Aa.animationstart.animation),"TransitionEvent"in window||delete Aa.transitionend.transition);function Fs(r){if(bf[r])return bf[r];if(!Aa[r])return r;var s=Aa[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Dx)return bf[r]=s[o];return r}var zx=Fs("animationend"),Ox=Fs("animationiteration"),Bx=Fs("animationstart"),RS=Fs("transitionrun"),LS=Fs("transitionstart"),DS=Fs("transitioncancel"),Px=Fs("transitionend"),$x=new Map,yf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yf.push("scrollEnd");function zr(r,s){$x.set(r,s),Gr(s,[r])}var qc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},gr=[],Ma=0,_f=0;function Hc(){for(var r=Ma,s=_f=Ma=0;s<r;){var o=gr[s];gr[s++]=null;var d=gr[s];gr[s++]=null;var m=gr[s];gr[s++]=null;var x=gr[s];if(gr[s++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Ux(o,m,x)}}function Ic(r,s,o,d){gr[Ma++]=r,gr[Ma++]=s,gr[Ma++]=o,gr[Ma++]=d,_f|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function wf(r,s,o,d){return Ic(r,s,o,d),Vc(r)}function qs(r,s){return Ic(r,null,null,s),Vc(r)}function Ux(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&s!==null&&(m=31-ut(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=o|536870912),x):null}function Vc(r){if(50<po)throw po=0,Mh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Ra={};function zS(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(r,s,o,d){return new zS(r,s,o,d)}function Sf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function xi(r,s){var o=r.alternate;return o===null?(o=nr(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Fx(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Gc(r,s,o,d,m,x){var w=0;if(d=r,typeof r=="function")Sf(r)&&(w=1);else if(typeof r=="string")w=Uk(r,o,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case V:return r=nr(31,o,s,m),r.elementType=V,r.lanes=x,r;case k:return Hs(o.children,m,x,s);case E:w=8,m|=24;break;case j:return r=nr(12,o,s,m|2),r.elementType=j,r.lanes=x,r;case z:return r=nr(13,o,s,m),r.elementType=z,r.lanes=x,r;case L:return r=nr(19,o,s,m),r.elementType=L,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case N:w=10;break e;case T:w=9;break e;case D:w=11;break e;case H:w=14;break e;case U:w=16,d=null;break e}w=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=nr(w,o,s,m),s.elementType=r,s.type=d,s.lanes=x,s}function Hs(r,s,o,d){return r=nr(7,r,d,s),r.lanes=o,r}function kf(r,s,o){return r=nr(6,r,null,s),r.lanes=o,r}function qx(r){var s=nr(18,null,null,0);return s.stateNode=r,s}function jf(r,s,o){return s=nr(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var Hx=new WeakMap;function xr(r,s){if(typeof r=="object"&&r!==null){var o=Hx.get(r);return o!==void 0?o:(s={value:r,source:s,stack:it(s)},Hx.set(r,s),s)}return{value:r,source:s,stack:it(s)}}var La=[],Da=0,Yc=null,Gl=0,vr=[],br=0,ns=null,Wr=1,Jr="";function vi(r,s){La[Da++]=Gl,La[Da++]=Yc,Yc=r,Gl=s}function Ix(r,s,o){vr[br++]=Wr,vr[br++]=Jr,vr[br++]=ns,ns=r;var d=Wr;r=Jr;var m=32-ut(d)-1;d&=~(1<<m),o+=1;var x=32-ut(s)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Wr=1<<32-ut(s)+m|o<<m|d,Jr=x+r}else Wr=1<<x|o<<m|d,Jr=r}function Nf(r){r.return!==null&&(vi(r,1),Ix(r,1,0))}function Cf(r){for(;r===Yc;)Yc=La[--Da],La[Da]=null,Gl=La[--Da],La[Da]=null;for(;r===ns;)ns=vr[--br],vr[br]=null,Jr=vr[--br],vr[br]=null,Wr=vr[--br],vr[br]=null}function Vx(r,s){vr[br++]=Wr,vr[br++]=Jr,vr[br++]=ns,Wr=s.id,Jr=s.overflow,ns=r}var kn=null,Bt=null,ht=!1,rs=null,yr=!1,Ef=Error(i(519));function is(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yl(xr(s,r)),Ef}function Gx(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Gt]=r,s[pn]=d,o){case"dialog":ot("cancel",s),ot("close",s);break;case"iframe":case"object":case"embed":ot("load",s);break;case"video":case"audio":for(o=0;o<go.length;o++)ot(go[o],s);break;case"source":ot("error",s);break;case"img":case"image":case"link":ot("error",s),ot("load",s);break;case"details":ot("toggle",s);break;case"input":ot("invalid",s),Oc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ot("invalid",s);break;case"textarea":ot("invalid",s),Bc(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||c1(s.textContent,o)?(d.popover!=null&&(ot("beforetoggle",s),ot("toggle",s)),d.onScroll!=null&&ot("scroll",s),d.onScrollEnd!=null&&ot("scrollend",s),d.onClick!=null&&(s.onclick=Dr),s=!0):s=!1,s||is(r,!0)}function Yx(r){for(kn=r.return;kn;)switch(kn.tag){case 5:case 31:case 13:yr=!1;return;case 27:case 3:yr=!0;return;default:kn=kn.return}}function za(r){if(r!==kn)return!1;if(!ht)return Yx(r),ht=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Gh(r.type,r.memoizedProps)),o=!o),o&&Bt&&is(r),Yx(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Bt=v1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Bt=v1(r)}else s===27?(s=Bt,vs(r.type)?(r=Xh,Xh=null,Bt=r):Bt=s):Bt=kn?wr(r.stateNode.nextSibling):null;return!0}function Is(){Bt=kn=null,ht=!1}function Tf(){var r=rs;return r!==null&&(Yn===null?Yn=r:Yn.push.apply(Yn,r),rs=null),r}function Yl(r){rs===null?rs=[r]:rs.push(r)}var Af=B(null),Vs=null,bi=null;function ss(r,s,o){M(Af,s._currentValue),s._currentValue=o}function yi(r){r._currentValue=Af.current,Z(Af)}function Mf(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Rf(r,s,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var C=x;x=m;for(var q=0;q<s.length;q++)if(C.context===s[q]){x.lanes|=o,C=x.alternate,C!==null&&(C.lanes|=o),Mf(x.return,o,r),d||(w=null);break e}x=C.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),Mf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Oa(r,s,o,d){r=null;for(var m=s,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var C=m.type;tr(m.pendingProps.value,w.value)||(r!==null?r.push(C):r=[C])}}else if(m===Te.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(_o):r=[_o])}m=m.return}r!==null&&Rf(s,r,o,d),s.flags|=262144}function Qc(r){for(r=r.firstContext;r!==null;){if(!tr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Gs(r){Vs=r,bi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function jn(r){return Qx(Vs,r)}function Wc(r,s){return Vs===null&&Gs(r),Qx(r,s)}function Qx(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},bi===null){if(r===null)throw Error(i(308));bi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else bi=bi.next=s;return o}var OS=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},BS=e.unstable_scheduleCallback,PS=e.unstable_NormalPriority,an={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lf(){return{controller:new OS,data:new Map,refCount:0}}function Ql(r){r.refCount--,r.refCount===0&&BS(PS,function(){r.controller.abort()})}var Wl=null,Df=0,Ba=0,Pa=null;function $S(r,s){if(Wl===null){var o=Wl=[];Df=0,Ba=Bh(),Pa={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Df++,s.then(Wx,Wx),s}function Wx(){if(--Df===0&&Wl!==null){Pa!==null&&(Pa.status="fulfilled");var r=Wl;Wl=null,Ba=0,Pa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function US(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<o.length;m++)(0,o[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var Jx=$.S;$.S=function(r,s){Lv=qe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&$S(r,s),Jx!==null&&Jx(r,s)};var Ys=B(null);function zf(){var r=Ys.current;return r!==null?r:Tt.pooledCache}function Jc(r,s){s===null?M(Ys,Ys.current):M(Ys,s.pool)}function Xx(){var r=zf();return r===null?null:{parent:an._currentValue,pool:r}}var $a=Error(i(460)),Of=Error(i(474)),Xc=Error(i(542)),Zc={then:function(){}};function Zx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Kx(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(Dr,Dr),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,t0(r),r;default:if(typeof s.status=="string")s.then(Dr,Dr);else{if(r=Tt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=d}},function(d){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,t0(r),r}throw Ws=s,$a}}function Qs(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ws=o,$a):o}}var Ws=null;function e0(){if(Ws===null)throw Error(i(459));var r=Ws;return Ws=null,r}function t0(r){if(r===$a||r===Xc)throw Error(i(483))}var Ua=null,Jl=0;function Kc(r){var s=Jl;return Jl+=1,Ua===null&&(Ua=[]),Kx(Ua,r,s)}function Xl(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function eu(r,s){throw s.$$typeof===y?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function n0(r){function s(J,G){if(r){var K=J.deletions;K===null?(J.deletions=[G],J.flags|=16):K.push(G)}}function o(J,G){if(!r)return null;for(;G!==null;)s(J,G),G=G.sibling;return null}function d(J){for(var G=new Map;J!==null;)J.key!==null?G.set(J.key,J):G.set(J.index,J),J=J.sibling;return G}function m(J,G){return J=xi(J,G),J.index=0,J.sibling=null,J}function x(J,G,K){return J.index=K,r?(K=J.alternate,K!==null?(K=K.index,K<G?(J.flags|=67108866,G):K):(J.flags|=67108866,G)):(J.flags|=1048576,G)}function w(J){return r&&J.alternate===null&&(J.flags|=67108866),J}function C(J,G,K,ce){return G===null||G.tag!==6?(G=kf(K,J.mode,ce),G.return=J,G):(G=m(G,K),G.return=J,G)}function q(J,G,K,ce){var Be=K.type;return Be===k?oe(J,G,K.props.children,ce,K.key):G!==null&&(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Qs(Be)===G.type)?(G=m(G,K.props),Xl(G,K),G.return=J,G):(G=Gc(K.type,K.key,K.props,null,J.mode,ce),Xl(G,K),G.return=J,G)}function ee(J,G,K,ce){return G===null||G.tag!==4||G.stateNode.containerInfo!==K.containerInfo||G.stateNode.implementation!==K.implementation?(G=jf(K,J.mode,ce),G.return=J,G):(G=m(G,K.children||[]),G.return=J,G)}function oe(J,G,K,ce,Be){return G===null||G.tag!==7?(G=Hs(K,J.mode,ce,Be),G.return=J,G):(G=m(G,K),G.return=J,G)}function ue(J,G,K){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=kf(""+G,J.mode,K),G.return=J,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return K=Gc(G.type,G.key,G.props,null,J.mode,K),Xl(K,G),K.return=J,K;case _:return G=jf(G,J.mode,K),G.return=J,G;case U:return G=Qs(G),ue(J,G,K)}if(I(G)||A(G))return G=Hs(G,J.mode,K,null),G.return=J,G;if(typeof G.then=="function")return ue(J,Kc(G),K);if(G.$$typeof===N)return ue(J,Wc(J,G),K);eu(J,G)}return null}function te(J,G,K,ce){var Be=G!==null?G.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Be!==null?null:C(J,G,""+K,ce);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return K.key===Be?q(J,G,K,ce):null;case _:return K.key===Be?ee(J,G,K,ce):null;case U:return K=Qs(K),te(J,G,K,ce)}if(I(K)||A(K))return Be!==null?null:oe(J,G,K,ce,null);if(typeof K.then=="function")return te(J,G,Kc(K),ce);if(K.$$typeof===N)return te(J,G,Wc(J,K),ce);eu(J,K)}return null}function se(J,G,K,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return J=J.get(K)||null,C(G,J,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return J=J.get(ce.key===null?K:ce.key)||null,q(G,J,ce,Be);case _:return J=J.get(ce.key===null?K:ce.key)||null,ee(G,J,ce,Be);case U:return ce=Qs(ce),se(J,G,K,ce,Be)}if(I(ce)||A(ce))return J=J.get(K)||null,oe(G,J,ce,Be,null);if(typeof ce.then=="function")return se(J,G,K,Kc(ce),Be);if(ce.$$typeof===N)return se(J,G,K,Wc(G,ce),Be);eu(G,ce)}return null}function Ee(J,G,K,ce){for(var Be=null,vt=null,Me=G,Ze=G=0,ft=null;Me!==null&&Ze<K.length;Ze++){Me.index>Ze?(ft=Me,Me=null):ft=Me.sibling;var bt=te(J,Me,K[Ze],ce);if(bt===null){Me===null&&(Me=ft);break}r&&Me&&bt.alternate===null&&s(J,Me),G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt,Me=ft}if(Ze===K.length)return o(J,Me),ht&&vi(J,Ze),Be;if(Me===null){for(;Ze<K.length;Ze++)Me=ue(J,K[Ze],ce),Me!==null&&(G=x(Me,G,Ze),vt===null?Be=Me:vt.sibling=Me,vt=Me);return ht&&vi(J,Ze),Be}for(Me=d(Me);Ze<K.length;Ze++)ft=se(Me,J,Ze,K[Ze],ce),ft!==null&&(r&&ft.alternate!==null&&Me.delete(ft.key===null?Ze:ft.key),G=x(ft,G,Ze),vt===null?Be=ft:vt.sibling=ft,vt=ft);return r&&Me.forEach(function(Ss){return s(J,Ss)}),ht&&vi(J,Ze),Be}function Ue(J,G,K,ce){if(K==null)throw Error(i(151));for(var Be=null,vt=null,Me=G,Ze=G=0,ft=null,bt=K.next();Me!==null&&!bt.done;Ze++,bt=K.next()){Me.index>Ze?(ft=Me,Me=null):ft=Me.sibling;var Ss=te(J,Me,bt.value,ce);if(Ss===null){Me===null&&(Me=ft);break}r&&Me&&Ss.alternate===null&&s(J,Me),G=x(Ss,G,Ze),vt===null?Be=Ss:vt.sibling=Ss,vt=Ss,Me=ft}if(bt.done)return o(J,Me),ht&&vi(J,Ze),Be;if(Me===null){for(;!bt.done;Ze++,bt=K.next())bt=ue(J,bt.value,ce),bt!==null&&(G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt);return ht&&vi(J,Ze),Be}for(Me=d(Me);!bt.done;Ze++,bt=K.next())bt=se(Me,J,Ze,bt.value,ce),bt!==null&&(r&&bt.alternate!==null&&Me.delete(bt.key===null?Ze:bt.key),G=x(bt,G,Ze),vt===null?Be=bt:vt.sibling=bt,vt=bt);return r&&Me.forEach(function(Xk){return s(J,Xk)}),ht&&vi(J,Ze),Be}function Ct(J,G,K,ce){if(typeof K=="object"&&K!==null&&K.type===k&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case b:e:{for(var Be=K.key;G!==null;){if(G.key===Be){if(Be=K.type,Be===k){if(G.tag===7){o(J,G.sibling),ce=m(G,K.props.children),ce.return=J,J=ce;break e}}else if(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Qs(Be)===G.type){o(J,G.sibling),ce=m(G,K.props),Xl(ce,K),ce.return=J,J=ce;break e}o(J,G);break}else s(J,G);G=G.sibling}K.type===k?(ce=Hs(K.props.children,J.mode,ce,K.key),ce.return=J,J=ce):(ce=Gc(K.type,K.key,K.props,null,J.mode,ce),Xl(ce,K),ce.return=J,J=ce)}return w(J);case _:e:{for(Be=K.key;G!==null;){if(G.key===Be)if(G.tag===4&&G.stateNode.containerInfo===K.containerInfo&&G.stateNode.implementation===K.implementation){o(J,G.sibling),ce=m(G,K.children||[]),ce.return=J,J=ce;break e}else{o(J,G);break}else s(J,G);G=G.sibling}ce=jf(K,J.mode,ce),ce.return=J,J=ce}return w(J);case U:return K=Qs(K),Ct(J,G,K,ce)}if(I(K))return Ee(J,G,K,ce);if(A(K)){if(Be=A(K),typeof Be!="function")throw Error(i(150));return K=Be.call(K),Ue(J,G,K,ce)}if(typeof K.then=="function")return Ct(J,G,Kc(K),ce);if(K.$$typeof===N)return Ct(J,G,Wc(J,K),ce);eu(J,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,G!==null&&G.tag===6?(o(J,G.sibling),ce=m(G,K),ce.return=J,J=ce):(o(J,G),ce=kf(K,J.mode,ce),ce.return=J,J=ce),w(J)):o(J,G)}return function(J,G,K,ce){try{Jl=0;var Be=Ct(J,G,K,ce);return Ua=null,Be}catch(Me){if(Me===$a||Me===Xc)throw Me;var vt=nr(29,Me,null,J.mode);return vt.lanes=ce,vt.return=J,vt}finally{}}}var Js=n0(!0),r0=n0(!1),as=!1;function Bf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ls(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function os(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(yt&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=Vc(r),Ux(r,null,o),s}return Ic(r,d,s,o),Vc(r)}function Zl(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Ll(r,o)}}function $f(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=s:x=x.next=s}else m=x=s;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var Uf=!1;function Kl(){if(Uf){var r=Pa;if(r!==null)throw r}}function eo(r,s,o,d){Uf=!1;var m=r.updateQueue;as=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,C=m.shared.pending;if(C!==null){m.shared.pending=null;var q=C,ee=q.next;q.next=null,w===null?x=ee:w.next=ee,w=q;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,C=oe.lastBaseUpdate,C!==w&&(C===null?oe.firstBaseUpdate=ee:C.next=ee,oe.lastBaseUpdate=q))}if(x!==null){var ue=m.baseState;w=0,oe=ee=q=null,C=x;do{var te=C.lane&-536870913,se=te!==C.lane;if(se?(dt&te)===te:(d&te)===te){te!==0&&te===Ba&&(Uf=!0),oe!==null&&(oe=oe.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Ee=r,Ue=C;te=s;var Ct=o;switch(Ue.tag){case 1:if(Ee=Ue.payload,typeof Ee=="function"){ue=Ee.call(Ct,ue,te);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ue.payload,te=typeof Ee=="function"?Ee.call(Ct,ue,te):Ee,te==null)break e;ue=v({},ue,te);break e;case 2:as=!0}}te=C.callback,te!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[te]:se.push(te))}else se={lane:te,tag:C.tag,payload:C.payload,callback:C.callback,next:null},oe===null?(ee=oe=se,q=ue):oe=oe.next=se,w|=te;if(C=C.next,C===null){if(C=m.shared.pending,C===null)break;se=C,C=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);oe===null&&(q=ue),m.baseState=q,m.firstBaseUpdate=ee,m.lastBaseUpdate=oe,x===null&&(m.shared.lanes=0),hs|=w,r.lanes=w,r.memoizedState=ue}}function i0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function s0(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)i0(o[r],s)}var Fa=B(null),tu=B(0);function a0(r,s){r=Ti,M(tu,r),M(Fa,s),Ti=r|s.baseLanes}function Ff(){M(tu,Ti),M(Fa,Fa.current)}function qf(){Ti=tu.current,Z(Fa),Z(tu)}var rr=B(null),_r=null;function cs(r){var s=r.alternate;M(en,en.current&1),M(rr,r),_r===null&&(s===null||Fa.current!==null||s.memoizedState!==null)&&(_r=r)}function Hf(r){M(en,en.current),M(rr,r),_r===null&&(_r=r)}function l0(r){r.tag===22?(M(en,en.current),M(rr,r),_r===null&&(_r=r)):us()}function us(){M(en,en.current),M(rr,rr.current)}function ir(r){Z(rr),_r===r&&(_r=null),Z(en)}var en=B(0);function nu(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Wh(o)||Jh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var _i=0,Je=null,jt=null,ln=null,ru=!1,qa=!1,Xs=!1,iu=0,to=0,Ha=null,FS=0;function Wt(){throw Error(i(321))}function If(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!tr(r[o],s[o]))return!1;return!0}function Vf(r,s,o,d,m,x){return _i=x,Je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$.H=r===null||r.memoizedState===null?I0:ah,Xs=!1,x=o(d,m),Xs=!1,qa&&(x=c0(s,o,d,m)),o0(r),x}function o0(r){$.H=io;var s=jt!==null&&jt.next!==null;if(_i=0,ln=jt=Je=null,ru=!1,to=0,Ha=null,s)throw Error(i(300));r===null||on||(r=r.dependencies,r!==null&&Qc(r)&&(on=!0))}function c0(r,s,o,d){Je=r;var m=0;do{if(qa&&(Ha=null),to=0,qa=!1,25<=m)throw Error(i(301));if(m+=1,ln=jt=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}$.H=V0,x=s(o,d)}while(qa);return x}function qS(){var r=$.H,s=r.useState()[0];return s=typeof s.then=="function"?no(s):s,r=r.useState()[0],(jt!==null?jt.memoizedState:null)!==r&&(Je.flags|=1024),s}function Gf(){var r=iu!==0;return iu=0,r}function Yf(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function Qf(r){if(ru){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ru=!1}_i=0,ln=jt=Je=null,qa=!1,to=iu=0,Ha=null}function Bn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Je.memoizedState=ln=r:ln=ln.next=r,ln}function tn(){if(jt===null){var r=Je.alternate;r=r!==null?r.memoizedState:null}else r=jt.next;var s=ln===null?Je.memoizedState:ln.next;if(s!==null)ln=s,jt=r;else{if(r===null)throw Je.alternate===null?Error(i(467)):Error(i(310));jt=r,r={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},ln===null?Je.memoizedState=ln=r:ln=ln.next=r}return ln}function su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function no(r){var s=to;return to+=1,Ha===null&&(Ha=[]),r=Kx(Ha,r,s),s=Je,(ln===null?s.memoizedState:ln.next)===null&&(s=s.alternate,$.H=s===null||s.memoizedState===null?I0:ah),r}function au(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return no(r);if(r.$$typeof===N)return jn(r)}throw Error(i(438,String(r)))}function Wf(r){var s=null,o=Je.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=Je.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=su(),Je.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=O;return s.index++,o}function wi(r,s){return typeof s=="function"?s(r):s}function lu(r){var s=tn();return Jf(s,jt,r)}function Jf(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}s.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{s=m.next;var C=w=null,q=null,ee=s,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(dt&ue)===ue:(_i&ue)===ue){var te=ee.revertLane;if(te===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Ba&&(oe=!0);else if((_i&te)===te){ee=ee.next,te===Ba&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(C=q=ue,w=x):q=q.next=ue,Je.lanes|=te,hs|=te;ue=ee.action,Xs&&o(x,ue),x=ee.hasEagerState?ee.eagerState:o(x,ue)}else te={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(C=q=te,w=x):q=q.next=te,Je.lanes|=ue,hs|=ue;ee=ee.next}while(ee!==null&&ee!==s);if(q===null?w=x:q.next=C,!tr(x,r.memoizedState)&&(on=!0,oe&&(o=Pa,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=q,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Xf(r){var s=tn(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=s.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);tr(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),o.lastRenderedState=x}return[x,d]}function u0(r,s,o){var d=Je,m=tn(),x=ht;if(x){if(o===void 0)throw Error(i(407));o=o()}else o=s();var w=!tr((jt||m).memoizedState,o);if(w&&(m.memoizedState=o,on=!0),m=m.queue,eh(h0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||ln!==null&&ln.memoizedState.tag&1){if(d.flags|=2048,Ia(9,{destroy:void 0},f0.bind(null,d,m,o,s),null),Tt===null)throw Error(i(349));x||(_i&127)!==0||d0(d,s,o)}return o}function d0(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=Je.updateQueue,s===null?(s=su(),Je.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function f0(r,s,o,d){s.value=o,s.getSnapshot=d,p0(s)&&m0(r)}function h0(r,s,o){return o(function(){p0(s)&&m0(r)})}function p0(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!tr(r,o)}catch{return!0}}function m0(r){var s=qs(r,2);s!==null&&Qn(s,r,2)}function Zf(r){var s=Bn();if(typeof r=="function"){var o=r;if(r=o(),Xs){nn(!0);try{o()}finally{nn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:r},s}function g0(r,s,o,d){return r.baseState=o,Jf(r,jt,typeof d=="function"?d:wi)}function HS(r,s,o,d,m){if(uu(r))throw Error(i(485));if(r=s.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};$.T!==null?o(!0):x.isTransition=!1,d(x),o=s.pending,o===null?(x.next=s.pending=x,x0(s,x)):(x.next=o.next,s.pending=o.next=x)}}function x0(r,s){var o=s.action,d=s.payload,m=r.state;if(s.isTransition){var x=$.T,w={};$.T=w;try{var C=o(m,d),q=$.S;q!==null&&q(w,C),v0(r,s,C)}catch(ee){Kf(r,s,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),$.T=x}}else try{x=o(m,d),v0(r,s,x)}catch(ee){Kf(r,s,ee)}}function v0(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){b0(r,s,d)},function(d){return Kf(r,s,d)}):b0(r,s,o)}function b0(r,s,o){s.status="fulfilled",s.value=o,y0(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,x0(r,o)))}function Kf(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,y0(s),s=s.next;while(s!==d)}r.action=null}function y0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function _0(r,s){return s}function w0(r,s){if(ht){var o=Tt.formState;if(o!==null){e:{var d=Je;if(ht){if(Bt){t:{for(var m=Bt,x=yr;m.nodeType!==8;){if(!x){m=null;break t}if(m=wr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Bt=wr(m.nextSibling),d=m.data==="F!";break e}}is(d)}d=!1}d&&(s=o[0])}}return o=Bn(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_0,lastRenderedState:s},o.queue=d,o=F0.bind(null,Je,d),d.dispatch=o,d=Zf(!1),x=sh.bind(null,Je,!1,d.queue),d=Bn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,o=HS.bind(null,Je,m,x,o),m.dispatch=o,d.memoizedState=r,[s,o,!1]}function S0(r){var s=tn();return k0(s,jt,r)}function k0(r,s,o){if(s=Jf(r,s,_0)[0],r=lu(wi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=no(s)}catch(w){throw w===$a?Xc:w}else d=s;s=tn();var m=s.queue,x=m.dispatch;return o!==s.memoizedState&&(Je.flags|=2048,Ia(9,{destroy:void 0},IS.bind(null,m,o),null)),[d,x,r]}function IS(r,s){r.action=s}function j0(r){var s=tn(),o=jt;if(o!==null)return k0(s,o,r);tn(),s=s.memoizedState,o=tn();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Ia(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=Je.updateQueue,s===null&&(s=su(),Je.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function N0(){return tn().memoizedState}function ou(r,s,o,d){var m=Bn();Je.flags|=r,m.memoizedState=Ia(1|s,{destroy:void 0},o,d===void 0?null:d)}function cu(r,s,o,d){var m=tn();d=d===void 0?null:d;var x=m.memoizedState.inst;jt!==null&&d!==null&&If(d,jt.memoizedState.deps)?m.memoizedState=Ia(s,x,o,d):(Je.flags|=r,m.memoizedState=Ia(1|s,x,o,d))}function C0(r,s){ou(8390656,8,r,s)}function eh(r,s){cu(2048,8,r,s)}function VS(r){Je.flags|=4;var s=Je.updateQueue;if(s===null)s=su(),Je.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function E0(r){var s=tn().memoizedState;return VS({ref:s,nextImpl:r}),function(){if((yt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function T0(r,s){return cu(4,2,r,s)}function A0(r,s){return cu(4,4,r,s)}function M0(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function R0(r,s,o){o=o!=null?o.concat([r]):null,cu(4,4,M0.bind(null,s,r),o)}function th(){}function L0(r,s){var o=tn();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&If(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function D0(r,s){var o=tn();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&If(s,d[1]))return d[0];if(d=r(),Xs){nn(!0);try{r()}finally{nn(!1)}}return o.memoizedState=[d,s],d}function nh(r,s,o){return o===void 0||(_i&1073741824)!==0&&(dt&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=zv(),Je.lanes|=r,hs|=r,o)}function z0(r,s,o,d){return tr(o,s)?o:Fa.current!==null?(r=nh(r,o,d),tr(r,s)||(on=!0),r):(_i&42)===0||(_i&1073741824)!==0&&(dt&261930)===0?(on=!0,r.memoizedState=o):(r=zv(),Je.lanes|=r,hs|=r,s)}function O0(r,s,o,d,m){var x=P.p;P.p=x!==0&&8>x?x:8;var w=$.T,C={};$.T=C,sh(r,!1,s,o);try{var q=m(),ee=$.S;if(ee!==null&&ee(C,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var oe=US(q,d);ro(r,s,oe,lr(r))}else ro(r,s,d,lr(r))}catch(ue){ro(r,s,{then:function(){},status:"rejected",reason:ue},lr())}finally{P.p=x,w!==null&&C.types!==null&&(w.types=C.types),$.T=w}}function GS(){}function rh(r,s,o,d){if(r.tag!==5)throw Error(i(476));var m=B0(r).queue;O0(r,m,s,ie,o===null?GS:function(){return P0(r),o(d)})}function B0(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:ie},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function P0(r){var s=B0(r);s.next===null&&(s=r.alternate.memoizedState),ro(r,s.next.queue,{},lr())}function ih(){return jn(_o)}function $0(){return tn().memoizedState}function U0(){return tn().memoizedState}function YS(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=lr();r=ls(o);var d=os(s,r,o);d!==null&&(Qn(d,s,o),Zl(d,s,o)),s={cache:Lf()},r.payload=s;return}s=s.return}}function QS(r,s,o){var d=lr();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},uu(r)?q0(s,o):(o=wf(r,s,o,d),o!==null&&(Qn(o,r,d),H0(o,s,d)))}function F0(r,s,o){var d=lr();ro(r,s,o,d)}function ro(r,s,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(uu(r))q0(s,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var w=s.lastRenderedState,C=x(w,o);if(m.hasEagerState=!0,m.eagerState=C,tr(C,w))return Ic(r,s,m,0),Tt===null&&Hc(),!1}catch{}finally{}if(o=wf(r,s,m,d),o!==null)return Qn(o,r,d),H0(o,s,d),!0}return!1}function sh(r,s,o,d){if(d={lane:2,revertLane:Bh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},uu(r)){if(s)throw Error(i(479))}else s=wf(r,o,d,2),s!==null&&Qn(s,r,2)}function uu(r){var s=r.alternate;return r===Je||s!==null&&s===Je}function q0(r,s){qa=ru=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function H0(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Ll(r,o)}}var io={readContext:jn,use:au,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};io.useEffectEvent=Wt;var I0={readContext:jn,use:au,useCallback:function(r,s){return Bn().memoizedState=[r,s===void 0?null:s],r},useContext:jn,useEffect:C0,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,ou(4194308,4,M0.bind(null,s,r),o)},useLayoutEffect:function(r,s){return ou(4194308,4,r,s)},useInsertionEffect:function(r,s){ou(4,2,r,s)},useMemo:function(r,s){var o=Bn();s=s===void 0?null:s;var d=r();if(Xs){nn(!0);try{r()}finally{nn(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Bn();if(o!==void 0){var m=o(s);if(Xs){nn(!0);try{o(s)}finally{nn(!1)}}}else m=s;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=QS.bind(null,Je,r),[d.memoizedState,r]},useRef:function(r){var s=Bn();return r={current:r},s.memoizedState=r},useState:function(r){r=Zf(r);var s=r.queue,o=F0.bind(null,Je,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:th,useDeferredValue:function(r,s){var o=Bn();return nh(o,r,s)},useTransition:function(){var r=Zf(!1);return r=O0.bind(null,Je,r.queue,!0,!1),Bn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=Je,m=Bn();if(ht){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),Tt===null)throw Error(i(349));(dt&127)!==0||d0(d,s,o)}m.memoizedState=o;var x={value:o,getSnapshot:s};return m.queue=x,C0(h0.bind(null,d,x,r),[r]),d.flags|=2048,Ia(9,{destroy:void 0},f0.bind(null,d,x,o,s),null),o},useId:function(){var r=Bn(),s=Tt.identifierPrefix;if(ht){var o=Jr,d=Wr;o=(d&~(1<<32-ut(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=iu++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=FS++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:ih,useFormState:w0,useActionState:w0,useOptimistic:function(r){var s=Bn();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=sh.bind(null,Je,!0,o),o.dispatch=s,[r,s]},useMemoCache:Wf,useCacheRefresh:function(){return Bn().memoizedState=YS.bind(null,Je)},useEffectEvent:function(r){var s=Bn(),o={impl:r};return s.memoizedState=o,function(){if((yt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},ah={readContext:jn,use:au,useCallback:L0,useContext:jn,useEffect:eh,useImperativeHandle:R0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:D0,useReducer:lu,useRef:N0,useState:function(){return lu(wi)},useDebugValue:th,useDeferredValue:function(r,s){var o=tn();return z0(o,jt.memoizedState,r,s)},useTransition:function(){var r=lu(wi)[0],s=tn().memoizedState;return[typeof r=="boolean"?r:no(r),s]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:ih,useFormState:S0,useActionState:S0,useOptimistic:function(r,s){var o=tn();return g0(o,jt,r,s)},useMemoCache:Wf,useCacheRefresh:U0};ah.useEffectEvent=E0;var V0={readContext:jn,use:au,useCallback:L0,useContext:jn,useEffect:eh,useImperativeHandle:R0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:D0,useReducer:Xf,useRef:N0,useState:function(){return Xf(wi)},useDebugValue:th,useDeferredValue:function(r,s){var o=tn();return jt===null?nh(o,r,s):z0(o,jt.memoizedState,r,s)},useTransition:function(){var r=Xf(wi)[0],s=tn().memoizedState;return[typeof r=="boolean"?r:no(r),s]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:ih,useFormState:j0,useActionState:j0,useOptimistic:function(r,s){var o=tn();return jt!==null?g0(o,jt,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:Wf,useCacheRefresh:U0};V0.useEffectEvent=E0;function lh(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:v({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var oh={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=lr(),m=ls(d);m.payload=s,o!=null&&(m.callback=o),s=os(r,m,d),s!==null&&(Qn(s,r,d),Zl(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=lr(),m=ls(d);m.tag=1,m.payload=s,o!=null&&(m.callback=o),s=os(r,m,d),s!==null&&(Qn(s,r,d),Zl(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=lr(),d=ls(o);d.tag=2,s!=null&&(d.callback=s),s=os(r,d,o),s!==null&&(Qn(s,r,o),Zl(s,r,o))}};function G0(r,s,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):s.prototype&&s.prototype.isPureReactComponent?!Il(o,d)||!Il(m,x):!0}function Y0(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&oh.enqueueReplaceState(s,s.state,null)}function Zs(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function Q0(r){qc(r)}function W0(r){console.error(r)}function J0(r){qc(r)}function du(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function X0(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function ch(r,s,o){return o=ls(o),o.tag=3,o.payload={element:null},o.callback=function(){du(r,s)},o}function Z0(r){return r=ls(r),r.tag=3,r}function K0(r,s,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){X0(s,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){X0(s,o,d),typeof m!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var C=d.stack;this.componentDidCatch(d.value,{componentStack:C!==null?C:""})})}function WS(r,s,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&Oa(s,o,m,!0),o=rr.current,o!==null){switch(o.tag){case 31:case 13:return _r===null?Su():o.alternate===null&&Jt===0&&(Jt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===Zc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),Dh(r,d,m)),!1;case 22:return o.flags|=65536,d===Zc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),Dh(r,d,m)),!1}throw Error(i(435,o.tag))}return Dh(r,d,m),Su(),!1}if(ht)return s=rr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==Ef&&(r=Error(i(422),{cause:d}),Yl(xr(r,o)))):(d!==Ef&&(s=Error(i(423),{cause:d}),Yl(xr(s,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=xr(d,o),m=ch(r.stateNode,d,m),$f(r,m),Jt!==4&&(Jt=2)),!1;var x=Error(i(520),{cause:d});if(x=xr(x,o),ho===null?ho=[x]:ho.push(x),Jt!==4&&(Jt=2),s===null)return!0;d=xr(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=ch(o.stateNode,d,r),$f(o,r),!1;case 1:if(s=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ps===null||!ps.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=Z0(m),K0(m,r,o,d),$f(o,m),!1}o=o.return}while(o!==null);return!1}var uh=Error(i(461)),on=!1;function Nn(r,s,o,d){s.child=r===null?r0(s,null,o,d):Js(s,r.child,o,d)}function ev(r,s,o,d,m){o=o.render;var x=s.ref;if("ref"in d){var w={};for(var C in d)C!=="ref"&&(w[C]=d[C])}else w=d;return Gs(s),d=Vf(r,s,o,w,x,m),C=Gf(),r!==null&&!on?(Yf(r,s,m),Si(r,s,m)):(ht&&C&&Nf(s),s.flags|=1,Nn(r,s,d,m),s.child)}function tv(r,s,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Sf(x)&&x.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=x,nv(r,s,x,d,m)):(r=Gc(o.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(x=r.child,!vh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Il,o(w,d)&&r.ref===s.ref)return Si(r,s,m)}return s.flags|=1,r=xi(x,d),r.ref=s.ref,r.return=s,s.child=r}function nv(r,s,o,d,m){if(r!==null){var x=r.memoizedProps;if(Il(x,d)&&r.ref===s.ref)if(on=!1,s.pendingProps=d=x,vh(r,m))(r.flags&131072)!==0&&(on=!0);else return s.lanes=r.lanes,Si(r,s,m)}return dh(r,s,o,d,m)}function rv(r,s,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,s.child=null;return iv(r,s,x,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Jc(s,x!==null?x.cachePool:null),x!==null?a0(s,x):Ff(),l0(s);else return d=s.lanes=536870912,iv(r,s,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(Jc(s,x.cachePool),a0(s,x),us(),s.memoizedState=null):(r!==null&&Jc(s,null),Ff(),us());return Nn(r,s,m,o),s.child}function so(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function iv(r,s,o,d,m){var x=zf();return x=x===null?null:{parent:an._currentValue,pool:x},s.memoizedState={baseLanes:o,cachePool:x},r!==null&&Jc(s,null),Ff(),l0(s),r!==null&&Oa(r,s,d,!0),s.childLanes=m,null}function fu(r,s){return s=pu({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function sv(r,s,o){return Js(s,r.child,null,o),r=fu(s,s.pendingProps),r.flags|=2,ir(s),s.memoizedState=null,r}function JS(r,s,o){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ht){if(d.mode==="hidden")return r=fu(s,d),s.lanes=536870912,so(null,r);if(Hf(s),(r=Bt)?(r=x1(r,yr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ns!==null?{id:Wr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},o=qx(r),o.return=s,s.child=o,kn=s,Bt=null)):r=null,r===null)throw is(s);return s.lanes=536870912,null}return fu(s,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Hf(s),m)if(s.flags&256)s.flags&=-257,s=sv(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(on||Oa(r,s,o,!1),m=(o&r.childLanes)!==0,on||m){if(d=Tt,d!==null&&(w=ba(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,qs(r,w),Qn(d,r,w),uh;Su(),s=sv(r,s,o)}else r=x.treeContext,Bt=wr(w.nextSibling),kn=s,ht=!0,rs=null,yr=!1,r!==null&&Vx(s,r),s=fu(s,d),s.flags|=4096;return s}return r=xi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function hu(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function dh(r,s,o,d,m){return Gs(s),o=Vf(r,s,o,d,void 0,m),d=Gf(),r!==null&&!on?(Yf(r,s,m),Si(r,s,m)):(ht&&d&&Nf(s),s.flags|=1,Nn(r,s,o,m),s.child)}function av(r,s,o,d,m,x){return Gs(s),s.updateQueue=null,o=c0(s,d,o,m),o0(r),d=Gf(),r!==null&&!on?(Yf(r,s,x),Si(r,s,x)):(ht&&d&&Nf(s),s.flags|=1,Nn(r,s,o,x),s.child)}function lv(r,s,o,d,m){if(Gs(s),s.stateNode===null){var x=Ra,w=o.contextType;typeof w=="object"&&w!==null&&(x=jn(w)),x=new o(d,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=oh,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=d,x.state=s.memoizedState,x.refs={},Bf(s),w=o.contextType,x.context=typeof w=="object"&&w!==null?jn(w):Ra,x.state=s.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(lh(s,o,w,d),x.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&oh.enqueueReplaceState(x,x.state,null),eo(s,d,x,m),Kl(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){x=s.stateNode;var C=s.memoizedProps,q=Zs(o,C);x.props=q;var ee=x.context,oe=o.contextType;w=Ra,typeof oe=="object"&&oe!==null&&(w=jn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C||ee!==w)&&Y0(s,x,d,w),as=!1;var te=s.memoizedState;x.state=te,eo(s,d,x,m),Kl(),ee=s.memoizedState,C||te!==ee||as?(typeof ue=="function"&&(lh(s,o,ue,d),ee=s.memoizedState),(q=as||G0(s,o,q,d,te,ee,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=q):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{x=s.stateNode,Pf(r,s),w=s.memoizedProps,oe=Zs(o,w),x.props=oe,ue=s.pendingProps,te=x.context,ee=o.contextType,q=Ra,typeof ee=="object"&&ee!==null&&(q=jn(ee)),C=o.getDerivedStateFromProps,(ee=typeof C=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||te!==q)&&Y0(s,x,d,q),as=!1,te=s.memoizedState,x.state=te,eo(s,d,x,m),Kl();var se=s.memoizedState;w!==ue||te!==se||as||r!==null&&r.dependencies!==null&&Qc(r.dependencies)?(typeof C=="function"&&(lh(s,o,C,d),se=s.memoizedState),(oe=as||G0(s,o,oe,d,te,se,q)||r!==null&&r.dependencies!==null&&Qc(r.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,se,q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,se,q)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),x.props=d,x.state=se,x.context=q,d=oe):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&te===r.memoizedState||(s.flags|=1024),d=!1)}return x=d,hu(r,s),d=(s.flags&128)!==0,x||d?(x=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,r!==null&&d?(s.child=Js(s,r.child,null,m),s.child=Js(s,null,o,m)):Nn(r,s,o,m),s.memoizedState=x.state,r=s.child):r=Si(r,s,m),r}function ov(r,s,o,d){return Is(),s.flags|=256,Nn(r,s,o,d),s.child}var fh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hh(r){return{baseLanes:r,cachePool:Xx()}}function ph(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=ar),r}function cv(r,s,o){var d=s.pendingProps,m=!1,x=(s.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ht){if(m?cs(s):us(),(r=Bt)?(r=x1(r,yr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ns!==null?{id:Wr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},o=qx(r),o.return=s,s.child=o,kn=s,Bt=null)):r=null,r===null)throw is(s);return Jh(r)?s.lanes=32:s.lanes=536870912,null}var C=d.children;return d=d.fallback,m?(us(),m=s.mode,C=pu({mode:"hidden",children:C},m),d=Hs(d,m,o,null),C.return=s,d.return=s,C.sibling=d,s.child=C,d=s.child,d.memoizedState=hh(o),d.childLanes=ph(r,w,o),s.memoizedState=fh,so(null,d)):(cs(s),mh(s,C))}var q=r.memoizedState;if(q!==null&&(C=q.dehydrated,C!==null)){if(x)s.flags&256?(cs(s),s.flags&=-257,s=gh(r,s,o)):s.memoizedState!==null?(us(),s.child=r.child,s.flags|=128,s=null):(us(),C=d.fallback,m=s.mode,d=pu({mode:"visible",children:d.children},m),C=Hs(C,m,o,null),C.flags|=2,d.return=s,C.return=s,d.sibling=C,s.child=d,Js(s,r.child,null,o),d=s.child,d.memoizedState=hh(o),d.childLanes=ph(r,w,o),s.memoizedState=fh,s=so(null,d));else if(cs(s),Jh(C)){if(w=C.nextSibling&&C.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(i(419)),d.stack="",d.digest=w,Yl({value:d,source:null,stack:null}),s=gh(r,s,o)}else if(on||Oa(r,s,o,!1),w=(o&r.childLanes)!==0,on||w){if(w=Tt,w!==null&&(d=ba(w,o),d!==0&&d!==q.retryLane))throw q.retryLane=d,qs(r,d),Qn(w,r,d),uh;Wh(C)||Su(),s=gh(r,s,o)}else Wh(C)?(s.flags|=192,s.child=r.child,s=null):(r=q.treeContext,Bt=wr(C.nextSibling),kn=s,ht=!0,rs=null,yr=!1,r!==null&&Vx(s,r),s=mh(s,d.children),s.flags|=4096);return s}return m?(us(),C=d.fallback,m=s.mode,q=r.child,ee=q.sibling,d=xi(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&65011712,ee!==null?C=xi(ee,C):(C=Hs(C,m,o,null),C.flags|=2),C.return=s,d.return=s,d.sibling=C,s.child=d,so(null,d),d=s.child,C=r.child.memoizedState,C===null?C=hh(o):(m=C.cachePool,m!==null?(q=an._currentValue,m=m.parent!==q?{parent:q,pool:q}:m):m=Xx(),C={baseLanes:C.baseLanes|o,cachePool:m}),d.memoizedState=C,d.childLanes=ph(r,w,o),s.memoizedState=fh,so(r.child,d)):(cs(s),o=r.child,r=o.sibling,o=xi(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=o,s.memoizedState=null,o)}function mh(r,s){return s=pu({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function pu(r,s){return r=nr(22,r,null,s),r.lanes=0,r}function gh(r,s,o){return Js(s,r.child,null,o),r=mh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function uv(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),Mf(r.return,s,o)}function xh(r,s,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function dv(r,s,o){var d=s.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=en.current,C=(w&2)!==0;if(C?(w=w&1|2,s.flags|=128):w&=1,M(en,w),Nn(r,s,d,o),d=ht?Gl:0,!C&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&uv(r,o,s);else if(r.tag===19)uv(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=s.child,m=null;o!==null;)r=o.alternate,r!==null&&nu(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=s.child,s.child=null):(m=o.sibling,o.sibling=null),xh(s,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&nu(r)===null){s.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}xh(s,!0,o,null,x,d);break;case"together":xh(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function Si(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),hs|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(Oa(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=xi(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=xi(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function vh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Qc(r)))}function XS(r,s,o){switch(s.tag){case 3:Le(s,s.stateNode.containerInfo),ss(s,an,r.memoizedState.cache),Is();break;case 27:case 5:rt(s);break;case 4:Le(s,s.stateNode.containerInfo);break;case 10:ss(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Hf(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(cs(s),s.flags|=128,null):(o&s.child.childLanes)!==0?cv(r,s,o):(cs(s),r=Si(r,s,o),r!==null?r.sibling:null);cs(s);break;case 19:var m=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(Oa(r,s,o,!1),d=(o&s.childLanes)!==0),m){if(d)return dv(r,s,o);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(en,en.current),d)break;return null;case 22:return s.lanes=0,rv(r,s,o,s.pendingProps);case 24:ss(s,an,r.memoizedState.cache)}return Si(r,s,o)}function fv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)on=!0;else{if(!vh(r,o)&&(s.flags&128)===0)return on=!1,XS(r,s,o);on=(r.flags&131072)!==0}else on=!1,ht&&(s.flags&1048576)!==0&&Ix(s,Gl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Qs(s.elementType),s.type=r,typeof r=="function")Sf(r)?(d=Zs(r,d),s.tag=1,s=lv(null,s,r,d,o)):(s.tag=0,s=dh(null,s,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===D){s.tag=11,s=ev(null,s,r,d,o);break e}else if(m===H){s.tag=14,s=tv(null,s,r,d,o);break e}}throw s=X(r)||r,Error(i(306,s,""))}}return s;case 0:return dh(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,m=Zs(d,s.pendingProps),lv(r,s,d,m,o);case 3:e:{if(Le(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var x=s.memoizedState;m=x.element,Pf(r,s),eo(s,d,null,o);var w=s.memoizedState;if(d=w.cache,ss(s,an,d),d!==x.cache&&Rf(s,[an],o,!0),Kl(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){s=ov(r,s,d,o);break e}else if(d!==m){m=xr(Error(i(424)),s),Yl(m),s=ov(r,s,d,o);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=wr(r.firstChild),kn=s,ht=!0,rs=null,yr=!0,o=r0(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Is(),d===m){s=Si(r,s,o);break e}Nn(r,s,d,o)}s=s.child}return s;case 26:return hu(r,s),r===null?(o=S1(s.type,null,s.pendingProps,null))?s.memoizedState=o:ht||(o=s.type,r=s.pendingProps,d=Au(Ce.current).createElement(o),d[Gt]=s,d[pn]=r,Cn(d,o,r),Zt(d),s.stateNode=d):s.memoizedState=S1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return rt(s),r===null&&ht&&(d=s.stateNode=y1(s.type,s.pendingProps,Ce.current),kn=s,yr=!0,m=Bt,vs(s.type)?(Xh=m,Bt=wr(d.firstChild)):Bt=m),Nn(r,s,s.pendingProps.children,o),hu(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ht&&((m=d=Bt)&&(d=Ck(d,s.type,s.pendingProps,yr),d!==null?(s.stateNode=d,kn=s,Bt=wr(d.firstChild),yr=!1,m=!0):m=!1),m||is(s)),rt(s),m=s.type,x=s.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,Gh(m,x)?d=null:w!==null&&Gh(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=Vf(r,s,qS,null,null,o),_o._currentValue=m),hu(r,s),Nn(r,s,d,o),s.child;case 6:return r===null&&ht&&((r=o=Bt)&&(o=Ek(o,s.pendingProps,yr),o!==null?(s.stateNode=o,kn=s,Bt=null,r=!0):r=!1),r||is(s)),null;case 13:return cv(r,s,o);case 4:return Le(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Js(s,null,d,o):Nn(r,s,d,o),s.child;case 11:return ev(r,s,s.type,s.pendingProps,o);case 7:return Nn(r,s,s.pendingProps,o),s.child;case 8:return Nn(r,s,s.pendingProps.children,o),s.child;case 12:return Nn(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,ss(s,s.type,d.value),Nn(r,s,d.children,o),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Gs(s),m=jn(m),d=d(m),s.flags|=1,Nn(r,s,d,o),s.child;case 14:return tv(r,s,s.type,s.pendingProps,o);case 15:return nv(r,s,s.type,s.pendingProps,o);case 19:return dv(r,s,o);case 31:return JS(r,s,o);case 22:return rv(r,s,o,s.pendingProps);case 24:return Gs(s),d=jn(an),r===null?(m=zf(),m===null&&(m=Tt,x=Lf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),s.memoizedState={parent:d,cache:m},Bf(s),ss(s,an,m)):((r.lanes&o)!==0&&(Pf(r,s),eo(s,null,null,o),Kl()),m=r.memoizedState,x=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),ss(s,an,d)):(d=x.cache,ss(s,an,d),d!==m.cache&&Rf(s,[an],o,!0))),Nn(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ki(r){r.flags|=4}function bh(r,s,o,d,m){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if($v())r.flags|=8192;else throw Ws=Zc,Of}else r.flags&=-16777217}function hv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!E1(s))if($v())r.flags|=8192;else throw Ws=Zc,Of}function mu(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?rn():536870912,r.lanes|=s,Qa|=s)}function ao(r,s){if(!ht)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Pt(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function ZS(r,s,o){var d=s.pendingProps;switch(Cf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(s),null;case 1:return Pt(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),yi(an),Pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(za(s)?ki(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Tf())),Pt(s),null;case 26:var m=s.type,x=s.memoizedState;return r===null?(ki(s),x!==null?(Pt(s),hv(s,x)):(Pt(s),bh(s,m,null,d,o))):x?x!==r.memoizedState?(ki(s),Pt(s),hv(s,x)):(Pt(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&ki(s),Pt(s),bh(s,m,r,d,o)),null;case 27:if(be(s),o=Ce.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Pt(s),null}r=pe.current,za(s)?Gx(s):(r=y1(m,d,o),s.stateNode=r,ki(s))}return Pt(s),null;case 5:if(be(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Pt(s),null}if(x=pe.current,za(s))Gx(s);else{var w=Au(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Gt]=s,x[pn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=x;e:switch(Cn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ki(s)}}return Pt(s),bh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ki(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=Ce.current,za(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,m=kn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Gt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||c1(r.nodeValue,o)),r||is(s,!0)}else r=Au(r).createTextNode(d),r[Gt]=s,s.stateNode=r}return Pt(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=za(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Gt]=s}else Is(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),r=!1}else o=Tf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(ir(s),s):(ir(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Pt(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=za(s),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Gt]=s}else Is(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),m=!1}else m=Tf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(ir(s),s):(ir(s),null)}return ir(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),mu(s,s.updateQueue),Pt(s),null);case 4:return Pe(),r===null&&Fh(s.stateNode.containerInfo),Pt(s),null;case 10:return yi(s.type),Pt(s),null;case 19:if(Z(en),d=s.memoizedState,d===null)return Pt(s),null;if(m=(s.flags&128)!==0,x=d.rendering,x===null)if(m)ao(d,!1);else{if(Jt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=nu(r),x!==null){for(s.flags|=128,ao(d,!1),r=x.updateQueue,s.updateQueue=r,mu(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Fx(o,r),o=o.sibling;return M(en,en.current&1|2),ht&&vi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&qe()>yu&&(s.flags|=128,m=!0,ao(d,!1),s.lanes=4194304)}else{if(!m)if(r=nu(x),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,mu(s,r),ao(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!ht)return Pt(s),null}else 2*qe()-d.renderingStartTime>yu&&o!==536870912&&(s.flags|=128,m=!0,ao(d,!1),s.lanes=4194304);d.isBackwards?(x.sibling=s.child,s.child=x):(r=d.last,r!==null?r.sibling=x:s.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=qe(),r.sibling=null,o=en.current,M(en,m?o&1|2:o&1),ht&&vi(s,d.treeForkCount),r):(Pt(s),null);case 22:case 23:return ir(s),qf(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(Pt(s),s.subtreeFlags&6&&(s.flags|=8192)):Pt(s),o=s.updateQueue,o!==null&&mu(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&Z(Ys),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),yi(an),Pt(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function KS(r,s){switch(Cf(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return yi(an),Pe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return be(s),null;case 31:if(s.memoizedState!==null){if(ir(s),s.alternate===null)throw Error(i(340));Is()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(ir(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Is()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(en),null;case 4:return Pe(),null;case 10:return yi(s.type),null;case 22:case 23:return ir(s),qf(),r!==null&&Z(Ys),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return yi(an),null;case 25:return null;default:return null}}function pv(r,s){switch(Cf(s),s.tag){case 3:yi(an),Pe();break;case 26:case 27:case 5:be(s);break;case 4:Pe();break;case 31:s.memoizedState!==null&&ir(s);break;case 13:ir(s);break;case 19:Z(en);break;case 10:yi(s.type);break;case 22:case 23:ir(s),qf(),r!==null&&Z(Ys);break;case 24:yi(an)}}function lo(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(C){St(s,s.return,C)}}function ds(r,s,o){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,C=w.destroy;if(C!==void 0){w.destroy=void 0,m=s;var q=o,ee=C;try{ee()}catch(oe){St(m,q,oe)}}}d=d.next}while(d!==x)}}catch(oe){St(s,s.return,oe)}}function mv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{s0(s,o)}catch(d){St(r,r.return,d)}}}function gv(r,s,o){o.props=Zs(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){St(r,s,d)}}function oo(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){St(r,s,m)}}function Xr(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){St(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){St(r,s,m)}else o.current=null}function xv(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){St(r,r.return,m)}}function yh(r,s,o){try{var d=r.stateNode;_k(d,r.type,o,s),d[pn]=s}catch(m){St(r,r.return,m)}}function vv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&vs(r.type)||r.tag===4}function _h(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||vv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&vs(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function wh(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Dr));else if(d!==4&&(d===27&&vs(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(wh(r,s,o),r=r.sibling;r!==null;)wh(r,s,o),r=r.sibling}function gu(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&vs(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(gu(r,s,o),r=r.sibling;r!==null;)gu(r,s,o),r=r.sibling}function bv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);Cn(s,d,o),s[Gt]=r,s[pn]=o}catch(x){St(r,r.return,x)}}var ji=!1,cn=!1,Sh=!1,yv=typeof WeakSet=="function"?WeakSet:Set,_n=null;function ek(r,s){if(r=r.containerInfo,Ih=Bu,r=Rx(r),gf(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,C=-1,q=-1,ee=0,oe=0,ue=r,te=null;t:for(;;){for(var se;ue!==o||m!==0&&ue.nodeType!==3||(C=w+m),ue!==x||d!==0&&ue.nodeType!==3||(q=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(se=ue.firstChild)!==null;)te=ue,ue=se;for(;;){if(ue===r)break t;if(te===o&&++ee===m&&(C=w),te===x&&++oe===d&&(q=w),(se=ue.nextSibling)!==null)break;ue=te,te=ue.parentNode}ue=se}o=C===-1||q===-1?null:{start:C,end:q}}else o=null}o=o||{start:0,end:0}}else o=null;for(Vh={focusedElem:r,selectionRange:o},Bu=!1,_n=s;_n!==null;)if(s=_n,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,_n=r;else for(;_n!==null;){switch(s=_n,x=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=s,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ee=Zs(o.type,m);r=d.getSnapshotBeforeUpdate(Ee,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){St(o,o.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)Qh(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Qh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,_n=r;break}_n=s.return}}function _v(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Ci(r,o),d&4&&lo(5,o);break;case 1:if(Ci(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(w){St(o,o.return,w)}else{var m=Zs(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){St(o,o.return,w)}}d&64&&mv(o),d&512&&oo(o,o.return);break;case 3:if(Ci(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{s0(r,s)}catch(w){St(o,o.return,w)}}break;case 27:s===null&&d&4&&bv(o);case 26:case 5:Ci(r,o),s===null&&d&4&&xv(o),d&512&&oo(o,o.return);break;case 12:Ci(r,o);break;case 31:Ci(r,o),d&4&&kv(r,o);break;case 13:Ci(r,o),d&4&&jv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=ck.bind(null,o),Tk(r,o))));break;case 22:if(d=o.memoizedState!==null||ji,!d){s=s!==null&&s.memoizedState!==null||cn,m=ji;var x=cn;ji=d,(cn=s)&&!x?Ei(r,o,(o.subtreeFlags&8772)!==0):Ci(r,o),ji=m,cn=x}break;case 30:break;default:Ci(r,o)}}function wv(r){var s=r.alternate;s!==null&&(r.alternate=null,wv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Qi(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var qt=null,In=!1;function Ni(r,s,o){for(o=o.child;o!==null;)Sv(r,s,o),o=o.sibling}function Sv(r,s,o){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(nt,o)}catch{}switch(o.tag){case 26:cn||Xr(o,s),Ni(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:cn||Xr(o,s);var d=qt,m=In;vs(o.type)&&(qt=o.stateNode,In=!1),Ni(r,s,o),vo(o.stateNode),qt=d,In=m;break;case 5:cn||Xr(o,s);case 6:if(d=qt,m=In,qt=null,Ni(r,s,o),qt=d,In=m,qt!==null)if(In)try{(qt.nodeType===9?qt.body:qt.nodeName==="HTML"?qt.ownerDocument.body:qt).removeChild(o.stateNode)}catch(x){St(o,s,x)}else try{qt.removeChild(o.stateNode)}catch(x){St(o,s,x)}break;case 18:qt!==null&&(In?(r=qt,m1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),nl(r)):m1(qt,o.stateNode));break;case 4:d=qt,m=In,qt=o.stateNode.containerInfo,In=!0,Ni(r,s,o),qt=d,In=m;break;case 0:case 11:case 14:case 15:ds(2,o,s),cn||ds(4,o,s),Ni(r,s,o);break;case 1:cn||(Xr(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&gv(o,s,d)),Ni(r,s,o);break;case 21:Ni(r,s,o);break;case 22:cn=(d=cn)||o.memoizedState!==null,Ni(r,s,o),cn=d;break;default:Ni(r,s,o)}}function kv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{nl(r)}catch(o){St(s,s.return,o)}}}function jv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{nl(r)}catch(o){St(s,s.return,o)}}function tk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new yv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new yv),s;default:throw Error(i(435,r.tag))}}function xu(r,s){var o=tk(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var m=uk.bind(null,r,d);d.then(m,m)}})}function Vn(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=s,C=w;e:for(;C!==null;){switch(C.tag){case 27:if(vs(C.type)){qt=C.stateNode,In=!1;break e}break;case 5:qt=C.stateNode,In=!1;break e;case 3:case 4:qt=C.stateNode.containerInfo,In=!0;break e}C=C.return}if(qt===null)throw Error(i(160));Sv(x,w,m),qt=null,In=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Nv(s,r),s=s.sibling}var Or=null;function Nv(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Vn(s,r),Gn(r),d&4&&(ds(3,r,r.return),lo(3,r),ds(5,r,r.return));break;case 1:Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),d&64&&ji&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Or;if(Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[di]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),Cn(x,d,o),x[Gt]=r,Zt(x),d=x;break e;case"link":var w=N1("link","href",m).get(d+(o.href||""));if(w){for(var C=0;C<w.length;C++)if(x=w[C],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(C,1);break t}}x=m.createElement(d),Cn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=N1("meta","content",m).get(d+(o.content||""))){for(C=0;C<w.length;C++)if(x=w[C],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(C,1);break t}}x=m.createElement(d),Cn(x,d,o),m.head.appendChild(x);break;default:throw Error(i(468,d))}x[Gt]=r,Zt(x),d=x}r.stateNode=d}else C1(m,r.type,r.stateNode);else r.stateNode=j1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?C1(m,r.type,r.stateNode):j1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&yh(r,r.memoizedProps,o.memoizedProps)}break;case 27:Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),o!==null&&d&4&&yh(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Vn(s,r),Gn(r),d&512&&(cn||o===null||Xr(o,o.return)),r.flags&32){m=r.stateNode;try{Zi(m,"")}catch(Ee){St(r,r.return,Ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,yh(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Sh=!0);break;case 6:if(Vn(s,r),Gn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ee){St(r,r.return,Ee)}}break;case 3:if(Lu=null,m=Or,Or=Mu(s.containerInfo),Vn(s,r),Or=m,Gn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{nl(s.containerInfo)}catch(Ee){St(r,r.return,Ee)}Sh&&(Sh=!1,Cv(r));break;case 4:d=Or,Or=Mu(r.stateNode.containerInfo),Vn(s,r),Gn(r),Or=d;break;case 12:Vn(s,r),Gn(r);break;case 31:Vn(s,r),Gn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 13:Vn(s,r),Gn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(bu=qe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 22:m=r.memoizedState!==null;var q=o!==null&&o.memoizedState!==null,ee=ji,oe=cn;if(ji=ee||m,cn=oe||q,Vn(s,r),cn=oe,ji=ee,Gn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(o===null||q||ji||cn||Ks(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){q=o=s;try{if(x=q.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{C=q.stateNode;var ue=q.memoizedProps.style,te=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;C.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ee){St(q,q.return,Ee)}}}else if(s.tag===6){if(o===null){q=s;try{q.stateNode.nodeValue=m?"":q.memoizedProps}catch(Ee){St(q,q.return,Ee)}}}else if(s.tag===18){if(o===null){q=s;try{var se=q.stateNode;m?g1(se,!0):g1(q.stateNode,!1)}catch(Ee){St(q,q.return,Ee)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,xu(r,o))));break;case 19:Vn(s,r),Gn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,xu(r,d)));break;case 30:break;case 21:break;default:Vn(s,r),Gn(r)}}function Gn(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(vv(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var m=o.stateNode,x=_h(r);gu(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Zi(w,""),o.flags&=-33);var C=_h(r);gu(r,C,w);break;case 3:case 4:var q=o.stateNode.containerInfo,ee=_h(r);wh(r,ee,q);break;default:throw Error(i(161))}}catch(oe){St(r,r.return,oe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Cv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Cv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function Ci(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)_v(r,s.alternate,s),s=s.sibling}function Ks(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:ds(4,s,s.return),Ks(s);break;case 1:Xr(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&gv(s,s.return,o),Ks(s);break;case 27:vo(s.stateNode);case 26:case 5:Xr(s,s.return),Ks(s);break;case 22:s.memoizedState===null&&Ks(s);break;case 30:Ks(s);break;default:Ks(s)}r=r.sibling}}function Ei(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,x=s,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ei(m,x,o),lo(4,x);break;case 1:if(Ei(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){St(d,d.return,ee)}if(d=x,m=d.updateQueue,m!==null){var C=d.stateNode;try{var q=m.shared.hiddenCallbacks;if(q!==null)for(m.shared.hiddenCallbacks=null,m=0;m<q.length;m++)i0(q[m],C)}catch(ee){St(d,d.return,ee)}}o&&w&64&&mv(x),oo(x,x.return);break;case 27:bv(x);case 26:case 5:Ei(m,x,o),o&&d===null&&w&4&&xv(x),oo(x,x.return);break;case 12:Ei(m,x,o);break;case 31:Ei(m,x,o),o&&w&4&&kv(m,x);break;case 13:Ei(m,x,o),o&&w&4&&jv(m,x);break;case 22:x.memoizedState===null&&Ei(m,x,o),oo(x,x.return);break;case 30:break;default:Ei(m,x,o)}s=s.sibling}}function kh(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&Ql(o))}function jh(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ql(r))}function Br(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ev(r,s,o,d),s=s.sibling}function Ev(r,s,o,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:Br(r,s,o,d),m&2048&&lo(9,s);break;case 1:Br(r,s,o,d);break;case 3:Br(r,s,o,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ql(r)));break;case 12:if(m&2048){Br(r,s,o,d),r=s.stateNode;try{var x=s.memoizedProps,w=x.id,C=x.onPostCommit;typeof C=="function"&&C(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(q){St(s,s.return,q)}}else Br(r,s,o,d);break;case 31:Br(r,s,o,d);break;case 13:Br(r,s,o,d);break;case 23:break;case 22:x=s.stateNode,w=s.alternate,s.memoizedState!==null?x._visibility&2?Br(r,s,o,d):co(r,s):x._visibility&2?Br(r,s,o,d):(x._visibility|=2,Va(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&kh(w,s);break;case 24:Br(r,s,o,d),m&2048&&jh(s.alternate,s);break;default:Br(r,s,o,d)}}function Va(r,s,o,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=r,w=s,C=o,q=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Va(x,w,C,q,m),lo(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Va(x,w,C,q,m):co(x,w):(oe._visibility|=2,Va(x,w,C,q,m)),m&&ee&2048&&kh(w.alternate,w);break;case 24:Va(x,w,C,q,m),m&&ee&2048&&jh(w.alternate,w);break;default:Va(x,w,C,q,m)}s=s.sibling}}function co(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,m=d.flags;switch(d.tag){case 22:co(o,d),m&2048&&kh(d.alternate,d);break;case 24:co(o,d),m&2048&&jh(d.alternate,d);break;default:co(o,d)}s=s.sibling}}var uo=8192;function Ga(r,s,o){if(r.subtreeFlags&uo)for(r=r.child;r!==null;)Tv(r,s,o),r=r.sibling}function Tv(r,s,o){switch(r.tag){case 26:Ga(r,s,o),r.flags&uo&&r.memoizedState!==null&&Fk(o,Or,r.memoizedState,r.memoizedProps);break;case 5:Ga(r,s,o);break;case 3:case 4:var d=Or;Or=Mu(r.stateNode.containerInfo),Ga(r,s,o),Or=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=uo,uo=16777216,Ga(r,s,o),uo=d):Ga(r,s,o));break;default:Ga(r,s,o)}}function Av(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function fo(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];_n=d,Rv(d,r)}Av(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Mv(r),r=r.sibling}function Mv(r){switch(r.tag){case 0:case 11:case 15:fo(r),r.flags&2048&&ds(9,r,r.return);break;case 3:fo(r);break;case 12:fo(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,vu(r)):fo(r);break;default:fo(r)}}function vu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];_n=d,Rv(d,r)}Av(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:ds(8,s,s.return),vu(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,vu(s));break;default:vu(s)}r=r.sibling}}function Rv(r,s){for(;_n!==null;){var o=_n;switch(o.tag){case 0:case 11:case 15:ds(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Ql(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,_n=d;else e:for(o=r;_n!==null;){d=_n;var m=d.sibling,x=d.return;if(wv(d),d===o){_n=null;break e}if(m!==null){m.return=x,_n=m;break e}_n=x}}}var nk={getCacheForType:function(r){var s=jn(an),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return jn(an).controller.signal}},rk=typeof WeakMap=="function"?WeakMap:Map,yt=0,Tt=null,lt=null,dt=0,wt=0,sr=null,fs=!1,Ya=!1,Nh=!1,Ti=0,Jt=0,hs=0,ea=0,Ch=0,ar=0,Qa=0,ho=null,Yn=null,Eh=!1,bu=0,Lv=0,yu=1/0,_u=null,ps=null,mn=0,ms=null,Wa=null,Ai=0,Th=0,Ah=null,Dv=null,po=0,Mh=null;function lr(){return(yt&2)!==0&&dt!==0?dt&-dt:$.T!==null?Bh():ci()}function zv(){if(ar===0)if((dt&536870912)===0||ht){var r=Rr;Rr<<=1,(Rr&3932160)===0&&(Rr=262144),ar=r}else ar=536870912;return r=rr.current,r!==null&&(r.flags|=32),ar}function Qn(r,s,o){(r===Tt&&(wt===2||wt===9)||r.cancelPendingCommit!==null)&&(Ja(r,0),gs(r,dt,ar,!1)),mt(r,o),((yt&2)===0||r!==Tt)&&(r===Tt&&((yt&2)===0&&(ea|=o),Jt===4&&gs(r,dt,ar,!1)),Zr(r))}function Ov(r,s,o){if((yt&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||Ye(r,s),m=d?ak(r,s):Lh(r,s,!0),x=d;do{if(m===0){Ya&&!d&&gs(r,s,0,!1);break}else{if(o=r.current.alternate,x&&!ik(o)){m=Lh(r,s,!1),x=!1;continue}if(m===2){if(x=s,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var C=r;m=ho;var q=C.current.memoizedState.isDehydrated;if(q&&(Ja(C,w).flags|=256),w=Lh(C,w,!1),w!==2){if(Nh&&!q){C.errorRecoveryDisabledLanes|=x,ea|=x,m=4;break e}x=Yn,Yn=m,x!==null&&(Yn===null?Yn=x:Yn.push.apply(Yn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){Ja(r,0),gs(r,s,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:gs(d,s,ar,!fs);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=bu+300-qe(),10<m)){if(gs(d,s,ar,!fs),ge(d,0,!0)!==0)break e;Ai=s,d.timeoutHandle=h1(Bv.bind(null,d,o,Yn,_u,Eh,s,ar,ea,Qa,fs,x,"Throttled",-0,0),m);break e}Bv(d,o,Yn,_u,Eh,s,ar,ea,Qa,fs,x,null,-0,0)}}break}while(!0);Zr(r)}function Bv(r,s,o,d,m,x,w,C,q,ee,oe,ue,te,se){if(r.timeoutHandle=-1,ue=s.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Dr},Tv(s,x,ue);var Ee=(x&62914560)===x?bu-qe():(x&4194048)===x?Lv-qe():0;if(Ee=qk(ue,Ee),Ee!==null){Ai=x,r.cancelPendingCommit=Ee(Vv.bind(null,r,s,x,o,d,m,w,C,q,oe,ue,null,te,se)),gs(r,x,w,!ee);return}}Vv(r,s,x,o,d,m,w,C,q)}function ik(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!tr(x(),m))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gs(r,s,o,d){s&=~Ch,s&=~ea,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var x=31-ut(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&zs(r,o,s)}function wu(){return(yt&6)===0?(mo(0),!1):!0}function Rh(){if(lt!==null){if(wt===0)var r=lt.return;else r=lt,bi=Vs=null,Qf(r),Ua=null,Jl=0,r=lt;for(;r!==null;)pv(r.alternate,r),r=r.return;lt=null}}function Ja(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,kk(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),Ai=0,Rh(),Tt=r,lt=o=xi(r.current,null),dt=s,wt=0,sr=null,fs=!1,Ya=Ye(r,s),Nh=!1,Qa=ar=Ch=ea=hs=Jt=0,Yn=ho=null,Eh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var m=31-ut(d),x=1<<m;s|=r[m],d&=~x}return Ti=s,Hc(),o}function Pv(r,s){Je=null,$.H=io,s===$a||s===Xc?(s=e0(),wt=3):s===Of?(s=e0(),wt=4):wt=s===uh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,sr=s,lt===null&&(Jt=1,du(r,xr(s,r.current)))}function $v(){var r=rr.current;return r===null?!0:(dt&4194048)===dt?_r===null:(dt&62914560)===dt||(dt&536870912)!==0?r===_r:!1}function Uv(){var r=$.H;return $.H=io,r===null?io:r}function Fv(){var r=$.A;return $.A=nk,r}function Su(){Jt=4,fs||(dt&4194048)!==dt&&rr.current!==null||(Ya=!0),(hs&134217727)===0&&(ea&134217727)===0||Tt===null||gs(Tt,dt,ar,!1)}function Lh(r,s,o){var d=yt;yt|=2;var m=Uv(),x=Fv();(Tt!==r||dt!==s)&&(_u=null,Ja(r,s)),s=!1;var w=Jt;e:do try{if(wt!==0&&lt!==null){var C=lt,q=sr;switch(wt){case 8:Rh(),w=6;break e;case 3:case 2:case 9:case 6:rr.current===null&&(s=!0);var ee=wt;if(wt=0,sr=null,Xa(r,C,q,ee),o&&Ya){w=0;break e}break;default:ee=wt,wt=0,sr=null,Xa(r,C,q,ee)}}sk(),w=Jt;break}catch(oe){Pv(r,oe)}while(!0);return s&&r.shellSuspendCounter++,bi=Vs=null,yt=d,$.H=m,$.A=x,lt===null&&(Tt=null,dt=0,Hc()),w}function sk(){for(;lt!==null;)qv(lt)}function ak(r,s){var o=yt;yt|=2;var d=Uv(),m=Fv();Tt!==r||dt!==s?(_u=null,yu=qe()+500,Ja(r,s)):Ya=Ye(r,s);e:do try{if(wt!==0&&lt!==null){s=lt;var x=sr;t:switch(wt){case 1:wt=0,sr=null,Xa(r,s,x,1);break;case 2:case 9:if(Zx(x)){wt=0,sr=null,Hv(s);break}s=function(){wt!==2&&wt!==9||Tt!==r||(wt=7),Zr(r)},x.then(s,s);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:Zx(x)?(wt=0,sr=null,Hv(s)):(wt=0,sr=null,Xa(r,s,x,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var C=lt;if(w?E1(w):C.stateNode.complete){wt=0,sr=null;var q=C.sibling;if(q!==null)lt=q;else{var ee=C.return;ee!==null?(lt=ee,ku(ee)):lt=null}break t}}wt=0,sr=null,Xa(r,s,x,5);break;case 6:wt=0,sr=null,Xa(r,s,x,6);break;case 8:Rh(),Jt=6;break e;default:throw Error(i(462))}}lk();break}catch(oe){Pv(r,oe)}while(!0);return bi=Vs=null,$.H=d,$.A=m,yt=o,lt!==null?0:(Tt=null,dt=0,Hc(),Jt)}function lk(){for(;lt!==null&&!Oe();)qv(lt)}function qv(r){var s=fv(r.alternate,r,Ti);r.memoizedProps=r.pendingProps,s===null?ku(r):lt=s}function Hv(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=av(o,s,s.pendingProps,s.type,void 0,dt);break;case 11:s=av(o,s,s.pendingProps,s.type.render,s.ref,dt);break;case 5:Qf(s);default:pv(o,s),s=lt=Fx(s,Ti),s=fv(o,s,Ti)}r.memoizedProps=r.pendingProps,s===null?ku(r):lt=s}function Xa(r,s,o,d){bi=Vs=null,Qf(s),Ua=null,Jl=0;var m=s.return;try{if(WS(r,m,s,o,dt)){Jt=1,du(r,xr(o,r.current)),lt=null;return}}catch(x){if(m!==null)throw lt=m,x;Jt=1,du(r,xr(o,r.current)),lt=null;return}s.flags&32768?(ht||d===1?r=!0:Ya||(dt&536870912)!==0?r=!1:(fs=r=!0,(d===2||d===9||d===3||d===6)&&(d=rr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Iv(s,r)):ku(s)}function ku(r){var s=r;do{if((s.flags&32768)!==0){Iv(s,fs);return}r=s.return;var o=ZS(s.alternate,s,Ti);if(o!==null){lt=o;return}if(s=s.sibling,s!==null){lt=s;return}lt=s=r}while(s!==null);Jt===0&&(Jt=5)}function Iv(r,s){do{var o=KS(r.alternate,r);if(o!==null){o.flags&=32767,lt=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){lt=r;return}lt=r=o}while(r!==null);Jt=6,lt=null}function Vv(r,s,o,d,m,x,w,C,q){r.cancelPendingCommit=null;do ju();while(mn!==0);if((yt&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(x=s.lanes|s.childLanes,x|=_f,qn(r,o,x,w,C,q),r===Tt&&(lt=Tt=null,dt=0),Wa=s,ms=r,Ai=o,Th=x,Ah=m,Dv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,dk(Q,function(){return Jv(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,m=P.p,P.p=2,w=yt,yt|=4;try{ek(r,s,o)}finally{yt=w,P.p=m,$.T=d}}mn=1,Gv(),Yv(),Qv()}}function Gv(){if(mn===1){mn=0;var r=ms,s=Wa,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var d=P.p;P.p=2;var m=yt;yt|=4;try{Nv(s,r);var x=Vh,w=Rx(r.containerInfo),C=x.focusedElem,q=x.selectionRange;if(w!==C&&C&&C.ownerDocument&&Mx(C.ownerDocument.documentElement,C)){if(q!==null&&gf(C)){var ee=q.start,oe=q.end;if(oe===void 0&&(oe=ee),"selectionStart"in C)C.selectionStart=ee,C.selectionEnd=Math.min(oe,C.value.length);else{var ue=C.ownerDocument||document,te=ue&&ue.defaultView||window;if(te.getSelection){var se=te.getSelection(),Ee=C.textContent.length,Ue=Math.min(q.start,Ee),Ct=q.end===void 0?Ue:Math.min(q.end,Ee);!se.extend&&Ue>Ct&&(w=Ct,Ct=Ue,Ue=w);var J=Ax(C,Ue),G=Ax(C,Ct);if(J&&G&&(se.rangeCount!==1||se.anchorNode!==J.node||se.anchorOffset!==J.offset||se.focusNode!==G.node||se.focusOffset!==G.offset)){var K=ue.createRange();K.setStart(J.node,J.offset),se.removeAllRanges(),Ue>Ct?(se.addRange(K),se.extend(G.node,G.offset)):(K.setEnd(G.node,G.offset),se.addRange(K))}}}}for(ue=[],se=C;se=se.parentNode;)se.nodeType===1&&ue.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ue.length;C++){var ce=ue[C];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Bu=!!Ih,Vh=Ih=null}finally{yt=m,P.p=d,$.T=o}}r.current=s,mn=2}}function Yv(){if(mn===2){mn=0;var r=ms,s=Wa,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var d=P.p;P.p=2;var m=yt;yt|=4;try{_v(r,s.alternate,s)}finally{yt=m,P.p=d,$.T=o}}mn=3}}function Qv(){if(mn===4||mn===3){mn=0,st();var r=ms,s=Wa,o=Ai,d=Dv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?mn=5:(mn=0,Wa=ms=null,Wv(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(ps=null),ya(o),s=s.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(nt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=$.T,m=P.p,P.p=2,$.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var C=d[w];x(C.value,{componentStack:C.stack})}}finally{$.T=s,P.p=m}}(Ai&3)!==0&&ju(),Zr(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===Mh?po++:(po=0,Mh=r):po=0,mo(0)}}function Wv(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Ql(s)))}function ju(){return Gv(),Yv(),Qv(),Jv()}function Jv(){if(mn!==5)return!1;var r=ms,s=Th;Th=0;var o=ya(Ai),d=$.T,m=P.p;try{P.p=32>o?32:o,$.T=null,o=Ah,Ah=null;var x=ms,w=Ai;if(mn=0,Wa=ms=null,Ai=0,(yt&6)!==0)throw Error(i(331));var C=yt;if(yt|=4,Mv(x.current),Ev(x,x.current,w,o),yt=C,mo(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(nt,x)}catch{}return!0}finally{P.p=m,$.T=d,Wv(r,s)}}function Xv(r,s,o){s=xr(o,s),s=ch(r.stateNode,s,2),r=os(r,s,2),r!==null&&(mt(r,2),Zr(r))}function St(r,s,o){if(r.tag===3)Xv(r,r,o);else for(;s!==null;){if(s.tag===3){Xv(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ps===null||!ps.has(d))){r=xr(o,r),o=Z0(2),d=os(s,o,2),d!==null&&(K0(o,d,s,r),mt(d,2),Zr(d));break}}s=s.return}}function Dh(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new rk;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(o)||(Nh=!0,m.add(o),r=ok.bind(null,r,s,o),s.then(r,r))}function ok(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Tt===r&&(dt&o)===o&&(Jt===4||Jt===3&&(dt&62914560)===dt&&300>qe()-bu?(yt&2)===0&&Ja(r,0):Ch|=o,Qa===dt&&(Qa=0)),Zr(r)}function Zv(r,s){s===0&&(s=rn()),r=qs(r,s),r!==null&&(mt(r,s),Zr(r))}function ck(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),Zv(r,o)}function uk(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),Zv(r,o)}function dk(r,s){return hn(r,s)}var Nu=null,Za=null,zh=!1,Cu=!1,Oh=!1,xs=0;function Zr(r){r!==Za&&r.next===null&&(Za===null?Nu=Za=r:Za=Za.next=r),Cu=!0,zh||(zh=!0,hk())}function mo(r,s){if(!Oh&&Cu){Oh=!0;do for(var o=!1,d=Nu;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,C=d.pingedLanes;x=(1<<31-ut(42|r)+1)-1,x&=m&~(w&~C),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,n1(d,x))}else x=dt,x=ge(d,d===Tt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Ye(d,x)||(o=!0,n1(d,x));d=d.next}while(o);Oh=!1}}function fk(){Kv()}function Kv(){Cu=zh=!1;var r=0;xs!==0&&Sk()&&(r=xs);for(var s=qe(),o=null,d=Nu;d!==null;){var m=d.next,x=e1(d,s);x===0?(d.next=null,o===null?Nu=m:o.next=m,m===null&&(Za=o)):(o=d,(r!==0||(x&3)!==0)&&(Cu=!0)),d=m}mn!==0&&mn!==5||mo(r),xs!==0&&(xs=0)}function e1(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-ut(x),C=1<<w,q=m[w];q===-1?((C&o)===0||(C&d)!==0)&&(m[w]=_t(C,s)):q<=s&&(r.expiredLanes|=C),x&=~C}if(s=Tt,o=dt,o=ge(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(wt===2||wt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ke(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||Ye(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&ke(d),ya(o)){case 2:case 8:o=xe;break;case 32:o=Q;break;case 268435456:o=Ae;break;default:o=Q}return d=t1.bind(null,r),o=hn(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&ke(d),r.callbackPriority=2,r.callbackNode=null,2}function t1(r,s){if(mn!==0&&mn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(ju()&&r.callbackNode!==o)return null;var d=dt;return d=ge(r,r===Tt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Ov(r,d,s),e1(r,qe()),r.callbackNode!=null&&r.callbackNode===o?t1.bind(null,r):null)}function n1(r,s){if(ju())return null;Ov(r,s,!0)}function hk(){jk(function(){(yt&6)!==0?hn(le,fk):Kv()})}function Bh(){if(xs===0){var r=Ba;r===0&&(r=Mr,Mr<<=1,(Mr&261888)===0&&(Mr=256)),xs=r}return xs}function r1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ka(""+r)}function i1(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function pk(r,s,o,d,m){if(s==="submit"&&o&&o.stateNode===m){var x=r1((m[pn]||null).action),w=d.submitter;w&&(s=(s=w[pn]||null)?r1(s.formAction):w.getAttribute("formAction"),s!==null&&(x=s,w=null));var C=new Ul("action","action",null,d,m);r.push({event:C,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(xs!==0){var q=w?i1(m,w):new FormData(m);rh(o,{pending:!0,data:q,method:m.method,action:x},null,q)}}else typeof x=="function"&&(C.preventDefault(),q=w?i1(m,w):new FormData(m),rh(o,{pending:!0,data:q,method:m.method,action:x},x,q))},currentTarget:m}]})}}for(var Ph=0;Ph<yf.length;Ph++){var $h=yf[Ph],mk=$h.toLowerCase(),gk=$h[0].toUpperCase()+$h.slice(1);zr(mk,"on"+gk)}zr(zx,"onAnimationEnd"),zr(Ox,"onAnimationIteration"),zr(Bx,"onAnimationStart"),zr("dblclick","onDoubleClick"),zr("focusin","onFocus"),zr("focusout","onBlur"),zr(RS,"onTransitionRun"),zr(LS,"onTransitionStart"),zr(DS,"onTransitionCancel"),zr(Px,"onTransitionEnd"),Wi("onMouseEnter",["mouseout","mouseover"]),Wi("onMouseLeave",["mouseout","mouseover"]),Wi("onPointerEnter",["pointerout","pointerover"]),Wi("onPointerLeave",["pointerout","pointerover"]),Gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Gr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="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(" "),xk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(go));function s1(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(s)for(var w=d.length-1;0<=w;w--){var C=d[w],q=C.instance,ee=C.currentTarget;if(C=C.listener,q!==x&&m.isPropagationStopped())break e;x=C,m.currentTarget=ee;try{x(m)}catch(oe){qc(oe)}m.currentTarget=null,x=q}else for(w=0;w<d.length;w++){if(C=d[w],q=C.instance,ee=C.currentTarget,C=C.listener,q!==x&&m.isPropagationStopped())break e;x=C,m.currentTarget=ee;try{x(m)}catch(oe){qc(oe)}m.currentTarget=null,x=q}}}}function ot(r,s){var o=s[Yi];o===void 0&&(o=s[Yi]=new Set);var d=r+"__bubble";o.has(d)||(a1(s,r,2,!1),o.add(d))}function Uh(r,s,o){var d=0;s&&(d|=4),a1(o,r,d,s)}var Eu="_reactListening"+Math.random().toString(36).slice(2);function Fh(r){if(!r[Eu]){r[Eu]=!0,Yt.forEach(function(o){o!=="selectionchange"&&(xk.has(o)||Uh(o,!1,r),Uh(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Eu]||(s[Eu]=!0,Uh("selectionchange",!1,s))}}function a1(r,s,o,d){switch(z1(s)){case 2:var m=Vk;break;case 8:m=Gk;break;default:m=np}o=m.bind(null,s,o,r),m=void 0,!He||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,o,{capture:!0,passive:m}):r.addEventListener(s,o,!0):m!==void 0?r.addEventListener(s,o,{passive:m}):r.addEventListener(s,o,!1)}function qh(r,s,o,d,m){var x=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var C=d.stateNode.containerInfo;if(C===m)break;if(w===4)for(w=d.return;w!==null;){var q=w.tag;if((q===3||q===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;C!==null;){if(w=bn(C),w===null)return;if(q=w.tag,q===5||q===6||q===26||q===27){d=x=w;continue e}C=C.parentNode}}d=d.return}Xe(function(){var ee=x,oe=ja(o),ue=[];e:{var te=$x.get(r);if(te!==void 0){var se=Ul,Ee=r;switch(r){case"keypress":if(Bs(o)===0)break e;case"keydown":case"keyup":se=uS;break;case"focusin":Ee="focus",se=df;break;case"focusout":Ee="blur",se=df;break;case"beforeblur":case"afterblur":se=df;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=$s;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Z2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=hS;break;case zx:case Ox:case Bx:se=tS;break;case Px:se=mS;break;case"scroll":case"scrollend":se=Uc;break;case"wheel":se=xS;break;case"copy":case"cut":case"paste":se=rS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=gx;break;case"toggle":case"beforetoggle":se=bS}var Ue=(s&4)!==0,Ct=!Ue&&(r==="scroll"||r==="scrollend"),J=Ue?te!==null?te+"Capture":null:te;Ue=[];for(var G=ee,K;G!==null;){var ce=G;if(K=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||K===null||J===null||(ce=at(G,J),ce!=null&&Ue.push(xo(G,ce,K))),Ct)break;G=G.return}0<Ue.length&&(te=new se(te,Ee,null,o,oe),ue.push({event:te,listeners:Ue}))}}if((s&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",te&&o!==$l&&(Ee=o.relatedTarget||o.fromElement)&&(bn(Ee)||Ee[Lr]))break e;if((se||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,se?(Ee=o.relatedTarget||o.toElement,se=ee,Ee=Ee?bn(Ee):null,Ee!==null&&(Ct=c(Ee),Ue=Ee.tag,Ee!==Ct||Ue!==5&&Ue!==27&&Ue!==6)&&(Ee=null)):(se=null,Ee=ee),se!==Ee)){if(Ue=$s,ce="onMouseLeave",J="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=gx,ce="onPointerLeave",J="onPointerEnter",G="pointer"),Ct=se==null?te:fi(se),K=Ee==null?te:fi(Ee),te=new Ue(ce,G+"leave",se,o,oe),te.target=Ct,te.relatedTarget=K,ce=null,bn(oe)===ee&&(Ue=new Ue(J,G+"enter",Ee,o,oe),Ue.target=K,Ue.relatedTarget=Ct,ce=Ue),Ct=ce,se&&Ee)t:{for(Ue=vk,J=se,G=Ee,K=0,ce=J;ce;ce=Ue(ce))K++;ce=0;for(var Be=G;Be;Be=Ue(Be))ce++;for(;0<K-ce;)J=Ue(J),K--;for(;0<ce-K;)G=Ue(G),ce--;for(;K--;){if(J===G||G!==null&&J===G.alternate){Ue=J;break t}J=Ue(J),G=Ue(G)}Ue=null}else Ue=null;se!==null&&l1(ue,te,se,Ue,!1),Ee!==null&&Ct!==null&&l1(ue,Ct,Ee,Ue,!0)}}e:{if(te=ee?fi(ee):window,se=te.nodeName&&te.nodeName.toLowerCase(),se==="select"||se==="input"&&te.type==="file")var vt=kx;else if(wx(te))if(jx)vt=TS;else{vt=CS;var Me=NS}else se=te.nodeName,!se||se.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Pl(ee.elementType)&&(vt=kx):vt=ES;if(vt&&(vt=vt(r,ee))){Sx(ue,vt,o,oe);break e}Me&&Me(r,te,ee),r==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&zl(te,"number",te.value)}switch(Me=ee?fi(ee):window,r){case"focusin":(wx(Me)||Me.contentEditable==="true")&&(Ta=Me,xf=ee,Vl=null);break;case"focusout":Vl=xf=Ta=null;break;case"mousedown":vf=!0;break;case"contextmenu":case"mouseup":case"dragend":vf=!1,Lx(ue,o,oe);break;case"selectionchange":if(MS)break;case"keydown":case"keyup":Lx(ue,o,oe)}var Ze;if(hf)e:{switch(r){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Ea?yx(r,o)&&(ft="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(ft="onCompositionStart");ft&&(xx&&o.locale!=="ko"&&(Ea||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Ea&&(Ze=Mn()):(er=oe,Ki="value"in er?er.value:er.textContent,Ea=!0)),Me=Tu(ee,ft),0<Me.length&&(ft=new mx(ft,r,null,o,oe),ue.push({event:ft,listeners:Me}),Ze?ft.data=Ze:(Ze=_x(o),Ze!==null&&(ft.data=Ze)))),(Ze=_S?wS(r,o):SS(r,o))&&(ft=Tu(ee,"onBeforeInput"),0<ft.length&&(Me=new mx("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Me,listeners:ft}),Me.data=Ze)),pk(ue,r,ee,o,oe)}s1(ue,s)})}function xo(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Tu(r,s){for(var o=s+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=at(r,o),m!=null&&d.unshift(xo(r,m,x)),m=at(r,s),m!=null&&d.push(xo(r,m,x))),r.tag===3)return d;r=r.return}return[]}function vk(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function l1(r,s,o,d,m){for(var x=s._reactName,w=[];o!==null&&o!==d;){var C=o,q=C.alternate,ee=C.stateNode;if(C=C.tag,q!==null&&q===d)break;C!==5&&C!==26&&C!==27||ee===null||(q=ee,m?(ee=at(o,x),ee!=null&&w.unshift(xo(o,ee,q))):m||(ee=at(o,x),ee!=null&&w.push(xo(o,ee,q)))),o=o.return}w.length!==0&&r.push({event:s,listeners:w})}var bk=/\r\n?/g,yk=/\u0000|\uFFFD/g;function o1(r){return(typeof r=="string"?r:""+r).replace(bk,`
49
+ `).replace(yk,"")}function c1(r,s){return s=o1(s),o1(r)===s}function Nt(r,s,o,d,m,x){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Zi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Zi(r,""+d);break;case"className":Ji(r,"class",d);break;case"tabIndex":Ji(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ji(r,o,d);break;case"style":Bl(r,d,x);break;case"data":if(s!=="object"){Ji(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ka(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(s!=="input"&&Nt(r,s,"name",m.name,m,null),Nt(r,s,"formEncType",m.formEncType,m,null),Nt(r,s,"formMethod",m.formMethod,m,null),Nt(r,s,"formTarget",m.formTarget,m,null)):(Nt(r,s,"encType",m.encType,m,null),Nt(r,s,"method",m.method,m,null),Nt(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ka(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=Dr);break;case"onScroll":d!=null&&ot("scroll",r);break;case"onScrollEnd":d!=null&&ot("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=ka(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":ot("beforetoggle",r),ot("toggle",r),mr(r,"popover",d);break;case"xlinkActuate":sn(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":sn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":sn(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":sn(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":sn(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":sn(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":sn(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":sn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":sn(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":mr(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=cf.get(o)||o,mr(r,o,d))}}function Hh(r,s,o,d,m,x){switch(o){case"style":Bl(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Zi(r,d):(typeof d=="number"||typeof d=="bigint")&&Zi(r,""+d);break;case"onScroll":d!=null&&ot("scroll",r);break;case"onScrollEnd":d!=null&&ot("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Mc.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),s=o.slice(2,m?o.length-7:void 0),x=r[pn]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(s,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):mr(r,o,d)}}}function Cn(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",r),ot("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Nt(r,s,x,w,o,null)}}m&&Nt(r,s,"srcSet",o.srcSet,o,null),d&&Nt(r,s,"src",o.src,o,null);return;case"input":ot("invalid",r);var C=x=w=m=null,q=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var oe=o[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":q=oe;break;case"defaultChecked":ee=oe;break;case"value":x=oe;break;case"defaultValue":C=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,s));break;default:Nt(r,s,d,oe,o,null)}}Oc(r,x,C,q,ee,w,m,!1);return;case"select":ot("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(C=o[m],C!=null))switch(m){case"value":x=C;break;case"defaultValue":w=C;break;case"multiple":d=C;default:Nt(r,s,m,C,o,null)}s=x,o=w,r.multiple=!!d,s!=null?hi(r,!!d,s,!1):o!=null&&hi(r,!!d,o,!0);return;case"textarea":ot("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(C=o[w],C!=null))switch(w){case"value":d=C;break;case"defaultValue":m=C;break;case"children":x=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(i(91));break;default:Nt(r,s,w,C,o,null)}Bc(r,d,m,x);return;case"option":for(q in o)if(o.hasOwnProperty(q)&&(d=o[q],d!=null))switch(q){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Nt(r,s,q,d,o,null)}return;case"dialog":ot("beforetoggle",r),ot("toggle",r),ot("cancel",r),ot("close",r);break;case"iframe":case"object":ot("load",r);break;case"video":case"audio":for(d=0;d<go.length;d++)ot(go[d],r);break;case"image":ot("error",r),ot("load",r);break;case"details":ot("toggle",r);break;case"embed":case"source":case"link":ot("error",r),ot("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Nt(r,s,ee,d,o,null)}return;default:if(Pl(s)){for(oe in o)o.hasOwnProperty(oe)&&(d=o[oe],d!==void 0&&Hh(r,s,oe,d,o,void 0));return}}for(C in o)o.hasOwnProperty(C)&&(d=o[C],d!=null&&Nt(r,s,C,d,o,null))}function _k(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,C=null,q=null,ee=null,oe=null;for(se in o){var ue=o[se];if(o.hasOwnProperty(se)&&ue!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":q=ue;default:d.hasOwnProperty(se)||Nt(r,s,se,null,d,ue)}}for(var te in d){var se=d[te];if(ue=o[te],d.hasOwnProperty(te)&&(se!=null||ue!=null))switch(te){case"type":x=se;break;case"name":m=se;break;case"checked":ee=se;break;case"defaultChecked":oe=se;break;case"value":w=se;break;case"defaultValue":C=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==ue&&Nt(r,s,te,se,d,ue)}}Dl(r,w,C,q,ee,oe,x,m);return;case"select":se=w=C=te=null;for(x in o)if(q=o[x],o.hasOwnProperty(x)&&q!=null)switch(x){case"value":break;case"multiple":se=q;default:d.hasOwnProperty(x)||Nt(r,s,x,null,d,q)}for(m in d)if(x=d[m],q=o[m],d.hasOwnProperty(m)&&(x!=null||q!=null))switch(m){case"value":te=x;break;case"defaultValue":C=x;break;case"multiple":w=x;default:x!==q&&Nt(r,s,m,x,d,q)}s=C,o=w,d=se,te!=null?hi(r,!!o,te,!1):!!d!=!!o&&(s!=null?hi(r,!!o,s,!0):hi(r,!!o,o?[]:"",!1));return;case"textarea":se=te=null;for(C in o)if(m=o[C],o.hasOwnProperty(C)&&m!=null&&!d.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Nt(r,s,C,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":te=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&Nt(r,s,w,m,d,x)}Ol(r,te,se);return;case"option":for(var Ee in o)if(te=o[Ee],o.hasOwnProperty(Ee)&&te!=null&&!d.hasOwnProperty(Ee))switch(Ee){case"selected":r.selected=!1;break;default:Nt(r,s,Ee,null,d,te)}for(q in d)if(te=d[q],se=o[q],d.hasOwnProperty(q)&&te!==se&&(te!=null||se!=null))switch(q){case"selected":r.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Nt(r,s,q,te,d,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in o)te=o[Ue],o.hasOwnProperty(Ue)&&te!=null&&!d.hasOwnProperty(Ue)&&Nt(r,s,Ue,null,d,te);for(ee in d)if(te=d[ee],se=o[ee],d.hasOwnProperty(ee)&&te!==se&&(te!=null||se!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,s));break;default:Nt(r,s,ee,te,d,se)}return;default:if(Pl(s)){for(var Ct in o)te=o[Ct],o.hasOwnProperty(Ct)&&te!==void 0&&!d.hasOwnProperty(Ct)&&Hh(r,s,Ct,void 0,d,te);for(oe in d)te=d[oe],se=o[oe],!d.hasOwnProperty(oe)||te===se||te===void 0&&se===void 0||Hh(r,s,oe,te,d,se);return}}for(var J in o)te=o[J],o.hasOwnProperty(J)&&te!=null&&!d.hasOwnProperty(J)&&Nt(r,s,J,null,d,te);for(ue in d)te=d[ue],se=o[ue],!d.hasOwnProperty(ue)||te===se||te==null&&se==null||Nt(r,s,ue,te,d,se)}function u1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,C=m.duration;if(x&&C&&u1(w)){for(w=0,C=m.responseEnd,d+=1;d<o.length;d++){var q=o[d],ee=q.startTime;if(ee>C)break;var oe=q.transferSize,ue=q.initiatorType;oe&&u1(ue)&&(q=q.responseEnd,w+=oe*(q<C?1:(C-ee)/(q-ee)))}if(--d,s+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Ih=null,Vh=null;function Au(r){return r.nodeType===9?r:r.ownerDocument}function d1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function f1(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Gh(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Yh=null;function Sk(){var r=window.event;return r&&r.type==="popstate"?r===Yh?!1:(Yh=r,!0):(Yh=null,!1)}var h1=typeof setTimeout=="function"?setTimeout:void 0,kk=typeof clearTimeout=="function"?clearTimeout:void 0,p1=typeof Promise=="function"?Promise:void 0,jk=typeof queueMicrotask=="function"?queueMicrotask:typeof p1<"u"?function(r){return p1.resolve(null).then(r).catch(Nk)}:h1;function Nk(r){setTimeout(function(){throw r})}function vs(r){return r==="head"}function m1(r,s){var o=s,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),nl(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")vo(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,vo(o);for(var x=o.firstChild;x;){var w=x.nextSibling,C=x.nodeName;x[di]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&vo(r.ownerDocument.body);o=m}while(o);nl(s)}function g1(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function Qh(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Qh(o),Qi(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function Ck(r,s,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[di])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=wr(r.nextSibling),r===null)break}return null}function Ek(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=wr(r.nextSibling),r===null))return null;return r}function x1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=wr(r.nextSibling),r===null))return null;return r}function Wh(r){return r.data==="$?"||r.data==="$~"}function Jh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Tk(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function wr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var Xh=null;function v1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return wr(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function b1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function y1(r,s,o){switch(s=Au(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function vo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Qi(r)}var Sr=new Map,_1=new Set;function Mu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Mi=P.d;P.d={f:Ak,r:Mk,D:Rk,C:Lk,L:Dk,m:zk,X:Bk,S:Ok,M:Pk};function Ak(){var r=Mi.f(),s=wu();return r||s}function Mk(r){var s=Ir(r);s!==null&&s.tag===5&&s.type==="form"?P0(s):Mi.r(r)}var Ka=typeof document>"u"?null:document;function w1(r,s,o){var d=Ka;if(d&&typeof s=="string"&&s){var m=Hn(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),_1.has(m)||(_1.add(m),r={rel:r,crossOrigin:o,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),Cn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function Rk(r){Mi.D(r),w1("dns-prefetch",r,null)}function Lk(r,s){Mi.C(r,s),w1("preconnect",r,s)}function Dk(r,s,o){Mi.L(r,s,o);var d=Ka;if(d&&r&&s){var m='link[rel="preload"][as="'+Hn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Hn(o.imageSizes)+'"]')):m+='[href="'+Hn(r)+'"]';var x=m;switch(s){case"style":x=el(r);break;case"script":x=tl(r)}Sr.has(x)||(r=v({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),Sr.set(x,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(bo(x))||s==="script"&&d.querySelector(yo(x))||(s=d.createElement("link"),Cn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function zk(r,s){Mi.m(r,s);var o=Ka;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+Hn(d)+'"][href="'+Hn(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=tl(r)}if(!Sr.has(x)&&(r=v({rel:"modulepreload",href:r},s),Sr.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(yo(x)))return}d=o.createElement("link"),Cn(d,"link",r),Zt(d),o.head.appendChild(d)}}}function Ok(r,s,o){Mi.S(r,s,o);var d=Ka;if(d&&r){var m=Vr(d).hoistableStyles,x=el(r);s=s||"default";var w=m.get(x);if(!w){var C={loading:0,preload:null};if(w=d.querySelector(bo(x)))C.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":s},o),(o=Sr.get(x))&&Zh(r,o);var q=w=d.createElement("link");Zt(q),Cn(q,"link",r),q._p=new Promise(function(ee,oe){q.onload=ee,q.onerror=oe}),q.addEventListener("load",function(){C.loading|=1}),q.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Ru(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:C},m.set(x,w)}}}function Bk(r,s){Mi.X(r,s);var o=Ka;if(o&&r){var d=Vr(o).hoistableScripts,m=tl(r),x=d.get(m);x||(x=o.querySelector(yo(m)),x||(r=v({src:r,async:!0},s),(s=Sr.get(m))&&Kh(r,s),x=o.createElement("script"),Zt(x),Cn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Pk(r,s){Mi.M(r,s);var o=Ka;if(o&&r){var d=Vr(o).hoistableScripts,m=tl(r),x=d.get(m);x||(x=o.querySelector(yo(m)),x||(r=v({src:r,async:!0,type:"module"},s),(s=Sr.get(m))&&Kh(r,s),x=o.createElement("script"),Zt(x),Cn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function S1(r,s,o,d){var m=(m=Ce.current)?Mu(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=el(o.href),o=Vr(m).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=el(o.href);var x=Vr(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(bo(r)))&&!x._p&&(w.instance=x,w.state.loading=5),Sr.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Sr.set(r,o),x||$k(m,r,o,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=tl(o),o=Vr(m).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function el(r){return'href="'+Hn(r)+'"'}function bo(r){return'link[rel="stylesheet"]['+r+"]"}function k1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function $k(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),Cn(s,"link",o),Zt(s),r.head.appendChild(s))}function tl(r){return'[src="'+Hn(r)+'"]'}function yo(r){return"script[async]"+r}function j1(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Hn(o.href)+'"]');if(d)return s.instance=d,Zt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Zt(d),Cn(d,"style",m),Ru(d,o.precedence,r),s.instance=d;case"stylesheet":m=el(o.href);var x=r.querySelector(bo(m));if(x)return s.state.loading|=4,s.instance=x,Zt(x),x;d=k1(o),(m=Sr.get(m))&&Zh(d,m),x=(r.ownerDocument||r).createElement("link"),Zt(x);var w=x;return w._p=new Promise(function(C,q){w.onload=C,w.onerror=q}),Cn(x,"link",d),s.state.loading|=4,Ru(x,o.precedence,r),s.instance=x;case"script":return x=tl(o.src),(m=r.querySelector(yo(x)))?(s.instance=m,Zt(m),m):(d=o,(m=Sr.get(x))&&(d=v({},o),Kh(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Zt(m),Cn(m,"link",d),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Ru(d,o.precedence,r));return s.instance}function Ru(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var C=d[w];if(C.dataset.precedence===s)x=C;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function Zh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Kh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Lu=null;function N1(r,s,o){if(Lu===null){var d=new Map,m=Lu=new Map;m.set(o,d)}else m=Lu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[di]||x[Gt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(s)||"";w=r+w;var C=d.get(w);C?C.push(x):d.set(w,[x])}}return d}function C1(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function Uk(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function E1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Fk(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=el(d.href),x=s.querySelector(bo(m));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Du.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=x,Zt(x);return}x=s.ownerDocument||s,d=k1(d),(m=Sr.get(m))&&Zh(d,m),x=x.createElement("link"),Zt(x);var w=x;w._p=new Promise(function(C,q){w.onload=C,w.onerror=q}),Cn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Du.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var ep=0;function qk(r,s){return r.stylesheets&&r.count===0&&Ou(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Ou(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+s);0<r.imgBytes&&ep===0&&(ep=62500*wk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Ou(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>ep?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Du(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ou(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var zu=null;function Ou(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,zu=new Map,s.forEach(Hk,r),zu=null,Du.call(r))}function Hk(r,s){if(!(s.state.loading&4)){var o=zu.get(r);if(o)var d=o.get(null);else{o=new Map,zu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=Du.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var _o={$$typeof:N,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function Ik(r,s,o,d,m,x,w,C,q){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pr(0),this.hiddenUpdates=pr(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function T1(r,s,o,d,m,x,w,C,q,ee,oe,ue){return r=new Ik(r,s,o,w,q,ee,oe,ue,C),s=1,x===!0&&(s|=24),x=nr(3,null,null,s),r.current=x,x.stateNode=r,s=Lf(),s.refCount++,r.pooledCache=s,s.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:s},Bf(x),r}function A1(r){return r?(r=Ra,r):Ra}function M1(r,s,o,d,m,x){m=A1(m),d.context===null?d.context=m:d.pendingContext=m,d=ls(s),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=os(r,d,s),o!==null&&(Qn(o,r,s),Zl(o,r,s))}function R1(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function tp(r,s){R1(r,s),(r=r.alternate)&&R1(r,s)}function L1(r){if(r.tag===13||r.tag===31){var s=qs(r,67108864);s!==null&&Qn(s,r,67108864),tp(r,67108864)}}function D1(r){if(r.tag===13||r.tag===31){var s=lr();s=qr(s);var o=qs(r,s);o!==null&&Qn(o,r,s),tp(r,s)}}var Bu=!0;function Vk(r,s,o,d){var m=$.T;$.T=null;var x=P.p;try{P.p=2,np(r,s,o,d)}finally{P.p=x,$.T=m}}function Gk(r,s,o,d){var m=$.T;$.T=null;var x=P.p;try{P.p=8,np(r,s,o,d)}finally{P.p=x,$.T=m}}function np(r,s,o,d){if(Bu){var m=rp(d);if(m===null)qh(r,s,d,Pu,o),O1(r,d);else if(Qk(m,r,s,o,d))d.stopPropagation();else if(O1(r,d),s&4&&-1<Yk.indexOf(r)){for(;m!==null;){var x=Ir(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=he(x.pendingLanes);if(w!==0){var C=x;for(C.pendingLanes|=2,C.entangledLanes|=2;w;){var q=1<<31-ut(w);C.entanglements[1]|=q,w&=~q}Zr(x),(yt&6)===0&&(yu=qe()+500,mo(0))}}break;case 31:case 13:C=qs(x,2),C!==null&&Qn(C,x,2),wu(),tp(x,2)}if(x=rp(d),x===null&&qh(r,s,d,Pu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else qh(r,s,d,null,o)}}function rp(r){return r=ja(r),ip(r)}var Pu=null;function ip(r){if(Pu=null,r=bn(r),r!==null){var s=c(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=f(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Pu=r,null}function z1(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(hr()){case le:return 2;case xe:return 8;case Q:case fe:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var sp=!1,bs=null,ys=null,_s=null,wo=new Map,So=new Map,ws=[],Yk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function O1(r,s){switch(r){case"focusin":case"focusout":bs=null;break;case"dragenter":case"dragleave":ys=null;break;case"mouseover":case"mouseout":_s=null;break;case"pointerover":case"pointerout":wo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":So.delete(s.pointerId)}}function ko(r,s,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},s!==null&&(s=Ir(s),s!==null&&L1(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function Qk(r,s,o,d,m){switch(s){case"focusin":return bs=ko(bs,r,s,o,d,m),!0;case"dragenter":return ys=ko(ys,r,s,o,d,m),!0;case"mouseover":return _s=ko(_s,r,s,o,d,m),!0;case"pointerover":var x=m.pointerId;return wo.set(x,ko(wo.get(x)||null,r,s,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,So.set(x,ko(So.get(x)||null,r,s,o,d,m)),!0}return!1}function B1(r){var s=bn(r.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,Ec(r.priority,function(){D1(o)});return}}else if(s===31){if(s=f(o),s!==null){r.blockedOn=s,Ec(r.priority,function(){D1(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function $u(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=rp(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);$l=d,o.target.dispatchEvent(d),$l=null}else return s=Ir(o),s!==null&&L1(s),r.blockedOn=o,!1;s.shift()}return!0}function P1(r,s,o){$u(r)&&o.delete(s)}function Wk(){sp=!1,bs!==null&&$u(bs)&&(bs=null),ys!==null&&$u(ys)&&(ys=null),_s!==null&&$u(_s)&&(_s=null),wo.forEach(P1),So.forEach(P1)}function Uu(r,s){r.blockedOn===s&&(r.blockedOn=null,sp||(sp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Wk)))}var Fu=null;function $1(r){Fu!==r&&(Fu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===r&&(Fu=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(ip(d||o)===null)continue;break}var x=Ir(o);x!==null&&(r.splice(s,3),s-=3,rh(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function nl(r){function s(q){return Uu(q,r)}bs!==null&&Uu(bs,r),ys!==null&&Uu(ys,r),_s!==null&&Uu(_s,r),wo.forEach(s),So.forEach(s);for(var o=0;o<ws.length;o++){var d=ws[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<ws.length&&(o=ws[0],o.blockedOn===null);)B1(o),o.blockedOn===null&&ws.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[pn]||null;if(typeof x=="function")w||$1(o);else if(w){var C=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[pn]||null)C=w.formAction;else if(ip(m)!==null)continue}else C=w.action;typeof C=="function"?o[d+1]=C:(o.splice(d,3),d-=3),$1(o)}}}function U1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function ap(r){this._internalRoot=r}qu.prototype.render=ap.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=lr();M1(o,d,r,s,null,null)},qu.prototype.unmount=ap.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;M1(r.current,2,null,r,null,null),wu(),s[Lr]=null}};function qu(r){this._internalRoot=r}qu.prototype.unstable_scheduleHydration=function(r){if(r){var s=ci();r={blockedOn:null,target:r,priority:s};for(var o=0;o<ws.length&&s!==0&&s<ws[o].priority;o++);ws.splice(o,0,r),o===0&&B1(r)}};var F1=t.version;if(F1!=="19.2.7")throw Error(i(527,F1,"19.2.7"));P.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var Jk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hu.isDisabled&&Hu.supportsFiber)try{nt=Hu.inject(Jk),xt=Hu}catch{}}return No.createRoot=function(r,s){if(!l(r))throw Error(i(299));var o=!1,d="",m=Q0,x=W0,w=J0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=T1(r,1,!1,null,null,o,d,null,m,x,w,U1),r[Lr]=s.current,Fh(r),new ap(s)},No.hydrateRoot=function(r,s,o){if(!l(r))throw Error(i(299));var d=!1,m="",x=Q0,w=W0,C=J0,q=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(C=o.onRecoverableError),o.formState!==void 0&&(q=o.formState)),s=T1(r,1,!0,s,o??null,d,m,q,x,w,C,U1),s.context=A1(null),o=s.current,d=lr(),d=qr(d),m=ls(d),m.callback=null,os(o,m,d),o=d,s.current.lanes=o,mt(s,o),Zr(s),r[Lr]=s.current,Fh(r),new qu(s)},No.version="19.2.7",No}var K1;function cj(){if(K1)return cp.exports;K1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),cp.exports=oj(),cp.exports}var uj=cj();const eb=e=>{let t;const n=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},l=()=>t,f={setState:i,getState:l,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,l,f);return f},dj=(e=>e?eb(e):eb),fj=e=>e;function hj(e,t=fj){const n=Iu.useSyncExternalStore(e.subscribe,Iu.useCallback(()=>t(e.getState()),[e,t]),Iu.useCallback(()=>t(e.getInitialState()),[e,t]));return Iu.useDebugValue(n),n}const tb=e=>{const t=dj(e),n=i=>hj(t,i);return Object.assign(n,t),n},pj=(e=>e?tb(e):tb),fm="companion_auth_token";function nb(){return typeof window>"u"?null:localStorage.getItem(fm)||null}const mj=e=>({authToken:nb(),isAuthenticated:nb()!==null,setAuthToken:t=>{localStorage.setItem(fm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(fm),e({authToken:null,isAuthenticated:!1})}});function Ht(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function gj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function xj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function vj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function bj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const yj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:vj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:xj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:bj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const l=new Map(n.messages);return l.has(t.session_id)||l.set(t.session_id,[]),{sessions:i,messages:l}}),updateSession:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c&&l.set(t,{...c,...n}),{sessions:l}}),removeSession:t=>e(n=>{const i=Ht(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Ht(n.sessions,t),connectionStatus:Ht(n.connectionStatus,t),cliConnected:Ht(n.cliConnected,t),cliReconnecting:Ht(n.cliReconnecting,t),sessionStatus:Ht(n.sessionStatus,t),previousPermissionMode:Ht(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:gj(n.recentlyRenamed,t),mcpServers:Ht(n.mcpServers,t),prStatus:Ht(n.prStatus,t),linkedLinearIssues:Ht(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(l=>l.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Ht(n.messages,t),streaming:Ht(n.streaming,t),streamingStartedAt:Ht(n.streamingStartedAt,t),streamingOutputTokens:Ht(n.streamingOutputTokens,t),pendingPermissions:Ht(n.pendingPermissions,t),aiResolvedPermissions:Ht(n.aiResolvedPermissions,t),sessionTasks:Ht(n.sessionTasks,t),changedFilesTick:Ht(n.changedFilesTick,t),gitChangedFilesCount:Ht(n.gitChangedFilesCount,t),sessionProcesses:Ht(n.sessionProcesses,t),toolProgress:Ht(n.toolProgress,t),toolActivity:Ht(n.toolActivity,t),diffPanelSelectedFile:Ht(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Ht(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const l=new Map(i.connectionStatus);return l.set(t,n),{connectionStatus:l}}),setCliConnected:(t,n)=>e(i=>{const l=new Map(i.cliConnected);return l.set(t,n),{cliConnected:l}}),setCliReconnecting:(t,n)=>e(i=>{const l=new Map(i.cliReconnecting);return n?l.set(t,!0):l.delete(t),{cliReconnecting:l}}),setSessionStatus:(t,n)=>e(i=>{const l=new Map(i.sessionStatus);return l.set(t,n),{sessionStatus:l}}),setPreviousPermissionMode:(t,n)=>e(i=>{const l=new Map(i.previousPermissionMode);return l.set(t,n),{previousPermissionMode:l}}),setSessionName:(t,n)=>e(i=>{const l=new Map(i.sessionNames);return l.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(l.entries()))),{sessionNames:l}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const l=new Map(i.prStatus);return l.set(t,n),{prStatus:l}}),setLinkedLinearIssue:(t,n)=>e(i=>{const l=new Map(i.linkedLinearIssues);return n?l.set(t,n):l.delete(t),{linkedLinearIssues:l}}),setMcpServers:(t,n)=>e(i=>{const l=new Map(i.mcpServers);return l.set(t,n),{mcpServers:l}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c?(l.set(t,{...c,...n}),{sessions:l}):{}})}),_j=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const l=i.messages.get(t)||[];if(n.id&&l.some(u=>u.id===n.id))return i;const c=new Map(i.messages);return c.set(t,[...l,n]),{messages:c}}),setMessages:(t,n)=>e(i=>{const l=new Map(i.messages);return l.set(t,n),{messages:l}}),updateLastAssistantMessage:(t,n)=>e(i=>{const l=new Map(i.messages),c=[...l.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return l.set(t,c),{messages:l}}),setStreaming:(t,n)=>e(i=>{const l=new Map(i.streaming);return n===null?l.delete(t):l.set(t,n),{streaming:l}}),setStreamingStats:(t,n)=>e(i=>{const l=new Map(i.streamingStartedAt),c=new Map(i.streamingOutputTokens);return n===null?(l.delete(t),c.delete(t)):(n.startedAt!==void 0&&l.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:l,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(i=>{const l=new Map(i.lastActivityAt);return l.set(t,n),{lastActivityAt:l}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const l=new Map(i.promptSuggestions);return l.set(t,n),{promptSuggestions:l}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),wj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=new Map(l.get(t)||[]);return c.set(n.request_id,n),l.set(t,c),{pendingPermissions:l}}),removePermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}return{pendingPermissions:l}}),addAiResolvedPermission:(t,n)=>e(i=>{const l=new Map(i.aiResolvedPermissions),c=[...l.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),l.set(t,c),{aiResolvedPermissions:l}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),Sj=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const l=new Map(i.sessionTasks),c=[...l.get(t)||[],n];return l.set(t,c),{sessionTasks:l}}),setTasks:(t,n)=>e(i=>{const l=new Map(i.sessionTasks);return l.set(t,n),{sessionTasks:l}}),updateTask:(t,n,i)=>e(l=>{const c=new Map(l.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const l=new Map(i.sessionProcesses),c=[...l.get(t)||[],n];return l.set(t,c),{sessionProcesses:l}}),updateProcess:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const l=new Map(i.sessionBackgroundAgents),c=[...l.get(t)||[],n];return l.set(t,c),{sessionBackgroundAgents:l}}),updateBackgroundAgent:(t,n,i)=>e(l=>{const c=new Map(l.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const l=new Map(i.gitChangedFilesCount);return l.set(t,n),{gitChangedFilesCount:l}}),setToolProgress:(t,n,i)=>e(l=>{const c=new Map(l.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const l=new Map(i.toolProgress);if(n){const c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}}else l.delete(t);return{toolProgress:l}}),setToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity);return n.length===0?l.delete(t):l.set(t,n),{toolActivity:l}}),addToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity),c=[...l.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return l.set(t,c),{toolActivity:l}}),updateToolActivity:(t,n,i)=>e(l=>{const c=new Map(l.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:c}})}),Vi=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],kj=Vi.map(e=>e.id),O5="cc-task-panel-config";function hm(){return{order:[...kj],enabled:Object.fromEntries(Vi.map(e=>[e.id,!0]))}}function jj(){if(typeof window>"u")return hm();try{const e=localStorage.getItem(O5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const l of Vi)n.has(l.id)||(t.order.push(l.id),t.enabled[l.id]=!0);const i=new Set(Vi.map(l=>l.id));return t.order=t.order.filter(l=>i.has(l)),t}}catch{}return hm()}function Vu(e){try{localStorage.setItem(O5,JSON.stringify(e))}catch{}}function Nj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function Cj(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Ej(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function B5(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}const Tj=e=>({darkMode:Nj(),notificationSound:Cj(),notificationDesktop:Ej(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:jj(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:B5(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Vu(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<=0)return n;[i[l-1],i[l]]=[i[l],i[l-1]];const c={...n.taskPanelConfig,order:i};return Vu(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<0||l>=i.length-1)return n;[i[l],i[l+1]]=[i[l+1],i[l]];const c={...n.taskPanelConfig,order:i};return Vu(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=hm();Vu(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),l=(i.get(t)??0)+1;return i.set(t,l),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const l=new Map(i.diffPanelSelectedFile);return n?l.set(t,n):l.delete(t),{diffPanelSelectedFile:l}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function P5(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const Aj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",l=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?l:l+1,f=i?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`:l===1?"Terminal":`Terminal ${l}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),l=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:l,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function Mj(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const Rj=e=>({updateInfo:null,updateDismissedVersion:Mj(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],l=i.findIndex(c=>c.step===t.step);if(l>=0){const c=[...i];return c[l]=t,{creationProgress:c}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),W=pj((...e)=>({...mj(...e),...yj(...e),..._j(...e),...wj(...e),...Sj(...e),...Tj(...e),...Aj(...e),...Rj(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:B5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Lj=Object.freeze(Object.defineProperty({__proto__:null,useStore:W},Symbol.toStringTag,{value:"Module"})),rb=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],ib=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function sb(){const e=rb[Math.floor(Math.random()*rb.length)],t=ib[Math.floor(Math.random()*ib.length)];return`${e} ${t}`}function $5(e){for(let t=0;t<100;t++){const n=sb();if(!e.has(n))return n}return sb()}let hp=null;function Dj(){return hp||(hp=new AudioContext),hp}function zj(){try{const e=Dj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const l=e.createOscillator(),c=e.createGain();l.type="sine",l.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),l.connect(c),c.connect(e.destination),l.start(t+.15),l.stop(t+.5)}catch{}}class U5{diff(t,n,i={}){let l;typeof i=="function"?(l=i,i={}):"callback"in i&&(l=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(c,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,l)}diffWithOptionsObj(t,n,i,l){var c;const u=T=>{if(T=this.postProcess(T,i),l){setTimeout(function(){l(T)},0);return}else return T},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,i);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let k=-1/0,E=1/0;const j=()=>{for(let T=Math.max(k,-p);T<=Math.min(E,p);T+=2){let N;const D=b[T-1],z=b[T+1];D&&(b[T-1]=void 0);let L=!1;if(z){const U=z.oldPos-T;L=z&&0<=U&&U<f}const H=D&&D.oldPos+1<h;if(!L&&!H){b[T]=void 0;continue}if(!H||L&&D.oldPos<z.oldPos?N=this.addToPath(z,!0,!1,0,i):N=this.addToPath(D,!1,!0,1,i),_=this.extractCommon(N,n,t,T,i),N.oldPos+1>=h&&_+1>=f)return u(this.buildValues(N.lastComponent,n,t))||!0;b[T]=N,N.oldPos+1>=h&&(E=Math.min(E,T-1)),_+1>=f&&(k=Math.max(k,T+1))}p++};if(l)(function T(){setTimeout(function(){if(p>g||Date.now()>y)return l(void 0);j()||T()},0)})();else for(;p<=g&&Date.now()<=y;){const T=j();if(T)return T}}addToPath(t,n,i,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,l,c){const u=n.length,f=i.length;let h=t.oldPos,p=h-l,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let f=0,h=0,p=0;for(;f<u;f++){const g=l[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=i[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return l}}function ab(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function lb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function pm(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function mm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Co(e,t){return pm(e,t,"")}function Gu(e,t){return mm(e,t,"")}function ob(e,t){return t.slice(0,Oj(e,t))}function Oj(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const l=Array(i);let c=0;l[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?l[u]=l[c]:l[u]=c;c>0&&t[u]!=t[c];)c=l[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=l[c];e[u]==t[c]&&c++}return c}function F5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const l=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(l)?n[n.length-1]+=l:n.push(l)}return n}function gm(e,t){if(t)return Wo(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function fl(e,t){if(t)return Wo(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Wo(e,t){if(!t)return[fl(e),gm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=F5(e,t),i=n[0],l=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(l)?l:"";return[c,u]}const cb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Bj=new RegExp(`[${cb}]+|\\s+|[^${cb}]`,"ug");class Pj extends U5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=F5(t,u)}else i=t.match(Bj)||[];const l=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?l.push(u):l.push(l.pop()+u):c!=null&&/\s/.test(c)?l[l.length-1]==c?l.push(l.pop()+u):l.push(c+u):l.push(u),c=u}),l}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,l=null,c=null;return t.forEach(u=>{u.added?l=u:u.removed?c=u:((l||c)&&ub(i,c,l,u,n.intlSegmenter),i=u,l=null,c=null)}),(l||c)&&ub(i,c,l,null,n.intlSegmenter),t}}const $j=new Pj;function Uj(e,t,n){return $j.diff(e,t,n)}function ub(e,t,n,i,l){if(t&&n){const[c,u]=Wo(t.value,l),[f,h]=Wo(n.value,l);if(e){const p=ab(c,f);e.value=mm(e.value,f,p),t.value=Co(t.value,p),n.value=Co(n.value,p)}if(i){const p=lb(u,h);i.value=pm(i.value,h,p),t.value=Gu(t.value,p),n.value=Gu(n.value,p)}}else if(n){if(e){const c=fl(n.value,l);n.value=n.value.substring(c.length)}if(i){const c=fl(i.value,l);i.value=i.value.substring(c.length)}}else if(e&&i){const c=fl(i.value,l),[u,f]=Wo(t.value,l),h=ab(c,u);t.value=Co(t.value,h);const p=lb(Co(c,h),f);t.value=Gu(t.value,p),i.value=pm(i.value,c,p),e.value=mm(e.value,c,c.slice(0,c.length-p.length))}else if(i){const c=fl(i.value,l),u=gm(t.value,l),f=ob(u,c);t.value=Gu(t.value,f)}else if(e){const c=gm(e.value,l),u=fl(t.value,l),f=ob(c,u);t.value=Co(t.value,f)}}class Fj extends U5{constructor(){super(...arguments),this.tokenize=Hj}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
50
50
  `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
51
51
  `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
52
52
  `)&&(t=t.slice(0,-1)),n.endsWith(`
@@ -58,14 +58,14 @@ Error generating stack: `+d.message+`
58
58
  `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Gj(e,t){return Ij("","",e,t,"","",{context:3}).hunks.map(i=>{const l=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,c=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const p=h[0],g=h.slice(1);p==="-"?c.push({type:"del",content:g,oldLineNo:u++}):p==="+"?c.push({type:"add",content:g,newLineNo:f++}):c.push({type:"context",content:g,oldLineNo:u++,newLineNo:f++})}return q5(c),{header:l,lines:c}})}function Yj(e){const t=[],n=e.split(`
59
59
  `);let i=null,l=null,c=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){l&&i&&i.hunks.push(l),i&&t.push(i),i={fileName:"",hunks:[]},l=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){l&&i&&i.hunks.push(l),c=parseInt(h[1],10),u=parseInt(h[2],10),l={header:f,lines:[]};continue}l&&(f.startsWith("+")?l.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?l.lines.push({type:"del",content:f.slice(1),oldLineNo:c++}):f.startsWith(" ")&&l.lines.push({type:"context",content:f.slice(1),oldLineNo:c++,newLineNo:u++}))}l&&i&&i.hunks.push(l),i&&t.push(i);for(const f of t)for(const h of f.hunks)q5(h.lines);return t}function q5(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,l=t;for(;t<e.length&&e[t].type==="add";)t++;const c=t,u=i-n,f=c-l;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const g=e[n+p],v=e[l+p],y=Uj(g.content,v.content);g.wordChanges=y.filter(b=>!b.added).map(b=>({value:b.value,removed:b.removed})),v.wordChanges=y.filter(b=>!b.removed).map(b=>({value:b.value,added:b.added}))}}t===n&&t++}}function Qj({line:e}){return e.wordChanges?a.jsx(a.Fragment,{children:e.wordChanges.map((t,n)=>t.added?a.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?a.jsx("span",{className:"diff-word-del",children:t.value},n):a.jsx("span",{children:t.value},n))}):a.jsx(a.Fragment,{children:e.content})}function Wj({hunk:e,showLineNumbers:t}){return a.jsxs("div",{className:"diff-hunk",children:[a.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>a.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),a.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),a.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),a.jsxs("span",{className:"diff-content",children:[a.jsx(Qj,{line:n}),!n.content&&" "]})]},i))]})}function Jj({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return a.jsxs("div",{className:"diff-file-header",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&a.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),a.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Tl({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:l="compact"}){const c=l==="compact",u=!c,f=S.useMemo(()=>{if(n)return Yj(n);const h=e??"",p=t??"";if(!h&&!p)return[];const g=Gj(h,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?a.jsx("div",{className:"diff-viewer diff-empty",children:a.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):a.jsx("div",{className:`diff-viewer ${c?"diff-compact":"diff-full"}`,children:f.map((h,p)=>a.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&a.jsx(Jj,{fileName:h.fileName||i||""}),h.hunks.map((g,v)=>a.jsx(Wj,{hunk:g,showLineNumbers:u},v))]},p))})}const Xj={Bash:"terminal",Read:"file",Write:"file-plus",Edit:"file-edit",Glob:"search",Grep:"search",WebFetch:"globe",WebSearch:"globe",NotebookEdit:"notebook",Task:"agent",TodoWrite:"checklist",TaskCreate:"list",TaskUpdate:"list",SendMessage:"message",web_search:"globe",mcp_tool_call:"tool"};function _c(e){return Xj[e]||"tool"}function As(e){return e==="Bash"?"Terminal":e==="Read"?"Read File":e==="Write"?"Write File":e==="Edit"?"Edit File":e==="Glob"?"Find Files":e==="Grep"?"Search Content":e==="WebSearch"?"Web Search":e==="WebFetch"?"Web Fetch":e==="Task"?"Subagent":e==="TodoWrite"?"Tasks":e==="NotebookEdit"?"Notebook":e==="SendMessage"?"Message":e==="web_search"?"Web Search":e==="mcp_tool_call"?"MCP Tool":e.startsWith("mcp:")?e.split(":").slice(1).join(":"):e}function H5({name:e,input:t,toolUseId:n}){const[i,l]=S.useState(e==="Edit"),c=_c(e),u=As(e),f=lc(e,t);return e==="Edit"?a.jsx(Zj,{input:t,toolUseId:n}):e==="Bash"?a.jsx(Kj,{input:t,toolUseId:n}):a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[a.jsxs("button",{onClick:()=>l(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:c}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:a.jsx("div",{className:"mt-2",children:a.jsx(eN,{name:e,input:t})})})]})}function Zj({input:e,toolUseId:t}){const n=String(e.file_path||""),i=n?n.split("/").pop()||n:"",l=String(e.old_string||""),c=String(e.new_string||""),u=!!(l||c),f=!!e.replace_all,[h,p]=S.useState(!1),v=(Array.isArray(e.changes)?e.changes:[]).map(_=>({path:typeof _.path=="string"?_.path:"",kind:typeof _.kind=="string"?_.kind:"update"})).filter(_=>_.path),y=(l+c).split(`
60
60
  `).length,b=y>15;return a.jsxs("div",{"data-tool-use-id":t,children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[a.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),i&&a.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:i}),f&&a.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?a.jsxs("div",{className:"relative mt-1",children:[a.jsx("div",{className:`overflow-hidden ${b&&!h?"max-h-[240px]":""}`,children:a.jsx(Tl,{oldText:l,newText:c,mode:"compact"})}),b&&!h&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),b&&a.jsx("button",{type:"button",onClick:()=>p(!h),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:h?"Show less":`Show all ${y} lines`})]}):v.length>0?a.jsx("div",{className:"mt-1 space-y-1",children:v.map((_,k)=>{const E=_.path.split("/").pop()||_.path;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:`text-[9px] font-semibold uppercase ${_.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":_.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:_.kind}),a.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:E})]},`${_.path}-${k}`)})}):a.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})]})}function Kj({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"";return a.jsxs("div",{"data-tool-use-id":t,children:[i&&a.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),a.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:a.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function eN({name:e,input:t}){switch(e){case"Bash":return a.jsx(tN,{input:t});case"Edit":return a.jsx(nN,{input:t});case"Write":return a.jsx(rN,{input:t});case"Read":return a.jsx(iN,{input:t});case"Glob":return a.jsx(sN,{input:t});case"Grep":return a.jsx(aN,{input:t});case"WebSearch":case"web_search":return a.jsx(lN,{input:t});case"WebFetch":return a.jsx(oN,{input:t});case"Task":return a.jsx(cN,{input:t});case"TodoWrite":return a.jsx(uN,{input:t});case"NotebookEdit":return a.jsx(dN,{input:t});case"SendMessage":return a.jsx(fN,{input:t});default:return a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function tN({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),a.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function nN({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return a.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?a.jsx(Tl,{oldText:n,newText:i,fileName:t,mode:"compact"}):c.length>0?a.jsxs("div",{className:"space-y-1.5",children:[!!t&&a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),c.map((u,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),a.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function rN({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(Tl,{newText:n,fileName:t,mode:"compact"})}function iN({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&a.jsxs("span",{children:["offset: ",n]}),i!=null&&a.jsxs("span",{children:["limit: ",i]})]})]})}function sN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function aN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&a.jsxs("span",{children:["path: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&a.jsxs("span",{children:["glob: ",a.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&a.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&a.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&a.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function lN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function oN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.url&&a.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&a.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function cN({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function uN({input:e}){const t=e.todos;return Array.isArray(t)?a.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const l=n.status||"pending";return a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("span",{className:"shrink-0 mt-0.5",children:l==="completed"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l==="in_progress"?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug ${l==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function dN({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&a.jsxs("span",{children:["type: ",n]}),i&&a.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&a.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&a.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function fN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&a.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",a.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&a.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function lc(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",l=n+i;return l.length>60?l.slice(0,60)+"...":l}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function _l({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("polyline",{points:"3 11 6 8 3 5"}),a.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"5",r:"3"}),a.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),a.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const hN=2e3,pN=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),$r=new Map,Ii=new Map,_d=new Map,dd=new Map,Ns=new Map,Jo=new Map,oc=new Map,wd=new Map;function I5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function V5(e){const t=W.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function mN(){const e=W.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let cc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){cc=!0;for(const[e,t]of Ii)clearTimeout(t),Ii.delete(e)}else{cc=!1;for(const e of mN()){if(!V5(e))continue;const t=$r.get(e);if(!I5(t)){if(t){try{t.close()}catch{}$r.delete(e)}wc(e)}}}});function fd(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const l of n)if(!(!l||l===".")){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}return`${t?"/":""}${i.join("/")}`}function gN(e,t){return e.startsWith("/")||!t?fd(e):fd(`${t}/${e}`)}function xN(e,t){if(!t)return!0;const n=fd(t);return e===n||e.startsWith(`${n}/`)}function vN(e){let t=wd.get(e);return t||(t=new Set,wd.set(e,t)),t}function pp(e,t){const n=W.getState(),i=vN(e);for(const l of t){if(l.type!=="tool_use")continue;const{name:c,input:u,id:f}=l;if(f){if(i.has(f))continue;i.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),dd.set(e,p.length)}continue}if(c==="TaskCreate"){const h=(dd.get(e)||0)+1;dd.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(c==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function mp(e,t){var c,u;const n=W.getState(),i=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let l=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const g=gN(p.file_path,i);xN(g,i)&&(l=!0)}}l&&n.bumpChangedFilesTick(e)}const qo=new Map,bN=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function gp(e,t){const n=W.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const l=i.input;if(l.run_in_background===!0){let c=qo.get(e);c||(c=new Map,qo.set(e,c)),c.set(i.id,{command:l.command||"",description:l.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const l=i.tool_use_id,c=qo.get(e),u=c==null?void 0:c.get(l);if(c&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(bN);if(h){const p={taskId:h[1],toolUseId:l,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}c.delete(l),c.size===0&&qo.delete(e)}}}}const Yu=new Map,Sd=new Map;function xp(e,t){const n=W.getState();let i=Sd.get(e);i||(i=new Set,Sd.set(e,i));for(const l of t){if(l.type==="tool_use"&&l.name==="Agent"){if(l.id&&i.has(l.id))continue;const c=l.input;if(c.run_in_background===!0){l.id&&i.add(l.id);let u=Yu.get(e);u||(u=new Map,Yu.set(e,u));const f={toolUseId:l.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(l.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(l.type==="tool_result"){const c=l.tool_use_id,u=Yu.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(g=>"text"in g?g.text:"").join(""):"",p=l.is_error===!0;n.updateBackgroundAgent(e,c,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&Yu.delete(e)}}}}function fb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function hb(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification"){const t=e.summary?` ${e.summary}`:"";return`Task ${e.status}: ${e.task_id}.${t}`}if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let yN=0,_N=0;function ei(){return`msg-${Date.now()}-${++yN}`}function wN(e,t){const n=oc.get(e)||[];n.push(t),oc.set(e,n)}function SN(e,t){const n=oc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){oc.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const Oi=new Map;function pb(e,t,n){const i=W.getState(),l=i.messages.get(e)||[],c=Jo.get(e);let u=l.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&Jo.delete(e)),f===-1){const h=`stream-${e}-${ei()}`;Jo.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function ks(e){Jo.delete(e);const t=W.getState(),n=t.messages.get(e)||[],i=n.filter(l=>!l.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const mb=new Map,kN=8e3;function rl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),l=mb.get(e);l&&l.code===t&&i-l.at<kN||(mb.set(e,{code:t,at:i}),W.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function G5(){return`cmsg-${Date.now()}-${++_N}`}function xm(){return G5()}const jN=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation"]);function NN(e){const t=location.protocol==="https:"?"wss:":"ws:",n=localStorage.getItem("companion_auth_token")||"";return`${t}//${location.host}/ws/browser/${e}?token=${encodeURIComponent(n)}`}function Y5(e){return`companion:last-seq:${e}`}function vm(e){const t=_d.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(Y5(e)),i=n?Number(n):0,l=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return _d.set(e,l),l}catch{return 0}}function gb(e,t){const n=Math.max(0,Math.floor(t));_d.set(e,n);try{localStorage.setItem(Y5(e),String(n))}catch{}}function xb(e,t){Pn(e,{type:"session_ack",last_seq:t})}function hd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
61
- `)}function vp(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function CN(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const l=new Map;for(const f of i)l.set(vp(f),f);const c=[],u=new Set;for(const f of n){const h=vp(f);u.has(h)||(u.add(h),c.push(l.get(h)||f))}for(const f of i){const h=vp(f);u.has(h)||(u.add(h),c.push(f))}return c}function vb(e,t,n,i,l){return{toolUseId:e,toolName:t,preview:lc(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:l||void 0}}function bm(e,t){const n=CN(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?hd(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function EN(e,t){const n=W.getState(),i=n.messages.get(e)||[],l=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(l===-1){n.appendMessage(e,t);return}const c=[...i];c[l]=bm(c[l],t),n.setMessages(e,c)}function TN(e,t){var l,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(l=t.data)==null?void 0:l.substring)==null?void 0:c.call(l,0,120));return}const i=W.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),Q5(e,n)}function Q5(e,t,n={}){var u,f,h,p,g,v,y,b;const{processSeq:i=!0,ackSeqMessage:l=!0}=n,c=W.getState();if(i&&typeof t.seq=="number"){const _=vm(e);if(t.seq<=_)return;gb(e,t.seq),l&&xb(e,t.seq)}switch(pN.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const _=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const k=new Set(c.sessionNames.values()),E=$5(k);c.setSessionName(e,E)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const _=t.message;if(_.model==="<synthetic>"){ks(e),c.setStreaming(e,null),rl(e,"synthetic_noop",{detail:{stopReason:_.stop_reason,text:hd(_.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const k=hd(_.content),E={id:_.id,role:"assistant",content:k,contentBlocks:_.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:_.model,stopReason:_.stop_reason};if(ks(e),EN(e,E),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),(u=_.content)!=null&&u.length)for(const j of _.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=_.content)!=null&&f.length)for(const j of _.content){if(j.type==="tool_use"){const T=j.input||{};c.addToolActivity(e,vb(j.id,j.name,T,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=_.content)!=null&&h.length&&(pp(e,_.content),mp(e,_.content),gp(e,_.content),xp(e,_.content));break}case"stream_event":{const _=t.event;if(_&&typeof _=="object"){if(_.type==="message_start"&&(Ns.delete(e),Oi.delete(e),ks(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),_.type==="content_block_delta"){const k=_.delta;if((k==null?void 0:k.type)==="text_delta"&&typeof k.text=="string"){const E=Oi.get(e)||{thinking:"",text:""};Ns.get(e)==="thinking"&&(E.thinking=""),E.text+=k.text,Oi.set(e,E),Ns.set(e,"text"),c.setStreaming(e,E.text),pb(e,E.text,"text")}if((k==null?void 0:k.type)==="thinking_delta"&&typeof k.thinking=="string"){const E=Oi.get(e)||{thinking:"",text:""};E.thinking+=k.thinking,Oi.set(e,E),Ns.set(e,"thinking"),c.setStreaming(e,E.thinking),pb(e,E.thinking,"thinking")}}if(_.type==="message_delta"){const k=_.usage;k!=null&&k.output_tokens&&c.setStreamingStats(e,{outputTokens:k.output_tokens})}}break}case"result":{wd.delete(e),Sd.delete(e);const _=t.data,k={total_cost_usd:_.total_cost_usd,num_turns:_.num_turns};if(typeof _.total_lines_added=="number"&&(k.total_lines_added=_.total_lines_added),typeof _.total_lines_removed=="number"&&(k.total_lines_removed=_.total_lines_removed),_.modelUsage){for(const E of Object.values(_.modelUsage))if(E.contextWindow>0){const j=Math.round((E.inputTokens+E.outputTokens)/E.contextWindow*100);k.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,k),ks(e),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&zj(),!document.hasFocus()&&c.notificationDesktop&&fb("Session completed","Claude finished the task",e),_.is_error&&((p=_.errors)!=null&&p.length)&&c.appendMessage(e,{id:ei(),role:"system",content:`Error: ${_.errors.join(", ")}`,timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const k=t.request;fb("Permission needed",`${k.tool_name}: approve or deny`,k.request_id)}const _=t.request;if(_.tool_name&&_.input){const k=[{type:"tool_use",id:_.tool_use_id,name:_.tool_name,input:_.input}];pp(e,k),mp(e,k),gp(e,k),xp(e,k)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((g=c.sdkSessions.find(k=>k.sessionId===e))==null?void 0:g.backendType)==="codex"&&c.appendMessage(e,{id:ei(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||ei(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((v=t.event)==null?void 0:v.subtype)==="task_notification"){const{task_id:k,status:E,summary:j}=t.event;k&&E&&c.updateProcess(e,k,{status:E,completedAt:Date.now(),summary:j||void 0})}const _=hb(t.event);if(!_)break;c.appendMessage(e,{id:ei(),role:"system",content:_,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:ei(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:ei(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const _=t.phase;_==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)?rl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):rl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):_==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)&&rl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):_==="starting"||_==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_==="ready"?c.setSessionStatus(e,"idle"):_==="streaming"?c.setSessionStatus(e,"running"):_==="compacting"?c.setSessionStatus(e,"compacting"):_==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)?rl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):rl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const _=c.sessionNames.get(e),k=_&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_);(!_||k)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const _=[],k=new Map;for(let j=0;j<t.messages.length;j++){const T=t.messages[j];if(T.type==="user_message")_.push({id:T.id||ei(),role:"user",content:T.content,timestamp:T.timestamp});else if(T.type==="assistant"){const N=T.message,D=hd(N.content),z={id:N.id,role:"assistant",content:D,contentBlocks:N.content,timestamp:T.timestamp||Date.now(),parentToolUseId:T.parent_tool_use_id,model:N.model,stopReason:N.stop_reason},L=_.findIndex(H=>H.role==="assistant"&&H.id===z.id);if(L===-1?_.push(z):_[L]=bm(_[L],z),(y=N.content)!=null&&y.length){pp(e,N.content),mp(e,N.content),gp(e,N.content),xp(e,N.content);const H=T.timestamp||Date.now();for(const U of N.content){if(U.type==="tool_use"){const V=U.input||{},O=k.get(U.id);k.set(U.id,O??vb(U.id,U.name,V,H,T.parent_tool_use_id))}if(U.type==="tool_result"){const V=k.get(U.tool_use_id);V&&k.set(U.tool_use_id,{...V,completedAt:H,isError:V.isError||!!U.is_error,elapsedSeconds:Math.max(V.elapsedSeconds,V.completedAt?V.elapsedSeconds:Math.max(0,(H-V.startedAt)/1e3))})}}}}else if(T.type==="result"){const N=T.data;N.is_error&&((b=N.errors)!=null&&b.length)&&_.push({id:`hist-error-${j}`,role:"system",content:`Error: ${N.errors.join(", ")}`,timestamp:Date.now()});const D={total_cost_usd:N.total_cost_usd,num_turns:N.num_turns};if(typeof N.total_lines_added=="number"&&(D.total_lines_added=N.total_lines_added),typeof N.total_lines_removed=="number"&&(D.total_lines_removed=N.total_lines_removed),N.modelUsage){for(const z of Object.values(N.modelUsage))if(z.contextWindow>0){const L=z,H=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);D.context_used_percent=Math.max(0,Math.min(H,100))}}c.updateSession(e,D)}else if(T.type==="system_event"){const N=hb(T.event);if(!N)continue;_.push({id:`hist-system-event-${j}`,role:"system",content:N,timestamp:T.timestamp||Date.now()})}}if(_.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,_);else{const T=[...j];for(const N of _){const D=T.findIndex(L=>L.id===N.id);if(D===-1){T.push(N);continue}const z=T[D];z.role==="assistant"&&N.role==="assistant"?T[D]=bm(z,N):T[D]=N}T.sort((N,D)=>(N.timestamp??0)-(D.timestamp??0)),c.setMessages(e,T)}}c.setToolActivity(e,Array.from(k.values()).sort((j,T)=>j.startedAt-T.startedAt));const E=t.messages[t.messages.length-1];(E==null?void 0:E.type)==="result"&&(ks(e),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let _;for(const k of t.events){const E=vm(e);k.seq<=E||(gb(e,k.seq),_=k.seq,Q5(e,k.message,{processSeq:!1,ackSeqMessage:!1}))}typeof _=="number"&&xb(e,_);break}case"prompt_suggestion":{const _=t.suggestions;c.setPromptSuggestions(e,_);break}case"streamlined_text":{c.appendMessage(e,{id:ei(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:ei(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function wc(e){const t=$r.get(e);if(I5(t))return;if(t){try{t.close()}catch{}$r.delete(e)}W.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(NN(e));$r.set(e,i),i.onopen=()=>{const l=vm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:l})),SN(e,i);const c=Ii.get(e);c&&(clearTimeout(c),Ii.delete(e))},i.onmessage=l=>TN(e,l),i.onclose=()=>{$r.get(e)===i&&($r.delete(e),W.getState().setConnectionStatus(e,"disconnected"),AN(e))},i.onerror=()=>{i.close()}}function AN(e){if(Ii.has(e)||cc)return;const t=setTimeout(()=>{Ii.delete(e),!cc&&V5(e)&&wc(e)},hN);Ii.set(e,t)}function ym(e){const t=Ii.get(e);t&&(clearTimeout(t),Ii.delete(e));const n=$r.get(e);n&&(n.close(),$r.delete(e)),W.getState().setConnectionStatus(e,"disconnected"),wd.delete(e),Sd.delete(e),qo.delete(e),dd.delete(e),Ns.delete(e),Jo.delete(e),Oi.delete(e),_d.delete(e),oc.delete(e)}function MN(e){if(!cc)for(const t of e)t.archived||wc(t.sessionId)}function RN(e){return new Promise((t,n)=>{const i=setInterval(()=>{const c=$r.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(l),t())},50),l=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Pn(e,t){const n=$r.get(e);let i=t;const l=jN.has(t.type);if(l)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(i={...t,client_msg_id:G5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}l&&wN(e,i)}function bb(e){Pn(e,{type:"mcp_get_status"})}function LN(e,t,n){Pn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function DN(e,t){Pn(e,{type:"mcp_reconnect",serverName:t})}function zN(e,t){Pn(e,{type:"mcp_set_servers",servers:t})}function ON(e,t){Pn(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,gn=typeof globalThis<"u"?globalThis:re;typeof self>"u"&&(gn.self=gn),typeof File>"u"&&(gn.File=function(){});var cr=gn==null?void 0:gn.navigator,Ne=gn==null?void 0:gn.document,Tn=gn==null?void 0:gn.location,_m=gn==null?void 0:gn.fetch,wm=gn!=null&&gn.XMLHttpRequest&&"withCredentials"in new gn.XMLHttpRequest?gn.XMLHttpRequest:void 0,yb=gn==null?void 0:gn.AbortController,BN=gn==null?void 0:gn.CompressionStream,Jn=cr==null?void 0:cr.userAgent,De=re??{},_b="1.390.2",Xt={DEBUG:!1,LIB_VERSION:_b,LIB_NAME:"web",JS_SDK_VERSION:_b};function wb(e,t,n,i,l,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,l)}function wn(e){return function(){var t=this,n=arguments;return new Promise((function(i,l){var c=e.apply(t,n);function u(h){wb(c,i,l,u,f,"next",h)}function f(h){wb(c,i,l,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ye.apply(null,arguments)}function W5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var PN=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function $N(e){return typeof e=="string"||e}function UN(e){return typeof e=="string"?e:void 0}var Eo,$i=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Sb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),FN=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],qN=["token"],J5="NativeGzipValidationError",Sm=e=>e.length>=2&&e[0]===31&&e[1]===139,kb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Qu=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=J5,t},HN=(function(){var e=wn((function*(t,n){18>t.size&&Qu("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Sm(i)&&i[2]===8||Qu("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Eo)return Eo;Eo=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;Eo[g]=v>>>0}return Eo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&Qu("invalid-crc");var c=n.length>>>0;l.getUint32(4,!0)!==c&&Qu("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function km(){return km=wn((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),l=new CompressionStream("gzip"),c=l.writable.getWriter(),u=c.write(i).then((()=>c.close())).catch((function(){var p=wn((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(l.readable).blob(),[h]=yield Promise.all([f,u]);return yield HN(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),km.apply(this,arguments)}var IN=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],jb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return IN.concat(t).some((i=>{var l=i.toLowerCase();return n.indexOf(l)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var Xd=function(e){return e.trim()},jm=function(e){return e.replace(/^\$/,"")},X5=Object.prototype,Z5=X5.hasOwnProperty,Zd=X5.toString,Ke=Array.isArray||function(e){return Zd.call(e)==="[object Array]"},Ui=e=>typeof e=="function",Qt=e=>e===Object(e)&&!Ke(e),Es=e=>{if(Qt(e)){for(var t in e)if(Z5.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,zt=e=>Zd.call(e)=="[object String]",Nm=e=>zt(e)&&e.trim().length===0,Un=e=>e===null,et=e=>Se(e)||Un(e),Fn=e=>Zd.call(e)=="[object Number]"&&e==e,Bi=e=>Fn(e)&&e>0,si=e=>Zd.call(e)==="[object Boolean]",VN=e=>e instanceof FormData,GN=e=>Ie(FN,e),YN=e=>Ie(qN,e);function K5(e){return e===null||typeof e!="object"}function kd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function jg(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var QN=[!0,"true",1,"1","yes"],bp=e=>Ie(QN,e),WN=[!1,"false",0,"0","no"];function ii(e,t,n,i,l){return t>n&&(i.warn("min cannot be greater than max."),t=n),Fn(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),ii(l||n,t,n,i))}class JN{constructor(t){this.$t={},this.zt=t.zt,this.Gt=ii(t.bucketSize,0,100,t.Zt),this.Qt=ii(t.refillRate,0,this.Gt,t.Zt),this.Jt=ii(t.refillInterval,0,864e5,t.Zt)}Kt(t,n){var i=Math.floor((n-t.lastAccess)/this.Jt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qt,this.Gt),t.lastAccess=t.lastAccess+i*this.Jt)}consumeRateLimit(t){var n,i=Date.now(),l=String(t),c=this.$t[l];return c?this.Kt(c,i):this.$t[l]=c={tokens:this.Gt,lastAccess:i},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.zt)==null||n.call(this,t)),c.tokens===0)}stop(){this.$t={}}}var dr="Mobile",jd="iOS",Hi="Android",wl="Tablet",e_=Hi+" "+wl,t_="iPad",n_="Apple",r_=n_+" Watch",Xo="Safari",Sl="BlackBerry",i_="Samsung",s_=i_+"Browser",a_=i_+" Internet",ha="Chrome",XN=ha+" OS",l_=ha+" "+jd,Ng="Internet Explorer",o_=Ng+" "+dr,Cg="Opera",ZN=Cg+" Mini",Eg="Edge",c_="Microsoft "+Eg,bl="Firefox",u_=bl+" "+jd,uc="Nintendo",dc="PlayStation",yl="Xbox",d_=Hi+" "+dr,f_=dr+" "+Xo,Ho="Windows",Cm=Ho+" Phone",Nb="Nokia",Em="Ouya",h_="Generic",KN=h_+" "+dr.toLowerCase(),p_=h_+" "+wl.toLowerCase(),Tm="Konqueror",m_="Oculus Browser",Nd="Vivaldi",g_="Yandex",Cd="Whale",Am="DuckDuckGo",x_="Pale Moon",Ed="Waterfox",Zo="Brave",v_="Google Search App",Ht="(\\d+(\\.\\d+)?)",yp=new RegExp("Version/"+Ht),eC=new RegExp(yl,"i"),tC=new RegExp(dc+" \\w+","i"),nC=new RegExp(uc+" \\w+","i"),Tg=new RegExp(Sl+"|PlayBook|BB10","i"),rC={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},b_=function(e,t,n,i){t=t||"";var l=(function(c){return c!=null&&c.brave?Zo:null})(n);return l||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?v_:Ie(e," OPR/")&&Ie(e,"Mini")?ZN:Ie(e," OPR/")?Cg:Tg.test(e)?Sl:Ie(e,"IE"+dr)||Ie(e,"WPDesktop")?o_:Ie(e,"OculusBrowser")?m_:Ie(e,s_)?a_:Ie(e,Eg)||Ie(e,"Edg/")?c_:Ie(e,Nd+"/")?Nd:Ie(e,"YaBrowser/")?g_:Ie(e,Cd+"/")?Cd:Ie(e,Am+"/")||Ie(e,"Ddg/")?Am:Ie(e,"FBIOS")?"Facebook "+dr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?l_:Ie(e,"CrMo")||Ie(e,ha)?ha:Ie(e,Hi)&&Ie(e,Xo)?d_:Ie(e,"FxiOS")?u_:Ie(e.toLowerCase(),Tm.toLowerCase())?Tm:Ie(e,Zo+"/")?Zo:((c,u)=>u&&Ie(u,n_)||(function(f){return Ie(f,Xo)&&!Ie(f,ha)&&!Ie(f,Hi)})(c))(e,t)?Ie(e,dr)?f_:Xo:Ie(e,"PaleMoon/")?x_:Ie(e,Ed+"/")?Ed:Ie(e,bl)?bl:Ie(e,"MSIE")||Ie(e,"Trident/")?Ng:Ie(e,"Gecko")?bl:"")},iC={[o_]:[new RegExp("rv:"+Ht)],[c_]:[new RegExp(Eg+"?\\/"+Ht)],[ha]:[new RegExp("("+ha+"|CrMo)\\/"+Ht)],[l_]:[new RegExp("CriOS\\/"+Ht)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ht)],[Xo]:[yp],[f_]:[yp],[Cg]:[new RegExp("(Opera|OPR)\\/"+Ht)],[bl]:[new RegExp(bl+"\\/"+Ht)],[u_]:[new RegExp("FxiOS\\/"+Ht)],[Tm]:[new RegExp("Konqueror[:/]?"+Ht,"i")],[Sl]:[new RegExp(Sl+" "+Ht),yp],[d_]:[new RegExp("android\\s"+Ht,"i")],[a_]:[new RegExp(s_+"\\/"+Ht)],[m_]:[new RegExp("OculusBrowser\\/"+Ht)],[Nd]:[new RegExp(Nd+"\\/"+Ht)],[g_]:[new RegExp("YaBrowser\\/"+Ht)],[Cd]:[new RegExp(Cd+"\\/"+Ht)],[Zo]:[new RegExp(Zo+"\\/"+Ht)],[Am]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ht)],[x_]:[new RegExp("PaleMoon\\/"+Ht)],[Ed]:[new RegExp(Ed+"\\/"+Ht)],[v_]:[new RegExp("GSA\\/"+Ht)],[Ng]:[new RegExp("(rv:|MSIE )"+Ht)],Mozilla:[new RegExp("rv:"+Ht)]},sC=function(e,t,n,i){var l=b_(e,t,n,i),c=iC[l];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},Cb=[[new RegExp(yl+"; "+yl+" (.*?)[);]","i"),e=>[yl,e&&e[1]||""]],[new RegExp(uc,"i"),[uc,""]],[new RegExp(dc,"i"),[dc,""]],[Tg,[Sl,""]],[new RegExp(Ho,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Cm,""];if(new RegExp(dr).test(t)&&!/IEMobile\b/.test(t))return[Ho+" "+dr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=rC[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Ho,i]}return[Ho,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[jd,[e[3],e[4],e[5]||"0"].join(".")]:[jd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hi+")","i"),e=>e&&e[2]?[Hi,[e[2],e[3],e[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[XN,""]],[/Linux|debian/i,["Linux",""]]],Eb=function(e){return nC.test(e)?uc:tC.test(e)?dc:eC.test(e)?yl:new RegExp(Em,"i").test(e)?Em:new RegExp("("+Cm+"|WPDesktop)","i").test(e)?Cm:/iPad/.test(e)?t_:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?r_:Tg.test(e)?Sl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Nb,"i").test(e)?Nb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(dr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hi:e_:new RegExp("(pda|"+dr+")","i").test(e)?KN:new RegExp(wl,"i").test(e)&&!new RegExp(wl+" pc","i").test(e)?p_:""};function _p(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var aC=e=>e instanceof Error,y_={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},lC=y_.info;function __(e){if(si(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(Ke(e))return{arrayValue:{values:e.map((t=>__(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function w_(e){var t=[];for(var n in e){var i=e[n];Un(i)||Se(i)||t.push({key:n,value:__(i)})}return t}function oC(e,t){var n=e.level||"info",{text:i,number:l}=y_[n]||lC,c=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=ye({},u,e.attributes||{}),h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:l,severityText:i,body:{stringValue:e.body},attributes:w_(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Se(e.trace_flags)||(h.flags=e.trace_flags),h}function S_(e,t,n){return ye({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function k_(e,t,n,i){return{resourceLogs:[{resource:{attributes:w_(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let cC=class{constructor(e,t,n,i,l,c){var u;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.qt=t,this.Zt=n,this.Yt=i,this.Xt=l,this.er=c,this.tr=null,this.rr=0,this.ir=0,this.nr=0,this.sr=0,this.ar=!1,this.lr=t.maxBufferSize,this.it=Math.max((u=t.maxQueueSize)!==null&&u!==void 0?u:t.maxBufferSize,t.maxBufferSize),this.ur=t.flushIntervalMs,this.hr=t.maxBatchRecordsPerPost,this.cr=t.rateCapWindowMs,this.dr=t.maxLogsPerInterval}reset(){this.vr(),this.tr=null,this.nr=0,this.sr=0,this.ar=!1,this.rr=0,this.ir=0,this.hr=this.qt.maxBatchRecordsPerPost}onReconnect(){this.ir=0,this.pr()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.gr(e);if(t!==null)if(t.body){if(this.mr()){var n={record:oC(t,this.Yt())};this.Xt((()=>this.yr(n)))}}else this.Zt.info("Log was rejected in beforeSend function")}}gr(e){var t=this.qt.beforeSend;if(!t)return e;var n=Ke(t)?t:[t],i=e;for(var l of n)try{var c=l(i);if(!c)return this.Zt.info("Log was rejected in beforeSend function"),null;i=c}catch(u){return this.Zt.error("Error in beforeSend function for log:",u),null}return i}mr(){if(this.dr===void 0)return!0;var e=Date.now(),t=e-this.nr;return this.cr>t&&t>=0||(this.nr=e,this.sr=0,this.ar=!1),this.dr>this.sr?(this.sr++,!0):(this.ar||(this.Zt.warn("captureLog dropping logs: exceeded "+this.dr+" logs per "+this.cr+"ms"),this.ar=!0),!1)}flush(){var e=this;return wn((function*(){if(!e._instance.isDisabled)return e.tr||(e.tr=e.br().finally((()=>{e.tr=null}))),e.tr}))()}br(){var e=this;return wn((function*(){var t;e.vr();var n=(t=e._instance.getPersistedProperty($i.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,l=0;n.length>0&&i>l;){var c;e.rr=0;var u=Math.min(n.length,e.hr),f=n.slice(0,u),h=k_(f.map((g=>g.record)),e._r(),e._instance.getLibraryId(),e._instance.getLibraryVersion()),p=yield e._instance.wr(h);if(p.kind==="too-large"&&f.length>1)e.hr=Math.max(1,Math.floor(f.length/2)),e.Zt.warn("Received 413 when sending logs batch of size "+f.length+", reducing batch size to "+e.hr);else if(p.kind==="retry-later"||(p.kind==="too-large"?e.Zt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&e.qt.maxBatchRecordsPerPost>e.hr&&(e.hr=Math.min(e.qt.maxBatchRecordsPerPost,e.hr+1)),yield e.kr(f.length),n=(c=e._instance.getPersistedProperty($i.LogsQueue))!==null&&c!==void 0?c:[],l+=f.length,p.kind==="fatal"))throw p.error}}))()}kr(e){var t=this;return wn((function*(){var n,i=Math.max(0,e-t.rr),l=(n=t._instance.getPersistedProperty($i.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty($i.LogsQueue,l.slice(i)),yield t.er()}))()}_r(){return S_(this.qt,this._instance.getLibraryId(),this._instance.getLibraryVersion())}yr(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty($i.LogsQueue))!==null&&t!==void 0?t:[];this.it>n.length||(n.shift(),this.rr++,this.Zt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty($i.LogsQueue,n),this.lr>n.length?this.Sr():this.pr()}}Sr(e){e===void 0&&(e=this.ur),this.Cr||(this.Cr=_p((()=>{this.Cr=void 0,this.pr()}),e))}Ir(){var e=Math.min(Math.max(0,this.ir-1),6);return this.ur*Math.pow(2,e)}Tr(){var e=this._instance.getPersistedProperty($i.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return wn((function*(){t.vr();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((i=>_p(i,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return wn((function*(){var n=!1,i=t.flush(),l=new Promise((c=>_p((()=>{n=!0,c()}),e)));try{yield Promise.race([i,l])}finally{n&&i.catch((()=>{}))}}))()}pr(){this.flush().then((()=>{this.ir=0}),(e=>{this.ir++,this.Zt.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Tr()&&this.Sr(this.Ir())}))}vr(){this.Cr&&(clearTimeout(this.Cr),this.Cr=void 0)}};var Wu,Tb,wp;function uC(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return wp&&n.length===Tb||(Tb=n.length,wp=n.reduce(((i,l)=>{Wu||(Wu={});var c=Wu[l];if(c)i[c[0]]=c[1];else for(var u=e(l),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[l];if(p&&g){i[p]=g,Wu[l]=[p,g];break}}return i}),{})),wp}}class dC{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(i,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(l,c);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return wn((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ke(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var i,l;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:i,stack:l})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return wn((function*(){var i=t;for(var l of n.modifiers)i=yield l(i);return i}))()}convertToExceptionList(t,n){var i,l,c,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:uC(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var l=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:c=>l(c,i),next:c=>l(c,i+1)})}}var kl="?";function Mm(e,t,n,i,l){var c={platform:e,filename:t,function:n==="<anonymous>"?kl:n,in_app:!0};return Se(i)||(c.lineno=i),Se(l)||(c.colno=l),c}var j_=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:kl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},fC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pC=/\((\S*)(?::(\d+))(?::(\d+))\)/,mC=(e,t)=>{var n=fC.exec(e);if(n){var[,i,l,c]=n;return Mm(t,i,kl,+l,+c)}var u=hC.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=pC.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=j_(u[1]||kl,u[2]);return Mm(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},gC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vC=(e,t)=>{var n=gC.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=xC.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var l=n[3],c=n[1]||kl;return[c,l]=j_(c,l),Mm(t,l,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Ab=/\(error: (.*)\)/;class bC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=zt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return kd(t,"DOMException")}isDOMError(t){return kd(t,"DOMError")}}class yC{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class _C{constructor(){}match(t){return kd(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var i;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var wC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class SC{match(t){return typeof t=="string"}coerce(t,n){var i,[l,c]=this.getInfos(t);return{type:l??"Error",value:c??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,l=t.match(wC);return l&&(n=l[1],i=l[2]),[n,i]}}var kC=["fatal","error","warning","log","info","debug"];function N_(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var l=n.slice(0,i).join(", ");if(t>=l.length)return i===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class jC{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return jg(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+N_(t)}isSeverityLevel(t){return zt(t)&&!Nm(t)&&kC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(aC(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class NC{match(t){return jg(t)}coerce(t,n){var i,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+N_(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class CC{match(t){return K5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class EC{match(t){return kd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!jg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,l=this.getUnhandledRejectionReason(t);return K5(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(l)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Td="$message",Ad="$timestamp",TC=new Set([Td,Ad]),Sp={enabled:!0,max_bytes:32768};function Md(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Sp.enabled,max_bytes:MC(e.max_bytes,Sp.max_bytes)}:ye({},Sp)}class AC{constructor(t){this.Er=[],this.Mr=0,this.qt=Md(t)}setConfig(t){this.qt=Md(t),this.Pr()}add(t){var n=(function(l){var c=(function(g){var v=new WeakSet;try{return JSON.stringify(g,((y,b)=>{if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Date)return b.toISOString();if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){if(v.has(b))return"[Circular]";v.add(b)}return b}}))}catch{return}})(l);if(c)try{var u=JSON.parse(c);if(!Qt(u))return;var f=u,h=f[Td],p=f[Ad];return!zt(h)||h.trim().length===0||!zt(p)&&!Fn(p)?void 0:{step:f,json:c}}catch{return}})(t);if(n){var i=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var c=encodeURIComponent(l),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.qt.max_bytes||(this.Er.push({step:n.step,bytes:i}),this.Mr+=i,this.Pr())}}getAttachable(){return this.Er.map((t=>t.step))}clear(){this.Er=[],this.Mr=0}size(){return this.Er.length}Pr(){for(;this.Mr>this.qt.max_bytes&&this.Er.length>0;){var t=this.Er.shift();t&&(this.Mr-=t.bytes)}}}function MC(e,t){if(!Fn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var C_=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,i={k(l){if(re&&(Xt.DEBUG||De.POSTHOG_DEBUG||n)&&!Se(re.console)&&re.console){for(var c=("__rrweb_original__"in re.console[l])?re.console[l].__rrweb_original__:re.console[l],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("debug",...c)},info(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("log",...c)},warn(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("warn",...c)},error(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("error",...c)},critical(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(l){i.error("You must initialize PostHog before calling "+l)},createLogger:(l,c)=>C_(e+" "+l,c)};return i},je=C_("[PostHog.js]"),It=je.createLogger,RC=It("[ExternalScriptsLoader]"),kp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return RC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ne==null?void 0:Ne.querySelectorAll("script");if(i){for(var l,c=function(){if(i[u].src===t){var h=i[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;i.length>u;u++)if(l=c())return l.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};De.__PosthogExtensions__=De.__PosthogExtensions__||{},De.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;l=l+"&t="+Math.floor(Date.now()/c)*c}i=e.requestRouter.endpointFor("assets",l)}kp(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");kp(e,u,n)}},De.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);kp(e,i,n)};var E_="$people_distinct_id",Rd="$device_id",Io="__alias",Vo="__timers",Rm="$autocapture_disabled_server_side",Lm="$heatmaps_enabled_server_side",Dm="$exception_capture_enabled_server_side",zm="$error_tracking_suppression_rules",Om="$error_tracking_capture_extension_exceptions",Bm="$web_vitals_enabled_server_side",Ag="$dead_clicks_enabled_server_side",Mg="$product_tours_enabled_server_side",Pm="$web_vitals_allowed_metrics",fa="$session_recording_remote_config",T_="$replay_sample_rate",A_="$replay_override_sampling",M_="$replay_override_linked_flag",R_="$replay_override_url_trigger",L_="$replay_override_event_trigger",xl="$sesid",Rg="$session_is_sampled",da="$enabled_feature_flags",pd="$active_feature_flags",Go="$early_access_features",$m="$feature_flag_details",md="$feature_flag_payloads",Um="$feature_flag_request_id",Pi="$override_feature_flags",hl="$override_feature_flag_payloads",oa="$stored_person_properties",ca="$stored_group_properties",Fm="$surveys",Lg="$surveys_loaded_at",qm="$surveys_activated",Yo="ph_product_tours",Ko="$flag_call_reported",Hm="$flag_call_reported_session_id",Im="$feature_flag_errors",fc="$feature_flag_evaluated_at",Pr="$user_state",Vm="$client_session_props",Gm="$capture_rate_limit",Ym="$initial_campaign_params",Qm="$initial_referrer_info",Ld="$initial_person_info",Dd="$epp",D_="__POSTHOG_TOOLBAR__",Ju="$posthog_cookieless",z_="$sdk_debug_extensions_init_method",O_="$sdk_debug_extensions_init_time_ms",B_="$sdk_debug_recording_script_not_loaded",Wm="PostHog loadExternalDependency extension not found.",ua="on_reject",Fi="always",il="anonymous",sl="identified",Jm="identified_only",zd="visibilitychange",Od="beforeunload",pl="$pageview",jp="$pageleave",Np="$identify",Mb="$groupidentify";function Xu(e,t){Ke(e)&&e.forEach(t)}function Rt(e,t){if(!et(e))if(Ke(e))e.forEach(t);else if(VN(e))e.forEach(((i,l)=>t(i,l)));else for(var n in e)Z5.call(e,n)&&t(e[n],n)}var Pt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var l of n)for(var c in l)l[c]!==void 0&&(e[c]=l[c]);return e};function gd(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var Rb=function(e){try{return e()}catch{return}},LC=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(l){je.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),je.critical(l)}}},Dg=function(e){var t={};return Rt(e,(function(n,i){(zt(n)&&n.length>0||Fn(n))&&(t[i]=n)})),t},DC=["herokuapp.com","vercel.app","netlify.app"];function zC(e){var t=e==null?void 0:e.hostname;if(!zt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of DC)if(n===i)return!1;return!0}function Yt(e,t,n,i){var{capture:l=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:l,passive:c})}function P_(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Fn(e)&&isFinite(e)&&Math.floor(e)===e});class Bd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(l)||0>t||0>n||0>i||0>l||t>0xffffffffffff||n>4095||i>1073741823||l>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new Bd(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Bd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class OC{constructor(){this.S=0,this.C=0,this.I=new BC}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.T();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Bd.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Lb,$_=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!Se(re.crypto)&&crypto.getRandomValues&&($_=e=>crypto.getRandomValues(e));class BC{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||($_(this.M),this.R=0),this.M[this.R++]}}var Cs=()=>PC().toString(),PC=()=>(Lb||(Lb=new OC)).generate(),To="",$C=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ri={O:()=>!!Ne,D(e){je.error("cookieStore error: "+e)},A(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),i=0;n.length>i;i++){for(var l=n[i];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(ri.A(e))||{}}catch{}return t},N(e,t,n,i,l){if(!Ne)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,k){if(k===void 0&&(k=Ne),To)return To;if(!k||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),j=Math.min(E.length,8),T="dmn_chk_"+Cs();!To&&j--;){var N=E.slice(j).join("."),D=T+"=1;domain=."+N+";path=/";k.cookie=D+";max-age=3",k.cookie.includes(T)&&(k.cookie=D+";max-age=0",To=N)}return To})(g);if(!y){var b=(_=>{var k=_.match($C);return k?k[0]:""})(g);b!==y&&je.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}l&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&je.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,!0}catch{return!1}},q(e,t){if(Ne!=null&&Ne.cookie)try{ri.N(e,"",-1,t)}catch{return}}},Cp=null,Mt={O(){if(!Un(Cp))return Cp;var e=!0;if(Se(re))e=!1;else try{var t="__mplssupport__";Mt.N(t,"xyz"),Mt.A(t)!=='"xyz"'&&(e=!1),Mt.q(t)}catch{e=!1}return e||je.error("localStorage unsupported; falling back to cookie store"),Cp=e,e},D(e){je.error("localStorage error: "+e)},A(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Mt.D(t)}return null},F(e){try{return JSON.parse(Mt.A(e))||{}}catch{}return null},N(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Mt.D(n)}return!1},q(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Mt.D(t)}}},UC=[Rd,"distinct_id",xl,Rg,Dd,Ld,Pr],Zu={},FC={O:()=>!0,D(e){je.error("memoryStorage error: "+e)},A:e=>Zu[e]||null,F:e=>Zu[e]||null,N:(e,t)=>(Zu[e]=t,!0),q(e){delete Zu[e]}},ta=null,An={O(){if(!Un(ta))return ta;if(ta=!0,Se(re))ta=!1;else try{var e="__support__";An.N(e,"xyz"),An.A(e)!=='"xyz"'&&(ta=!1),An.q(e)}catch{ta=!1}return ta},D(e){je.error("sessionStorage error: ",e)},A(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){An.D(t)}return null},F(e){try{return JSON.parse(An.A(e))||null}catch{}return null},N(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){An.D(n)}return!1},q(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){An.D(t)}}};class qC{constructor(t){this._instance=t}get qt(){return this._instance.config}get consent(){return this.Or()?0:this.Lr}isOptedOut(){return this.qt.cookieless_mode===Fi||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===ua}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(t){this.Ar.N(this.Fr,t?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.Ar.q(this.Fr,this.qt.cross_subdomain_cookie)}get Fr(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:i}=this._instance.config;return i||(n?n+t:"__ph_opt_in_out_"+t)}get Lr(){var t=this.Ar.A(this.Fr);return bp(t)?1:Ie(WN,t)?0:-1}get Ar(){var t=this.qt.opt_out_capturing_persistence_type,n=t==="localStorage"?Mt:ri;if(!this.Nr||this.Nr!==n){this.Nr=n;var i=t==="localStorage"?ri:Mt;i.A(this.Fr)&&(this.Nr.A(this.Fr)||this.optInOut(bp(i.A(this.Fr))),i.q(this.Fr,this.qt.cross_subdomain_cookie))}return this.Nr}Or(){return!!this.qt.respect_dnt&&[cr==null?void 0:cr.doNotTrack,cr==null?void 0:cr.msDoNotTrack,De.doNotTrack].some((t=>bp(t)))}}var HC=1,IC=3,VC=11;function Db(e){return e instanceof Element&&(e.id===D_||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ms(e){return!!e&&e.nodeType===HC}function ur(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function U_(e){return!!e&&e.nodeType===IC}function F_(e){return!!e&&e.nodeType===VC&&Ms(e.host)}function zg(e){return e?Xd(e).split(/\s+/):[]}function zb(e){var t=re==null?void 0:re.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function Pd(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return zg(t)}function q_(e){return et(e)?null:Xd(e).split(/(\s+)/).filter((t=>ec(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hc(e){var t="";return Zm(e)&&!G_(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;U_(n)&&n.textContent&&(t+=(i=q_(n.textContent))!==null&&i!==void 0?i:"")})),Xd(t)}function Ep(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Og=["a","button","form","input","select","textarea","label"];function Xm(e,t){if(Se(t))return!0;var n,i=function(c){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(c,u))))return{v:!0}};for(var l of e)if(n=i(l))return n.v;return!1}function H_(e){var t=e.parentNode;return!(!t||!Ms(t))&&t}var GC=[".ph-no-autocapture","[data-ph-no-autocapture]"],I_=["next","previous","prev",">","<"],YC=[...I_,"+","-","−","–"],Ob=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Bb=[".ph-no-rageclick",".ph-no-capture"],QC=["","text","search","email","password","url","tel","number"];function Pb(e,t){if(!re||Bg(e))return!1;var n,i,l,c,u;if(si(t)?(n=!!t&&Bb,i=void 0,l=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Bb,i=t==null?void 0:t.content_ignorelist,l=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||l&&(function(h){return!(!h||!Ms(h))&&(!!ur(h,"textarea")||(ur(h,"input")?Ie(QC,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var{targetElementList:f}=V_(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=I_;else{if(!Ke(h))return!1;if(h.length>10)return je.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Ob(y,_)||Ob(b,_)))}))})(i,f.map((h=>{var p;return{safeText:hc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!Xm(f,n)}var Bg=e=>!e||ur(e,"html")||!Ms(e),V_=(e,t)=>{if(!re||Bg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],l=e;l.parentNode&&!ur(l,"body");)if(F_(l.parentNode))i.push(l.parentNode.host),l=l.parentNode.host;else{var c=H_(l);if(!c)break;if(t||Og.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=re.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}i.push(c),l=c}return{parentIsUsefulElement:n,targetElementList:i}};function Zm(e){for(var t=e;t.parentNode&&!ur(t,"body");t=t.parentNode){var n=Pd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(Pd(e),"ph-include"))return!0;var i=e.type||"";if(zt(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";return!zt(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function G_(e){return!!(ur(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ur(e,"select")||ur(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Y_="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",WC=new RegExp("^(?:"+Y_+")$"),JC=new RegExp(Y_),Q_="\\d{3}-?\\d{2}-?\\d{4}",XC=new RegExp("^("+Q_+")$"),ZC=new RegExp("("+Q_+")");function ec(e,t){return t===void 0&&(t=!0),!(et(e)||zt(e)&&(e=Xd(e),(t?WC:JC).test((e||"").replace(/[- ]/g,""))||(t?XC:ZC).test(e)))}function $b(e){var t=hc(e);return ec(t=(t+" "+W_(e)).trim())?t:""}function W_(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var l=hc(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+W_(n)).trim())}catch(c){je.error("[AutoCapture]",c)}})),t}function Ub(e){return e.replace(/"|\\"/g,'\\"')}function KC(e){var t=e.attr__class;return t?Ke(t)?t:zg(t):void 0}var Ku=It("[Dead Clicks]"),e3=()=>!0,t3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Ag)),i=e.instance.config.capture_dead_clicks;return si(i)?i:!!Qt(i)||n};class Fb{get lazyLoadedDeadClicksAutocapture(){return this.Dr}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Ag]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.$r((()=>{this.qr()})):this.stop()}$r(t){var n,i;(n=De.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?Ku.error("failed to load script",l):t()}))}qr(){var t;if(Ne){if(!this.Dr&&(t=De.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Qt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.Dr=De.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Dr.start(Ne),Ku.info("starting...")}}else Ku.error("`document` not found. Cannot start.")}stop(){this.Dr&&(this.Dr.stop(),this.Dr=void 0,Ku.info("stopping..."))}}var Tp=It("[SegmentIntegration]"),J_="posthog-js";function X_(e,t){var{organization:n,projectId:i,prefix:l,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,k=((h=f.exception)==null?void 0:h.values)||[],E=k.map((T=>ye({},T,{stacktrace:T.stacktrace?ye({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((N=>ye({},N,{platform:"web:javascript"})))}):void 0}))),j={$exception_message:((p=k[0])==null?void 0:p.value)||f.message,$exception_type:(g=k[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=k[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=k[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&i&&(j.$sentry_url=(l||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(j)),f}}class n3{constructor(t,n,i,l,c,u){this.name=J_,this.setupOnce=function(f){f(X_(t,{organization:n,projectId:i,prefix:l,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class qb{constructor(t){this.jr=(n,i,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(je.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.Br=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Hr()}Hr(){var t;this.Ur=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.jr)}destroy(){var t;(t=this.Ur)==null||t.call(this),this.Ur=void 0}doPageView(t,n){var i,l=this.zr(t,n);return this.Br={pathname:(i=re==null?void 0:re.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.zr(t,(n=this.Br)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Br)==null?void 0:t.pageViewId}}zr(t,n){var i=this.Br;if(!i)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:i.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?ii(f/u,0,1,je):1,b=u>1?ii(h/u,0,1,je):1,_=p>1?ii(g/p,0,1,je):1,k=p>1?ii(v/p,0,1,je):1;l=Pt(l,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:k})}}return i.pathname&&(l.$prev_pageview_pathname=i.pathname),i.timestamp&&(l.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),l}}var ed=["flags","surveys"],r3={[E_]:{exposure:"hidden"},[Io]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Vo]:{exposure:"hidden"},[Rm]:{exposure:"event"},[Lm]:{exposure:"hidden"},[Dm]:{exposure:"event"},[zm]:{exposure:"hidden"},[Om]:{exposure:"event"},[Bm]:{exposure:"event"},[Ag]:{exposure:"event"},[Mg]:{exposure:"hidden"},[Pm]:{exposure:"event"},[fa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[xl]:{exposure:"hidden"},[Rg]:{exposure:"event"},[T_]:{exposure:"event",shouldSkipFromEventProperties:e=>Un(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[da]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Qt(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[pd]:{exposure:"event",storageGroup:"flags"},[Go]:{exposure:"hidden"},[$m]:{exposure:"hidden",storageGroup:"flags"},[md]:{exposure:"event",storageGroup:"flags"},[Um]:{exposure:"event",storageGroup:"flags",volatile:!0},[Pi]:{exposure:"event"},[hl]:{exposure:"hidden"},[oa]:{exposure:"hidden"},[ca]:{exposure:"hidden"},[Fm]:{exposure:"hidden",storageGroup:"surveys"},[Lg]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[qm]:{exposure:"event"},[Yo]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ko]:{exposure:"hidden"},[Hm]:{exposure:"hidden"},[Im]:{exposure:"hidden"},[fc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Pr]:{exposure:"hidden"},[Vm]:{exposure:"hidden"},[Gm]:{exposure:"hidden"},[Ym]:{exposure:"hidden"},[Qm]:{exposure:"hidden"},[Ld]:{exposure:"hidden"},[Dd]:{exposure:"hidden"},[A_]:{exposure:"event"},[M_]:{exposure:"event"},[R_]:{exposure:"event"},[L_]:{exposure:"event"},[z_]:{exposure:"event"},[O_]:{exposure:"event"},[B_]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},i3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],na=e=>{var t=r3[e];if(t)return t;for(var[n,i]of i3)if(e.indexOf(n)===0)return i},$d=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Se(t)?null:(t.href=e,t)},pc=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;i.length>l;l++){var c=i[l].split("=");if(c[0]===t){n=c;break}}if(!Ke(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{je.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},mc=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),l=i[1],c=(i[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");Ke(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),l!=null&&(y+="#"+l),y},Ud=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},td="https?://(.*)",jl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],s3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...jl],gc="<masked>",a3=["li_fat_id"];function Z_(e,t,n){if(!Ne)return{};var i,l=t?[...jl,...n||[]]:[],c=K_(mc(Ne.URL,l,gc),e),u=(i={},Rt(a3,(function(f){var h=ri.A(f);i[f]=h||null})),i);return Pt(u,c)}function K_(e,t){var n=s3.concat(t||[]),i={};return Rt(n,(function(l){var c=pc(e,l);i[l]=c||null})),i}function ew(e){var t=(function(c){return c?c.search(td+"google.([^/?]*)")===0?"google":c.search(td+"bing.com")===0?"bing":c.search(td+"yahoo.com")===0?"yahoo":c.search(td+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Un(t)){i.$search_engine=t;var l=Ne?pc(Ne.referrer,n):"";l.length&&(i.ph_keyword=l)}return i}function Hb(){return navigator.language||navigator.userLanguage}var Fd="$direct";function tw(){return(Ne==null?void 0:Ne.referrer)||Fd}function nw(e,t){var n=e?[...jl,...t||[]]:[],i=Tn==null?void 0:Tn.href.substring(0,1e3);return{r:tw().substring(0,1e3),u:i?mc(i,n,gc):void 0}}function rw(e){var t,{r:n,u:i}=e,l={$referrer:n,$referring_domain:n==null?void 0:n==Fd?Fd:(t=$d(n))==null?void 0:t.host};if(i){l.$current_url=i;var c=$d(i);l.$host=c==null?void 0:c.host,l.$pathname=c==null?void 0:c.pathname;var u=K_(i);Pt(l,u)}if(n){var f=ew(n);Pt(l,f)}return l}function iw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function l3(){try{return new Date().getTimezoneOffset()}catch{return}}var o3={flags:fc,surveys:Lg},c3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],al="main";class Ap{constructor(t,n,i){if(i===void 0&&(i=!0),this.Vr={},this.Wr=!1,this.Gr=!1,this.qt=t,this.Zr=i,this.props={},this.Qr=!1,this.Jr=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.Ar=this.Kr(t),this.Gr=this.Yr(t),this.load(),t.debug&&je.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),re){var l=()=>this.flush();Yt(re,"beforeunload",l,{capture:!1}),Yt(re,"pagehide",l,{capture:!1})}}Xr(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return Fn(n)&&n>0?n:0}isDisabled(){return!!this.ei}Kr(t){c3.indexOf(t.persistence.toLowerCase())===-1&&(je.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,i=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...UC,...u];return ye({},Mt,{F(p){try{var g={};try{g=ri.F(p)||{}}catch{}var v,y=JSON.parse(Mt.A(p)||"{}");if(f){var b={};for(var _ in g){var k=g[_];Un(k)||k===""||(b[_]=k)}v=Pt(y,b)}else v=Pt(g,y);return Mt.N(p,v),v}catch{}return null},N(p,g,v,y,b,_){var k=Mt.N(p,g,void 0,void 0,_);try{var E={};h.forEach((j=>{g[j]&&(E[j]=g[j])})),Object.keys(E).length&&ri.N(p,E,v,y,b,_)}catch(j){Mt.D(j)}return k},q(p,g){try{re==null||re.localStorage.removeItem(p),ri.q(p,g)}catch(v){Mt.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Mt.O()?(n=Mt,l=!0):c==="localstorage+cookie"&&i.O()?(n=i,l=!0):c==="sessionstorage"&&An.O()?n=An:c==="memory"?n=FC:c==="cookie"?n=ri:i.O()?(n=i,l=!0):n=ri,this.Wr=l,n}ti(t){return this.Jr+"__"+t}Yr(t){return this.Wr&&!!t.split_storage}ri(t){var n=t??this.qt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[fc];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Rt(this.props,((n,i)=>{var l=na(i);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,i===da?()=>this.ri():()=>!1))return;l.transformToEventProperties&&Pt(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[i]=n}})),t}load(){if(!this.ei){var t=this.Ar.F(this.Jr);t&&(this.props=Pt({},t)),this.Gr&&this.ii()}}ii(){for(var t of ed){var n=Mt.F(this.ti(t));if(n&&!Es(n)){var i=this.ni(t);i.persisted=!0,this.si(t)||(i.fingerprint=this.oi(n,t)),this.ai(t,n)||Pt(this.props,n)}}}si(t){return Object.keys(this.props).some((n=>{var i;return((i=na(n))==null?void 0:i.storageGroup)===t}))}ai(t,n){var i=o3[t];if(!i)return!1;var l=n[i],c=this.props[i];return Fn(l)&&Fn(c)&&c>l}refreshKey(t){var n;if(!this.ei){var i=this.Gr?(n=na(t))==null?void 0:n.storageGroup:void 0,l=i?Mt.F(this.ti(i)):this.Ar.F(this.Jr);if(l&&t in l)this.li(t,l[t]);else{if(i){var c=this.Ar.F(this.Jr);if(c&&t in c)return void this.li(t,c[t])}this.ui(t)}}}save(){if(!this.ei){var t=this.Xr();t>0?Se(this.hi)&&(this.hi=setTimeout((()=>{this.hi=void 0,this.ci()}),t)):this.ci()}}flush(){Se(this.hi)||(clearTimeout(this.hi),this.hi=void 0,this.ci())}ci(){this.ei||(this.Gr?this.di():this.vi(this.Ar,this.Jr,this.props,al))}di(){var{main:t,groups:n}=this.fi();for(var i of(this.vi(this.Ar,this.Jr,t,al),ed)){var l,c=n[i];(!Es(c)||(l=this.Vr[i])!=null&&l.persisted)&&this.vi(Mt,this.ti(i),c,i)}}fi(){var t={},n={};for(var i of ed)n[i]={};return Rt(this.props,((l,c)=>{var u,f=(u=na(c))==null?void 0:u.storageGroup;f?n[f][c]=l:t[c]=l})),{main:t,groups:n}}oi(t,n){if(n===al)return JSON.stringify(t)+"|"+this.pi+"|"+this.gi+"|"+this.mi;var i={};return Rt(t,((l,c)=>{var u;i[c]=(u=na(c))!=null&&u.volatile?"__volatile__":l})),JSON.stringify(i)}vi(t,n,i,l){var c=this.ni(l);if(l===al||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.oi(i,l))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.N(n,i,this.pi,this.gi,this.mi,this.qt.debug)?(c.dirty=!1,l!==al&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.qt.debug&&je.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.hi)||(clearTimeout(this.hi),this.hi=void 0),this.Ar.q(this.Jr,!1),this.Ar.q(this.Jr,!0),!n&&this.Zr)for(var i of ed)Mt.q(this.ti(i));n?delete this.Vr[al]:this.Vr={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(Qt(t)){Se(n)&&(n="None"),this.pi=Se(i)?this.yi:i;var l=!1;if(Rt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.li(u,c),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if(Qt(t)){this.pi=Se(n)?this.yi:n;var i=!1;if(Rt(t,((l,c)=>{t.hasOwnProperty(c)&&this.props[c]!==l&&(this.li(c,l),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.ui(t),this.save())}update_campaign_params(){if(!this.Qr){var t=Z_(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);Es(Dg(t))||this.register(t),this.Qr=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?ew(t):{})}update_referrer_info(){var t;this.register_once({$referrer:tw(),$referring_domain:Ne!=null&&Ne.referrer&&((t=$d(Ne.referrer))==null?void 0:t.host)||Fd},void 0)}set_initial_person_info(){this.props[Ym]||this.props[Qm]||this.register_once({[Ld]:nw(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Rt([Qm,Ym],(u=>{var f=this.props[u];f&&Rt(f,(function(h,p){t["$initial_"+jm(p)]=h}))}));var n,i,l=this.props[Ld];if(l){var c=(n=rw(l),i={},Rt(n,(function(u,f){i["$initial_"+jm(f)]=u})),i);Pt(t,c)}return t}safe_merge(t){return Rt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){this.yi=this.pi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=l?this.Kr(t):this.Ar,u=this.Yr(t);if(l||u!==this.Gr){var f=this.props;this.clear(),this.Ar=c,this.Gr=u,this.props=f,this.save()}}set_disabled(t){this.ei=t,this.ei?this.remove():this.save()}set_cross_subdomain(t){t!==this.gi&&(this.gi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.mi&&(this.mi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[Vo]||{};i[t]=n,this.li(Vo,i),this.save()}remove_event_timer(t){var n=this.props[Vo]||{},i=n[t];return Se(i)||(delete n[t],this.li(Vo,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.li(t,n),this.save()}li(t,n){var i;this.props[t]=n,(i=na(t))!=null&&i.volatile||this.bi(t)}ui(t){delete this.props[t],this.bi(t)}bi(t){var n,i=(n=na(t))==null?void 0:n.storageGroup;i&&(this.ni(i).dirty=!0)}ni(t){return this.Vr[t]||(this.Vr[t]={})}}var Ao={Activation:"events",Cancellation:"cancelEvents"},Mp={Popover:"popover",API:"api",Widget:"widget"},u3={Always:"always"},qi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Rp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Km={Popover:"popover",Inline:"inline"},d3={SHOWN:"product tour shown"},Ib={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Vb=It("[RateLimiter]");class f3{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((l=>{Vb.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Vb.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,i,l;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(Gm))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property(Gm,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Mo=It("[RemoteConfig]");class sw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=De._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}wi(t){var n,i;(n=De.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}xi(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return Mo.info("Using preloaded remote config",this.remoteConfig),this.ki(this.remoteConfig),void this.Si();if(this._instance.Ci())return void Mo.warn("Remote config is disabled. Falling back to local config.");this.wi((t=>{if(!t)return Mo.info("No config found after loading remote JS config. Falling back to JSON."),void this.xi((n=>{this.ki(n),this.Si()}));this.ki(t),this.Si()}))}catch(t){Mo.error("Error loading remote config",t)}}stop(){this.Ii&&(clearInterval(this.Ii),this.Ii=void 0)}refresh(){!this._instance.Ci()&&Ne&&Ne.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Si(){var t;if(!this.Ii){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.Ii=setInterval((()=>{this.refresh()}),n))}}ki(t){var n;t||Mo.error("Failed to fetch remote config from PostHog."),this._instance.ki(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var ni={GZipJS:"gzip-js",Base64:"base64"},Ar=Uint8Array,Xn=Uint16Array,Nl=Uint32Array,Pg=new Ar([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$g=new Ar([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Gb=new Ar([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),aw=function(e,t){for(var n=new Xn(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var l=new Nl(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)l[c]=c-n[i]<<5|i;return[n,l]},lw=aw(Pg,2),eg=lw[1];lw[0][28]=258,eg[258]=28;for(var Yb=aw($g,0)[1],ow=new Xn(32768),$t=0;32768>$t;++$t){var ll=(43690&$t)>>>1|(21845&$t)<<1;ow[$t]=((65280&(ll=(61680&(ll=(52428&ll)>>>2|(13107&ll)<<2))>>>4|(3855&ll)<<4))>>>8|(255&ll)<<8)>>>1}var tc=function(e,t,n){for(var i=e.length,l=0,c=new Xn(t);i>l;++l)++c[e[l]-1];var u,f=new Xn(t);for(l=0;t>l;++l)f[l]=f[l-1]+c[l-1]<<1;for(u=new Xn(i),l=0;i>l;++l)u[l]=ow[f[e[l]-1]++]>>>15-e[l];return u},ma=new Ar(288);for($t=0;144>$t;++$t)ma[$t]=8;for($t=144;256>$t;++$t)ma[$t]=9;for($t=256;280>$t;++$t)ma[$t]=7;for($t=280;288>$t;++$t)ma[$t]=8;var qd=new Ar(32);for($t=0;32>$t;++$t)qd[$t]=5;var h3=tc(ma,9),p3=tc(qd,5),cw=function(e){return(e/8>>0)+(7&e&&1)},uw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof Xn?Xn:e instanceof Nl?Nl:Ar)(n-t);return i.set(e.subarray(t,n)),i},Ri=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Ro=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Lp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var l=n.length,c=n.slice();if(!l)return[new Ar(0),0];if(l==1){var u=new Ar(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(z,L){return z.f-L.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=l-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(i=1;l>i;++i)c[i].s>y&&(y=c[i].s);var b=new Xn(y+1),_=tg(n[g-1],b,0);if(_>t){i=0;var k=0,E=_-t,j=1<<E;for(c.sort((function(z,L){return b[L.s]-b[z.s]||z.f-L.f}));l>i;++i){var T=c[i].s;if(t>=b[T])break;k+=j-(1<<_-b[T]),b[T]=t}for(k>>>=E;k>0;){var N=c[i].s;t>b[N]?k-=1<<t-b[N]++-1:++i}for(;i>=0&&k;--i){var D=c[i].s;b[D]==t&&(--b[D],++k)}_=t}return[new Ar(b),_]},tg=function(e,t,n){return e.s==-1?Math.max(tg(e.l,t,n+1),tg(e.r,t,n+1)):t[e.s]=n},Qb=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Xn(++t),i=0,l=e[0],c=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==l&&f!=t)++c;else{if(!l&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(l),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(l);c=1,l=e[f]}return[n.subarray(0,i),t]},Lo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},ng=function(e,t,n){var i=n.length,l=cw(t+2);e[l]=255&i,e[l+1]=i>>>8,e[l+2]=255^e[l],e[l+3]=255^e[l+1];for(var c=0;i>c;++c)e[l+c+4]=n[c];return 8*(l+4+i)},Wb=function(e,t,n,i,l,c,u,f,h,p,g){Ri(t,g++,n),++l[256];for(var v=Lp(l,15),y=v[0],b=v[1],_=Lp(c,15),k=_[0],E=_[1],j=Qb(y),T=j[0],N=j[1],D=Qb(k),z=D[0],L=D[1],H=new Xn(19),U=0;T.length>U;++U)H[31&T[U]]++;for(U=0;z.length>U;++U)H[31&z[U]]++;for(var V=Lp(H,7),O=V[0],F=V[1],A=19;A>4&&!O[Gb[A-1]];--A);var ae,X,I,$,P=p+5<<3,ie=Lo(l,ma)+Lo(c,qd)+u,me=Lo(l,y)+Lo(c,k)+u+14+3*A+Lo(H,O)+(2*H[16]+3*H[17]+7*H[18]);if(ie>=P&&me>=P)return ng(t,g,e.subarray(h,h+p));if(Ri(t,g,1+(ie>me)),g+=2,ie>me){ae=tc(y,b),X=y,I=tc(k,E),$=k;var R=tc(O,F);for(Ri(t,g,N-257),Ri(t,g+5,L-1),Ri(t,g+10,A-4),g+=14,U=0;A>U;++U)Ri(t,g+3*U,O[Gb[U]]);g+=3*A;for(var B=[T,z],Z=0;2>Z;++Z){var M=B[Z];for(U=0;M.length>U;++U)Ri(t,g,R[pe=31&M[U]]),g+=O[pe],pe>15&&(Ri(t,g,M[U]>>>5&127),g+=M[U]>>>12)}}else ae=h3,X=ma,I=p3,$=qd;for(U=0;f>U;++U)if(i[U]>255){var pe;Ro(t,g,ae[257+(pe=i[U]>>>18&31)]),g+=X[pe+257],pe>7&&(Ri(t,g,i[U]>>>23&31),g+=Pg[pe]);var _e=31&i[U];Ro(t,g,I[_e]),g+=$[_e],_e>3&&(Ro(t,g,i[U]>>>5&8191),g+=$g[_e])}else Ro(t,g,ae[i[U]]),g+=X[i[U]];return Ro(t,g,ae[256]),g+X[256]},m3=new Nl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),g3=(function(){for(var e=new Nl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Dp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function x3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=g3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var l,c,u,f,h,p=(f=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(v,y,b,_,k,E){var j=v.length,T=new Ar(_+j+5*(1+Math.floor(j/7e3))+k),N=T.subarray(_,T.length-k),D=0;if(!y||8>j)for(var z=0;j>=z;z+=65535){var L=z+65535;j>L?D=ng(N,D,v.subarray(z,L)):(N[z]=!0,D=ng(N,D,v.subarray(z,j)))}else{for(var H=m3[y-1],U=H>>>13,V=8191&H,O=(1<<b)-1,F=new Xn(32768),A=new Xn(O+1),ae=Math.ceil(b/3),X=2*ae,I=function(st){return(v[st]^v[st+1]<<ae^v[st+2]<<X)&O},$=new Nl(25e3),P=new Xn(288),ie=new Xn(32),me=0,R=0,B=(z=0,0),Z=0,M=0;j>z;++z){var pe=I(z),_e=32767&z,Ce=A[pe];if(F[_e]=Ce,A[pe]=_e,z>=Z){var Te=j-z;if((me>7e3||B>24576)&&Te>423){D=Wb(v,N,0,$,P,ie,R,B,M,z-M,D),B=me=R=0,M=z;for(var Le=0;286>Le;++Le)P[Le]=0;for(Le=0;30>Le;++Le)ie[Le]=0}var Pe=2,rt=0,be=V,ze=_e-Ce&32767;if(Te>2&&pe==I(z-ze))for(var gt=Math.min(U,Te)-1,Ut=Math.min(32767,z),Dt=Math.min(258,Te);Ut>=ze&&--be&&_e!=Ce;){if(v[z+Pe]==v[z+Pe-ze]){for(var kt=0;Dt>kt&&v[z+kt]==v[z+kt-ze];++kt);if(kt>Pe){if(Pe=kt,rt=ze,kt>gt)break;var fn=Math.min(ze,kt-2),it=0;for(Le=0;fn>Le;++Le){var xn=z-ze+Le+32768&32767,hn=xn-F[xn]+32768&32767;hn>it&&(it=hn,Ce=xn)}}}ze+=(_e=Ce)-(Ce=F[_e])+32768&32767}if(rt){$[B++]=268435456|eg[Pe]<<18|Yb[rt];var ke=31&eg[Pe],Oe=31&Yb[rt];R+=Pg[ke]+$g[Oe],++P[257+ke],++ie[Oe],Z=z+Pe,++me}else $[B++]=v[z],++P[v[z]]}}D=Wb(v,N,!0,$,P,ie,R,B,M,z-M,D)}return uw(T,0,_+cw(D)+k)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&Dp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),Dp(p,g-8,n.d()),Dp(p,g-4,i),p}var v3=!!wm||!!_m,dw="text/plain",xd=!1,b3=(e,t)=>{var[n,i]=e.split("#"),[l,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return l+(u?"?"+u:"")+(i?"#"+i:"")},Kd=function(e,t,n){var i;n===void 0&&(n=!0);var[l,c]=e.split("?"),u=ye({},t),f=(i=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&i!==void 0?i:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return Rt(p,(function(_,k){Se(_)||Se(k)||k==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(k),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),l+"?"+f.join("&")},vl=(e,t)=>JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t),Jb=e=>{if(e.Rr)return e.Rr;var{data:t,compression:n}=e;if(t){if(n===ni.GZipJS){var i=x3((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Ar(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new Ar(v+8+(p-b<<1));_.set(g),g=_}var k=f.charCodeAt(b);128>k?y(k):2048>k?(y(192|k>>>6),y(128|63&k)):k>55295&&57344>k?(y(240|(k=65536+(1047552&k)|1023&f.charCodeAt(++b))>>>18),y(128|k>>>12&63),y(128|k>>>6&63),y(128|63&k)):(y(224|k>>>12),y(128|k>>>6&63),y(128|63&k))}return uw(g,0,v)})(vl(t)),{mtime:0});return{contentType:dw,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===ni.Base64){var l=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(vl(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:vl(f)))(l);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=vl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},zp=e=>{var t,n,i,l=Jb(e);return!l||(n=e.compression,i=pc(e.url,"compression"),n!==Sb.GZipJS&&i!==Sb.GZipJS&&i!=="gzip")||((t=l.body)instanceof ArrayBuffer?Sm(new Uint8Array(t)):ArrayBuffer.isView(t)&&Sm(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:l}:(xd=!0,{url:b3(e.url,"compression"),encodedBody:Jb(ye({},e,{compression:void 0,Rr:void 0}))})},y3=(function(){var e=wn((function*(t){var n=vl(t.data),i=yield(function(c,u,f){return km.apply(this,arguments)})(n,Xt.DEBUG,{rethrow:!0});if(!i)return t;var l=yield i.arrayBuffer();return ye({},t,{Rr:{contentType:dw,body:l,estimatedSize:l.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),Xb=(e,t)=>Kd(e,{_:new Date().getTime().toString(),ver:Xt.JS_SDK_VERSION,compression:t}),vd=[];_m&&vd.push({transport:"fetch",method(e){var t,{url:n,encodedBody:i}=zp(e),{contentType:l,body:c,estimatedSize:u}=i??{},f=new Headers;Rt(e.headers,(function(g,v){f.append(v,g)})),l&&f.append("Content-Type",l);var h=null;if(yb){var p=new yb;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}_m(n,ye({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&52428.8>(u||0),body:c,signal:(t=h)==null?void 0:t.signal},e.fetchOptions)).then((g=>g.text().then((v=>{var y={statusCode:g.status,text:v};if(g.status===200)try{y.json=JSON.parse(v)}catch(b){je.error(b)}e.callback==null||e.callback(y)})))).catch((g=>{je.error(g),e.callback==null||e.callback({statusCode:0,error:g})})).finally((()=>h?clearTimeout(h.timeout):null))}}),wm&&vd.push({transport:"XHR",method(e){var t=new wm,{url:n,encodedBody:i}=zp(e);t.open(e.method||"GET",n,!0);var{contentType:l,body:c}=i??{};Rt(e.headers,(function(u,f){t.setRequestHeader(f,u)})),l&&t.setRequestHeader("Content-Type",l),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var u={statusCode:t.status,text:t.responseText};if(t.status===200)try{u.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(u)}},t.send(c)}}),cr!=null&&cr.sendBeacon&&vd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=zp(e),i=Kd(t,{beacon:"1"}),{contentType:l,body:c}=n??{};if(!c)return;var u=c instanceof Blob?c:new Blob([c],{type:l});cr.sendBeacon(i,u)}catch{}}});var rg=3e3;class _3{constructor(t,n){this.Ti=!0,this.Ei=[],this.Mi=ii((n==null?void 0:n.flush_interval_ms)||rg,250,5e3,je.createLogger("flush interval"),rg),this.Pi=t}enqueue(t){this.Ei.push(t),this.Ri||this.Oi()}unload(){this.Li();var t=this.Ei.length>0?this.Ai():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Pi(ye({},i,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Oi()}Oi(){var t=this;this.Ti||(this.Ri=setTimeout((()=>{if(this.Li(),this.Ei.length>0){var n=this.Ai(),i=function(){var c=n[l],u=new Date().getTime();c.data&&Ke(c.data)&&Rt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Pi(c)};for(var l in n)i()}}),this.Mi))}Li(){clearTimeout(this.Ri),this.Ri=void 0}Ai(){var t={};return Rt(this.Ei,(n=>{var i,l=n,c=(l?l.batchKey:null)||l.url;Se(t[c])&&(t[c]=ye({},l,{data:[]})),(i=t[c].data)==null||i.push(l.data)})),this.Ei=[],t}}var w3=["retriesPerformedSoFar"];class S3{constructor(t){this.Fi=!1,this.Ni=3e3,this.Ei=[],this._instance=t,this.Ei=[],this.Di=!0,!Se(re)&&"onLine"in re.navigator&&(this.Di=re.navigator.onLine,this.$i=()=>{this.Di=!0,this.qi()},this.ji=()=>{this.Di=!1},Yt(re,"online",this.$i),Yt(re,"offline",this.ji))}get length(){return this.Ei.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,i=W5(t,w3);Bi(n)&&(i.url=Kd(i.url,{retry_count:n})),this._instance._send_request(ye({},i,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.yr(ye({retriesPerformedSoFar:n},i));l.statusCode===0&&je.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}i.callback==null||i.callback(l)}}))}yr(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),l=Date.now()+i;this.Ei.push({retryAt:l,requestOptions:t});var c="Enqueued failed request for retry in "+i;navigator.onLine||(c+=" (Browser is offline)"),je.warn(c),this.Fi||(this.Fi=!0,this.Bi())}Bi(){if(this.Hi&&clearTimeout(this.Hi),this.Ei.length===0)return this.Fi=!1,void(this.Hi=void 0);this.Hi=setTimeout((()=>{this.Di&&this.Ei.length>0&&this.qi(),this.Bi()}),this.Ni)}qi(){var t=Date.now(),n=[],i=this.Ei.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Ei=n,i.length>0)for(var{requestOptions:l}of i)this.retriableRequest(l)}unload(){for(var{requestOptions:t}of(this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0),this.Fi=!1,Se(re)||(this.$i&&(re.removeEventListener("online",this.$i),this.$i=void 0),this.ji&&(re.removeEventListener("offline",this.ji),this.ji=void 0)),this.Ei))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){je.error(n)}this.Ei=[]}}class k3{constructor(t){this.Ui=()=>{var n,i,l,c;this.zi||(this.zi={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.zi.lastScrollY=Math.ceil(f),this.zi.maxScrollY=Math.max(f,(n=this.zi.maxScrollY)!==null&&n!==void 0?n:0),this.zi.maxScrollHeight=Math.max(h,(i=this.zi.maxScrollHeight)!==null&&i!==void 0?i:0),this.zi.lastContentY=p,this.zi.maxContentY=Math.max(p,(l=this.zi.maxContentY)!==null&&l!==void 0?l:0),this.zi.maxContentHeight=Math.max(g,(c=this.zi.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get Vi(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var t=this.zi;return setTimeout(this.Ui,0),t}startMeasuringScrollPosition(){Yt(re,"scroll",this.Ui,{capture:!0}),Yt(re,"scrollend",this.Ui,{capture:!0}),Yt(re,"resize",this.Ui)}scrollElement(){if(!this.Vi)return re==null?void 0:re.document.documentElement;var t=Ke(this.Vi)?this.Vi:[this.Vi];for(var n of t){var i=re==null?void 0:re.document.querySelector(n);if(i)return i}}Wi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.Vi){var i=this.scrollElement();return i&&i[n]||0}return re?t==="y"?re.scrollY||re.pageYOffset||re.document.documentElement.scrollTop||0:re.scrollX||re.pageXOffset||re.document.documentElement.scrollLeft||0:0}scrollY(){return this.Wi("y")}scrollX(){return this.Wi("x")}}var j3=e=>nw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class Zb{constructor(t,n,i,l){this.Gi=c=>{var u=this.Zi();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Qi(this._instance)};this.Ji.register({[Vm]:f})}},this._instance=t,this.Ki=n,this.Ji=i,this.Qi=l||j3,this.Ki.onSessionId(this.Gi)}Zi(){return this.Ji.props[Vm]}getSetOnceProps(){var t,n=(t=this.Zi())==null?void 0:t.props;return n?"r"in n?rw(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Rt(Dg(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+jm(i)]=n})),t}}class Ug{constructor(){this.Yi={}}on(t,n){return this.Yi[t]||(this.Yi[t]=[]),this.Yi[t].push(n),()=>{this.Yi[t]=this.Yi[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Yi[t]||[])i(n);for(var l of this.Yi["*"]||[])l(t,n)}}var Do=It("[SessionId]");class Kb{on(t,n){return this.Xi.on(t,n)}constructor(t,n,i){var l;if(this.en=null,this.tn=[],this.rn=void 0,this.nn=!1,this.Xi=new Ug,this.sn=(p,g)=>!(!Bi(p)||!Bi(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Fi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.Ji=t.persistence,this.an=void 0,this.ln=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.un=n||Cs,this.hn=i||Cs;var c=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*ii(this.qt.session_idle_timeout_seconds||1800,60,36e3,Do.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.cn(),this.dn="ph_"+c+"_window_id",this.vn="ph_"+c+"_primary_window_exists",this.fn()){var u=An.F(this.dn),f=An.F(this.vn);u&&!f?this.an=u:An.q(this.dn),An.N(this.vn,!0)}if((l=this.qt.bootstrap)!=null&&l.sessionID)try{var h=(p=>{var g=this.qt.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.pn(this.qt.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Do.error("Invalid sessionID in bootstrap",p)}this.gn()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.tn)&&(this.tn=[]),this.tn.push(t),this.ln&&t(this.ln,this.an),()=>{this.tn=this.tn.filter((n=>n!==t))}}fn(){return this.qt.persistence!=="memory"&&!this.Ji.ei&&An.O()}mn(t){t!==this.an&&(this.an=t,this.fn()&&An.N(this.dn,t))}yn(){return this.an?this.an:this.fn()?An.F(this.dn):null}bn(t){var n=this.en;return!Un(n)&&!Un(t)&&5e3>Math.abs(t-n)}pn(t,n,i){var l=n!==this._sessionActivityTimestamp,c=!(t!==this.ln||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.ln=t,c&&!l||c&&this.bn(n)||(this.en=n,this.Ji.register({[xl]:[n,t,i]}))}_n(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return Bi(n)&&n>0}wn(){this._n()?this.Ji.refreshKey(xl):(this.Ji.flush(),this.Ji.load())}xn(){var t;if(!Un(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.en){this.wn();var[,n,i]=this.kn();n===this.ln&&i===this._sessionStartTimestamp&&(this.en=this._sessionActivityTimestamp,this.Ji.register({[xl]:[this._sessionActivityTimestamp,(t=this.ln)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ji.flush())}}Sn(){var[t]=this.kn(),n=Bi(t)?t:0,i=Bi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}Cn(t){return this.wn(),this.sn(t,this.Sn())}kn(){var t=this.Ji.props[xl];return Ke(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.en=null,clearTimeout(this.In),this.In=void 0,this.pn(null,null,null)}destroy(){this.nn=!0,this.xn(),clearTimeout(this.In),this.In=void 0,this.rn&&re&&(re.removeEventListener(Od,this.rn,{capture:!1}),this.rn=void 0),this.tn=[]}gn(){this.rn=()=>{this.xn(),this.fn()&&An.q(this.vn)},Yt(re,Od,this.rn,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.qt.cookieless_mode===Fi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),[,l,c]=this.kn(),u=this.Sn(),f=this.yn(),h=Bi(c)&&Math.abs(i-c)>864e5,p=!1,g=!1,v=!l,y=l,b=!v&&!t&&this.sn(i,u);b&&((b=this.Cn(i))||Do.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,c]=this.kn()),v||b||h?(l=this.un(),f=this.hn(),Do.info("new session ID generated",{sessionId:l,windowId:f,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),c=i,p=!0):(f||(f=this.hn(),p=!0),(g=l!==y)&&(Do.info("adopted cross-tab session id",{sessionId:l,windowId:f}),p=!0));var _=Bi(u)&&t&&!h?u:i,k=Bi(c)?c:new Date().getTime();this.mn(f),this.pn(l,_,k),t||this.cn();var E={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:g};return p&&this.tn.forEach((j=>j(l,f,E))),{sessionId:l,windowId:f,sessionStartTimestamp:k,changeReason:p?E:void 0,lastActivityTimestamp:u}}cn(){this.nn||(clearTimeout(this.In),this.In=setTimeout((()=>{if(!this.nn)if(this.Cn(new Date().getTime())){var t=this.ln;this.resetSessionId(),this.Xi.emit("forcedIdleReset",{idleSessionId:t})}else this.cn()}),1.1*this.sessionTimeoutMs))}}var fw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&jb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((l=>jb(l==null?void 0:l.brand,t))))return!0}catch{}return!!e.webdriver},Hd=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function ey(e,t,n){return vl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var hw={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>Hd(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!Hd(n,i))))),icontains:(e,t)=>t.map(nd).some((n=>e.map(nd).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(nd).every((n=>e.map(nd).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i>parseFloat(l)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i<parseFloat(l)))}))},nd=e=>e.toLowerCase();function pw(e,t){return!e||Object.entries(e).every((n=>{var[i,l]=n,c=t==null?void 0:t[i];if(Se(c)||Un(c))return!1;var u=[String(c)],f=hw[l.operator];return!!f&&f(l.values,u)}))}var ig="custom",ty="i.posthog.com",N3=/^\/static\//;class C3{constructor(t){this.Tn={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+ty,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Tn[this.apiHost]||(this.Tn[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ig),this.Tn[this.apiHost]}En(t){if(N3.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var i=this.En(n);if(i)return""+i+n}if(this.region===ig)return this.apiHost+n;var l=ty+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}var Et=It("[Surveys]"),sg="seenSurvey_",E3=[Mp.Popover,Mp.Widget,Mp.API],T3={ignoreConditions:!1,ignoreDelay:!1,displayType:Km.Popover},A3=It("[PostHog ExternalIntegrations]"),M3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class R3{constructor(t){this._instance=t}$r(t,n){var i;(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(l=>{if(l)return A3.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!l||(f=De.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.$r(M3[u],(()=>{var g;(g=De.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!l&&(h=De.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=De.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[i,l]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(i)}}}var ol,nc={},Op=0,ag=()=>{},ny='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',zo="Surveys module not available",ry="sanitize_properties is deprecated. Use before_send instead",mw="Invalid value for property_denylist config: ",ml="posthog",gw=!v3&&(Jn==null?void 0:Jn.indexOf("MSIE"))===-1&&(Jn==null?void 0:Jn.indexOf("Mozilla"))===-1,iy=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zC(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ag,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Tn&&zt(Tn==null?void 0:Tn.search)&&Tn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){je.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Jm,before_send:void 0,request_queue_config:{flush_interval_ms:rg},error_tracking:{},_onCapture:ag},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:YC,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n)}))(e))},L3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],sy=e=>{var t={};for(var[n,i]of L3)Se(e[n])||(t[i]=e[n]);var l=Pt({},t,e),c=e.__preview_external_dependency_versioned_paths;return Se(c)||(Se(e.strict_script_versioning)&&(l.strict_script_versioning=!!c),zt(c)&&Se(e.asset_host)&&(l.asset_host=c)),Ke(e.property_blacklist)&&(Se(e.property_denylist)?l.property_denylist=e.property_blacklist:Ke(e.property_denylist)?l.property_denylist=[...e.property_blacklist,...e.property_denylist]:je.error(mw+e.property_denylist)),l};class D3{constructor(){this.__forceAllowLocalhost=!1}get Mn(){return this.__forceAllowLocalhost}set Mn(t){je.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Er{Pn(t,n){if(t){var i=this.Rn.indexOf(t);i!==-1&&this.Rn.splice(i,1)}return this.Rn.push(n),n.initialize==null||n.initialize(),n}On(){return this.config.cookieless_mode===Fi||this.config.cookieless_mode===ua&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new D3,this.Ln=!1,this.version=Xt.LIB_VERSION,this.An=new Ug,this.Rn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=iy(),this.SentryIntegration=n3,this.sentryIntegration=i=>(function(l,c){var u=X_(l,c);return{name:J_,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fn=!1,this.Nn=null,this.Dn=null,this.$n=null,this.scrollManager=new k3(this),this.pageViewManager=new qb(this),this.rateLimiter=new f3(this),this.requestRouter=new C3(this),this.consent=new qC(this),this.externalIntegrations=new R3(this);var n=(t=Er.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,l,c)=>{var u=zt(i)?{[i]:l}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,l,c)=>{var u=zt(i)?{[i]:l}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(i=>je.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==ml){var l,c=(l=nc[i])!==null&&l!==void 0?l:new Er;return c._init(t,n,i),nc[i]=c,nc[ml][i]=c,c}return this._init(t,n,i)}_init(t,n,i){var l,c;n===void 0&&(n={});var u=zt(t)?t.trim():"";if(!u)return je.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.qn(n.debug),this.jn=n,this.Bn=[],n.person_profiles?this.Dn=n.person_profiles:n.process_person&&(this.Dn=n.process_person);var f=iy(n.defaults),h=sy(n),p=Pt({},f,h,{name:i,token:u});Qt(f.rageclick)&&Qt(h.rageclick)&&(p.rageclick=Pt({},f.rageclick,h.rageclick)),this.set_config(p),this.config.on_xhr_error&&je.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ni.GZipJS;var g=this.Hn();this.persistence=new Ap(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ap(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Un=new _3((D=>this.zn(D)),this.config.request_queue_config),this.Vn=new S3(this),this.__request_queue=[];var b=this.On();if(b||(this.sessionManager=new Kb(this),this.sessionPropsManager=new Zb(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(je.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Wn(b)}),0)):(je.info("Initializing extensions synchronously"),this.Wn(b)),Xt.DEBUG=Xt.DEBUG||this.config.debug,Xt.DEBUG&&je.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,k=this.get_distinct_id(),E=this.persistence.get_property(Pr);if(n.bootstrap.isIdentifiedID&&k!=null&&k!==_&&E===il)this.identify(_);else if(n.bootstrap.isIdentifiedID&&k!=null&&k!==_&&E===sl)je.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var j=this.config.get_device_id(Cs()),T=n.bootstrap.isIdentifiedID?j:_;this.persistence.set_property(Pr,n.bootstrap.isIdentifiedID?sl:il),this.register({distinct_id:_,$device_id:T})}}if(b)this.register_once({distinct_id:Ju,$device_id:null},"");else if(!this.get_distinct_id()){var N=this.config.get_device_id(Cs());this.register_once({distinct_id:N,$device_id:N},""),this.persistence.set_property(Pr,il)}return Yt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(D,z){var L=D.config.segment;if(!L)return z();(function(H,U){var V=H.config.segment;if(!V)return U();var O=A=>{var ae=()=>A.anonymousId()||Cs();H.config.get_device_id=ae,A.id()&&(H.register({distinct_id:A.id(),$device_id:ae()}),H.persistence.set_property(Pr,sl)),U()},F=V.user();"then"in F&&Ui(F.then)?F.then(O):O(F)})(D,(()=>{L.register((H=>{Promise&&Promise.resolve||Tp.warn("This browser does not have Promise support, and can not use the segment integration");var U=(V,O)=>{if(!O)return V;V.event.userId||V.event.anonymousId===H.get_distinct_id()||(Tp.info("No userId set, resetting PostHog"),H.reset()),V.event.userId&&V.event.userId!==H.get_distinct_id()&&(Tp.info("UserId set, identifying with PostHog"),H.identify(V.event.userId));var F=H.calculateEventProperties(O,V.event.properties);return V.event.properties=Object.assign({},F,V.event.properties),V};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:V=>U(V,V.event.event),page:V=>U(V,pl),identify:V=>U(V,Np),screen:V=>U(V,"$screen")}})(D)).then((()=>{z()}))}))})(this,(()=>this.Gn())):this.Gn(),Ui(this.config._onCapture)&&this.config._onCapture!==ag&&(je.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(D=>this.config._onCapture(D.event,D)))),this.config.ip&&je.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Wn(t){var n,i,l,c,u,f,h,p=performance.now(),g=ye({},Er.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.Rn.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.Rn.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new g.exceptions(this)),g.historyAutocapture&&this.Rn.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Rn.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.Rn.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Rn.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Rn.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Rn.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new g.surveys(this)),g.logs&&this.Rn.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.Rn.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.Rn.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Rn.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Rn.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Rn.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Rn.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,t3)),g.toolbar&&this.Rn.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.Rn.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.Rn.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Zn){var y=this.Zn;this.Zn=void 0,this.ki(y)}})),this.Qn(v,p)}Qn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Qn(t,n)}),0);var i=t.shift();if(i)try{i()}catch(c){je.error("Error initializing extension:",c)}}var l=Math.round(performance.now()-n);this.register_for_session({[z_]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[O_]:l}),this.config.__preview_deferred_init_extensions&&je.info("PostHog extensions initialized ("+l+"ms)")}ki(t){var n;if(!Ne||!Ne.body)return je.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ki(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Zn=t),this.Jn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,ni.GZipJS)?ni.GZipJS:Ie(t.supportedCompression,ni.Base64)?ni.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Dn?this.Dn:Jm}),this.Rn.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}Gn(){try{this.config.loaded(this)}catch(i){je.critical("`loaded` function failed",i)}if(this.Kn(),this.config.internal_or_test_user_hostname&&Tn!=null&&Tn.hostname){var t=Tn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.On())&&this.Yn()}),1),this.Xn=new sw(this),this.Xn.load()}Kn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Un)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Xu(this.__request_queue,(t=>this.zn(t))),this.__request_queue=[],this.Kn()}_handle_unload(){var t,n,i,l;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.es()&&this.capture(jp),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.Un)==null||i.unload(),(l=this.Vn)==null||l.unload()):this.es()&&this.capture(jp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?gw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.skipIPParam||(t.url=Kd(t.url,{ip:this.config.ip?1:0})),t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var i,l,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=Xb(u.url,u.compression);var f=(i=u.transport)!==null&&i!==void 0?i:"fetch",h=vd.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(l=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&l!==void 0?l:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===ni.GZipJS&&BN&&!xd?y3(u).then((g=>{p(g)})).catch((g=>{if(kb(g))return xd=!0,void p(ye({},u,{compression:void 0,url:Xb(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return kb(v)||y===J5})(g)&&(xd=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var i,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(l=this.config).on_request_error)==null||i.call(l,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}zn(t){this.Vn?this.Vn.retriableRequest(t):this._send_request(t)}_execute_array(t){Op++;try{var n,i=[],l=[],c=[];Xu(t,(f=>{if(f)if(Ke(n=f[0]))c.push(f);else if(Ui(f))try{f.call(this)}catch(h){je.error("Error executing queued PostHog call",f,h)}else Ke(f)&&n==="alias"?i.push(f):Ke(f)&&n.indexOf("capture")!==-1&&Ui(this[n])?c.push(f):l.push(f)}));var u=function(f,h){Xu(f,(function(p){try{if(Ke(p[0])){var g=h;Rt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){je.error("Error executing queued PostHog call",p,v)}}))};u(i,this),u(l,this),u(c,this)}finally{Op--}}push(t){if(Op>0&&Ke(t)&&zt(t[0])){var n=Er.prototype[t[0]];Ui(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var l,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Un){if(this.is_capturing())if(!Se(t)&&zt(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!zt(n==null?void 0:n.$current_url)&&(je.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.ts||je.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,y=(i==null?void 0:i.timestamp)||v,b=(i==null?void 0:i.uuid)||Cs(),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===pl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),i!=null&&i.$set&&(_.$set=i==null?void 0:i.$set);var k=i==null?void 0:i.$unset;k&&(_.$unset=k);var E,j,T,N=this.rs(i==null?void 0:i.$set_once,t!==Mb,t===Np);if(N&&(_.$set_once=N),i!=null&&i._noTruncate||(c=this.config.properties_string_max_length,u=_,f=O=>zt(O)?O.slice(0,c):O,h=new Set,_=(function O(F,A){return F!==Object(F)?f?f(F):F:h.has(F)?void 0:(h.add(F),Ke(F)?(ae=[],Xu(F,(X=>{ae.push(O(X))}))):(ae={},Rt(F,((X,I)=>{h.has(X)||(ae[I]=O(X))}))),ae);var ae})(u)),_.timestamp=y,Se(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===qi.DISMISSED||t===qi.SENT){var D=n==null?void 0:n[Rp.SURVEY_ID],z=n==null?void 0:n[Rp.SURVEY_ITERATION];(O=>{try{var F=(A=>((ae,X)=>{var I=""+sg+X.id;return X.current_iteration&&X.current_iteration>0&&(I=""+sg+X.id+"_"+X.current_iteration),I})(0,A))(O);if(localStorage.getItem(F))return;localStorage.setItem(F,"true")}catch(A){Et.error("Failed to persist survey seen state",A)}})({id:D,current_iteration:z}),_.$set=ye({},_.$set,{[(E={id:D,current_iteration:z},j=t===qi.SENT?"responded":"dismissed",T="$survey_"+j+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(T="$survey_"+j+"/"+E.id+"/"+E.current_iteration),T)]:!0})}else t===qi.SHOWN&&(_.$set=ye({},_.$set,{[Rp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===d3.SHOWN){var L=n==null?void 0:n[Ib.TOUR_TYPE];L&&(_.$set=ye({},_.$set,{[Ib.TOUR_LAST_SEEN_DATE+"/"+L]:new Date().toISOString()}))}var H=ye({},_.properties.$set,_.$set);if(Es(H)||this.setPersonPropertiesForFlags(H),!et(this.config.before_send)){var U=this.gr(_);if(!U)return;_=U}this.An.emit("eventCaptured",_);var V={method:"POST",url:(l=i==null?void 0:i._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.zn(V):this.Un.enqueue(V),_}je.critical("This capture call is ignored due to client rate limiting.")}}else je.error("No event name provided to posthog.capture")}else je.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,l,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.On()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!zt(f.distinct_id)&&!Fn(f.distinct_id)||Nm(f.distinct_id))&&je.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(j,T,N){var D,z,L,H;if(!Jn)return{};var U,V,O,F,A,ae,X,I,$,P=j?[...jl,...T||[]]:[],[ie,me]=(function(M){for(var pe=0;Cb.length>pe;pe++){var[_e,Ce]=Cb[pe],Te=_e.exec(M),Le=Te&&(Ui(Ce)?Ce(Te,M):Ce);if(Le)return Le}return["",""]})(Jn),R=(U=typeof navigator<"u"?navigator:void 0)!=null&&U.brave?{brave:!0}:{},B={detectGoogleSearchApp:N},Z=Pt(Dg({$os:ie,$os_version:me,$browser:b_(Jn,navigator.vendor,R,B),$device:Eb(Jn),$device_type:(O=Jn,F={userAgentDataPlatform:(D=navigator)==null||(D=D.userAgentData)==null?void 0:D.platform,maxTouchPoints:(z=navigator)==null?void 0:z.maxTouchPoints,screenWidth:re==null||(L=re.screen)==null?void 0:L.width,screenHeight:re==null||(H=re.screen)==null?void 0:H.height,devicePixelRatio:re==null?void 0:re.devicePixelRatio},$=Eb(O),$===t_||$===e_||$==="Kobo"||$==="Kindle Fire"||$===p_?wl:$===uc||$===yl||$===dc||$===Em?"Console":$===r_?"Wearable":$?dr:(F==null?void 0:F.userAgentDataPlatform)==="Android"&&((A=F==null?void 0:F.maxTouchPoints)!==null&&A!==void 0?A:0)>0?600>Math.min((ae=F==null?void 0:F.screenWidth)!==null&&ae!==void 0?ae:0,(X=F==null?void 0:F.screenHeight)!==null&&X!==void 0?X:0)/((I=F==null?void 0:F.devicePixelRatio)!==null&&I!==void 0?I:1)?dr:wl:"Desktop"),$timezone:iw(),$timezone_offset:l3()}),{$current_url:mc(Tn==null?void 0:Tn.href,P,gc),$host:Tn==null?void 0:Tn.host,$pathname:Tn==null?void 0:Tn.pathname,$raw_user_agent:Jn.length>1e3?Jn.substring(0,997)+"...":Jn,$browser_version:sC(Jn,navigator.vendor,R,B),$browser_language:Hb(),$browser_language_prefix:(V=Hb(),typeof V=="string"?V.split("-")[0]:void 0),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:Xt.LIB_NAME,$lib_version:Xt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Xt.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=Xt.SDK_DIST_CHANNEL),Z})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Pt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Pt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Vn)==null?void 0:b.length}catch(j){f.$sdk_debug_error_capturing_properties=String(j)}if(this.requestRouter.region===ig&&(f.$lib_custom_api_host=this.config.api_host),p=t!==pl||c?t!==jp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,l),f=Pt(f,p),t===pl&&Ne&&(f.title=Ne.title),!Se(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Jn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Pt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),Ke(this.config.property_denylist)?Rt(this.config.property_denylist,(function(j){delete f[j]})):je.error(mw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(je.error(ry),f=k(f,t));var E=this.ns();return f.$process_person_profile=E,E&&!c&&this.ss("_calculate_event_properties"),f}rs(t,n,i){var l;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.ns()||this.Ln&&!i)return t;var c=this.persistence.get_initial_props(),u=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),f=Pt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(je.error(ry),f=h(f,"$set_once")),n&&(this.Ln=!0),Es(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var l;(l=this.persistence)==null||l.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}os(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var i;return(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.An.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:zo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:zo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:zo})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=T3),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:zo}}canRenderSurveyAsync(t,n){var i,l;return n===void 0&&(n=!1),(i=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:zo})}ls(t){return!t||Nm(t)?(je.critical("Unique user id has not been set in posthog.identify"),!1):t===Ju?(je.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(je.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return je.uninitializedWarning("posthog.identify");if(Fn(t)&&(t=t.toString(),je.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ls(t)&&this.ss("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Rd)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Io)&&(this.unregister(Io),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(Pr)||il)===il;t!==l&&u?(this.persistence.set_property(Pr,sl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Np,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:i||{}}),this.$n=ey(t,n,i),(c=this.featureFlags)==null||c.setAnonymousDistinctId(l)):(n||i)&&this.setPersonProperties(n,i),t!==l&&(this.reloadFeatureFlags(),this.unregister(Ko))}}setPersonProperties(t,n){if((t||n)&&this.ss("posthog.setPersonProperties")){var i=ey(this.get_distinct_id(),t,n);this.$n!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.$n=i):je.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ke(t)?t:[t]).filter((l=>zt(l)&&l.length>0));i.length!==0&&this.ss("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.$n=null)}group(t,n,i){if(t&&n){var l=this.getGroups(),c=l[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},l,{[t]:n})}),c||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(Mb,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),c&&!i&&this.reloadFeatureFlags()}else je.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.ss("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,i,l,c,u,f,h,p,g;if(je.info("reset"),!this.__loaded)return je.uninitializedWarning("posthog.reset");var v,y=this.get_property(Rd),b=this.get_property(fa);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),Se(b)||(v=this.persistence)==null||v.register({[fa]:b}),(l=this.surveys)==null||l.reset(),(c=this.Xn)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.persistence)==null||p.set_property(Pr,il),(g=this.sessionManager)==null||g.resetSessionId(),this.$n=null,this.config.cookieless_mode===Fi)this.register_once({distinct_id:Ju,$device_id:null},"");else{var _=this.config.get_device_id(Cs());this.register_once({distinct_id:_,$device_id:t?_:y},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.us()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.hs()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&i){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!i)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return l}alias(t,n){return t===this.get_property(E_)?(je.critical("Attempting to create alias for existing People user - aborting."),-2):this.ss("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.os(Io,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(je.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if(Qt(t)){var i,l,c,u,f,h,p,g,v,y,b;Pt(this.config,sy(t));var _=this.Hn();(i=this.persistence)==null||i.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ap(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var k=this.qn(this.config.debug);si(k)&&(this.config.debug=k),si(this.config.debug)&&(this.config.debug?(Xt.DEBUG=!0,Mt.O()&&Mt.N("ph_debug",!0),je.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Xt.DEBUG=!1,Mt.O()&&Mt.q("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.cs(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Xt.LIB_NAME=t,Xt.LIB_VERSION=n}startSessionRecording(t){var n,i,l,c,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var i=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(ye({},l,n))}}addExceptionStep(t,n){var i;(i=this.exceptions)==null||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:Er.ds}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:ml;return n!==ml&&(n=ml+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Pr))===sl||((n=this.sessionPersistence)==null?void 0:n.get_property(Pr))===sl}ns(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Jm&&!this._isIdentified()&&Es(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Io])&&((n=this.persistence)==null||(n=n.props)==null||!n[Dd]))}es(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.ns()||this.ss("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ss("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ss(t){return this.config.person_profiles==="never"?(je.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.os(Dd,!0),!0)}Hn(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ua)}cs(){var t,n,i,l,c=this.Hn();return((t=this.persistence)==null?void 0:t.ei)!==c&&((i=this.persistence)==null||i.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.ei)!==c&&((l=this.sessionPersistence)==null||l.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Fi){if(this.On()){var i,l,c,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new Kb(this),this.pageViewManager=new qb(this),this.persistence&&(this.sessionPropsManager=new Zb(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=Er.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.Pn(this.sessionRecording,new p(this)),this.Jn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.Jn)))}var g,v;this.consent.optInOut(!0),this.cs(),this.Kn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==ua&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Yn()}else je.warn(ny)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==Fi?(this.config.cookieless_mode===ua&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cs(),this.config.cookieless_mode===ua&&(this.register({distinct_id:Ju,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Yn(),this.Kn())):je.warn(ny)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Fi||(this.config.cookieless_mode===ua?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cs()}_is_bot(){return cr?fw(cr,this.config.custom_blocked_useragents):void 0}Yn(){Ne&&(Ne.visibilityState==="visible"?this.Fn||(this.Fn=!0,this.capture(pl,{title:Ne.title},{send_instantly:!0}),this.Nn&&(Ne.removeEventListener(zd,this.Nn),this.Nn=null)):this.Nn||(this.Nn=this.Yn.bind(this),Yt(Ne,zd,this.Nn)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ci(){var t,n,i,l,c,u,f=this.jn||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(je.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",l=je,c=(n="advanced_disable_flags")in(t=f)&&!et(t[n]),u=i in t&&!et(t[i]),c?t[n]:!!u&&(l&&l.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[i]))}gr(t){var n;if(et(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(YN),l=Ke(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var u of l){if(c=u(c),et(c)){var f="Event '"+t.event+"' was rejected in beforeSend function";return GN(t.event)?je.warn(f+". This can cause unexpected behavior."):je.info(f),null}c.properties&&!Es(c.properties)||je.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(c.properties&&et(c.properties[h]))return je.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.Br)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}qn(t){var n=si(t)&&!t,i=Mt.O()&&Mt.A("ph_debug")==="true";return!n&&(!!i||t)}}Er.__defaultExtensionClasses={},Er.ds={trace:ol=()=>{},debug:ol,info:ol,warn:ol,error:ol,fatal:ol},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=LC(e.prototype[t[n]])})(Er,["identify"]);class ay{constructor(t){this.disabled=t===!1;var n=Qt(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,i){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>i-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var Bp="$copy_autocapture",Pp=It("[AutoCapture]");function $p(e,t){return t.length>e?t.slice(0,e)+"...":t}function z3(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ms(t));return t}function O3(e,t){var n,i,{e:l,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h}=t;if(!Ms(e))return{props:{}};for(var p=[e],g=e;g.parentNode&&!ur(g,"body");)if(F_(g.parentNode))p.push(g.parentNode.host),g=g.parentNode.host;else{if(!Ms(g.parentNode))break;p.push(g.parentNode),g=g.parentNode}var v,y,b=[],_={},k=!1,E=!1;if(Rt(p,(z=>{var L=Zm(z);if(ur(z,"a")){var H=z.getAttribute("href");k=L&&!!H&&ec(H)&&H}Ie(Pd(z),"ph-no-capture")&&(E=!0),b.push((function(V,O,F,A){var ae=V.tagName.toLowerCase(),X={tag_name:ae};Og.indexOf(ae)>-1&&!F&&(X.$el_text=ae.toLowerCase()==="a"||ae.toLowerCase()==="button"?$p(1024,$b(V)):$p(1024,hc(V)));var I=Pd(V);I.length>0&&(X.classes=I.filter((function(me){return me!==""}))),Rt(V.attributes,(function(me){var R;if((!G_(V)||["name","id","class","aria-label"].indexOf(me.name)!==-1)&&(A==null||!A.includes(me.name))&&!O&&ec(me.value)&&(!zt(R=me.name)||R.substring(0,10)!=="_ngcontent"&&R.substring(0,7)!=="_nghost")){var B=me.value;me.name==="class"&&(B=zg(B).join(" ")),X["attr__"+me.name]=$p(1024,B)}}));for(var $=1,P=1,ie=V;ie=z3(ie);)$++,ie.tagName===V.tagName&&P++;return X.nth_child=$,X.nth_of_type=P,X})(z,c,u,f));var U=(function(V){if(!Zm(V))return{};var O={};return Rt(V.attributes,(function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var A=F.name.replace("data-ph-capture-attribute-",""),ae=F.value;A&&ae&&ec(ae)&&(O[A]=ae)}})),O})(z);Pt(_,U)})),E)return{props:{},explicitNoCapture:E};if(u||(b[0].$el_text=ur(e,"a")||ur(e,"button")?$b(e):hc(e)),k){var j,T;b[0].attr__href=k;var N=(j=$d(k))==null?void 0:j.host,D=re==null||(T=re.location)==null?void 0:T.host;N&&D&&N!==D&&(v=k)}return{props:Pt({$event_type:l.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(y=b,(function(z){return z.map((L=>{var H,U,V="";if(L.tag_name&&(V+=L.tag_name),L.attr_class)for(var O of(L.attr_class.sort(),L.attr_class))V+="."+O.replace(/"/g,"");var F=ye({},L.text?{text:L.text}:{},{"nth-child":(H=L.nth_child)!==null&&H!==void 0?H:0,"nth-of-type":(U=L.nth_of_type)!==null&&U!==void 0?U:0},L.href?{href:L.href}:{},L.attr_id?{attr_id:L.attr_id}:{},L.attributes),A={};return gd(F).sort(((ae,X)=>{var[I]=ae,[$]=X;return I.localeCompare($)})).forEach((ae=>{var[X,I]=ae;return A[Ub(X.toString())]=Ub(I.toString())})),(V+=":")+gd(A).map((ae=>{var[X,I]=ae;return X+'="'+I+'"'})).join("")})).join(";")})((function(z){return z.map((L=>{var H,U,V={text:(H=L.$el_text)==null?void 0:H.slice(0,400),tag_name:L.tag_name,href:(U=L.attr__href)==null?void 0:U.slice(0,2048),attr_class:KC(L),attr_id:L.attr__id,nth_child:L.nth_child,nth_of_type:L.nth_of_type,attributes:{}};return gd(L).filter((O=>{var[F]=O;return F.indexOf("attr__")===0})).forEach((O=>{var[F,A]=O;return V.attributes[F]=A})),V}))})(y)))},(n=b[0])!=null&&n.$el_text?{$el_text:(i=b[0])==null?void 0:i.$el_text}:{},v&&l.type==="click"?{$external_click_url:v}:{},_)}}var Oo=It("[ExceptionAutocapture]"),B3=It("[TracingHeaders]"),ra=It("[Web Vitals]"),ly=9e5,oy="disabled",cy="lazy_loading",Bo="awaiting_config",rd="missing_config";It("[SessionRecording]"),It("[SessionRecording]");var lg="[SessionRecording]",Li=It(lg),P3=It("[Heatmaps]");function uy(e){return Qt(e)&&"clientX"in e&&"clientY"in e&&Fn(e.clientX)&&Fn(e.clientY)}var Up=It("[Product Tours]"),Fp=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Mg))},$3=["$set_once","$set"],Kr=It("[SiteApps]"),dy="Error while initializing PostHog app with config id ";function cl(e,t,n){if(et(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class U3{constructor(t){this.vs=new Ug,this.fs=(n,i)=>this.ps(n,i)&&this.gs(n,i)&&this.ys(n,i)&&this.bs(n,i),this.ps=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this._s=new Set,this.ws=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,l)=>{this.on(i,l)}))}register(t){var n,i;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.ws)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this._s)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var l,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(c)}}on(t,n){var i;n!=null&&t.length!=0&&(this._s.has(t)||this._s.has(n==null?void 0:n.event))&&this.ws&&((i=this.ws)==null?void 0:i.size)>0&&this.ws.forEach((l=>{this.xs(n,l)&&this.vs.emit("actionCaptured",l.name)}))}ks(t){this.onAction("actionCaptured",(n=>t(n)))}xs(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.fs(t,i))return!0;return!1}onAction(t,n){return this.vs.on(t,n)}gs(t,n){if(n!=null&&n.url){var i,l=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!l||typeof l!="string"||!cl(l,n.url,n.url_matching||"contains"))return!1}return!0}ys(t,n){return!!this.Ss(t,n)&&!!this.Cs(t,n)&&!!this.Is(t,n)}Ss(t,n){var i;if(n==null||!n.href)return!0;var l=this.Ts(t);if(l.length>0)return l.some((f=>cl(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&cl((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Cs(t,n){var i;if(n==null||!n.text)return!0;var l=this.Ts(t);if(l.length>0)return l.some((p=>cl(p.text,n.text,n.text_matching||"exact")||cl(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!et(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>cl(p,u,f))))}Is(t,n){var i,l;if(n==null||!n.selector)return!0;var c=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}Ts(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}bs(t,n){return n==null||!n.properties||n.properties.length===0||pw(n.properties.reduce(((i,l)=>{var c=Ke(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return i[l.key]={values:c,operator:l.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class F3{constructor(t){this.Es=[],this._instance=t,this.Ms=new Map,this.Ps=new Map,this.Rs=new Map}Os(t,n){return!!t&&pw(t.propertyFilters,n==null?void 0:n.properties)}Ls(t,n){var i=new Map;return t.forEach((l=>{var c;(c=l.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(l.id),i.set(u.name,f)}}))})),i}As(t,n,i){var l=(i===Ao.Activation?this.Ms:this.Ps).get(t),c=[];return this.Fs((u=>{c=u.filter((f=>l==null?void 0:l.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Os(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Ns(t),this.Ds(t))}Ds(t){var n=t.filter((i=>{var l,c;return((l=i.conditions)==null?void 0:l.actions)&&((c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.$s==null&&(this.$s=new U3(this._instance),this.$s.init(),this.$s.ks((i=>{this.onAction(i)}))),n.forEach((i=>{var l,c,u,f,h;i.conditions&&(l=i.conditions)!=null&&l.actions&&(c=i.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.$s)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.Rs.get(p.name);g&&g.push(i.id),this.Rs.set(p.name,g||[i.id])}})))})))}Ns(t){var n,i=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),l=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.Ms=this.Ls(t,Ao.Activation),this.Ps=this.Ls(t,Ao.Cancellation))}onEvent(t,n){var i,l,c=this.le(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.qs(t,u);if(f==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.js([u]);if(f==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.Bs(u)}if(this.Ps.has(t)){var h=this.As(t,n,Ao.Cancellation);h.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.js(h.map((g=>g.id))),h.forEach((g=>this.Hs(g.id))))}if(this.Ms.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.Ms.get(t)});var p=this.As(t,n,Ao.Activation);this.Us(p.map((g=>g.id)))}}onAction(t){this.Rs.has(t)&&this.Us(this.Rs.get(t)||[])}Us(t){t.length!==0&&(this.Es=[...new Set([...this.Es,...t])],this.le().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Bs(t){this.Es=this.Es.filter((i=>i!==t));var n=this.zs();n.includes(t)||this.Vs([...n,t])}js(t){var n=new Set(t);this.Es=this.Es.filter((c=>!n.has(c)));var i=this.zs(),l=i.filter((c=>!n.has(c)));l.length!==i.length&&this.Vs(l)}zs(){var t,n=this.Ws();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getActivatedIds(){return[...new Set([...this.zs(),...this.Es])].filter((t=>!this.Gs(t)))}reset(){this.Es=[],this.zs().length>0&&this.Vs([])}getEventToItemsMap(){return this.Ms}Zs(){return this.$s}}class q3 extends F3{constructor(t){super(t)}Ws(){return qm}Qs(){return qi.SHOWN}Fs(t){var n;(n=this._instance)==null||n.getSurveys(t)}Hs(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}le(){return Et}Vs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[qm]:t})}Gs(){return!1}qs(t,n){var i;this.Fs((c=>{i=c.find((u=>u.id===n))}));var l=!i||(function(c){var u,f,h,p=((u=(f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)!==null&&u!==void 0?u:0)>0;return c.schedule===u3.Always||!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation||!p)})(i);return l?t===qi.SHOWN?"consume":"ignore":t===qi.SHOWN?"persist":t===qi.DISMISSED||t===qi.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var qp="SDK is not enabled or survey functionality is not yet loaded",fy="Disabled. Not loading surveys.",H3=re!=null&&re.location?Ud(re.location.hash,"__posthog")||Ud(location.hash,"state"):null,hy="_postHogToolbarParams",py=It("[Toolbar]"),En=It("[FeatureFlags]"),ia=It("[FeatureFlags]",{debugEnabled:!0}),Hp=`" failed. Feature flags didn't load in time.`,my=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},gy=e=>{var t={};for(var[n,i]of gd(e||{}))i&&(t[n]=i);return t},Di=It("[Error tracking]"),xy="Refusing to render web experiment since the viewer is a likely bot",I3={icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!re&&Hd(t.href,e),not_regex:(e,t)=>!!re&&!Hd(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Dn{get qt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((l=>{Dn.Js("retrieved web experiments from the server"),n.Ks=new Map,l.forEach((c=>{if(c.feature_flag_key){var u;n.Ks&&(Dn.Js("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.Ks)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);zt(f)&&c.variants[f]&&n.Ys(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Dn.Xs(p)&&n.Ys(c.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Dn.Js(xy);else if(!this.qt.disable_web_experiments){if(et(this.Ks))return this.Ks=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Dn.Js("applying feature flags",t),t.forEach((n=>{var i;if(this.Ks&&(i=this.Ks)!=null&&i.has(n)){var l,c=this._instance.getFeatureFlag(n),u=(l=this.Ks)==null?void 0:l.get(n);c&&u!=null&&u.variants[c]&&this.Ys(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Dn.getWindowLocation();if(t!=null&&t.search){var n=pc(t==null?void 0:t.search,"__experiment_id"),i=pc(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Dn.Js("previewing web experiments "+n+" && "+i),this.getWebExperiments((l=>{this.eo(parseInt(n),i,l)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.qt.disable_web_experiments&&!i)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}eo(t,n,i){var l=i.filter((c=>c.id===t));l&&l.length>0&&(Dn.Js("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.Ys(l[0].name,n,l[0].variants[n].transforms))}static Xs(t){return!et(t.conditions)&&Dn.ro(t)&&Dn.io(t)}static ro(t){var n;if(et(t.conditions)||et((n=t.conditions)==null?void 0:n.url))return!0;var i,l,c,u=Dn.getWindowLocation();return!!u&&((i=t.conditions)==null||!i.url||I3[(l=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](t.conditions.url,u))}static getWindowLocation(){return re==null?void 0:re.location}static io(t){var n;if(et(t.conditions)||et((n=t.conditions)==null?void 0:n.utm))return!0;var i=Z_();if(i.utm_source){var l,c,u,f,h,p,g,v,y=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==i.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==i.utm_medium,k=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==i.utm_term;return y&&_&&k&&b}return!1}static Js(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),l=1;n>l;l++)i[l-1]=arguments[l];je.info("[WebExperiments] "+t,i)}Ys(t,n,i){this._is_bot()?Dn.Js(xy):n!=="control"?i.forEach((l=>{if(l.selector){var c;Dn.Js("applying transform of variant "+n+" for experiment "+t+" ",l);var u=(c=document)==null?void 0:c.querySelectorAll(l.selector);u==null||u.forEach((f=>{var h=f;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):Dn.Js("Control variants leave the page unmodified.")}_is_bot(){return cr&&this._instance?fw(cr,this.qt.custom_blocked_useragents):void 0}}var kr=It("[Conversations]"),sa="Conversations not available yet.",ef={featureFlags:class{constructor(e){this.no=!1,this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.co=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get Ji(){return this._instance.persistence}do(e){return this._instance.get_property(e)}vo(){var e,t;return(e=(t=this.Ji)==null?void 0:t.ri(this.qt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}fo(){return!!this.vo()&&(this.co||this.oo||(this.co=!0,En.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}po(){var e,t=(e=this.qt.evaluation_contexts)!==null&&e!==void 0?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ho||(En.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ho=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||En.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}mo(){return this.po().length>0}yo(){var e=this.qt.flag_keys;if(!Se(e)){if(Ke(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||En.error("Invalid flag key found:",t,"Expected non-empty string"),n}));En.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var l,c,u=(l=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&l!==void 0?l:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,g)=>(p[g]=i[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i,l,c=n!=null&&n.merge&&(i=this.do(da))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(l=this.do(md))!==null&&l!==void 0?l:{},f=ye({},c,e),h=ye({},u,t),p={};for(var[g,v]of Object.entries(f))p[g]={key:g,enabled:$N(v),variant:UN(v),reason:void 0,metadata:Se(h==null?void 0:h[g])?void 0:{id:0,version:void 0,description:void 0,payload:h[g]}};this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.so}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.do($m),t=this.do(Pi),n=this.do(hl);if(!n&&!t)return e||{};var i=Pt({},e||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of l){var u,f,h=i[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[c]=b}return this.no||(En.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.no=!0),i}getFlagVariants(){var e=this.do(da),t=this.do(Pi);if(!t)return e||{};for(var n=Pt({},e),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.no||(En.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.no=!0),n}getFlagPayloads(){var e=this.do(md),t=this.do(hl);if(!t)return e||{};for(var n=Pt({},e||{}),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.no||(En.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.no=!0),n}reloadFeatureFlags(){this.ao||this.qt.advanced_disable_feature_flags||this.bo||(this._instance.An.emit("featureFlagsReloading",!0),this.bo=setTimeout((()=>{this._o()}),5))}wo(){clearTimeout(this.bo),this.bo=void 0}ensureFlagsLoaded(){this.so||this.oo||this.bo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ao=e}_o(e){var t;if(this.wo(),!this._instance.Ci())if(this.oo)this.lo=!0;else{var n=this.qt.token,i=this.do(Rd),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.Ji)==null?void 0:t.get_initial_props())||{},this.do(oa)||{}),group_properties:this.do(ca),timezone:iw()};Un(i)||Se(i)||(l.$device_id=i),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.mo()&&(l.evaluation_contexts=this.po());var c=this.yo();Se(c)||(l.flag_keys=c);var u=!!this.qt.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.oo=!0,this._instance._send_request({method:"POST",url:f,data:l,skipIPParam:!0,compression:this.qt.disable_compression?void 0:ni.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.lo||(this.$anon_distinct_id=void 0),y=!1),this.oo=!1,!l.disable_flags||this.lo){this.uo=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,k=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));k&&b.push("quota_limited"),(v=this.Ji)==null||v.register({[Im]:b}),k?En.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(l.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.lo&&(this.lo=!1,this._o()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.uo)if(this.so||this.getFlags()&&this.getFlags().length>0){if(!this.fo()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else En.warn('getFeatureFlag for key "'+e+Hp)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.uo)if(this.so||this.getFlags()&&this.getFlags().length>0){if(!this.fo()){var n=this.getFlagVariants(),i=e in n,l=n[e],c=this.getFlagPayloads()[e],u=String(l),f=this.do(Um)||void 0,h=this.do(fc)||void 0,p=this.do(Ko)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.do(Hm);v&&v!==y&&(p={},(g=this.Ji)==null||g.register({[Ko]:p,[Hm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,k,E,j,T,N,D,z,L;Ke(p[e])?p[e].push(u):p[e]=[u],(b=this.Ji)==null||b.register({[Ko]:p});var H=this.getFeatureFlagDetails(e),U=[...(_=this.do(Im))!==null&&_!==void 0?_:[]];Se(l)&&U.push("flag_missing");var V={$feature_flag:e,$feature_flag_response:l,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((k=this.qt.bootstrap)==null||(k=k.featureFlags)==null?void 0:k[e])||null,$feature_flag_bootstrapped_payload:((E=this.qt.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.uo};Se(H==null||(j=H.metadata)==null?void 0:j.version)||(V.$feature_flag_version=H.metadata.version);var O,F=(T=H==null||(N=H.reason)==null?void 0:N.description)!==null&&T!==void 0?T:H==null||(D=H.reason)==null?void 0:D.code;F&&(V.$feature_flag_reason=F),H!=null&&(z=H.metadata)!=null&&z.id&&(V.$feature_flag_id=H.metadata.id),Se(H==null?void 0:H.original_variant)&&Se(H==null?void 0:H.original_enabled)||(V.$feature_flag_original_response=Se(H.original_variant)?H.original_enabled:H.original_variant),H!=null&&(L=H.metadata)!=null&&L.original_payload&&(V.$feature_flag_original_payload=H==null||(O=H.metadata)==null?void 0:O.original_payload),U.length&&(V.$feature_flag_error=U.join(",")),this._instance.capture("$feature_flag_called",V)}if(i)return{key:e,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:PN(c)}}}else En.warn('getFeatureFlagResult for key "'+e+Hp)}getRemoteConfigPayload(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.mo()&&(i.evaluation_contexts=this.po());var l=this.yo();Se(l)||(i.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,skipIPParam:!0,compression:this.qt.disable_compression?void 0:ni.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.uo){if(this.so||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}En.warn('isFeatureEnabled for key "'+e+Hp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Ji){this.so=!0;var i=this.getFlagVariants(),l=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(U=>{var V=U.flags;return V?(U.featureFlags=Object.fromEntries(Object.keys(V).map((O=>{var F;return[O,(F=V[O].variant)!==null&&F!==void 0?F:V[O].enabled]}))),U.featureFlagPayloads=Object.fromEntries(Object.keys(V).filter((O=>V[O].enabled)).filter((O=>{var F;return(F=V[O].metadata)==null?void 0:F.payload})).map((O=>{var F;return[O,(F=V[O].metadata)==null?void 0:F.payload]})))):En.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),U})(u),b=y.flags,_=y.featureFlags,k=y.featureFlagPayloads;if(_){var E=u.requestId,j=u.evaluatedAt;if(Ke(_)){En.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var T={};if(_)for(var N=0;_.length>N;N++)T[_[N]]=!0;f&&f.register({[pd]:_,[da]:T})}else{var D=_,z=k,L=b;if(v!=null&&v.partialResponse)D=ye({},h,D),z=ye({},p,z),L=ye({},g,L);else if(u.errorsWhileComputingFlags)if(b){var H=new Set(Object.keys(b).filter((U=>{var V;return!((V=b[U])!=null&&V.failed)})));D=ye({},h,Object.fromEntries(Object.entries(D).filter((U=>{var[V]=U;return H.has(V)})))),z=ye({},p,Object.fromEntries(Object.entries(z||{}).filter((U=>{var[V]=U;return H.has(V)})))),L=ye({},g,Object.fromEntries(Object.entries(L||{}).filter((U=>{var[V]=U;return H.has(V)}))))}else D=ye({},h,D),z=ye({},p,z),L=ye({},g,L);f&&f.register(ye({[pd]:Object.keys(gy(D)),[da]:D||{},[md]:z||{},[$m]:L||{}},E?{[Um]:E}:{},j?{[fc]:j}:{}))}}})(e,this.Ji,i,l,c,n),t||(this.co=!1),this.xo(t)}}override(e,t){t===void 0&&(t=!1),En.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Ji)return En.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.Ji.unregister(Pi),this.Ji.unregister(hl),this.xo(),ia.info("All overrides cleared");if(Ke(e)){var t=my(e);return this.Ji.register({[Pi]:t}),this.xo(),ia.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.no=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.Ji.unregister(Pi),ia.info("Flag overrides cleared");else if(i.flags){if(Ke(i.flags)){var l=my(i.flags);this.Ji.register({[Pi]:l})}else this.Ji.register({[Pi]:i.flags});ia.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.Ji.unregister(hl),ia.info("Payload overrides cleared")):i.payloads&&(this.Ji.register({[hl]:i.payloads}),ia.info("Payload overrides set",{payloads:i.payloads}))),void this.xo()}if(e&&typeof e=="object")return this.Ji.register({[Pi]:e}),this.xo(),ia.info("Flag overrides set",{flags:e});En.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.so){var{flags:t,flagVariants:n}=this.ko();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,l=(this.do(Go)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};l&&(u.$early_access_feature_name=l.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(i=this.Ji)==null||i.register({[pd]:Object.keys(gy(f)),[da]:f}),this.xo()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.do(Go),l=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+l),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.Ji)==null||u.unregister(Go),(f=this.Ji)==null||f.register({[Go]:h}),e(h)}}})}ko(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}xo(e){var{flags:t,flagVariants:n}=this.ko();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.do(oa)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),l=e==null?void 0:e.$set_once,c={};if(l)for(var u in l)({}).hasOwnProperty.call(l,u)&&(u in n||(c[u]=l[u]));this._instance.register({[oa]:ye({},n,c,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ye({},this.do(oa)||{});e.forEach((i=>{delete n[i]})),this._instance.register({[oa]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(oa),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.do(ca)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=ye({},n[i],e[i]),delete e[i]})),this._instance.register({[ca]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.do(ca)||{};this._instance.register({[ca]:ye({},t,{[e]:{}})})}else this._instance.unregister(ca)}reset(){this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.$anon_distinct_id=void 0,this.wo(),this.no=!1}}},V3={sessionRecording:class{get qt(){return this._instance.config}get Ji(){return this._instance.persistence}get started(){var e;return!((e=this.So)==null||!e.isStarted)}get status(){var e,t;return this.Co===Bo||this.Co===rd?this.Co:(e=(t=this.So)==null?void 0:t.status)!==null&&e!==void 0?e:this.Co}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Co=oy,this.Io=void 0,this._instance=e,!this._instance.sessionManager)throw Li.error("started without valid sessionManager"),new Error(lg+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Fi)throw new Error(lg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get To(){var e,t=!((e=this._instance.get_property(fa))==null||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.To||(t=this.So)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this.To&&n?(this.Eo(e),Li.info("starting")):(this.Co=oy,this.stopRecording())}}Eo(e){var t,n,i;this.To&&(this.Co!==Bo&&this.Co!==rd&&(this.Co=cy),De!=null&&(t=De.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=De.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Mo(e):(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Po,(l=>{if(l)return Li.error("could not load recorder",l);this.Mo(e)})))}stopRecording(){var e,t;(e=this.Io)==null||e.call(this),this.Io=void 0,(t=this.So)==null||t.stop()}Ro(){var e,t;(e=this.Io)==null||e.call(this),this.Io=void 0,(t=this.So)==null||t.discard()}Oo(){var e,t;(e=this.Ji)==null||e.unregister(Rg),(t=this.Ji)==null||t.unregister(T_)}Lo(e,t){if(et(e))return null;var n,i=Fn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Li.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Ao(e){if(this.Ji){var t,n,i=this.Ji,l=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Lo((c=this.qt.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Lo(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;et(p)&&this.Oo();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[fa]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:Se(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};l(),(t=this.Io)==null||t.call(this),this.Io=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Ao(e),void this.Ro()):(this.Ao(e),void this.startIfEnabledOrStop()):(this.Co===Bo&&(this.Co=rd,Li.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.So)!=null&&n.log?this.So.log(e,t):Li.warn("log called before recorder was ready")}get Po(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fa);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Fo(){var e,t,n=this._instance.get_property(fa);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return Li.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}Mo(e){var t,n;if((t=De.__PosthogExtensions__)==null||!t.initSessionRecording)return Li.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[B_]:!0});if(this.So||(this.So=(n=De.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.So._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Fo())return this.Co===rd||this.Co===Bo?void 0:(this.Co=Bo,Li.info("persisted remote config is stale, requesting fresh config before starting"),void new sw(this._instance).load());this.Co=cy,this.So.start(e)}onRRwebEmit(e){var t;(t=this.So)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.So||(t=this.Ji)==null||t.register({[M_]:!0}),(e=this.So)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.So||(t=this.Ji)==null||t.register({[A_]:!0}),(e=this.So)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.So||(n=this.Ji)==null||n.register({[e==="url"?R_:L_]:!0}),(t=this.So)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.So)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.So)==null||!n.tryAddCustomEvent(e,t))}}},G3={autocapture:class{constructor(e){this.No=!1,this.Do=null,this.$o=!1,this.instance=e,this.rageclicks=new ay(e.config.rageclick),this.qo=null}initialize(){this.startIfEnabled()}get qt(){var e,t,n=Qt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}jo(){if(this.isBrowserSupported()){if(re&&Ne){var e=n=>{n=n||(re==null?void 0:re.event);try{this.Bo(n)}catch(i){Pp.error("Failed to capture event",i)}};if(Yt(Ne,"submit",e,{capture:!0}),Yt(Ne,"change",e,{capture:!0}),Yt(Ne,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=n=>{n=n||(re==null?void 0:re.event);try{this.Bo(n,Bp)}catch(i){Pp.error("Failed to capture copy/cut event",i)}};Yt(Ne,"copy",t,{capture:!0}),Yt(Ne,"cut",t,{capture:!0})}}}else Pp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.No&&(this.jo(),this.No=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.$o=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Rm]:!!e.autocapture_opt_out}),this.Do=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.qo=e}getElementSelectors(e){var t,n=[];return(t=this.qo)==null||t.forEach((i=>{var l=Ne==null?void 0:Ne.querySelectorAll(i);l==null||l.forEach((c=>{e===c&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Rm];if(Un(this.Do)&&!si(n)&&!this.instance.Ci())return!1;var i=(t=this.Do)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!i}Bo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Ep(e);U_(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Pb(i,this.instance.config.rageclick)&&this.Bo(e,"$rageclick");var l=t===Bp;if(i&&(function(v,y,b,_,k){var E,j,T,N,D,z;if(b===void 0&&(b=void 0),!re||Bg(v)||(E=b)!=null&&E.url_allowlist&&!zb(b.url_allowlist)||(j=b)!=null&&j.url_ignorelist&&zb(b.url_ignorelist))return!1;if((T=b)!=null&&T.dom_event_allowlist){var L=b.dom_event_allowlist;if(L&&!L.some((F=>y.type===F)))return!1}var{parentIsUsefulElement:H,targetElementList:U}=V_(v,_);if(!(function(F,A){var ae=A==null?void 0:A.element_allowlist;if(Se(ae))return!0;var X,I=function(P){if(ae.some((ie=>P.tagName.toLowerCase()===ie)))return{v:!0}};for(var $ of F)if(X=I($))return X.v;return!1})(U,b)||!Xm(U,(N=b)==null?void 0:N.css_selector_allowlist)||Xm(U,(D=(z=b)==null?void 0:z.css_selector_ignorelist)!==null&&D!==void 0?D:GC))return!1;var V=re.getComputedStyle(v);if(V&&V.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var O=v.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(k||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(k||["change","click"]).indexOf(y.type)>=0;default:return H?(k||["click"]).indexOf(y.type)>=0:(k||["click"]).indexOf(y.type)>=0&&(Og.indexOf(O)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,this.qt,l,l?["copy","cut"]:void 0)){var{props:c,explicitNoCapture:u}=O3(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.$o});if(u)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(c.$element_selectors=f),t===Bp){var h,p=q_(re==null||(h=re.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return Ui(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ho=(re==null||(t=re.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(je.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Uo&&this.Uo(),this.Uo=void 0,je.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.zo("pushState"),this.zo("replaceState"),this.Vo())}zo(e){var t;if(re&&((t=re.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,l,c){try{if(!(l in i))return()=>{};var u=i[l],f=c(u);return Ui(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[l]=f,()=>{i[l]===f&&(i[l]=u)}}catch{return()=>{}}})(re.history,e,(i=>function(l,c,u){i.call(this,l,c,u),n.Wo(e)}))}}Wo(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.Ho&&this.isEnabled&&this._instance.capture(pl,{navigation_type:e}),this.Ho=n}catch(i){je.error("Error capturing "+e+" pageview",i)}}Vo(){if(!this.Uo){var e=()=>{this.Wo("popstate")};Yt(re,"popstate",e),this.Uo=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.Go=!1,this.No=!1,this.Zo=null,this.instance=e,this.Go=!((t=this.instance.persistence)==null||!t.props[Lm]),this.rageclicks=new ay(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Qt(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return et(this.qt.capture_heatmaps)?et(this.qt.enable_heatmaps)?this.Go:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.No)return;P3.info("starting..."),this.Qo(),this.At()}else{var e;clearInterval((e=this.Zo)!==null&&e!==void 0?e:void 0),this.Jo(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Lm]:t}),this.Go=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}Ko(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Zo&&clearInterval(this.Zo),this.Zo=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.qi.bind(this),this.flushIntervalMilliseconds):null}Qo(){re&&Ne&&(this.Yo=this.qi.bind(this),Yt(re,Od,this.Yo),this.Xo=e=>this.Mt(e||(re==null?void 0:re.event)),Yt(Ne,"click",this.Xo,{capture:!0}),this.ea=e=>this.ta(e||(re==null?void 0:re.event)),Yt(Ne,"mousemove",this.ea,{capture:!0}),this.ra=new Fb(this.instance,e3,this.Ko.bind(this)),this.ra.startIfEnabledOrStop(),this.ia=this.At.bind(this),Yt(Ne,zd,this.ia),this.No=!0)}Jo(){var e;re&&Ne&&(this.Yo&&re.removeEventListener(Od,this.Yo),this.Xo&&Ne.removeEventListener("click",this.Xo,{capture:!0}),this.ea&&Ne.removeEventListener("mousemove",this.ea,{capture:!0}),this.ia&&Ne.removeEventListener(zd,this.ia),clearTimeout(this.na),(e=this.ra)==null||e.stop(),this.No=!1)}sa(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Ms(p)&&!ur(p,"body");){if(p===h)return!1;if(Ie(f,re==null?void 0:re.getComputedStyle(p).position))return!0;p=H_(p)}return!1})(Ep(e),["fixed","sticky"],l);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}Mt(e,t){var n;if(t===void 0&&(t="click"),!Db(e.target)&&uy(e)){var i=this.sa(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Pb(Ep(e),this.instance.config.rageclick)&&this.oa(ye({},i,{type:"rageclick"})),this.oa(i)}}ta(e){!Db(e.target)&&uy(e)&&(clearTimeout(this.na),this.na=setTimeout((()=>{this.oa(this.sa(e,"mousemove"))}),500))}oa(e){if(re){var t=re.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?[...jl,...n||[]]:[],l=mc(t,i,gc);this.M=this.M||{},this.M[l]||(this.M[l]=[]),this.M[l].push(e)}}qi(){this.M&&!Es(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Fb,webVitalsAutocapture:class{constructor(e){var t;this.Go=!1,this.No=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.aa=()=>{clearTimeout(this.la),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((n,i)=>ye({},n,{["$web_vitals_"+i.name+"_event"]:ye({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=n=>{var i;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.ua();if(!Se(l))if(et(n==null?void 0:n.name)||et(n==null?void 0:n.value))ra.error("Invalid metric received",n);else if(!this.ha||this.ha>n.value){this.M.url!==l&&(this.aa(),this.la=setTimeout(this.aa,this.flushToCaptureTimeoutMs)),Se(this.M.url)&&(this.M.url=l),this.M.firstMetricTimestamp=Se(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:l,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.M.metrics.push(u),this.M.metrics.length===this.allowedMetrics.length&&this.aa()}else ra.error("Ignoring metric with value >= "+this.ha,n)},this.ca=()=>{if(!this.No){var n,i,l,c,u=De.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:l,onINP:c}=u.postHogWebVitalsCallbacks),n&&i&&l&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.ht.bind(this)),this.No=!0):ra.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Go=!((t=this._instance.persistence)==null||!t.props[Bm]),this.startIfEnabled()}get da(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Qt(this.da)?(e=this.da)==null?void 0:e.web_vitals_allowed_metrics:void 0;return et(n)?((t=this._instance.persistence)==null?void 0:t.props[Pm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Qt(this.da)?this.da.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Qt(this.da)?this.da.web_vitals_attribution:void 0;return e!=null&&e}get ha(){var e=Qt(this.da)&&Fn(this.da.__web_vitals_max_value)?this.da.__web_vitals_max_value:ly;return e>0&&6e4>=e?ly:e}get isEnabled(){var e=Tn==null?void 0:Tn.protocol;if(e!=="http:"&&e!=="https:")return ra.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Qt(this.da)?this.da.web_vitals:si(this.da)?this.da:void 0;return si(t)?t:this.Go}startIfEnabled(){this.isEnabled&&!this.No&&(ra.info("enabled, starting..."),this.$r(this.ca))}onRemoteConfig(e){if("capturePerformance"in e){var t=Qt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Qt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Bm]:t}),this._instance.persistence.register({[Pm]:n})),this.Go=t,this.startIfEnabled()}}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?ra.error("failed to load script",i):e()}))}ua(){var e=re?re.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...jl,...t||[]]:[];return mc(e,n,gc)}ra.error("Could not determine current URL")}}},Y3={exceptionObserver:class{constructor(e){var t,n,i;this.ca=()=>{var l;if(re&&this.isEnabled&&(l=De.__PosthogExtensions__)!=null&&l.errorWrappingFunctions){var c=De.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=De.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=De.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.va&&this.qt.capture_unhandled_errors&&(this.va=c(this.captureException.bind(this))),!this.fa&&this.qt.capture_unhandled_rejections&&(this.fa=u(this.captureException.bind(this))),!this.pa&&this.qt.capture_console_errors&&(this.pa=f(this.captureException.bind(this)))}catch(h){Oo.error("failed to start",h),this.ga()}}},this._instance=e,this.ma=!((t=this._instance.persistence)==null||!t.props[Dm]),this.ya=new JN({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,Zt:Oo}),this.qt=this.ba(),this.startIfEnabledOrStop()}ba(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Qt(e)?t=ye({},t,e):(Se(e)?this.ma:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Oo.info("enabled"),this.ga(),this.$r(this.ca)):this.ga()}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Oo.error("failed to load script",i);e()}))}ga(){var e,t,n;(e=this.va)==null||e.call(this),this.va=void 0,(t=this.fa)==null||t.call(this),this.fa=void 0,(n=this.pa)==null||n.call(this),this.pa=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.ma=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Dm]:this.ma}),this.qt=this.ba(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.ba()}captureException(e){var t,n,i,l=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.ya.consumeRateLimit(l)?Oo.info("Skipping exception capture because of client rate limiting.",{exception:l}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this._a=[],this.wa=new dC([new bC,new EC,new _C,new yC,new NC,new jC,new SC,new CC],(function(i){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
62
- `),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=Ab.test(y)?y.replace(Ab,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var k=_(b,i);if(k){p.push(k);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var j=Array.from(E);return j.reverse(),j.slice(0,50).map((T=>{return ye({},T,{filename:T.filename||(N=j,N[N.length-1]||{}).filename,function:T.function||kl});var N}))})(p)}})("web:javascript",mC,vC)),this._instance=e,this._a=(t=(n=this._instance.persistence)==null?void 0:n.get_property(zm))!==null&&t!==void 0?t:[],this.xa=Md(this.ka()),this.Sa=new AC(this.xa)}onConfigChange(){this.xa=Md(this.ka()),this.Sa.setConfig(this.xa)}onRemoteConfig(e){var t,n,i;if("errorTracking"in e){var l=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this._a=l,this._instance.persistence&&this._instance.persistence.register({[zm]:this._a,[Om]:c})}}get Ca(){var e,t=!!this._instance.get_property(Om),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.wa.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.xa.enabled)try{if(!zt(e)||e.trim().length===0)return void Di.warn("Ignoring exception step because message must be a non-empty string");var n=this.Ia(t),{sanitizedProperties:i,droppedKeys:l}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>TC.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);l.length>0&&Di.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.Sa.add(ye({[Td]:e,[Ad]:new Date().toISOString()},i))}catch(c){Di.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ta(t)){if(this.Ea(t))return this.Ma("Exception dropped: matched a suppression rule"),void Di.info("Skipping exception capture because a suppression rule matched");if(!this.Ca&&this.Pa(t))return this.Ma("Exception dropped: thrown by a browser extension"),void Di.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ra(t))return this.Ma("Exception dropped: thrown by the PostHog SDK"),void Di.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.xa.enabled&&et(e.$exception_steps)?this.Oa(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",ts:!0});return i&&this.Sa.clear(),i}catch(l){return Di.error("Failed to capture exception event. Dropping this exception.",l),void this.Sa.clear()}}catch(l){return void Di.error("Failed to process exception event. Ignoring this exception.",l)}}Oa(e){try{var t=this.Sa.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return Di.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Ma(e){this.xa.enabled&&this.Sa.add({[Td]:e,[Ad]:new Date().toISOString()})}Ia(e){return Qt(e)?ye({},e):{}}ka(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Ea(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:l,value:c}=i;return zt(l)&&l.length>0&&n.$exception_types.push(l),zt(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this._a.some((n=>{var i=n.values.map((l=>{var c,u=hw[l.operator],f=Ke(l.value)?l.value:[l.value],h=(c=t[l.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}Pa(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Ra(e){if(e.length>0){var t,n,i,l,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(i=u==null||(l=u.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Ta(e){return!et(e)&&Ke(e)}}},Q3=ye({productTours:class{get Ji(){return this._instance.persistence}constructor(e){this.La=null,this.Aa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,n;if(this.Ji&&this.Ji.register({[Mg]:!!e.productTours}),!Fp(this._instance))return!this.La&&et((t=this.Ji)==null?void 0:t.props[Yo])||Up.info("product tours disabled; stopping and clearing cached tours"),(n=this.La)==null||n.stop(),this.La=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.La&&Fp(this._instance)&&this.$r((()=>this.Fa()))}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?Up.error("Could not load product tours script",i):e()}))}Fa(){var e;!this.La&&(e=De.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.La=De.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ke(this.Aa)||t){var n=this.Ji;if(n){var i=n.props[Yo];if(Ke(i)&&!t)return this.Aa=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:l=>{if(Fp(this._instance)){var c=l.statusCode;if(c!==200||!l.json){var u="Product Tours API could not be loaded, status: "+c;return Up.error(u),void e([],{isLoaded:!1,error:u})}var f=Ke(l.json.product_tours)?l.json.product_tours:[];this.Aa=f,n&&n.register({[Yo]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Aa,{isLoaded:!0})}getActiveProductTours(e){et(this.La)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.La.getActiveProductTours(e)}showProductTour(e){var t;(t=this.La)==null||t.showTourById(e)}previewTour(e){this.La?this.La.previewTour(e):this.$r((()=>{var t;this.Fa(),(t=this.La)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.La)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.La)==null||e.nextStep()}previousStep(){var e;(e=this.La)==null||e.previousStep()}clearCache(){var e;this.Aa=null,(e=this.Ji)==null||e.unregister(Yo)}resetTour(e){var t;(t=this.La)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.La)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.La)==null||t.cancelPendingTour(e)}}},ef),W3={siteApps:class{constructor(e){this.Na=0,this._instance=e,this.Da=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}$a(e,t){if(t){var n=this.globalsForEvent(t);this.Da.push(n),this.Da.length>1e3&&(this.Da=this.Da.slice(10))}}get siteAppLoaders(){var e;return(e=De._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.$a.bind(this));this.qa=()=>{e(),this.Da=[],this.qa=void 0}}}globalsForEvent(e){var t,n,i,l,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},W5(e,$3),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(i=(l=e.properties)==null?void 0:l.$set_once)!==null&&i!==void 0?i:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}ja(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Kr.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Kr.error("prepare_external_dependency_script returned null"),null):e}Ba(){var e,t,n,i,l,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ne==null?void 0:Ne.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Na++,this.Ha)return this.Ua();var g=[],v=this,y=new WeakSet,b=(E,j,T)=>{if(E!=null&&E[j]){var N=E[j];E[j]=T(N),g.push((()=>{E[j]=N}))}},_=E=>{if(y.has(E))return E;var j=v.ja(E);return j&&y.add(j),j},k=E=>E.map((j=>typeof j=="string"?j:_(j))).filter((j=>!Un(j)));return b(p,"appendChild",(E=>function(j){var T=_(j);return T?E.call(this,T):j})),b(p,"insertBefore",(E=>function(j,T){var N=_(j);return N?E.call(this,N,T):j})),b(p,"replaceChild",(E=>function(j,T){var N=_(j);return N?E.call(this,N,T):T})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(i=h.DocumentFragment)==null?void 0:i.prototype].forEach((E=>{b(E,"append",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"prepend",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))}))})),[(l=h.Element)==null?void 0:l.prototype,(c=h.CharacterData)==null?void 0:c.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((E=>{b(E,"before",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"after",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"replaceWith",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];var z=k(N);return N.length&&!z.length?void 0:j.apply(this,z)}))})),b((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(E=>function(j,T){var N=_(T);return N?E.call(this,j,N):null})),this.Ha=()=>{g.forEach((E=>E())),this.Ha=void 0},this.Ua()}Ua(){var e=!1;return()=>{var t;e||(e=!0,this.Na--,this.Na===0&&((t=this.Ha)==null||t.call(this)))}}za(e,t){t===void 0&&(t=!0);var n=this.Ba();try{var i=e(n);return t&&n(),i}catch(l){throw n(),l}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Da.length&&(Kr.info("Processing "+this.Da.length+" events for site app with id "+e.id),this.Da.forEach((f=>this.za((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.qa)==null||u.call(this))},i=!1,l=u=>{t.errored=!u,t.loaded=!0,Kr.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var{processEvent:c}=this.za((u=>e.init({posthog:this._instance,callback(f){u(),l(f)}})),!1);c&&(t.processEvent=c),i=!0}catch(u){Kr.error(dy+e.id,u),l(!1)}if(i&&t.loaded)try{n()}catch(u){Kr.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Va(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Wa(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(c){try{t.za((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(u){Kr.error("Error while processing event "+e.event+" for site app "+c.id,u)}};for(var l of Object.values(this.apps))i(l)}}onRemoteConfig(e){var t,n,i,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Va(),void this._instance.on("eventCaptured",(h=>this.Wa(h)))):void Kr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.qa)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var c=function(h){var p;De["__$$ph_site_app_"+h]=l._instance,(p=De.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(l._instance,f,(g=>{if(g)return Kr.error(dy+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else Kr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},J3={tracingHeaders:class{constructor(e){this.Ga=void 0,this.Za=void 0,this.Qa=void 0,this.ca=()=>{var t,n,i=this.Ja();i?(Se(this.Ga)&&(this.Ga=(t=De.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.Za)&&(this.Za=(n=De.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.ga()},this._instance=e}initialize(){this.startIfEnabledOrStop()}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return B3.error("failed to load script",i);e()}))}Ka(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Ja(){var e=this.Ka();return Ke(e)?(Ke(this.Qa)?this.Qa.splice(0,this.Qa.length,...e):this.Qa=[...e],e.length>0?this.Qa:void 0):(Ke(this.Qa)&&this.Qa.splice(0),this.Qa=e||void 0,this.Qa)}ga(){var e,t;(e=this.Ga)==null||e.call(this),(t=this.Za)==null||t.call(this),this.Ga=void 0,this.Za=void 0}startIfEnabledOrStop(){this.Ja()?this.$r(this.ca):this.ga()}}},X3=ye({surveys:class{get qt(){return this._instance.config}constructor(e){this.Ya=void 0,this._surveyManager=null,this.Xa=!1,this.el=[],this.tl=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(et(t))return Et.warn("Flags not loaded yet. Not loading surveys.");var n=Ke(t);this.Ya=n?t.length>0:t,Et.info("flags response received, isSurveysEnabled: "+this.Ya),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);(i!=null&&i.startsWith(sg)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((l=>localStorage.removeItem(l)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Xa)Et.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)Et.info(fy);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())Et.info("Not loading surveys in cookieless mode without consent.");else{var e=De==null?void 0:De.__PosthogExtensions__;if(e){if(!Se(this.Ya)||this.qt.advanced_enable_surveys){var t=this.Ya||this.qt.advanced_enable_surveys;this.Xa=!0;try{var n=e.generateSurveys;if(n)return void this.rl(n,t);var i=e.loadExternalDependency;if(!i)return void this.il(Wm);i(this._instance,"surveys",(l=>{l||!e.generateSurveys?this.il("Could not load surveys script",l):this.rl(e.generateSurveys,t)}))}catch(l){throw this.il("Error initializing surveys",l),l}finally{this.Xa=!1}}}else Et.error("PostHog Extensions not found.")}}rl(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new q3(this._instance),Et.info("Surveys loaded successfully"),this.nl({isLoaded:!0})}il(e,t){Et.error(e,t),this.nl({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.el.push(e),this._surveyManager&&this.nl({isLoaded:!0}),()=>{this.el=this.el.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qt.disable_surveys)return Et.info(fy),e([]);var n,i=this._instance.get_property(Fm);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.tl?this.tl.then((l=>{var{surveys:c,context:u}=l;return e(c,u)})):(typeof Promise<"u"&&(this.tl=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:l=>{var c;this.tl=null;var u=l.statusCode;if(u!==200||!l.json){var f="Surveys API could not be loaded, status: "+u;Et.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=l.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var k;return!((k=_.conditions)==null||(k=k.events)==null||(k=k.values)==null||!k.length)})(b)||(function(_){var k;return!((k=_.conditions)==null||(k=k.actions)==null||(k=k.values)==null||!k.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Fm]:g,[Lg]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}nl(e){for(var t of this.el)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Et.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!et(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Et.warn("init was not called")}sl(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((l=>l.id===e)))!==null&&i!==void 0?i:null})),t}ol(e){if(et(this._surveyManager))return{eligible:!1,reason:qp};var t=typeof e=="string"?this.sl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(et(this._surveyManager))return Et.warn("init was not called"),{visible:!1,disabledReason:qp};var t=this.ol(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return et(this._surveyManager)?(Et.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:qp})):new Promise((n=>{this.getSurveys((i=>{var l,c=(l=i.find((f=>f.id===e)))!==null&&l!==void 0?l:null;if(c){var u=this.ol(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(et(this._surveyManager))Et.warn("init was not called");else{var l=typeof e=="string"?this.sl(e):e;if(l!=null&&l.id)if(E3.includes(l.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(i=l.appearance)!=null&&i.surveyPopupDelaySeconds?(Et.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Et.info("Rendering survey "+l.id+" with delay of "+((u=l.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(l,c,n),Et.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,c,n);Et.warn("Survey element not found")}else Et.warn("Surveys of type "+l.type+" cannot be rendered in the app");else Et.warn("Survey not found")}}displaySurvey(e,t){var n;if(et(this._surveyManager))Et.warn("init was not called");else{var i=this.sl(e);if(i){var l=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=ye({},i,{appearance:ye({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Km.Popover&&t.initialResponses&&Et.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(i);if(!c.visible)return void Et.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==Km.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else Et.warn("Survey not found")}}cancelPendingSurvey(e){et(this._surveyManager)?Et.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},ef),Z3={toolbar:class{constructor(e){this.instance=e}al(e){De.ph_toolbar_state=e}ll(){var e;return(e=De.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),P_(this.instance.config)||!re||!Ne)return!1;e=e??re.location,n=n??re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}var i,l=H3||Ud(e.hash,"__posthog")||Ud(e.hash,"state"),c=l?Rb((()=>JSON.parse(atob(decodeURIComponent(l)))))||Rb((()=>JSON.parse(decodeURIComponent(l)))):null;return c&&c.action==="ph_authorize"?((i=c).source="url",i&&Object.keys(i).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(hy)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}ul(e){var t=De.ph_load_toolbar||De.ph_load_editor;!et(t)&&Ui(t)?t(e,this.instance):py.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById(D_));if(!re||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(hy,JSON.stringify(ye({},i,{source:void 0}))),this.ll()===2)this.ul(i);else if(this.ll()===0){var l;this.al(1),(l=De.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return py.error("[Toolbar] Failed to load",c),void this.al(0);this.al(2),this.ul(i)})),Yt(re,"turbolinks:load",(()=>{this.al(0),this.loadToolbar(i)}))}return!0}hl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},K3=ye({experiments:Dn},ef),e4=ye({},ef,V3,G3,Y3,Q3,W3,X3,J3,Z3,K3,{conversations:class{constructor(e){this.cl=void 0,this._conversationsManager=null,this.dl=!1,this.vl=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;et(t)||(si(t)?this.cl=t:(this.cl=t.enabled,this.vl=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.cl=void 0,this.vl=null}loadIfEnabled(){if(!(this._conversationsManager||this.dl||this._instance.config.disable_conversations||P_(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=De==null?void 0:De.__PosthogExtensions__;if(e&&!Se(this.cl)&&this.cl)if(this.vl&&this.vl.token){this.dl=!0;try{var t=e.initConversations;if(t)return this.fl(t),void(this.dl=!1);var n=e.loadExternalDependency;if(!n)return void this.pl(Wm);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.pl("Could not load conversations script",i):this.fl(e.initConversations),this.dl=!1}))}catch(i){this.pl("Error initializing conversations",i),this.dl=!1}}else kr.error("Conversations enabled but missing token in remote config.")}}fl(e){if(this.vl)try{this._conversationsManager=e(this.vl,this._instance),kr.info("Conversations loaded successfully")}catch(t){this.pl("Error completing conversations initialization",t)}else kr.error("Cannot complete initialization: remote config is null")}pl(e,t){kr.error(e,t),this._conversationsManager=null,this.dl=!1}show(){this._conversationsManager?this._conversationsManager.show():kr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.cl===!0&&!Un(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return wn((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(kr.warn(sa),null)}))()}getMessages(e,t){var n=this;return wn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(kr.warn(sa),null)}))()}markAsRead(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(kr.warn(sa),null)}))()}getTickets(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(kr.warn(sa),null)}))()}requestRestoreLink(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(kr.warn(sa),null)}))()}restoreFromToken(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(kr.warn(sa),null)}))()}restoreFromUrlToken(){var e=this;return wn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kr.warn(sa),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}us(){var e;(e=this._conversationsManager)==null||e.setIdentity()}hs(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.gl=!1,this.ml=!1,this.Zt=It("[logs]"),this.Ei=[],this.yl=()=>{var n;(n=this.bl)==null||n.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.gl=!0),re&&Yt(re,"online",this.yl)}_l(){var e,t,n,i,l,c,u,f,h,p,g,v,y,b,_=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.bl&&this.wl===_||((t=this.bl)==null||t.reset(),this.wl=_,this.xl=(p=(i=(n=_)==null?void 0:n.flushIntervalMs)!==null&&i!==void 0?i:3e3,g=(l=n==null?void 0:n.maxBufferSize)!==null&&l!==void 0?l:100,v=(c=n==null?void 0:n.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,y=Math.max(g,v),{serviceName:(u=(b=n==null?void 0:n.resourceAttributes)==null?void 0:b["service.name"])!==null&&u!==void 0?u:n==null?void 0:n.serviceName,serviceVersion:(f=b==null?void 0:b["service.version"])!==null&&f!==void 0?f:n==null?void 0:n.serviceVersion,environment:(h=b==null?void 0:b["deployment.environment"])!==null&&h!==void 0?h:n==null?void 0:n.environment,resourceAttributes:b,beforeSend:n==null?void 0:n.beforeSend,flushIntervalMs:p,maxBufferSize:g,maxQueueSize:y,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}),this.bl=new cC(this.kl(),this.xl,this.Zt,(()=>this.Sl()),(k=>k()))),this.bl}Cl(){return this._l(),this.xl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!et(n)&&n&&(this.gl=!0,this.loadIfEnabled())}reset(){var e;this.Ei=[],(e=this.bl)==null||e.reset()}captureLog(e){this._l().captureLog(e)}get logger(){return this.Il||(this.Il={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Il}flushLogs(e){e?this.Tl(e):this._l().flush().catch((t=>this.Zt.error("PostHog logs flush failed:",t)))}loadIfEnabled(){if(this.gl&&!this.ml){var e=De==null?void 0:De.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.Zt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.ml=!0)})):this.Zt.error(Wm)}else this.Zt.error("PostHog Extensions not found.")}}kl(){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:t=>t===$i.LogsQueue?this.Ei:void 0,setPersistedProperty:(t,n)=>{var i;t===$i.LogsQueue&&(this.Ei=(i=n)!==null&&i!==void 0?i:[])},wr:t=>this.wr(t),getLibraryId:()=>Xt.LIB_NAME,getLibraryVersion:()=>Xt.LIB_VERSION}}wr(e){return new Promise((t=>{var n=!1,i=c=>{n||(n=!0,clearTimeout(l),t(c))},l=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.El(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(c){var u=c.statusCode;if(u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==429&&500>u)i({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;i({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}))}Tl(e){var t=this.Cl();if(this.Ei.length!==0){var n=this.Ei.map((l=>l.record));this.Ei=[];var i=k_(n,S_(t,Xt.LIB_NAME,Xt.LIB_VERSION),Xt.LIB_NAME,Xt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.El(),data:i,compression:"best-available",batchKey:"logs",transport:e})}}El(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Sl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(De!=null&&(e=De.location)!=null&&e.href&&(t.currentUrl=De.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}});Er.__defaultExtensionClasses=ye({},e4);var xc=(function(){Xt.SDK_DIST_CHANNEL="npm";var e=nc[ml]=new Er;return(function(){function t(){t.done||(t.done=!0,gw=!1,Rt(nc,(function(n){n._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?t():Yt(Ne,"DOMContentLoaded",t,{capture:!1}):re&&je.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const t4="https://us.i.posthog.com",xw="cc-telemetry-enabled";let og=!1,vc=!1;function n4(){return t4}function r4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(xw);return e===null?!0:e==="true"}function vw(e){og&&(e?(xc.opt_in_capturing({captureEventName:null}),vc=!0):(xc.opt_out_capturing(),vc=!1))}function AL(e){typeof localStorage<"u"&&localStorage.setItem(xw,String(e)),vw(e)}function i4(){const e=void 0;return e?(xc.init(e,{api_host:n4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),og=!0,vw(r4()),!0):(og=!1,vc=!1,!1)}function Fg(e,t){vc&&xc.capture(e,t)}function Rs(e,t){vc&&xc.captureException(e,t)}function s4(e){Fg("$pageview",{$current_url:e})}const ai="/api",bw="companion_auth_token";function Ls(){if(typeof window>"u")return{};const e=localStorage.getItem(bw);return e?{Authorization:`Bearer ${e}`}:{}}function ga(e){e===401&&typeof window<"u"&&(localStorage.removeItem(bw),Zn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Lj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function dn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Sc(e,t,n,i){Fg("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function li(e,t,n,i,l){Fg("api_request_failed",{method:e,path:t,status:l,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Rs(i,{method:e,path:t,status:l})}async function Fe(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("POST",e,dn()-n,u,l.status),i=!0,u}return Sc("POST",e,dn()-n,l.status),l.json()}catch(l){throw i||li("POST",e,dn()-n,l),l}}async function Re(e){const t=dn();let n=!1;try{const i=await fetch(`${ai}${e}`,{headers:{...Ls()}});if(!i.ok){ga(i.status);const l=await i.json().catch(()=>({error:i.statusText})),c=new Error(l.error||i.statusText);throw li("GET",e,dn()-t,c,i.status),n=!0,c}return Sc("GET",e,dn()-t,i.status),i.json()}catch(i){throw n||li("GET",e,dn()-t,i),i}}async function jr(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("PUT",e,dn()-n,u,l.status),i=!0,u}return Sc("PUT",e,dn()-n,l.status),l.json()}catch(l){throw i||li("PUT",e,dn()-n,l),l}}async function a4(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("PATCH",e,dn()-n,u,l.status),i=!0,u}return Sc("PATCH",e,dn()-n,l.status),l.json()}catch(l){throw i||li("PATCH",e,dn()-n,l),l}}async function Nr(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("DELETE",e,dn()-n,u,l.status),i=!0,u}return Sc("DELETE",e,dn()-n,l.status),l.json()}catch(l){throw i||li("DELETE",e,dn()-n,l),l}}async function l4(e,t){const n=await fetch(`${ai}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),l=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
61
+ `)}function vp(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function CN(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const l=new Map;for(const f of i)l.set(vp(f),f);const c=[],u=new Set;for(const f of n){const h=vp(f);u.has(h)||(u.add(h),c.push(l.get(h)||f))}for(const f of i){const h=vp(f);u.has(h)||(u.add(h),c.push(f))}return c}function vb(e,t,n,i,l){return{toolUseId:e,toolName:t,preview:lc(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:l||void 0}}function bm(e,t){const n=CN(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?hd(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function EN(e,t){const n=W.getState(),i=n.messages.get(e)||[],l=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(l===-1){n.appendMessage(e,t);return}const c=[...i];c[l]=bm(c[l],t),n.setMessages(e,c)}function TN(e,t){var l,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(l=t.data)==null?void 0:l.substring)==null?void 0:c.call(l,0,120));return}const i=W.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),Q5(e,n)}function Q5(e,t,n={}){var u,f,h,p,g,v,y,b;const{processSeq:i=!0,ackSeqMessage:l=!0}=n,c=W.getState();if(i&&typeof t.seq=="number"){const _=vm(e);if(t.seq<=_)return;gb(e,t.seq),l&&xb(e,t.seq)}switch(pN.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const _=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const k=new Set(c.sessionNames.values()),E=$5(k);c.setSessionName(e,E)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const _=t.message;if(_.model==="<synthetic>"){ks(e),c.setStreaming(e,null),rl(e,"synthetic_noop",{detail:{stopReason:_.stop_reason,text:hd(_.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const k=hd(_.content),E={id:_.id,role:"assistant",content:k,contentBlocks:_.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:_.model,stopReason:_.stop_reason};if(ks(e),EN(e,E),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),(u=_.content)!=null&&u.length)for(const j of _.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=_.content)!=null&&f.length)for(const j of _.content){if(j.type==="tool_use"){const T=j.input||{};c.addToolActivity(e,vb(j.id,j.name,T,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=_.content)!=null&&h.length&&(pp(e,_.content),mp(e,_.content),gp(e,_.content),xp(e,_.content));break}case"stream_event":{const _=t.event;if(_&&typeof _=="object"){if(_.type==="message_start"&&(Ns.delete(e),Oi.delete(e),ks(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),_.type==="content_block_delta"){const k=_.delta;if((k==null?void 0:k.type)==="text_delta"&&typeof k.text=="string"){const E=Oi.get(e)||{thinking:"",text:""};Ns.get(e)==="thinking"&&(E.thinking=""),E.text+=k.text,Oi.set(e,E),Ns.set(e,"text"),c.setStreaming(e,E.text),pb(e,E.text,"text")}if((k==null?void 0:k.type)==="thinking_delta"&&typeof k.thinking=="string"){const E=Oi.get(e)||{thinking:"",text:""};E.thinking+=k.thinking,Oi.set(e,E),Ns.set(e,"thinking"),c.setStreaming(e,E.thinking),pb(e,E.thinking,"thinking")}}if(_.type==="message_delta"){const k=_.usage;k!=null&&k.output_tokens&&c.setStreamingStats(e,{outputTokens:k.output_tokens})}}break}case"result":{wd.delete(e),Sd.delete(e);const _=t.data,k={total_cost_usd:_.total_cost_usd,num_turns:_.num_turns};if(typeof _.total_lines_added=="number"&&(k.total_lines_added=_.total_lines_added),typeof _.total_lines_removed=="number"&&(k.total_lines_removed=_.total_lines_removed),_.modelUsage){for(const E of Object.values(_.modelUsage))if(E.contextWindow>0){const j=Math.round((E.inputTokens+E.outputTokens)/E.contextWindow*100);k.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,k),ks(e),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&zj(),!document.hasFocus()&&c.notificationDesktop&&fb("Session completed","Claude finished the task",e),_.is_error&&((p=_.errors)!=null&&p.length)&&c.appendMessage(e,{id:ei(),role:"system",content:`Error: ${_.errors.join(", ")}`,timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const k=t.request;fb("Permission needed",`${k.tool_name}: approve or deny`,k.request_id)}const _=t.request;if(_.tool_name&&_.input){const k=[{type:"tool_use",id:_.tool_use_id,name:_.tool_name,input:_.input}];pp(e,k),mp(e,k),gp(e,k),xp(e,k)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((g=c.sdkSessions.find(k=>k.sessionId===e))==null?void 0:g.backendType)==="codex"&&c.appendMessage(e,{id:ei(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||ei(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((v=t.event)==null?void 0:v.subtype)==="task_notification"){const{task_id:k,status:E,summary:j}=t.event;k&&E&&c.updateProcess(e,k,{status:E,completedAt:Date.now(),summary:j||void 0})}const _=hb(t.event);if(!_)break;c.appendMessage(e,{id:ei(),role:"system",content:_,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:ei(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:ei(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const _=t.phase;_==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)?rl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):rl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):_==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)&&rl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):_==="starting"||_==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_==="ready"?c.setSessionStatus(e,"idle"):_==="streaming"?c.setSessionStatus(e,"running"):_==="compacting"?c.setSessionStatus(e,"compacting"):_==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),ks(e)?rl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):rl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const _=c.sessionNames.get(e),k=_&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_);(!_||k)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const _=[],k=new Map;for(let j=0;j<t.messages.length;j++){const T=t.messages[j];if(T.type==="user_message")_.push({id:T.id||ei(),role:"user",content:T.content,timestamp:T.timestamp});else if(T.type==="assistant"){const N=T.message,D=hd(N.content),z={id:N.id,role:"assistant",content:D,contentBlocks:N.content,timestamp:T.timestamp||Date.now(),parentToolUseId:T.parent_tool_use_id,model:N.model,stopReason:N.stop_reason},L=_.findIndex(H=>H.role==="assistant"&&H.id===z.id);if(L===-1?_.push(z):_[L]=bm(_[L],z),(y=N.content)!=null&&y.length){pp(e,N.content),mp(e,N.content),gp(e,N.content),xp(e,N.content);const H=T.timestamp||Date.now();for(const U of N.content){if(U.type==="tool_use"){const V=U.input||{},O=k.get(U.id);k.set(U.id,O??vb(U.id,U.name,V,H,T.parent_tool_use_id))}if(U.type==="tool_result"){const V=k.get(U.tool_use_id);V&&k.set(U.tool_use_id,{...V,completedAt:H,isError:V.isError||!!U.is_error,elapsedSeconds:Math.max(V.elapsedSeconds,V.completedAt?V.elapsedSeconds:Math.max(0,(H-V.startedAt)/1e3))})}}}}else if(T.type==="result"){const N=T.data;N.is_error&&((b=N.errors)!=null&&b.length)&&_.push({id:`hist-error-${j}`,role:"system",content:`Error: ${N.errors.join(", ")}`,timestamp:Date.now()});const D={total_cost_usd:N.total_cost_usd,num_turns:N.num_turns};if(typeof N.total_lines_added=="number"&&(D.total_lines_added=N.total_lines_added),typeof N.total_lines_removed=="number"&&(D.total_lines_removed=N.total_lines_removed),N.modelUsage){for(const z of Object.values(N.modelUsage))if(z.contextWindow>0){const L=z,H=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);D.context_used_percent=Math.max(0,Math.min(H,100))}}c.updateSession(e,D)}else if(T.type==="system_event"){const N=hb(T.event);if(!N)continue;_.push({id:`hist-system-event-${j}`,role:"system",content:N,timestamp:T.timestamp||Date.now()})}}if(_.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,_);else{const T=[...j];for(const N of _){const D=T.findIndex(L=>L.id===N.id);if(D===-1){T.push(N);continue}const z=T[D];z.role==="assistant"&&N.role==="assistant"?T[D]=bm(z,N):T[D]=N}T.sort((N,D)=>(N.timestamp??0)-(D.timestamp??0)),c.setMessages(e,T)}}c.setToolActivity(e,Array.from(k.values()).sort((j,T)=>j.startedAt-T.startedAt));const E=t.messages[t.messages.length-1];(E==null?void 0:E.type)==="result"&&(ks(e),c.setStreaming(e,null),Ns.delete(e),Oi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let _;for(const k of t.events){const E=vm(e);k.seq<=E||(gb(e,k.seq),_=k.seq,Q5(e,k.message,{processSeq:!1,ackSeqMessage:!1}))}typeof _=="number"&&xb(e,_);break}case"prompt_suggestion":{const _=t.suggestions;c.setPromptSuggestions(e,_);break}case"streamlined_text":{c.appendMessage(e,{id:ei(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:ei(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function wc(e){const t=$r.get(e);if(I5(t))return;if(t){try{t.close()}catch{}$r.delete(e)}W.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(NN(e));$r.set(e,i),i.onopen=()=>{const l=vm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:l})),SN(e,i);const c=Ii.get(e);c&&(clearTimeout(c),Ii.delete(e))},i.onmessage=l=>TN(e,l),i.onclose=()=>{$r.get(e)===i&&($r.delete(e),W.getState().setConnectionStatus(e,"disconnected"),AN(e))},i.onerror=()=>{i.close()}}function AN(e){if(Ii.has(e)||cc)return;const t=setTimeout(()=>{Ii.delete(e),!cc&&V5(e)&&wc(e)},hN);Ii.set(e,t)}function ym(e){const t=Ii.get(e);t&&(clearTimeout(t),Ii.delete(e));const n=$r.get(e);n&&(n.close(),$r.delete(e)),W.getState().setConnectionStatus(e,"disconnected"),wd.delete(e),Sd.delete(e),qo.delete(e),dd.delete(e),Ns.delete(e),Jo.delete(e),Oi.delete(e),_d.delete(e),oc.delete(e)}function MN(e){if(!cc)for(const t of e)t.archived||wc(t.sessionId)}function RN(e){return new Promise((t,n)=>{const i=setInterval(()=>{const c=$r.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(l),t())},50),l=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Pn(e,t){const n=$r.get(e);let i=t;const l=jN.has(t.type);if(l)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(i={...t,client_msg_id:G5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}l&&wN(e,i)}function bb(e){Pn(e,{type:"mcp_get_status"})}function LN(e,t,n){Pn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function DN(e,t){Pn(e,{type:"mcp_reconnect",serverName:t})}function zN(e,t){Pn(e,{type:"mcp_set_servers",servers:t})}function ON(e,t){Pn(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,gn=typeof globalThis<"u"?globalThis:re;typeof self>"u"&&(gn.self=gn),typeof File>"u"&&(gn.File=function(){});var cr=gn==null?void 0:gn.navigator,Ne=gn==null?void 0:gn.document,Tn=gn==null?void 0:gn.location,_m=gn==null?void 0:gn.fetch,wm=gn!=null&&gn.XMLHttpRequest&&"withCredentials"in new gn.XMLHttpRequest?gn.XMLHttpRequest:void 0,yb=gn==null?void 0:gn.AbortController,BN=gn==null?void 0:gn.CompressionStream,Jn=cr==null?void 0:cr.userAgent,De=re??{},_b="1.391.0",Xt={DEBUG:!1,LIB_VERSION:_b,LIB_NAME:"web",JS_SDK_VERSION:_b};function wb(e,t,n,i,l,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,l)}function wn(e){return function(){var t=this,n=arguments;return new Promise((function(i,l){var c=e.apply(t,n);function u(h){wb(c,i,l,u,f,"next",h)}function f(h){wb(c,i,l,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ye.apply(null,arguments)}function W5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var PN=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function $N(e){return typeof e=="string"||e}function UN(e){return typeof e=="string"?e:void 0}var Eo,$i=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Sb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),FN=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],qN=["token"],J5="NativeGzipValidationError",Sm=e=>e.length>=2&&e[0]===31&&e[1]===139,kb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Qu=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=J5,t},HN=(function(){var e=wn((function*(t,n){18>t.size&&Qu("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Sm(i)&&i[2]===8||Qu("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Eo)return Eo;Eo=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;Eo[g]=v>>>0}return Eo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&Qu("invalid-crc");var c=n.length>>>0;l.getUint32(4,!0)!==c&&Qu("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function km(){return km=wn((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),l=new CompressionStream("gzip"),c=l.writable.getWriter(),u=c.write(i).then((()=>c.close())).catch((function(){var p=wn((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(l.readable).blob(),[h]=yield Promise.all([f,u]);return yield HN(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),km.apply(this,arguments)}var IN=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],jb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return IN.concat(t).some((i=>{var l=i.toLowerCase();return n.indexOf(l)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var Xd=function(e){return e.trim()},jm=function(e){return e.replace(/^\$/,"")},X5=Object.prototype,Z5=X5.hasOwnProperty,Zd=X5.toString,Ke=Array.isArray||function(e){return Zd.call(e)==="[object Array]"},Ui=e=>typeof e=="function",$t=e=>e===Object(e)&&!Ke(e),Es=e=>{if($t(e)){for(var t in e)if(Z5.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,Ot=e=>Zd.call(e)=="[object String]",Nm=e=>Ot(e)&&e.trim().length===0,Un=e=>e===null,et=e=>Se(e)||Un(e),Fn=e=>Zd.call(e)=="[object Number]"&&e==e,Bi=e=>Fn(e)&&e>0,si=e=>Zd.call(e)==="[object Boolean]",VN=e=>e instanceof FormData,GN=e=>Ie(FN,e),YN=e=>Ie(qN,e);function K5(e){return e===null||typeof e!="object"}function kd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function jg(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var QN=[!0,"true",1,"1","yes"],bp=e=>Ie(QN,e),WN=[!1,"false",0,"0","no"];function ii(e,t,n,i,l){return t>n&&(i.warn("min cannot be greater than max."),t=n),Fn(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),ii(l||n,t,n,i))}class JN{constructor(t){this.$t={},this.zt=t.zt,this.Gt=ii(t.bucketSize,0,100,t.Zt),this.Qt=ii(t.refillRate,0,this.Gt,t.Zt),this.Jt=ii(t.refillInterval,0,864e5,t.Zt)}Kt(t,n){var i=Math.floor((n-t.lastAccess)/this.Jt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qt,this.Gt),t.lastAccess=t.lastAccess+i*this.Jt)}consumeRateLimit(t){var n,i=Date.now(),l=String(t),c=this.$t[l];return c?this.Kt(c,i):this.$t[l]=c={tokens:this.Gt,lastAccess:i},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.zt)==null||n.call(this,t)),c.tokens===0)}stop(){this.$t={}}}var dr="Mobile",jd="iOS",Hi="Android",wl="Tablet",e_=Hi+" "+wl,t_="iPad",n_="Apple",r_=n_+" Watch",Xo="Safari",Sl="BlackBerry",i_="Samsung",s_=i_+"Browser",a_=i_+" Internet",ha="Chrome",XN=ha+" OS",l_=ha+" "+jd,Ng="Internet Explorer",o_=Ng+" "+dr,Cg="Opera",ZN=Cg+" Mini",Eg="Edge",c_="Microsoft "+Eg,bl="Firefox",u_=bl+" "+jd,uc="Nintendo",dc="PlayStation",yl="Xbox",d_=Hi+" "+dr,f_=dr+" "+Xo,Ho="Windows",Cm=Ho+" Phone",Nb="Nokia",Em="Ouya",h_="Generic",KN=h_+" "+dr.toLowerCase(),p_=h_+" "+wl.toLowerCase(),Tm="Konqueror",m_="Oculus Browser",Nd="Vivaldi",g_="Yandex",Cd="Whale",Am="DuckDuckGo",x_="Pale Moon",Ed="Waterfox",Zo="Brave",v_="Google Search App",It="(\\d+(\\.\\d+)?)",yp=new RegExp("Version/"+It),eC=new RegExp(yl,"i"),tC=new RegExp(dc+" \\w+","i"),nC=new RegExp(uc+" \\w+","i"),Tg=new RegExp(Sl+"|PlayBook|BB10","i"),rC={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},b_=function(e,t,n,i){t=t||"";var l=(function(c){return c!=null&&c.brave?Zo:null})(n);return l||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?v_:Ie(e," OPR/")&&Ie(e,"Mini")?ZN:Ie(e," OPR/")?Cg:Tg.test(e)?Sl:Ie(e,"IE"+dr)||Ie(e,"WPDesktop")?o_:Ie(e,"OculusBrowser")?m_:Ie(e,s_)?a_:Ie(e,Eg)||Ie(e,"Edg/")?c_:Ie(e,Nd+"/")?Nd:Ie(e,"YaBrowser/")?g_:Ie(e,Cd+"/")?Cd:Ie(e,Am+"/")||Ie(e,"Ddg/")?Am:Ie(e,"FBIOS")?"Facebook "+dr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?l_:Ie(e,"CrMo")||Ie(e,ha)?ha:Ie(e,Hi)&&Ie(e,Xo)?d_:Ie(e,"FxiOS")?u_:Ie(e.toLowerCase(),Tm.toLowerCase())?Tm:Ie(e,Zo+"/")?Zo:((c,u)=>u&&Ie(u,n_)||(function(f){return Ie(f,Xo)&&!Ie(f,ha)&&!Ie(f,Hi)})(c))(e,t)?Ie(e,dr)?f_:Xo:Ie(e,"PaleMoon/")?x_:Ie(e,Ed+"/")?Ed:Ie(e,bl)?bl:Ie(e,"MSIE")||Ie(e,"Trident/")?Ng:Ie(e,"Gecko")?bl:"")},iC={[o_]:[new RegExp("rv:"+It)],[c_]:[new RegExp(Eg+"?\\/"+It)],[ha]:[new RegExp("("+ha+"|CrMo)\\/"+It)],[l_]:[new RegExp("CriOS\\/"+It)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+It)],[Xo]:[yp],[f_]:[yp],[Cg]:[new RegExp("(Opera|OPR)\\/"+It)],[bl]:[new RegExp(bl+"\\/"+It)],[u_]:[new RegExp("FxiOS\\/"+It)],[Tm]:[new RegExp("Konqueror[:/]?"+It,"i")],[Sl]:[new RegExp(Sl+" "+It),yp],[d_]:[new RegExp("android\\s"+It,"i")],[a_]:[new RegExp(s_+"\\/"+It)],[m_]:[new RegExp("OculusBrowser\\/"+It)],[Nd]:[new RegExp(Nd+"\\/"+It)],[g_]:[new RegExp("YaBrowser\\/"+It)],[Cd]:[new RegExp(Cd+"\\/"+It)],[Zo]:[new RegExp(Zo+"\\/"+It)],[Am]:[new RegExp("(DuckDuckGo|Ddg)\\/"+It)],[x_]:[new RegExp("PaleMoon\\/"+It)],[Ed]:[new RegExp(Ed+"\\/"+It)],[v_]:[new RegExp("GSA\\/"+It)],[Ng]:[new RegExp("(rv:|MSIE )"+It)],Mozilla:[new RegExp("rv:"+It)]},sC=function(e,t,n,i){var l=b_(e,t,n,i),c=iC[l];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},Cb=[[new RegExp(yl+"; "+yl+" (.*?)[);]","i"),e=>[yl,e&&e[1]||""]],[new RegExp(uc,"i"),[uc,""]],[new RegExp(dc,"i"),[dc,""]],[Tg,[Sl,""]],[new RegExp(Ho,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Cm,""];if(new RegExp(dr).test(t)&&!/IEMobile\b/.test(t))return[Ho+" "+dr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=rC[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Ho,i]}return[Ho,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[jd,[e[3],e[4],e[5]||"0"].join(".")]:[jd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hi+")","i"),e=>e&&e[2]?[Hi,[e[2],e[3],e[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[XN,""]],[/Linux|debian/i,["Linux",""]]],Eb=function(e){return nC.test(e)?uc:tC.test(e)?dc:eC.test(e)?yl:new RegExp(Em,"i").test(e)?Em:new RegExp("("+Cm+"|WPDesktop)","i").test(e)?Cm:/iPad/.test(e)?t_:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?r_:Tg.test(e)?Sl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Nb,"i").test(e)?Nb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(dr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hi:e_:new RegExp("(pda|"+dr+")","i").test(e)?KN:new RegExp(wl,"i").test(e)&&!new RegExp(wl+" pc","i").test(e)?p_:""};function _p(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var aC=e=>e instanceof Error,y_={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},lC=y_.info;function __(e){if(si(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(Ke(e))return{arrayValue:{values:e.map((t=>__(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function w_(e){var t=[];for(var n in e){var i=e[n];Un(i)||Se(i)||t.push({key:n,value:__(i)})}return t}function oC(e,t){var n=e.level||"info",{text:i,number:l}=y_[n]||lC,c=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=ye({},u,e.attributes||{}),h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:l,severityText:i,body:{stringValue:e.body},attributes:w_(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Se(e.trace_flags)||(h.flags=e.trace_flags),h}function S_(e,t,n){return ye({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function k_(e,t,n,i){return{resourceLogs:[{resource:{attributes:w_(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let cC=class{constructor(e,t,n,i,l,c){var u;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.qt=t,this.Zt=n,this.Yt=i,this.Xt=l,this.er=c,this.tr=null,this.rr=0,this.ir=0,this.nr=0,this.sr=0,this.ar=!1,this.lr=t.maxBufferSize,this.it=Math.max((u=t.maxQueueSize)!==null&&u!==void 0?u:t.maxBufferSize,t.maxBufferSize),this.ur=t.flushIntervalMs,this.hr=t.maxBatchRecordsPerPost,this.cr=t.rateCapWindowMs,this.dr=t.maxLogsPerInterval}reset(){this.vr(),this.tr=null,this.nr=0,this.sr=0,this.ar=!1,this.rr=0,this.ir=0,this.hr=this.qt.maxBatchRecordsPerPost}onReconnect(){this.ir=0,this.pr()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.gr(e);if(t!==null)if(t.body){if(this.mr()){var n={record:oC(t,this.Yt())};this.Xt((()=>this.yr(n)))}}else this.Zt.info("Log was rejected in beforeSend function")}}gr(e){var t=this.qt.beforeSend;if(!t)return e;var n=Ke(t)?t:[t],i=e;for(var l of n)try{var c=l(i);if(!c)return this.Zt.info("Log was rejected in beforeSend function"),null;i=c}catch(u){return this.Zt.error("Error in beforeSend function for log:",u),null}return i}mr(){if(this.dr===void 0)return!0;var e=Date.now(),t=e-this.nr;return this.cr>t&&t>=0||(this.nr=e,this.sr=0,this.ar=!1),this.dr>this.sr?(this.sr++,!0):(this.ar||(this.Zt.warn("captureLog dropping logs: exceeded "+this.dr+" logs per "+this.cr+"ms"),this.ar=!0),!1)}flush(){var e=this;return wn((function*(){if(!e._instance.isDisabled)return e.tr||(e.tr=e.br().finally((()=>{e.tr=null}))),e.tr}))()}br(){var e=this;return wn((function*(){var t;e.vr();var n=(t=e._instance.getPersistedProperty($i.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,l=0;n.length>0&&i>l;){var c;e.rr=0;var u=Math.min(n.length,e.hr),f=n.slice(0,u),h=k_(f.map((g=>g.record)),e._r(),e._instance.getLibraryId(),e._instance.getLibraryVersion()),p=yield e._instance.wr(h);if(p.kind==="too-large"&&f.length>1)e.hr=Math.max(1,Math.floor(f.length/2)),e.Zt.warn("Received 413 when sending logs batch of size "+f.length+", reducing batch size to "+e.hr);else if(p.kind==="retry-later"||(p.kind==="too-large"?e.Zt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&e.qt.maxBatchRecordsPerPost>e.hr&&(e.hr=Math.min(e.qt.maxBatchRecordsPerPost,e.hr+1)),yield e.kr(f.length),n=(c=e._instance.getPersistedProperty($i.LogsQueue))!==null&&c!==void 0?c:[],l+=f.length,p.kind==="fatal"))throw p.error}}))()}kr(e){var t=this;return wn((function*(){var n,i=Math.max(0,e-t.rr),l=(n=t._instance.getPersistedProperty($i.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty($i.LogsQueue,l.slice(i)),yield t.er()}))()}_r(){return S_(this.qt,this._instance.getLibraryId(),this._instance.getLibraryVersion())}yr(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty($i.LogsQueue))!==null&&t!==void 0?t:[];this.it>n.length||(n.shift(),this.rr++,this.Zt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty($i.LogsQueue,n),this.lr>n.length?this.Sr():this.pr()}}Sr(e){e===void 0&&(e=this.ur),this.Cr||(this.Cr=_p((()=>{this.Cr=void 0,this.pr()}),e))}Ir(){var e=Math.min(Math.max(0,this.ir-1),6);return this.ur*Math.pow(2,e)}Tr(){var e=this._instance.getPersistedProperty($i.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return wn((function*(){t.vr();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((i=>_p(i,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return wn((function*(){var n=!1,i=t.flush(),l=new Promise((c=>_p((()=>{n=!0,c()}),e)));try{yield Promise.race([i,l])}finally{n&&i.catch((()=>{}))}}))()}pr(){this.flush().then((()=>{this.ir=0}),(e=>{this.ir++,this.Zt.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Tr()&&this.Sr(this.Ir())}))}vr(){this.Cr&&(clearTimeout(this.Cr),this.Cr=void 0)}};var Wu,Tb,wp;function uC(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return wp&&n.length===Tb||(Tb=n.length,wp=n.reduce(((i,l)=>{Wu||(Wu={});var c=Wu[l];if(c)i[c[0]]=c[1];else for(var u=e(l),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[l];if(p&&g){i[p]=g,Wu[l]=[p,g];break}}return i}),{})),wp}}class dC{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(i,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(l,c);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return wn((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ke(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var i,l;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:i,stack:l})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return wn((function*(){var i=t;for(var l of n.modifiers)i=yield l(i);return i}))()}convertToExceptionList(t,n){var i,l,c,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:uC(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var l=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:c=>l(c,i),next:c=>l(c,i+1)})}}var kl="?";function Mm(e,t,n,i,l){var c={platform:e,filename:t,function:n==="<anonymous>"?kl:n,in_app:!0};return Se(i)||(c.lineno=i),Se(l)||(c.colno=l),c}var j_=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:kl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},fC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pC=/\((\S*)(?::(\d+))(?::(\d+))\)/,mC=(e,t)=>{var n=fC.exec(e);if(n){var[,i,l,c]=n;return Mm(t,i,kl,+l,+c)}var u=hC.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=pC.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=j_(u[1]||kl,u[2]);return Mm(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},gC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vC=(e,t)=>{var n=gC.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=xC.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var l=n[3],c=n[1]||kl;return[c,l]=j_(c,l),Mm(t,l,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Ab=/\(error: (.*)\)/;class bC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=Ot(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return kd(t,"DOMException")}isDOMError(t){return kd(t,"DOMError")}}class yC{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class _C{constructor(){}match(t){return kd(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var i;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var wC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class SC{match(t){return typeof t=="string"}coerce(t,n){var i,[l,c]=this.getInfos(t);return{type:l??"Error",value:c??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,l=t.match(wC);return l&&(n=l[1],i=l[2]),[n,i]}}var kC=["fatal","error","warning","log","info","debug"];function N_(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var l=n.slice(0,i).join(", ");if(t>=l.length)return i===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class jC{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return jg(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+N_(t)}isSeverityLevel(t){return Ot(t)&&!Nm(t)&&kC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(aC(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class NC{match(t){return jg(t)}coerce(t,n){var i,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+N_(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class CC{match(t){return K5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class EC{match(t){return kd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!jg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,l=this.getUnhandledRejectionReason(t);return K5(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(l)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Td="$message",Ad="$timestamp",TC=new Set([Td,Ad]),Sp={enabled:!0,max_bytes:32768};function Md(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Sp.enabled,max_bytes:MC(e.max_bytes,Sp.max_bytes)}:ye({},Sp)}class AC{constructor(t){this.Er=[],this.Mr=0,this.qt=Md(t)}setConfig(t){this.qt=Md(t),this.Pr()}add(t){var n=(function(l){var c=(function(g){var v=new WeakSet;try{return JSON.stringify(g,((y,b)=>{if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Date)return b.toISOString();if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){if(v.has(b))return"[Circular]";v.add(b)}return b}}))}catch{return}})(l);if(c)try{var u=JSON.parse(c);if(!$t(u))return;var f=u,h=f[Td],p=f[Ad];return!Ot(h)||h.trim().length===0||!Ot(p)&&!Fn(p)?void 0:{step:f,json:c}}catch{return}})(t);if(n){var i=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var c=encodeURIComponent(l),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.qt.max_bytes||(this.Er.push({step:n.step,bytes:i}),this.Mr+=i,this.Pr())}}getAttachable(){return this.Er.map((t=>t.step))}clear(){this.Er=[],this.Mr=0}size(){return this.Er.length}Pr(){for(;this.Mr>this.qt.max_bytes&&this.Er.length>0;){var t=this.Er.shift();t&&(this.Mr-=t.bytes)}}}function MC(e,t){if(!Fn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var C_=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,i={k(l){if(re&&(Xt.DEBUG||De.POSTHOG_DEBUG||n)&&!Se(re.console)&&re.console){for(var c=("__rrweb_original__"in re.console[l])?re.console[l].__rrweb_original__:re.console[l],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("debug",...c)},info(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("log",...c)},warn(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("warn",...c)},error(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("error",...c)},critical(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(l){i.error("You must initialize PostHog before calling "+l)},createLogger:(l,c)=>C_(e+" "+l,c)};return i},je=C_("[PostHog.js]"),Vt=je.createLogger,RC=Vt("[ExternalScriptsLoader]"),kp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return RC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ne==null?void 0:Ne.querySelectorAll("script");if(i){for(var l,c=function(){if(i[u].src===t){var h=i[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;i.length>u;u++)if(l=c())return l.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};De.__PosthogExtensions__=De.__PosthogExtensions__||{},De.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;l=l+"&t="+Math.floor(Date.now()/c)*c}i=e.requestRouter.endpointFor("assets",l)}kp(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");kp(e,u,n)}},De.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);kp(e,i,n)};var E_="$people_distinct_id",Rd="$device_id",Io="__alias",Vo="__timers",Rm="$autocapture_disabled_server_side",Lm="$heatmaps_enabled_server_side",Dm="$exception_capture_enabled_server_side",zm="$error_tracking_suppression_rules",Om="$error_tracking_capture_extension_exceptions",Bm="$web_vitals_enabled_server_side",Ag="$dead_clicks_enabled_server_side",Mg="$product_tours_enabled_server_side",Pm="$web_vitals_allowed_metrics",fa="$session_recording_remote_config",T_="$replay_sample_rate",A_="$replay_override_sampling",M_="$replay_override_linked_flag",R_="$replay_override_url_trigger",L_="$replay_override_event_trigger",xl="$sesid",Rg="$session_is_sampled",da="$enabled_feature_flags",pd="$active_feature_flags",Go="$early_access_features",$m="$feature_flag_details",md="$feature_flag_payloads",Um="$feature_flag_request_id",Pi="$override_feature_flags",hl="$override_feature_flag_payloads",oa="$stored_person_properties",ca="$stored_group_properties",Fm="$surveys",Lg="$surveys_loaded_at",qm="$surveys_activated",Yo="ph_product_tours",Ko="$flag_call_reported",Hm="$flag_call_reported_session_id",Im="$feature_flag_errors",fc="$feature_flag_evaluated_at",Pr="$user_state",Vm="$client_session_props",Gm="$capture_rate_limit",Ym="$initial_campaign_params",Qm="$initial_referrer_info",Ld="$initial_person_info",Dd="$epp",D_="__POSTHOG_TOOLBAR__",Ju="$posthog_cookieless",z_="$sdk_debug_extensions_init_method",O_="$sdk_debug_extensions_init_time_ms",B_="$sdk_debug_recording_script_not_loaded",Wm="PostHog loadExternalDependency extension not found.",ua="on_reject",Fi="always",il="anonymous",sl="identified",Jm="identified_only",zd="visibilitychange",Od="beforeunload",pl="$pageview",jp="$pageleave",Np="$identify",Mb="$groupidentify";function Xu(e,t){Ke(e)&&e.forEach(t)}function Rt(e,t){if(!et(e))if(Ke(e))e.forEach(t);else if(VN(e))e.forEach(((i,l)=>t(i,l)));else for(var n in e)Z5.call(e,n)&&t(e[n],n)}var zt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var l of n)for(var c in l)l[c]!==void 0&&(e[c]=l[c]);return e};function gd(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var Rb=function(e){try{return e()}catch{return}},LC=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(l){je.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),je.critical(l)}}},Dg=function(e){var t={};return Rt(e,(function(n,i){(Ot(n)&&n.length>0||Fn(n))&&(t[i]=n)})),t},DC=["herokuapp.com","vercel.app","netlify.app"];function zC(e){var t=e==null?void 0:e.hostname;if(!Ot(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of DC)if(n===i)return!1;return!0}function Qt(e,t,n,i){var{capture:l=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:l,passive:c})}function P_(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Fn(e)&&isFinite(e)&&Math.floor(e)===e});class Bd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(l)||0>t||0>n||0>i||0>l||t>0xffffffffffff||n>4095||i>1073741823||l>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new Bd(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Bd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class OC{constructor(){this.S=0,this.C=0,this.I=new BC}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Bd.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Lb,$_=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!Se(re.crypto)&&crypto.getRandomValues&&($_=e=>crypto.getRandomValues(e));class BC{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||($_(this.R),this.O=0),this.R[this.O++]}}var Cs=()=>PC().toString(),PC=()=>(Lb||(Lb=new OC)).generate(),To="",$C=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ri={N:()=>!!Ne,D(e){je.error("cookieStore error: "+e)},P(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),i=0;n.length>i;i++){for(var l=n[i];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(ri.P(e))||{}}catch{}return t},A(e,t,n,i,l){if(!Ne)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,k){if(k===void 0&&(k=Ne),To)return To;if(!k||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),j=Math.min(E.length,8),T="dmn_chk_"+Cs();!To&&j--;){var N=E.slice(j).join("."),D=T+"=1;domain=."+N+";path=/";k.cookie=D+";max-age=3",k.cookie.includes(T)&&(k.cookie=D+";max-age=0",To=N)}return To})(g);if(!y){var b=(_=>{var k=_.match($C);return k?k[0]:""})(g);b!==y&&je.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}l&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&je.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,!0}catch{return!1}},q(e,t){if(Ne!=null&&Ne.cookie)try{ri.A(e,"",-1,t)}catch{return}}},Cp=null,Mt={N(){if(!Un(Cp))return Cp;var e=!0;if(Se(re))e=!1;else try{var t="__mplssupport__";Mt.A(t,"xyz"),Mt.P(t)!=='"xyz"'&&(e=!1),Mt.q(t)}catch{e=!1}return e||je.error("localStorage unsupported; falling back to cookie store"),Cp=e,e},D(e){je.error("localStorage error: "+e)},P(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Mt.D(t)}return null},F(e){try{return JSON.parse(Mt.P(e))||{}}catch{}return null},A(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Mt.D(n)}return!1},q(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Mt.D(t)}}},UC=[Rd,"distinct_id",xl,Rg,Dd,Ld,Pr],Zu={},FC={N:()=>!0,D(e){je.error("memoryStorage error: "+e)},P:e=>Zu[e]||null,F:e=>Zu[e]||null,A:(e,t)=>(Zu[e]=t,!0),q(e){delete Zu[e]}},ta=null,An={N(){if(!Un(ta))return ta;if(ta=!0,Se(re))ta=!1;else try{var e="__support__";An.A(e,"xyz"),An.P(e)!=='"xyz"'&&(ta=!1),An.q(e)}catch{ta=!1}return ta},D(e){je.error("sessionStorage error: ",e)},P(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){An.D(t)}return null},F(e){try{return JSON.parse(An.P(e))||null}catch{}return null},A(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){An.D(n)}return!1},q(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){An.D(t)}}};class qC{constructor(t){this._instance=t}get qt(){return this._instance.config}get consent(){return this.Or()?0:this.Lr}isOptedOut(){return this.qt.cookieless_mode===Fi||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===ua}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(t){this.Ar.A(this.Fr,t?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.Ar.q(this.Fr,this.qt.cross_subdomain_cookie)}get Fr(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:i}=this._instance.config;return i||(n?n+t:"__ph_opt_in_out_"+t)}get Lr(){var t=this.Ar.P(this.Fr);return bp(t)?1:Ie(WN,t)?0:-1}get Ar(){var t=this.qt.opt_out_capturing_persistence_type,n=t==="localStorage"?Mt:ri;if(!this.Nr||this.Nr!==n){this.Nr=n;var i=t==="localStorage"?ri:Mt;i.P(this.Fr)&&(this.Nr.P(this.Fr)||this.optInOut(bp(i.P(this.Fr))),i.q(this.Fr,this.qt.cross_subdomain_cookie))}return this.Nr}Or(){return!!this.qt.respect_dnt&&[cr==null?void 0:cr.doNotTrack,cr==null?void 0:cr.msDoNotTrack,De.doNotTrack].some((t=>bp(t)))}}var HC=1,IC=3,VC=11;function Db(e){return e instanceof Element&&(e.id===D_||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ms(e){return!!e&&e.nodeType===HC}function ur(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function U_(e){return!!e&&e.nodeType===IC}function F_(e){return!!e&&e.nodeType===VC&&Ms(e.host)}function zg(e){return e?Xd(e).split(/\s+/):[]}function zb(e){var t=re==null?void 0:re.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function Pd(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return zg(t)}function q_(e){return et(e)?null:Xd(e).split(/(\s+)/).filter((t=>ec(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hc(e){var t="";return Zm(e)&&!G_(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;U_(n)&&n.textContent&&(t+=(i=q_(n.textContent))!==null&&i!==void 0?i:"")})),Xd(t)}function Ep(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Og=["a","button","form","input","select","textarea","label"];function Xm(e,t){if(Se(t))return!0;var n,i=function(c){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(c,u))))return{v:!0}};for(var l of e)if(n=i(l))return n.v;return!1}function H_(e){var t=e.parentNode;return!(!t||!Ms(t))&&t}var GC=[".ph-no-autocapture","[data-ph-no-autocapture]"],I_=["next","previous","prev",">","<"],YC=[...I_,"+","-","−","–"],Ob=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Bb=[".ph-no-rageclick",".ph-no-capture"],QC=["","text","search","email","password","url","tel","number"];function Pb(e,t){if(!re||Bg(e))return!1;var n,i,l,c,u;if(si(t)?(n=!!t&&Bb,i=void 0,l=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Bb,i=t==null?void 0:t.content_ignorelist,l=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||l&&(function(h){return!(!h||!Ms(h))&&(!!ur(h,"textarea")||(ur(h,"input")?Ie(QC,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var{targetElementList:f}=V_(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=I_;else{if(!Ke(h))return!1;if(h.length>10)return je.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Ob(y,_)||Ob(b,_)))}))})(i,f.map((h=>{var p;return{safeText:hc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!Xm(f,n)}var Bg=e=>!e||ur(e,"html")||!Ms(e),V_=(e,t)=>{if(!re||Bg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],l=e;l.parentNode&&!ur(l,"body");)if(F_(l.parentNode))i.push(l.parentNode.host),l=l.parentNode.host;else{var c=H_(l);if(!c)break;if(t||Og.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=re.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}i.push(c),l=c}return{parentIsUsefulElement:n,targetElementList:i}};function Zm(e){for(var t=e;t.parentNode&&!ur(t,"body");t=t.parentNode){var n=Pd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(Pd(e),"ph-include"))return!0;var i=e.type||"";if(Ot(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";return!Ot(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function G_(e){return!!(ur(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ur(e,"select")||ur(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Y_="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",WC=new RegExp("^(?:"+Y_+")$"),JC=new RegExp(Y_),Q_="\\d{3}-?\\d{2}-?\\d{4}",XC=new RegExp("^("+Q_+")$"),ZC=new RegExp("("+Q_+")");function ec(e,t){return t===void 0&&(t=!0),!(et(e)||Ot(e)&&(e=Xd(e),(t?WC:JC).test((e||"").replace(/[- ]/g,""))||(t?XC:ZC).test(e)))}function $b(e){var t=hc(e);return ec(t=(t+" "+W_(e)).trim())?t:""}function W_(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var l=hc(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+W_(n)).trim())}catch(c){je.error("[AutoCapture]",c)}})),t}function Ub(e){return e.replace(/"|\\"/g,'\\"')}function KC(e){var t=e.attr__class;return t?Ke(t)?t:zg(t):void 0}var Ku=Vt("[Dead Clicks]"),e3=()=>!0,t3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Ag)),i=e.instance.config.capture_dead_clicks;return si(i)?i:!!$t(i)||n};class Fb{get lazyLoadedDeadClicksAutocapture(){return this.Dr}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Ag]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.$r((()=>{this.qr()})):this.stop()}$r(t){var n,i;(n=De.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?Ku.error("failed to load script",l):t()}))}qr(){var t;if(Ne){if(!this.Dr&&(t=De.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=$t(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.Dr=De.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Dr.start(Ne),Ku.info("starting...")}}else Ku.error("`document` not found. Cannot start.")}stop(){this.Dr&&(this.Dr.stop(),this.Dr=void 0,Ku.info("stopping..."))}}var Tp=Vt("[SegmentIntegration]"),J_="posthog-js";function X_(e,t){var{organization:n,projectId:i,prefix:l,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,k=((h=f.exception)==null?void 0:h.values)||[],E=k.map((T=>ye({},T,{stacktrace:T.stacktrace?ye({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((N=>ye({},N,{platform:"web:javascript"})))}):void 0}))),j={$exception_message:((p=k[0])==null?void 0:p.value)||f.message,$exception_type:(g=k[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=k[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=k[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&i&&(j.$sentry_url=(l||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(j)),f}}class n3{constructor(t,n,i,l,c,u){this.name=J_,this.setupOnce=function(f){f(X_(t,{organization:n,projectId:i,prefix:l,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class qb{constructor(t){this.jr=(n,i,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(je.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.Br=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Hr()}Hr(){var t;this.Ur=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.jr)}destroy(){var t;(t=this.Ur)==null||t.call(this),this.Ur=void 0}doPageView(t,n){var i,l=this.zr(t,n);return this.Br={pathname:(i=re==null?void 0:re.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.zr(t,(n=this.Br)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Br)==null?void 0:t.pageViewId}}zr(t,n){var i=this.Br;if(!i)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:i.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?ii(f/u,0,1,je):1,b=u>1?ii(h/u,0,1,je):1,_=p>1?ii(g/p,0,1,je):1,k=p>1?ii(v/p,0,1,je):1;l=zt(l,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:k})}}return i.pathname&&(l.$prev_pageview_pathname=i.pathname),i.timestamp&&(l.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),l}}var ed=["flags","surveys"],r3={[E_]:{exposure:"hidden"},[Io]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Vo]:{exposure:"hidden"},[Rm]:{exposure:"event"},[Lm]:{exposure:"hidden"},[Dm]:{exposure:"event"},[zm]:{exposure:"hidden"},[Om]:{exposure:"event"},[Bm]:{exposure:"event"},[Ag]:{exposure:"event"},[Mg]:{exposure:"hidden"},[Pm]:{exposure:"event"},[fa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[xl]:{exposure:"hidden"},[Rg]:{exposure:"event"},[T_]:{exposure:"event",shouldSkipFromEventProperties:e=>Un(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[da]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!$t(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[pd]:{exposure:"event",storageGroup:"flags"},[Go]:{exposure:"hidden"},[$m]:{exposure:"hidden",storageGroup:"flags"},[md]:{exposure:"event",storageGroup:"flags"},[Um]:{exposure:"event",storageGroup:"flags",volatile:!0},[Pi]:{exposure:"event"},[hl]:{exposure:"hidden"},[oa]:{exposure:"hidden"},[ca]:{exposure:"hidden"},[Fm]:{exposure:"hidden",storageGroup:"surveys"},[Lg]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[qm]:{exposure:"event"},[Yo]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ko]:{exposure:"hidden"},[Hm]:{exposure:"hidden"},[Im]:{exposure:"hidden"},[fc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Pr]:{exposure:"hidden"},[Vm]:{exposure:"hidden"},[Gm]:{exposure:"hidden"},[Ym]:{exposure:"hidden"},[Qm]:{exposure:"hidden"},[Ld]:{exposure:"hidden"},[Dd]:{exposure:"hidden"},[A_]:{exposure:"event"},[M_]:{exposure:"event"},[R_]:{exposure:"event"},[L_]:{exposure:"event"},[z_]:{exposure:"event"},[O_]:{exposure:"event"},[B_]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},i3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],na=e=>{var t=r3[e];if(t)return t;for(var[n,i]of i3)if(e.indexOf(n)===0)return i},$d=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Se(t)?null:(t.href=e,t)},pc=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;i.length>l;l++){var c=i[l].split("=");if(c[0]===t){n=c;break}}if(!Ke(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{je.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},mc=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),l=i[1],c=(i[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");Ke(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),l!=null&&(y+="#"+l),y},Ud=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},td="https?://(.*)",jl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],s3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...jl],gc="<masked>",a3=["li_fat_id"];function Z_(e,t,n){if(!Ne)return{};var i,l=t?[...jl,...n||[]]:[],c=K_(mc(Ne.URL,l,gc),e),u=(i={},Rt(a3,(function(f){var h=ri.P(f);i[f]=h||null})),i);return zt(u,c)}function K_(e,t){var n=s3.concat(t||[]),i={};return Rt(n,(function(l){var c=pc(e,l);i[l]=c||null})),i}function ew(e){var t=(function(c){return c?c.search(td+"google.([^/?]*)")===0?"google":c.search(td+"bing.com")===0?"bing":c.search(td+"yahoo.com")===0?"yahoo":c.search(td+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Un(t)){i.$search_engine=t;var l=Ne?pc(Ne.referrer,n):"";l.length&&(i.ph_keyword=l)}return i}function Hb(){return navigator.language||navigator.userLanguage}var Fd="$direct";function tw(){return(Ne==null?void 0:Ne.referrer)||Fd}function nw(e,t){var n=e?[...jl,...t||[]]:[],i=Tn==null?void 0:Tn.href.substring(0,1e3);return{r:tw().substring(0,1e3),u:i?mc(i,n,gc):void 0}}function rw(e){var t,{r:n,u:i}=e,l={$referrer:n,$referring_domain:n==null?void 0:n==Fd?Fd:(t=$d(n))==null?void 0:t.host};if(i){l.$current_url=i;var c=$d(i);l.$host=c==null?void 0:c.host,l.$pathname=c==null?void 0:c.pathname;var u=K_(i);zt(l,u)}if(n){var f=ew(n);zt(l,f)}return l}function iw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function l3(){try{return new Date().getTimezoneOffset()}catch{return}}var o3={flags:fc,surveys:Lg},c3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],al="main";class Ap{constructor(t,n,i){if(i===void 0&&(i=!0),this.Vr={},this.Wr=!1,this.Gr=!1,this.qt=t,this.Zr=i,this.props={},this.Qr=!1,this.Jr=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.Ar=this.Kr(t),this.Gr=this.Yr(t),this.load(),t.debug&&je.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),re){var l=()=>this.flush();Qt(re,"beforeunload",l,{capture:!1}),Qt(re,"pagehide",l,{capture:!1})}}Xr(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return Fn(n)&&n>0?n:0}isDisabled(){return!!this.ei}Kr(t){c3.indexOf(t.persistence.toLowerCase())===-1&&(je.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,i=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...UC,...u];return ye({},Mt,{F(p){try{var g={};try{g=ri.F(p)||{}}catch{}var v,y=JSON.parse(Mt.P(p)||"{}");if(f){var b={};for(var _ in g){var k=g[_];Un(k)||k===""||(b[_]=k)}v=zt(y,b)}else v=zt(g,y);return Mt.A(p,v),v}catch{}return null},A(p,g,v,y,b,_){var k=Mt.A(p,g,void 0,void 0,_);try{var E={};h.forEach((j=>{g[j]&&(E[j]=g[j])})),Object.keys(E).length&&ri.A(p,E,v,y,b,_)}catch(j){Mt.D(j)}return k},q(p,g){try{re==null||re.localStorage.removeItem(p),ri.q(p,g)}catch(v){Mt.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Mt.N()?(n=Mt,l=!0):c==="localstorage+cookie"&&i.N()?(n=i,l=!0):c==="sessionstorage"&&An.N()?n=An:c==="memory"?n=FC:c==="cookie"?n=ri:i.N()?(n=i,l=!0):n=ri,this.Wr=l,n}ti(t){return this.Jr+"__"+t}Yr(t){return this.Wr&&!!t.split_storage}ri(t){var n=t??this.qt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[fc];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Rt(this.props,((n,i)=>{var l=na(i);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,i===da?()=>this.ri():()=>!1))return;l.transformToEventProperties&&zt(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[i]=n}})),t}load(){if(!this.ei){var t=this.Ar.F(this.Jr);t&&(this.props=zt({},t)),this.Gr&&this.ii()}}ii(){for(var t of ed){var n=Mt.F(this.ti(t));if(n&&!Es(n)){var i=this.ni(t);i.persisted=!0,this.si(t)||(i.fingerprint=this.oi(n,t)),this.ai(t,n)||zt(this.props,n)}}}si(t){return Object.keys(this.props).some((n=>{var i;return((i=na(n))==null?void 0:i.storageGroup)===t}))}ai(t,n){var i=o3[t];if(!i)return!1;var l=n[i],c=this.props[i];return Fn(l)&&Fn(c)&&c>l}refreshKey(t){var n;if(!this.ei){var i=this.Gr?(n=na(t))==null?void 0:n.storageGroup:void 0,l=i?Mt.F(this.ti(i)):this.Ar.F(this.Jr);if(l&&t in l)this.li(t,l[t]);else{if(i){var c=this.Ar.F(this.Jr);if(c&&t in c)return void this.li(t,c[t])}this.ui(t)}}}save(){if(!this.ei){var t=this.Xr();t>0?Se(this.hi)&&(this.hi=setTimeout((()=>{this.hi=void 0,this.ci()}),t)):this.ci()}}flush(){Se(this.hi)||(clearTimeout(this.hi),this.hi=void 0,this.ci())}ci(){this.ei||(this.Gr?this.di():this.vi(this.Ar,this.Jr,this.props,al))}di(){var{main:t,groups:n}=this.fi();for(var i of(this.vi(this.Ar,this.Jr,t,al),ed)){var l,c=n[i];(!Es(c)||(l=this.Vr[i])!=null&&l.persisted)&&this.vi(Mt,this.ti(i),c,i)}}fi(){var t={},n={};for(var i of ed)n[i]={};return Rt(this.props,((l,c)=>{var u,f=(u=na(c))==null?void 0:u.storageGroup;f?n[f][c]=l:t[c]=l})),{main:t,groups:n}}oi(t,n){if(n===al)return JSON.stringify(t)+"|"+this.pi+"|"+this.gi+"|"+this.mi;var i={};return Rt(t,((l,c)=>{var u;i[c]=(u=na(c))!=null&&u.volatile?"__volatile__":l})),JSON.stringify(i)}vi(t,n,i,l){var c=this.ni(l);if(l===al||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.oi(i,l))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.A(n,i,this.pi,this.gi,this.mi,this.qt.debug)?(c.dirty=!1,l!==al&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.qt.debug&&je.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.hi)||(clearTimeout(this.hi),this.hi=void 0),this.Ar.q(this.Jr,!1),this.Ar.q(this.Jr,!0),!n&&this.Zr)for(var i of ed)Mt.q(this.ti(i));n?delete this.Vr[al]:this.Vr={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if($t(t)){Se(n)&&(n="None"),this.pi=Se(i)?this.yi:i;var l=!1;if(Rt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.li(u,c),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if($t(t)){this.pi=Se(n)?this.yi:n;var i=!1;if(Rt(t,((l,c)=>{t.hasOwnProperty(c)&&this.props[c]!==l&&(this.li(c,l),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.ui(t),this.save())}update_campaign_params(){if(!this.Qr){var t=Z_(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);Es(Dg(t))||this.register(t),this.Qr=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?ew(t):{})}update_referrer_info(){var t;this.register_once({$referrer:tw(),$referring_domain:Ne!=null&&Ne.referrer&&((t=$d(Ne.referrer))==null?void 0:t.host)||Fd},void 0)}set_initial_person_info(){this.props[Ym]||this.props[Qm]||this.register_once({[Ld]:nw(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Rt([Qm,Ym],(u=>{var f=this.props[u];f&&Rt(f,(function(h,p){t["$initial_"+jm(p)]=h}))}));var n,i,l=this.props[Ld];if(l){var c=(n=rw(l),i={},Rt(n,(function(u,f){i["$initial_"+jm(f)]=u})),i);zt(t,c)}return t}safe_merge(t){return Rt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){this.yi=this.pi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=l?this.Kr(t):this.Ar,u=this.Yr(t);if(l||u!==this.Gr){var f=this.props;this.clear(),this.Ar=c,this.Gr=u,this.props=f,this.save()}}set_disabled(t){this.ei=t,this.ei?this.remove():this.save()}set_cross_subdomain(t){t!==this.gi&&(this.gi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.mi&&(this.mi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[Vo]||{};i[t]=n,this.li(Vo,i),this.save()}remove_event_timer(t){var n=this.props[Vo]||{},i=n[t];return Se(i)||(delete n[t],this.li(Vo,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.li(t,n),this.save()}li(t,n){var i;this.props[t]=n,(i=na(t))!=null&&i.volatile||this.bi(t)}ui(t){delete this.props[t],this.bi(t)}bi(t){var n,i=(n=na(t))==null?void 0:n.storageGroup;i&&(this.ni(i).dirty=!0)}ni(t){return this.Vr[t]||(this.Vr[t]={})}}var Ao={Activation:"events",Cancellation:"cancelEvents"},Mp={Popover:"popover",API:"api",Widget:"widget"},u3={Always:"always"},qi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Rp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Km={Popover:"popover",Inline:"inline"},d3={SHOWN:"product tour shown"},Ib={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Vb=Vt("[RateLimiter]");class f3{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((l=>{Vb.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Vb.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,i,l;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(Gm))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property(Gm,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Mo=Vt("[RemoteConfig]");class sw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=De._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}wi(t){var n,i;(n=De.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}xi(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return Mo.info("Using preloaded remote config",this.remoteConfig),this.ki(this.remoteConfig),void this.Si();if(this._instance.Ci())return void Mo.warn("Remote config is disabled. Falling back to local config.");this.wi((t=>{if(!t)return Mo.info("No config found after loading remote JS config. Falling back to JSON."),void this.xi((n=>{this.ki(n),this.Si()}));this.ki(t),this.Si()}))}catch(t){Mo.error("Error loading remote config",t)}}stop(){this.Ii&&(clearInterval(this.Ii),this.Ii=void 0)}refresh(){!this._instance.Ci()&&Ne&&Ne.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Si(){var t;if(!this.Ii){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.Ii=setInterval((()=>{this.refresh()}),n))}}ki(t){var n;t||Mo.error("Failed to fetch remote config from PostHog."),this._instance.ki(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var ni={GZipJS:"gzip-js",Base64:"base64"},Ar=Uint8Array,Xn=Uint16Array,Nl=Uint32Array,Pg=new Ar([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$g=new Ar([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Gb=new Ar([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),aw=function(e,t){for(var n=new Xn(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var l=new Nl(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)l[c]=c-n[i]<<5|i;return[n,l]},lw=aw(Pg,2),eg=lw[1];lw[0][28]=258,eg[258]=28;for(var Yb=aw($g,0)[1],ow=new Xn(32768),Ut=0;32768>Ut;++Ut){var ll=(43690&Ut)>>>1|(21845&Ut)<<1;ow[Ut]=((65280&(ll=(61680&(ll=(52428&ll)>>>2|(13107&ll)<<2))>>>4|(3855&ll)<<4))>>>8|(255&ll)<<8)>>>1}var tc=function(e,t,n){for(var i=e.length,l=0,c=new Xn(t);i>l;++l)++c[e[l]-1];var u,f=new Xn(t);for(l=0;t>l;++l)f[l]=f[l-1]+c[l-1]<<1;for(u=new Xn(i),l=0;i>l;++l)u[l]=ow[f[e[l]-1]++]>>>15-e[l];return u},ma=new Ar(288);for(Ut=0;144>Ut;++Ut)ma[Ut]=8;for(Ut=144;256>Ut;++Ut)ma[Ut]=9;for(Ut=256;280>Ut;++Ut)ma[Ut]=7;for(Ut=280;288>Ut;++Ut)ma[Ut]=8;var qd=new Ar(32);for(Ut=0;32>Ut;++Ut)qd[Ut]=5;var h3=tc(ma,9),p3=tc(qd,5),cw=function(e){return(e/8>>0)+(7&e&&1)},uw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof Xn?Xn:e instanceof Nl?Nl:Ar)(n-t);return i.set(e.subarray(t,n)),i},Ri=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Ro=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Lp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var l=n.length,c=n.slice();if(!l)return[new Ar(0),0];if(l==1){var u=new Ar(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(z,L){return z.f-L.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=l-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(i=1;l>i;++i)c[i].s>y&&(y=c[i].s);var b=new Xn(y+1),_=tg(n[g-1],b,0);if(_>t){i=0;var k=0,E=_-t,j=1<<E;for(c.sort((function(z,L){return b[L.s]-b[z.s]||z.f-L.f}));l>i;++i){var T=c[i].s;if(t>=b[T])break;k+=j-(1<<_-b[T]),b[T]=t}for(k>>>=E;k>0;){var N=c[i].s;t>b[N]?k-=1<<t-b[N]++-1:++i}for(;i>=0&&k;--i){var D=c[i].s;b[D]==t&&(--b[D],++k)}_=t}return[new Ar(b),_]},tg=function(e,t,n){return e.s==-1?Math.max(tg(e.l,t,n+1),tg(e.r,t,n+1)):t[e.s]=n},Qb=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Xn(++t),i=0,l=e[0],c=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==l&&f!=t)++c;else{if(!l&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(l),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(l);c=1,l=e[f]}return[n.subarray(0,i),t]},Lo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},ng=function(e,t,n){var i=n.length,l=cw(t+2);e[l]=255&i,e[l+1]=i>>>8,e[l+2]=255^e[l],e[l+3]=255^e[l+1];for(var c=0;i>c;++c)e[l+c+4]=n[c];return 8*(l+4+i)},Wb=function(e,t,n,i,l,c,u,f,h,p,g){Ri(t,g++,n),++l[256];for(var v=Lp(l,15),y=v[0],b=v[1],_=Lp(c,15),k=_[0],E=_[1],j=Qb(y),T=j[0],N=j[1],D=Qb(k),z=D[0],L=D[1],H=new Xn(19),U=0;T.length>U;++U)H[31&T[U]]++;for(U=0;z.length>U;++U)H[31&z[U]]++;for(var V=Lp(H,7),O=V[0],F=V[1],A=19;A>4&&!O[Gb[A-1]];--A);var ae,X,I,$,P=p+5<<3,ie=Lo(l,ma)+Lo(c,qd)+u,me=Lo(l,y)+Lo(c,k)+u+14+3*A+Lo(H,O)+(2*H[16]+3*H[17]+7*H[18]);if(ie>=P&&me>=P)return ng(t,g,e.subarray(h,h+p));if(Ri(t,g,1+(ie>me)),g+=2,ie>me){ae=tc(y,b),X=y,I=tc(k,E),$=k;var R=tc(O,F);for(Ri(t,g,N-257),Ri(t,g+5,L-1),Ri(t,g+10,A-4),g+=14,U=0;A>U;++U)Ri(t,g+3*U,O[Gb[U]]);g+=3*A;for(var B=[T,z],Z=0;2>Z;++Z){var M=B[Z];for(U=0;M.length>U;++U)Ri(t,g,R[pe=31&M[U]]),g+=O[pe],pe>15&&(Ri(t,g,M[U]>>>5&127),g+=M[U]>>>12)}}else ae=h3,X=ma,I=p3,$=qd;for(U=0;f>U;++U)if(i[U]>255){var pe;Ro(t,g,ae[257+(pe=i[U]>>>18&31)]),g+=X[pe+257],pe>7&&(Ri(t,g,i[U]>>>23&31),g+=Pg[pe]);var _e=31&i[U];Ro(t,g,I[_e]),g+=$[_e],_e>3&&(Ro(t,g,i[U]>>>5&8191),g+=$g[_e])}else Ro(t,g,ae[i[U]]),g+=X[i[U]];return Ro(t,g,ae[256]),g+X[256]},m3=new Nl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),g3=(function(){for(var e=new Nl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Dp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function x3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=g3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var l,c,u,f,h,p=(f=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(v,y,b,_,k,E){var j=v.length,T=new Ar(_+j+5*(1+Math.floor(j/7e3))+k),N=T.subarray(_,T.length-k),D=0;if(!y||8>j)for(var z=0;j>=z;z+=65535){var L=z+65535;j>L?D=ng(N,D,v.subarray(z,L)):(N[z]=!0,D=ng(N,D,v.subarray(z,j)))}else{for(var H=m3[y-1],U=H>>>13,V=8191&H,O=(1<<b)-1,F=new Xn(32768),A=new Xn(O+1),ae=Math.ceil(b/3),X=2*ae,I=function(st){return(v[st]^v[st+1]<<ae^v[st+2]<<X)&O},$=new Nl(25e3),P=new Xn(288),ie=new Xn(32),me=0,R=0,B=(z=0,0),Z=0,M=0;j>z;++z){var pe=I(z),_e=32767&z,Ce=A[pe];if(F[_e]=Ce,A[pe]=_e,z>=Z){var Te=j-z;if((me>7e3||B>24576)&&Te>423){D=Wb(v,N,0,$,P,ie,R,B,M,z-M,D),B=me=R=0,M=z;for(var Le=0;286>Le;++Le)P[Le]=0;for(Le=0;30>Le;++Le)ie[Le]=0}var Pe=2,rt=0,be=V,ze=_e-Ce&32767;if(Te>2&&pe==I(z-ze))for(var gt=Math.min(U,Te)-1,Ft=Math.min(32767,z),Dt=Math.min(258,Te);Ft>=ze&&--be&&_e!=Ce;){if(v[z+Pe]==v[z+Pe-ze]){for(var kt=0;Dt>kt&&v[z+kt]==v[z+kt-ze];++kt);if(kt>Pe){if(Pe=kt,rt=ze,kt>gt)break;var fn=Math.min(ze,kt-2),it=0;for(Le=0;fn>Le;++Le){var xn=z-ze+Le+32768&32767,hn=xn-F[xn]+32768&32767;hn>it&&(it=hn,Ce=xn)}}}ze+=(_e=Ce)-(Ce=F[_e])+32768&32767}if(rt){$[B++]=268435456|eg[Pe]<<18|Yb[rt];var ke=31&eg[Pe],Oe=31&Yb[rt];R+=Pg[ke]+$g[Oe],++P[257+ke],++ie[Oe],Z=z+Pe,++me}else $[B++]=v[z],++P[v[z]]}}D=Wb(v,N,!0,$,P,ie,R,B,M,z-M,D)}return uw(T,0,_+cw(D)+k)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&Dp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),Dp(p,g-8,n.d()),Dp(p,g-4,i),p}var v3=!!wm||!!_m,dw="text/plain",xd=!1,b3=(e,t)=>{var[n,i]=e.split("#"),[l,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return l+(u?"?"+u:"")+(i?"#"+i:"")},Kd=function(e,t,n){var i;n===void 0&&(n=!0);var[l,c]=e.split("?"),u=ye({},t),f=(i=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&i!==void 0?i:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return Rt(p,(function(_,k){Se(_)||Se(k)||k==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(k),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),l+"?"+f.join("&")},vl=(e,t)=>JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t),Jb=e=>{if(e.Rr)return e.Rr;var{data:t,compression:n}=e;if(t){if(n===ni.GZipJS){var i=x3((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Ar(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new Ar(v+8+(p-b<<1));_.set(g),g=_}var k=f.charCodeAt(b);128>k?y(k):2048>k?(y(192|k>>>6),y(128|63&k)):k>55295&&57344>k?(y(240|(k=65536+(1047552&k)|1023&f.charCodeAt(++b))>>>18),y(128|k>>>12&63),y(128|k>>>6&63),y(128|63&k)):(y(224|k>>>12),y(128|k>>>6&63),y(128|63&k))}return uw(g,0,v)})(vl(t)),{mtime:0});return{contentType:dw,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===ni.Base64){var l=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(vl(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:vl(f)))(l);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=vl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},zp=e=>{var t,n,i,l=Jb(e);return!l||(n=e.compression,i=pc(e.url,"compression"),n!==Sb.GZipJS&&i!==Sb.GZipJS&&i!=="gzip")||((t=l.body)instanceof ArrayBuffer?Sm(new Uint8Array(t)):ArrayBuffer.isView(t)&&Sm(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:l}:(xd=!0,{url:b3(e.url,"compression"),encodedBody:Jb(ye({},e,{compression:void 0,Rr:void 0}))})},y3=(function(){var e=wn((function*(t){var n=vl(t.data),i=yield(function(c,u,f){return km.apply(this,arguments)})(n,Xt.DEBUG,{rethrow:!0});if(!i)return t;var l=yield i.arrayBuffer();return ye({},t,{Rr:{contentType:dw,body:l,estimatedSize:l.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),Xb=(e,t)=>Kd(e,{_:new Date().getTime().toString(),ver:Xt.JS_SDK_VERSION,compression:t}),vd=[];_m&&vd.push({transport:"fetch",method(e){var t,{url:n,encodedBody:i}=zp(e),{contentType:l,body:c,estimatedSize:u}=i??{},f=new Headers;Rt(e.headers,(function(g,v){f.append(v,g)})),l&&f.append("Content-Type",l);var h=null;if(yb){var p=new yb;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}_m(n,ye({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&52428.8>(u||0),body:c,signal:(t=h)==null?void 0:t.signal},e.fetchOptions)).then((g=>g.text().then((v=>{var y={statusCode:g.status,text:v};if(g.status===200)try{y.json=JSON.parse(v)}catch(b){je.error(b)}e.callback==null||e.callback(y)})))).catch((g=>{je.error(g),e.callback==null||e.callback({statusCode:0,error:g})})).finally((()=>h?clearTimeout(h.timeout):null))}}),wm&&vd.push({transport:"XHR",method(e){var t=new wm,{url:n,encodedBody:i}=zp(e);t.open(e.method||"GET",n,!0);var{contentType:l,body:c}=i??{};Rt(e.headers,(function(u,f){t.setRequestHeader(f,u)})),l&&t.setRequestHeader("Content-Type",l),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var u={statusCode:t.status,text:t.responseText};if(t.status===200)try{u.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(u)}},t.send(c)}}),cr!=null&&cr.sendBeacon&&vd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=zp(e),i=Kd(t,{beacon:"1"}),{contentType:l,body:c}=n??{};if(!c)return;var u=c instanceof Blob?c:new Blob([c],{type:l});cr.sendBeacon(i,u)}catch{}}});var rg=3e3;class _3{constructor(t,n){this.Ti=!0,this.Ei=[],this.Mi=ii((n==null?void 0:n.flush_interval_ms)||rg,250,5e3,je.createLogger("flush interval"),rg),this.Pi=t}enqueue(t){this.Ei.push(t),this.Ri||this.Oi()}unload(){this.Li();var t=this.Ei.length>0?this.Ai():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Pi(ye({},i,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Oi()}Oi(){var t=this;this.Ti||(this.Ri=setTimeout((()=>{if(this.Li(),this.Ei.length>0){var n=this.Ai(),i=function(){var c=n[l],u=new Date().getTime();c.data&&Ke(c.data)&&Rt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Pi(c)};for(var l in n)i()}}),this.Mi))}Li(){clearTimeout(this.Ri),this.Ri=void 0}Ai(){var t={};return Rt(this.Ei,(n=>{var i,l=n,c=(l?l.batchKey:null)||l.url;Se(t[c])&&(t[c]=ye({},l,{data:[]})),(i=t[c].data)==null||i.push(l.data)})),this.Ei=[],t}}var w3=["retriesPerformedSoFar"];class S3{constructor(t){this.Fi=!1,this.Ni=3e3,this.Ei=[],this._instance=t,this.Ei=[],this.Di=!0,!Se(re)&&"onLine"in re.navigator&&(this.Di=re.navigator.onLine,this.$i=()=>{this.Di=!0,this.qi()},this.ji=()=>{this.Di=!1},Qt(re,"online",this.$i),Qt(re,"offline",this.ji))}get length(){return this.Ei.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,i=W5(t,w3);Bi(n)&&(i.url=Kd(i.url,{retry_count:n})),this._instance._send_request(ye({},i,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.yr(ye({retriesPerformedSoFar:n},i));l.statusCode===0&&je.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}i.callback==null||i.callback(l)}}))}yr(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),l=Date.now()+i;this.Ei.push({retryAt:l,requestOptions:t});var c="Enqueued failed request for retry in "+i;navigator.onLine||(c+=" (Browser is offline)"),je.warn(c),this.Fi||(this.Fi=!0,this.Bi())}Bi(){if(this.Hi&&clearTimeout(this.Hi),this.Ei.length===0)return this.Fi=!1,void(this.Hi=void 0);this.Hi=setTimeout((()=>{this.Di&&this.Ei.length>0&&this.qi(),this.Bi()}),this.Ni)}qi(){var t=Date.now(),n=[],i=this.Ei.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Ei=n,i.length>0)for(var{requestOptions:l}of i)this.retriableRequest(l)}unload(){for(var{requestOptions:t}of(this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0),this.Fi=!1,Se(re)||(this.$i&&(re.removeEventListener("online",this.$i),this.$i=void 0),this.ji&&(re.removeEventListener("offline",this.ji),this.ji=void 0)),this.Ei))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){je.error(n)}this.Ei=[]}}class k3{constructor(t){this.Ui=()=>{var n,i,l,c;this.zi||(this.zi={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.zi.lastScrollY=Math.ceil(f),this.zi.maxScrollY=Math.max(f,(n=this.zi.maxScrollY)!==null&&n!==void 0?n:0),this.zi.maxScrollHeight=Math.max(h,(i=this.zi.maxScrollHeight)!==null&&i!==void 0?i:0),this.zi.lastContentY=p,this.zi.maxContentY=Math.max(p,(l=this.zi.maxContentY)!==null&&l!==void 0?l:0),this.zi.maxContentHeight=Math.max(g,(c=this.zi.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get Vi(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var t=this.zi;return setTimeout(this.Ui,0),t}startMeasuringScrollPosition(){Qt(re,"scroll",this.Ui,{capture:!0}),Qt(re,"scrollend",this.Ui,{capture:!0}),Qt(re,"resize",this.Ui)}scrollElement(){if(!this.Vi)return re==null?void 0:re.document.documentElement;var t=Ke(this.Vi)?this.Vi:[this.Vi];for(var n of t){var i=re==null?void 0:re.document.querySelector(n);if(i)return i}}Wi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.Vi){var i=this.scrollElement();return i&&i[n]||0}return re?t==="y"?re.scrollY||re.pageYOffset||re.document.documentElement.scrollTop||0:re.scrollX||re.pageXOffset||re.document.documentElement.scrollLeft||0:0}scrollY(){return this.Wi("y")}scrollX(){return this.Wi("x")}}var j3=e=>nw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class Zb{constructor(t,n,i,l){this.Gi=c=>{var u=this.Zi();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Qi(this._instance)};this.Ji.register({[Vm]:f})}},this._instance=t,this.Ki=n,this.Ji=i,this.Qi=l||j3,this.Ki.onSessionId(this.Gi)}Zi(){return this.Ji.props[Vm]}getSetOnceProps(){var t,n=(t=this.Zi())==null?void 0:t.props;return n?"r"in n?rw(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Rt(Dg(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+jm(i)]=n})),t}}class Ug{constructor(){this.Yi={}}on(t,n){return this.Yi[t]||(this.Yi[t]=[]),this.Yi[t].push(n),()=>{this.Yi[t]=this.Yi[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Yi[t]||[])i(n);for(var l of this.Yi["*"]||[])l(t,n)}}var Do=Vt("[SessionId]");class Kb{on(t,n){return this.Xi.on(t,n)}constructor(t,n,i){var l;if(this.en=null,this.tn=[],this.rn=void 0,this.nn=!1,this.Xi=new Ug,this.sn=(p,g)=>!(!Bi(p)||!Bi(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Fi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.Ji=t.persistence,this.an=void 0,this.ln=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.un=n||Cs,this.hn=i||Cs;var c=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*ii(this.qt.session_idle_timeout_seconds||1800,60,36e3,Do.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.cn(),this.dn="ph_"+c+"_window_id",this.vn="ph_"+c+"_primary_window_exists",this.fn()){var u=An.F(this.dn),f=An.F(this.vn);u&&!f?this.an=u:An.q(this.dn),An.A(this.vn,!0)}if((l=this.qt.bootstrap)!=null&&l.sessionID)try{var h=(p=>{var g=this.qt.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.pn(this.qt.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Do.error("Invalid sessionID in bootstrap",p)}this.gn()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.tn)&&(this.tn=[]),this.tn.push(t),this.ln&&t(this.ln,this.an),()=>{this.tn=this.tn.filter((n=>n!==t))}}fn(){return this.qt.persistence!=="memory"&&!this.Ji.ei&&An.N()}mn(t){t!==this.an&&(this.an=t,this.fn()&&An.A(this.dn,t))}yn(){return this.an?this.an:this.fn()?An.F(this.dn):null}bn(t){var n=this.en;return!Un(n)&&!Un(t)&&5e3>Math.abs(t-n)}pn(t,n,i){var l=n!==this._sessionActivityTimestamp,c=!(t!==this.ln||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.ln=t,c&&!l||c&&this.bn(n)||(this.en=n,this.Ji.register({[xl]:[n,t,i]}))}_n(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return Bi(n)&&n>0}wn(){this._n()?this.Ji.refreshKey(xl):(this.Ji.flush(),this.Ji.load())}xn(){var t;if(!Un(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.en){this.wn();var[,n,i]=this.kn();n===this.ln&&i===this._sessionStartTimestamp&&(this.en=this._sessionActivityTimestamp,this.Ji.register({[xl]:[this._sessionActivityTimestamp,(t=this.ln)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ji.flush())}}Sn(){var[t]=this.kn(),n=Bi(t)?t:0,i=Bi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}Cn(t){return this.wn(),this.sn(t,this.Sn())}kn(){var t=this.Ji.props[xl];return Ke(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.en=null,clearTimeout(this.In),this.In=void 0,this.pn(null,null,null)}destroy(){this.nn=!0,this.xn(),clearTimeout(this.In),this.In=void 0,this.rn&&re&&(re.removeEventListener(Od,this.rn,{capture:!1}),this.rn=void 0),this.tn=[]}gn(){this.rn=()=>{this.xn(),this.fn()&&An.q(this.vn)},Qt(re,Od,this.rn,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.qt.cookieless_mode===Fi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),[,l,c]=this.kn(),u=this.Sn(),f=this.yn(),h=Bi(c)&&Math.abs(i-c)>864e5,p=!1,g=!1,v=!l,y=l,b=!v&&!t&&this.sn(i,u);b&&((b=this.Cn(i))||Do.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,c]=this.kn()),v||b||h?(l=this.un(),f=this.hn(),Do.info("new session ID generated",{sessionId:l,windowId:f,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),c=i,p=!0):(f||(f=this.hn(),p=!0),(g=l!==y)&&(Do.info("adopted cross-tab session id",{sessionId:l,windowId:f}),p=!0));var _=Bi(u)&&t&&!h?u:i,k=Bi(c)?c:new Date().getTime();this.mn(f),this.pn(l,_,k),t||this.cn();var E={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:g};return p&&this.tn.forEach((j=>j(l,f,E))),{sessionId:l,windowId:f,sessionStartTimestamp:k,changeReason:p?E:void 0,lastActivityTimestamp:u}}cn(){this.nn||(clearTimeout(this.In),this.In=setTimeout((()=>{if(!this.nn)if(this.Cn(new Date().getTime())){var t=this.ln;this.resetSessionId(),this.Xi.emit("forcedIdleReset",{idleSessionId:t})}else this.cn()}),1.1*this.sessionTimeoutMs))}}var fw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&jb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((l=>jb(l==null?void 0:l.brand,t))))return!0}catch{}return!!e.webdriver},Hd=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function ey(e,t,n){return vl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var hw={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>Hd(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!Hd(n,i))))),icontains:(e,t)=>t.map(nd).some((n=>e.map(nd).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(nd).every((n=>e.map(nd).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i>parseFloat(l)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i<parseFloat(l)))}))},nd=e=>e.toLowerCase();function pw(e,t){return!e||Object.entries(e).every((n=>{var[i,l]=n,c=t==null?void 0:t[i];if(Se(c)||Un(c))return!1;var u=[String(c)],f=hw[l.operator];return!!f&&f(l.values,u)}))}var ig="custom",ty="i.posthog.com",N3=/^\/static\//;class C3{constructor(t){this.Tn={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+ty,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Tn[this.apiHost]||(this.Tn[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ig),this.Tn[this.apiHost]}En(t){if(N3.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var i=this.En(n);if(i)return""+i+n}if(this.region===ig)return this.apiHost+n;var l=ty+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}var Et=Vt("[Surveys]"),sg="seenSurvey_",E3=[Mp.Popover,Mp.Widget,Mp.API],T3={ignoreConditions:!1,ignoreDelay:!1,displayType:Km.Popover},A3=Vt("[PostHog ExternalIntegrations]"),M3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class R3{constructor(t){this._instance=t}$r(t,n){var i;(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(l=>{if(l)return A3.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!l||(f=De.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.$r(M3[u],(()=>{var g;(g=De.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!l&&(h=De.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=De.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[i,l]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(i)}}}var ol,nc={},Op=0,ag=()=>{},ny='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',zo="Surveys module not available",ry="sanitize_properties is deprecated. Use before_send instead",mw="Invalid value for property_denylist config: ",ml="posthog",gw=!v3&&(Jn==null?void 0:Jn.indexOf("MSIE"))===-1&&(Jn==null?void 0:Jn.indexOf("Mozilla"))===-1,iy=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zC(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ag,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Tn&&Ot(Tn==null?void 0:Tn.search)&&Tn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){je.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Jm,before_send:void 0,request_queue_config:{flush_interval_ms:rg},error_tracking:{},_onCapture:ag},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:YC,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n)}))(e))},L3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],sy=e=>{var t={};for(var[n,i]of L3)Se(e[n])||(t[i]=e[n]);var l=zt({},t,e),c=e.__preview_external_dependency_versioned_paths;return Se(c)||(Se(e.strict_script_versioning)&&(l.strict_script_versioning=!!c),Ot(c)&&Se(e.asset_host)&&(l.asset_host=c)),Ke(e.property_blacklist)&&(Se(e.property_denylist)?l.property_denylist=e.property_blacklist:Ke(e.property_denylist)?l.property_denylist=[...e.property_blacklist,...e.property_denylist]:je.error(mw+e.property_denylist)),l};class D3{constructor(){this.__forceAllowLocalhost=!1}get Mn(){return this.__forceAllowLocalhost}set Mn(t){je.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Er{Pn(t,n){if(t){var i=this.Rn.indexOf(t);i!==-1&&this.Rn.splice(i,1)}return this.Rn.push(n),n.initialize==null||n.initialize(),n}On(){return this.config.cookieless_mode===Fi||this.config.cookieless_mode===ua&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new D3,this.Ln=!1,this.version=Xt.LIB_VERSION,this.An=new Ug,this.Rn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=iy(),this.SentryIntegration=n3,this.sentryIntegration=i=>(function(l,c){var u=X_(l,c);return{name:J_,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fn=!1,this.Nn=null,this.Dn=null,this.$n=null,this.scrollManager=new k3(this),this.pageViewManager=new qb(this),this.rateLimiter=new f3(this),this.requestRouter=new C3(this),this.consent=new qC(this),this.externalIntegrations=new R3(this);var n=(t=Er.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,l,c)=>{var u=Ot(i)?{[i]:l}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,l,c)=>{var u=Ot(i)?{[i]:l}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(i=>je.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==ml){var l,c=(l=nc[i])!==null&&l!==void 0?l:new Er;return c._init(t,n,i),nc[i]=c,nc[ml][i]=c,c}return this._init(t,n,i)}_init(t,n,i){var l,c;n===void 0&&(n={});var u=Ot(t)?t.trim():"";if(!u)return je.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.qn(n.debug),this.jn=n,this.Bn=[],n.person_profiles?this.Dn=n.person_profiles:n.process_person&&(this.Dn=n.process_person);var f=iy(n.defaults),h=sy(n),p=zt({},f,h,{name:i,token:u});$t(f.rageclick)&&$t(h.rageclick)&&(p.rageclick=zt({},f.rageclick,h.rageclick)),$t(f.session_recording)&&$t(h.session_recording)&&(p.session_recording=zt({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&je.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ni.GZipJS;var g=this.Hn();this.persistence=new Ap(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ap(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Un=new _3((D=>this.zn(D)),this.config.request_queue_config),this.Vn=new S3(this),this.__request_queue=[];var b=this.On();if(b||(this.sessionManager=new Kb(this),this.sessionPropsManager=new Zb(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(je.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Wn(b)}),0)):(je.info("Initializing extensions synchronously"),this.Wn(b)),Xt.DEBUG=Xt.DEBUG||this.config.debug,Xt.DEBUG&&je.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,k=this.get_distinct_id(),E=this.persistence.get_property(Pr);if(n.bootstrap.isIdentifiedID&&k!=null&&k!==_&&E===il)this.identify(_);else if(n.bootstrap.isIdentifiedID&&k!=null&&k!==_&&E===sl)je.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var j=this.config.get_device_id(Cs()),T=n.bootstrap.isIdentifiedID?j:_;this.persistence.set_property(Pr,n.bootstrap.isIdentifiedID?sl:il),this.register({distinct_id:_,$device_id:T})}}if(b)this.register_once({distinct_id:Ju,$device_id:null},"");else if(!this.get_distinct_id()){var N=this.config.get_device_id(Cs());this.register_once({distinct_id:N,$device_id:N},""),this.persistence.set_property(Pr,il)}return Qt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(D,z){var L=D.config.segment;if(!L)return z();(function(H,U){var V=H.config.segment;if(!V)return U();var O=A=>{var ae=()=>A.anonymousId()||Cs();H.config.get_device_id=ae,A.id()&&(H.register({distinct_id:A.id(),$device_id:ae()}),H.persistence.set_property(Pr,sl)),U()},F=V.user();"then"in F&&Ui(F.then)?F.then(O):O(F)})(D,(()=>{L.register((H=>{Promise&&Promise.resolve||Tp.warn("This browser does not have Promise support, and can not use the segment integration");var U=(V,O)=>{if(!O)return V;V.event.userId||V.event.anonymousId===H.get_distinct_id()||(Tp.info("No userId set, resetting PostHog"),H.reset()),V.event.userId&&V.event.userId!==H.get_distinct_id()&&(Tp.info("UserId set, identifying with PostHog"),H.identify(V.event.userId));var F=H.calculateEventProperties(O,V.event.properties);return V.event.properties=Object.assign({},F,V.event.properties),V};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:V=>U(V,V.event.event),page:V=>U(V,pl),identify:V=>U(V,Np),screen:V=>U(V,"$screen")}})(D)).then((()=>{z()}))}))})(this,(()=>this.Gn())):this.Gn(),Ui(this.config._onCapture)&&this.config._onCapture!==ag&&(je.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(D=>this.config._onCapture(D.event,D)))),this.config.ip&&je.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Wn(t){var n,i,l,c,u,f,h,p=performance.now(),g=ye({},Er.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.Rn.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.Rn.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new g.exceptions(this)),g.historyAutocapture&&this.Rn.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Rn.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.Rn.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Rn.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Rn.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Rn.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new g.surveys(this)),g.logs&&this.Rn.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.Rn.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.Rn.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Rn.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Rn.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Rn.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Rn.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,t3)),g.toolbar&&this.Rn.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.Rn.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.Rn.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Zn){var y=this.Zn;this.Zn=void 0,this.ki(y)}})),this.Qn(v,p)}Qn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Qn(t,n)}),0);var i=t.shift();if(i)try{i()}catch(c){je.error("Error initializing extension:",c)}}var l=Math.round(performance.now()-n);this.register_for_session({[z_]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[O_]:l}),this.config.__preview_deferred_init_extensions&&je.info("PostHog extensions initialized ("+l+"ms)")}ki(t){var n;if(!Ne||!Ne.body)return je.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ki(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Zn=t),this.Jn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,ni.GZipJS)?ni.GZipJS:Ie(t.supportedCompression,ni.Base64)?ni.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Dn?this.Dn:Jm}),this.Rn.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}Gn(){try{this.config.loaded(this)}catch(i){je.critical("`loaded` function failed",i)}if(this.Kn(),this.config.internal_or_test_user_hostname&&Tn!=null&&Tn.hostname){var t=Tn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.On())&&this.Yn()}),1),this.Xn=new sw(this),this.Xn.load()}Kn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Un)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Xu(this.__request_queue,(t=>this.zn(t))),this.__request_queue=[],this.Kn()}_handle_unload(){var t,n,i,l;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.es()&&this.capture(jp),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.Un)==null||i.unload(),(l=this.Vn)==null||l.unload()):this.es()&&this.capture(jp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?gw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.skipIPParam||(t.url=Kd(t.url,{ip:this.config.ip?1:0})),t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var i,l,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=Xb(u.url,u.compression);var f=(i=u.transport)!==null&&i!==void 0?i:"fetch",h=vd.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(l=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&l!==void 0?l:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===ni.GZipJS&&BN&&!xd?y3(u).then((g=>{p(g)})).catch((g=>{if(kb(g))return xd=!0,void p(ye({},u,{compression:void 0,url:Xb(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return kb(v)||y===J5})(g)&&(xd=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var i,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(l=this.config).on_request_error)==null||i.call(l,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}zn(t){this.Vn?this.Vn.retriableRequest(t):this._send_request(t)}_execute_array(t){Op++;try{var n,i=[],l=[],c=[];Xu(t,(f=>{if(f)if(Ke(n=f[0]))c.push(f);else if(Ui(f))try{f.call(this)}catch(h){je.error("Error executing queued PostHog call",f,h)}else Ke(f)&&n==="alias"?i.push(f):Ke(f)&&n.indexOf("capture")!==-1&&Ui(this[n])?c.push(f):l.push(f)}));var u=function(f,h){Xu(f,(function(p){try{if(Ke(p[0])){var g=h;Rt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){je.error("Error executing queued PostHog call",p,v)}}))};u(i,this),u(l,this),u(c,this)}finally{Op--}}push(t){if(Op>0&&Ke(t)&&Ot(t[0])){var n=Er.prototype[t[0]];Ui(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var l,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Un){if(this.is_capturing())if(!Se(t)&&Ot(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!Ot(n==null?void 0:n.$current_url)&&(je.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.ts||je.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,y=(i==null?void 0:i.timestamp)||v,b=(i==null?void 0:i.uuid)||Cs(),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===pl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),i!=null&&i.$set&&(_.$set=i==null?void 0:i.$set);var k=i==null?void 0:i.$unset;k&&(_.$unset=k);var E,j,T,N=this.rs(i==null?void 0:i.$set_once,t!==Mb,t===Np);if(N&&(_.$set_once=N),i!=null&&i._noTruncate||(c=this.config.properties_string_max_length,u=_,f=O=>Ot(O)?O.slice(0,c):O,h=new Set,_=(function O(F,A){return F!==Object(F)?f?f(F):F:h.has(F)?void 0:(h.add(F),Ke(F)?(ae=[],Xu(F,(X=>{ae.push(O(X))}))):(ae={},Rt(F,((X,I)=>{h.has(X)||(ae[I]=O(X))}))),ae);var ae})(u)),_.timestamp=y,Se(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===qi.DISMISSED||t===qi.SENT){var D=n==null?void 0:n[Rp.SURVEY_ID],z=n==null?void 0:n[Rp.SURVEY_ITERATION];(O=>{try{var F=(A=>((ae,X)=>{var I=""+sg+X.id;return X.current_iteration&&X.current_iteration>0&&(I=""+sg+X.id+"_"+X.current_iteration),I})(0,A))(O);if(localStorage.getItem(F))return;localStorage.setItem(F,"true")}catch(A){Et.error("Failed to persist survey seen state",A)}})({id:D,current_iteration:z}),_.$set=ye({},_.$set,{[(E={id:D,current_iteration:z},j=t===qi.SENT?"responded":"dismissed",T="$survey_"+j+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(T="$survey_"+j+"/"+E.id+"/"+E.current_iteration),T)]:!0})}else t===qi.SHOWN&&(_.$set=ye({},_.$set,{[Rp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===d3.SHOWN){var L=n==null?void 0:n[Ib.TOUR_TYPE];L&&(_.$set=ye({},_.$set,{[Ib.TOUR_LAST_SEEN_DATE+"/"+L]:new Date().toISOString()}))}var H=ye({},_.properties.$set,_.$set);if(Es(H)||this.setPersonPropertiesForFlags(H),!et(this.config.before_send)){var U=this.gr(_);if(!U)return;_=U}this.An.emit("eventCaptured",_);var V={method:"POST",url:(l=i==null?void 0:i._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.zn(V):this.Un.enqueue(V),_}je.critical("This capture call is ignored due to client rate limiting.")}}else je.error("No event name provided to posthog.capture")}else je.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,l,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.On()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Ot(f.distinct_id)&&!Fn(f.distinct_id)||Nm(f.distinct_id))&&je.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(j,T,N){var D,z,L,H;if(!Jn)return{};var U,V,O,F,A,ae,X,I,$,P=j?[...jl,...T||[]]:[],[ie,me]=(function(M){for(var pe=0;Cb.length>pe;pe++){var[_e,Ce]=Cb[pe],Te=_e.exec(M),Le=Te&&(Ui(Ce)?Ce(Te,M):Ce);if(Le)return Le}return["",""]})(Jn),R=(U=typeof navigator<"u"?navigator:void 0)!=null&&U.brave?{brave:!0}:{},B={detectGoogleSearchApp:N},Z=zt(Dg({$os:ie,$os_version:me,$browser:b_(Jn,navigator.vendor,R,B),$device:Eb(Jn),$device_type:(O=Jn,F={userAgentDataPlatform:(D=navigator)==null||(D=D.userAgentData)==null?void 0:D.platform,maxTouchPoints:(z=navigator)==null?void 0:z.maxTouchPoints,screenWidth:re==null||(L=re.screen)==null?void 0:L.width,screenHeight:re==null||(H=re.screen)==null?void 0:H.height,devicePixelRatio:re==null?void 0:re.devicePixelRatio},$=Eb(O),$===t_||$===e_||$==="Kobo"||$==="Kindle Fire"||$===p_?wl:$===uc||$===yl||$===dc||$===Em?"Console":$===r_?"Wearable":$?dr:(F==null?void 0:F.userAgentDataPlatform)==="Android"&&((A=F==null?void 0:F.maxTouchPoints)!==null&&A!==void 0?A:0)>0?600>Math.min((ae=F==null?void 0:F.screenWidth)!==null&&ae!==void 0?ae:0,(X=F==null?void 0:F.screenHeight)!==null&&X!==void 0?X:0)/((I=F==null?void 0:F.devicePixelRatio)!==null&&I!==void 0?I:1)?dr:wl:"Desktop"),$timezone:iw(),$timezone_offset:l3()}),{$current_url:mc(Tn==null?void 0:Tn.href,P,gc),$host:Tn==null?void 0:Tn.host,$pathname:Tn==null?void 0:Tn.pathname,$raw_user_agent:Jn.length>1e3?Jn.substring(0,997)+"...":Jn,$browser_version:sC(Jn,navigator.vendor,R,B),$browser_language:Hb(),$browser_language_prefix:(V=Hb(),typeof V=="string"?V.split("-")[0]:void 0),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:Xt.LIB_NAME,$lib_version:Xt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Xt.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=Xt.SDK_DIST_CHANNEL),Z})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&zt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&zt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Vn)==null?void 0:b.length}catch(j){f.$sdk_debug_error_capturing_properties=String(j)}if(this.requestRouter.region===ig&&(f.$lib_custom_api_host=this.config.api_host),p=t!==pl||c?t!==jp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,l),f=zt(f,p),t===pl&&Ne&&(f.title=Ne.title),!Se(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Jn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=zt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),Ke(this.config.property_denylist)?Rt(this.config.property_denylist,(function(j){delete f[j]})):je.error(mw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(je.error(ry),f=k(f,t));var E=this.ns();return f.$process_person_profile=E,E&&!c&&this.ss("_calculate_event_properties"),f}rs(t,n,i){var l;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.ns()||this.Ln&&!i)return t;var c=this.persistence.get_initial_props(),u=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),f=zt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(je.error(ry),f=h(f,"$set_once")),n&&(this.Ln=!0),Es(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var l;(l=this.persistence)==null||l.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}os(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var i;return(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.An.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:zo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:zo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:zo})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=T3),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:zo}}canRenderSurveyAsync(t,n){var i,l;return n===void 0&&(n=!1),(i=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:zo})}ls(t){return!t||Nm(t)?(je.critical("Unique user id has not been set in posthog.identify"),!1):t===Ju?(je.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(je.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return je.uninitializedWarning("posthog.identify");if(Fn(t)&&(t=t.toString(),je.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ls(t)&&this.ss("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Rd)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Io)&&(this.unregister(Io),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(Pr)||il)===il;t!==l&&u?(this.persistence.set_property(Pr,sl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Np,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:i||{}}),this.$n=ey(t,n,i),(c=this.featureFlags)==null||c.setAnonymousDistinctId(l)):(n||i)&&this.setPersonProperties(n,i),t!==l&&(this.reloadFeatureFlags(),this.unregister(Ko))}}setPersonProperties(t,n){if((t||n)&&this.ss("posthog.setPersonProperties")){var i=ey(this.get_distinct_id(),t,n);this.$n!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.$n=i):je.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ke(t)?t:[t]).filter((l=>Ot(l)&&l.length>0));i.length!==0&&this.ss("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.$n=null)}group(t,n,i){if(t&&n){var l=this.getGroups(),c=l[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},l,{[t]:n})}),c||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(Mb,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),c&&!i&&this.reloadFeatureFlags()}else je.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.ss("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,i,l,c,u,f,h,p,g;if(je.info("reset"),!this.__loaded)return je.uninitializedWarning("posthog.reset");var v,y=this.get_property(Rd),b=this.get_property(fa);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),Se(b)||(v=this.persistence)==null||v.register({[fa]:b}),(l=this.surveys)==null||l.reset(),(c=this.Xn)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.persistence)==null||p.set_property(Pr,il),(g=this.sessionManager)==null||g.resetSessionId(),this.$n=null,this.config.cookieless_mode===Fi)this.register_once({distinct_id:Ju,$device_id:null},"");else{var _=this.config.get_device_id(Cs());this.register_once({distinct_id:_,$device_id:t?_:y},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.us()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.hs()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&i){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!i)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return l}alias(t,n){return t===this.get_property(E_)?(je.critical("Attempting to create alias for existing People user - aborting."),-2):this.ss("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.os(Io,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(je.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if($t(t)){var i,l,c,u,f,h,p,g,v,y,b;zt(this.config,sy(t));var _=this.Hn();(i=this.persistence)==null||i.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ap(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var k=this.qn(this.config.debug);si(k)&&(this.config.debug=k),si(this.config.debug)&&(this.config.debug?(Xt.DEBUG=!0,Mt.N()&&Mt.A("ph_debug",!0),je.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Xt.DEBUG=!1,Mt.N()&&Mt.q("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.cs(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Xt.LIB_NAME=t,Xt.LIB_VERSION=n}startSessionRecording(t){var n,i,l,c,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var i=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(ye({},l,n))}}addExceptionStep(t,n){var i;(i=this.exceptions)==null||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:Er.ds}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:ml;return n!==ml&&(n=ml+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Pr))===sl||((n=this.sessionPersistence)==null?void 0:n.get_property(Pr))===sl}ns(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Jm&&!this._isIdentified()&&Es(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Io])&&((n=this.persistence)==null||(n=n.props)==null||!n[Dd]))}es(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.ns()||this.ss("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ss("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ss(t){return this.config.person_profiles==="never"?(je.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.os(Dd,!0),!0)}Hn(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ua)}cs(){var t,n,i,l,c=this.Hn();return((t=this.persistence)==null?void 0:t.ei)!==c&&((i=this.persistence)==null||i.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.ei)!==c&&((l=this.sessionPersistence)==null||l.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Fi){if(this.On()){var i,l,c,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new Kb(this),this.pageViewManager=new qb(this),this.persistence&&(this.sessionPropsManager=new Zb(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=Er.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.Pn(this.sessionRecording,new p(this)),this.Jn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.Jn)))}var g,v;this.consent.optInOut(!0),this.cs(),this.Kn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==ua&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Yn()}else je.warn(ny)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==Fi?(this.config.cookieless_mode===ua&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cs(),this.config.cookieless_mode===ua&&(this.register({distinct_id:Ju,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Yn(),this.Kn())):je.warn(ny)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Fi||(this.config.cookieless_mode===ua?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cs()}_is_bot(){return cr?fw(cr,this.config.custom_blocked_useragents):void 0}Yn(){Ne&&(Ne.visibilityState==="visible"?this.Fn||(this.Fn=!0,this.capture(pl,{title:Ne.title},{send_instantly:!0}),this.Nn&&(Ne.removeEventListener(zd,this.Nn),this.Nn=null)):this.Nn||(this.Nn=this.Yn.bind(this),Qt(Ne,zd,this.Nn)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ci(){var t,n,i,l,c,u,f=this.jn||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(je.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",l=je,c=(n="advanced_disable_flags")in(t=f)&&!et(t[n]),u=i in t&&!et(t[i]),c?t[n]:!!u&&(l&&l.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[i]))}gr(t){var n;if(et(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(YN),l=Ke(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var u of l){if(c=u(c),et(c)){var f="Event '"+t.event+"' was rejected in beforeSend function";return GN(t.event)?je.warn(f+". This can cause unexpected behavior."):je.info(f),null}c.properties&&!Es(c.properties)||je.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(c.properties&&et(c.properties[h]))return je.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.Br)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}qn(t){var n=si(t)&&!t,i=Mt.N()&&Mt.P("ph_debug")==="true";return!n&&(!!i||t)}}Er.__defaultExtensionClasses={},Er.ds={trace:ol=()=>{},debug:ol,info:ol,warn:ol,error:ol,fatal:ol},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=LC(e.prototype[t[n]])})(Er,["identify"]);class ay{constructor(t){this.disabled=t===!1;var n=$t(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,i){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>i-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var Bp="$copy_autocapture",Pp=Vt("[AutoCapture]");function $p(e,t){return t.length>e?t.slice(0,e)+"...":t}function z3(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ms(t));return t}function O3(e,t){var n,i,{e:l,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h}=t;if(!Ms(e))return{props:{}};for(var p=[e],g=e;g.parentNode&&!ur(g,"body");)if(F_(g.parentNode))p.push(g.parentNode.host),g=g.parentNode.host;else{if(!Ms(g.parentNode))break;p.push(g.parentNode),g=g.parentNode}var v,y,b=[],_={},k=!1,E=!1;if(Rt(p,(z=>{var L=Zm(z);if(ur(z,"a")){var H=z.getAttribute("href");k=L&&!!H&&ec(H)&&H}Ie(Pd(z),"ph-no-capture")&&(E=!0),b.push((function(V,O,F,A){var ae=V.tagName.toLowerCase(),X={tag_name:ae};Og.indexOf(ae)>-1&&!F&&(X.$el_text=ae.toLowerCase()==="a"||ae.toLowerCase()==="button"?$p(1024,$b(V)):$p(1024,hc(V)));var I=Pd(V);I.length>0&&(X.classes=I.filter((function(me){return me!==""}))),Rt(V.attributes,(function(me){var R;if((!G_(V)||["name","id","class","aria-label"].indexOf(me.name)!==-1)&&(A==null||!A.includes(me.name))&&!O&&ec(me.value)&&(!Ot(R=me.name)||R.substring(0,10)!=="_ngcontent"&&R.substring(0,7)!=="_nghost")){var B=me.value;me.name==="class"&&(B=zg(B).join(" ")),X["attr__"+me.name]=$p(1024,B)}}));for(var $=1,P=1,ie=V;ie=z3(ie);)$++,ie.tagName===V.tagName&&P++;return X.nth_child=$,X.nth_of_type=P,X})(z,c,u,f));var U=(function(V){if(!Zm(V))return{};var O={};return Rt(V.attributes,(function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var A=F.name.replace("data-ph-capture-attribute-",""),ae=F.value;A&&ae&&ec(ae)&&(O[A]=ae)}})),O})(z);zt(_,U)})),E)return{props:{},explicitNoCapture:E};if(u||(b[0].$el_text=ur(e,"a")||ur(e,"button")?$b(e):hc(e)),k){var j,T;b[0].attr__href=k;var N=(j=$d(k))==null?void 0:j.host,D=re==null||(T=re.location)==null?void 0:T.host;N&&D&&N!==D&&(v=k)}return{props:zt({$event_type:l.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(y=b,(function(z){return z.map((L=>{var H,U,V="";if(L.tag_name&&(V+=L.tag_name),L.attr_class)for(var O of(L.attr_class.sort(),L.attr_class))V+="."+O.replace(/"/g,"");var F=ye({},L.text?{text:L.text}:{},{"nth-child":(H=L.nth_child)!==null&&H!==void 0?H:0,"nth-of-type":(U=L.nth_of_type)!==null&&U!==void 0?U:0},L.href?{href:L.href}:{},L.attr_id?{attr_id:L.attr_id}:{},L.attributes),A={};return gd(F).sort(((ae,X)=>{var[I]=ae,[$]=X;return I.localeCompare($)})).forEach((ae=>{var[X,I]=ae;return A[Ub(X.toString())]=Ub(I.toString())})),(V+=":")+gd(A).map((ae=>{var[X,I]=ae;return X+'="'+I+'"'})).join("")})).join(";")})((function(z){return z.map((L=>{var H,U,V={text:(H=L.$el_text)==null?void 0:H.slice(0,400),tag_name:L.tag_name,href:(U=L.attr__href)==null?void 0:U.slice(0,2048),attr_class:KC(L),attr_id:L.attr__id,nth_child:L.nth_child,nth_of_type:L.nth_of_type,attributes:{}};return gd(L).filter((O=>{var[F]=O;return F.indexOf("attr__")===0})).forEach((O=>{var[F,A]=O;return V.attributes[F]=A})),V}))})(y)))},(n=b[0])!=null&&n.$el_text?{$el_text:(i=b[0])==null?void 0:i.$el_text}:{},v&&l.type==="click"?{$external_click_url:v}:{},_)}}var Oo=Vt("[ExceptionAutocapture]"),B3=Vt("[TracingHeaders]"),ra=Vt("[Web Vitals]"),ly=9e5,oy="disabled",cy="lazy_loading",Bo="awaiting_config",rd="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var lg="[SessionRecording]",Li=Vt(lg),P3=Vt("[Heatmaps]");function uy(e){return $t(e)&&"clientX"in e&&"clientY"in e&&Fn(e.clientX)&&Fn(e.clientY)}var Up=Vt("[Product Tours]"),Fp=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Mg))},$3=["$set_once","$set"],Kr=Vt("[SiteApps]"),dy="Error while initializing PostHog app with config id ";function cl(e,t,n){if(et(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class U3{constructor(t){this.vs=new Ug,this.fs=(n,i)=>this.ps(n,i)&&this.gs(n,i)&&this.ys(n,i)&&this.bs(n,i),this.ps=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this._s=new Set,this.ws=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,l)=>{this.on(i,l)}))}register(t){var n,i;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.ws)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this._s)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var l,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(c)}}on(t,n){var i;n!=null&&t.length!=0&&(this._s.has(t)||this._s.has(n==null?void 0:n.event))&&this.ws&&((i=this.ws)==null?void 0:i.size)>0&&this.ws.forEach((l=>{this.xs(n,l)&&this.vs.emit("actionCaptured",l.name)}))}ks(t){this.onAction("actionCaptured",(n=>t(n)))}xs(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.fs(t,i))return!0;return!1}onAction(t,n){return this.vs.on(t,n)}gs(t,n){if(n!=null&&n.url){var i,l=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!l||typeof l!="string"||!cl(l,n.url,n.url_matching||"contains"))return!1}return!0}ys(t,n){return!!this.Ss(t,n)&&!!this.Cs(t,n)&&!!this.Is(t,n)}Ss(t,n){var i;if(n==null||!n.href)return!0;var l=this.Ts(t);if(l.length>0)return l.some((f=>cl(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&cl((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Cs(t,n){var i;if(n==null||!n.text)return!0;var l=this.Ts(t);if(l.length>0)return l.some((p=>cl(p.text,n.text,n.text_matching||"exact")||cl(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!et(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>cl(p,u,f))))}Is(t,n){var i,l;if(n==null||!n.selector)return!0;var c=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}Ts(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}bs(t,n){return n==null||!n.properties||n.properties.length===0||pw(n.properties.reduce(((i,l)=>{var c=Ke(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return i[l.key]={values:c,operator:l.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class F3{constructor(t){this.Es=[],this._instance=t,this.Ms=new Map,this.Ps=new Map,this.Rs=new Map}Os(t,n){return!!t&&pw(t.propertyFilters,n==null?void 0:n.properties)}Ls(t,n){var i=new Map;return t.forEach((l=>{var c;(c=l.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(l.id),i.set(u.name,f)}}))})),i}As(t,n,i){var l=(i===Ao.Activation?this.Ms:this.Ps).get(t),c=[];return this.Fs((u=>{c=u.filter((f=>l==null?void 0:l.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Os(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Ns(t),this.Ds(t))}Ds(t){var n=t.filter((i=>{var l,c;return((l=i.conditions)==null?void 0:l.actions)&&((c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.$s==null&&(this.$s=new U3(this._instance),this.$s.init(),this.$s.ks((i=>{this.onAction(i)}))),n.forEach((i=>{var l,c,u,f,h;i.conditions&&(l=i.conditions)!=null&&l.actions&&(c=i.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.$s)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.Rs.get(p.name);g&&g.push(i.id),this.Rs.set(p.name,g||[i.id])}})))})))}Ns(t){var n,i=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),l=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.Ms=this.Ls(t,Ao.Activation),this.Ps=this.Ls(t,Ao.Cancellation))}onEvent(t,n){var i,l,c=this.le(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.qs(t,u);if(f==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.js([u]);if(f==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.Bs(u)}if(this.Ps.has(t)){var h=this.As(t,n,Ao.Cancellation);h.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.js(h.map((g=>g.id))),h.forEach((g=>this.Hs(g.id))))}if(this.Ms.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.Ms.get(t)});var p=this.As(t,n,Ao.Activation);this.Us(p.map((g=>g.id)))}}onAction(t){this.Rs.has(t)&&this.Us(this.Rs.get(t)||[])}Us(t){t.length!==0&&(this.Es=[...new Set([...this.Es,...t])],this.le().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Bs(t){this.Es=this.Es.filter((i=>i!==t));var n=this.zs();n.includes(t)||this.Vs([...n,t])}js(t){var n=new Set(t);this.Es=this.Es.filter((c=>!n.has(c)));var i=this.zs(),l=i.filter((c=>!n.has(c)));l.length!==i.length&&this.Vs(l)}zs(){var t,n=this.Ws();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getActivatedIds(){return[...new Set([...this.zs(),...this.Es])].filter((t=>!this.Gs(t)))}reset(){this.Es=[],this.zs().length>0&&this.Vs([])}getEventToItemsMap(){return this.Ms}Zs(){return this.$s}}class q3 extends F3{constructor(t){super(t)}Ws(){return qm}Qs(){return qi.SHOWN}Fs(t){var n;(n=this._instance)==null||n.getSurveys(t)}Hs(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}le(){return Et}Vs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[qm]:t})}Gs(){return!1}qs(t,n){var i;this.Fs((c=>{i=c.find((u=>u.id===n))}));var l=!i||(function(c){var u,f,h,p=((u=(f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)!==null&&u!==void 0?u:0)>0;return c.schedule===u3.Always||!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation||!p)})(i);return l?t===qi.SHOWN?"consume":"ignore":t===qi.SHOWN?"persist":t===qi.DISMISSED||t===qi.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var qp="SDK is not enabled or survey functionality is not yet loaded",fy="Disabled. Not loading surveys.",H3=re!=null&&re.location?Ud(re.location.hash,"__posthog")||Ud(location.hash,"state"):null,hy="_postHogToolbarParams",py=Vt("[Toolbar]"),En=Vt("[FeatureFlags]"),ia=Vt("[FeatureFlags]",{debugEnabled:!0}),Hp=`" failed. Feature flags didn't load in time.`,my=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},gy=e=>{var t={};for(var[n,i]of gd(e||{}))i&&(t[n]=i);return t},Di=Vt("[Error tracking]"),xy="Refusing to render web experiment since the viewer is a likely bot",I3={icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!re&&Hd(t.href,e),not_regex:(e,t)=>!!re&&!Hd(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Dn{get qt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((l=>{Dn.Js("retrieved web experiments from the server"),n.Ks=new Map,l.forEach((c=>{if(c.feature_flag_key){var u;n.Ks&&(Dn.Js("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.Ks)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);Ot(f)&&c.variants[f]&&n.Ys(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Dn.Xs(p)&&n.Ys(c.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Dn.Js(xy);else if(!this.qt.disable_web_experiments){if(et(this.Ks))return this.Ks=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Dn.Js("applying feature flags",t),t.forEach((n=>{var i;if(this.Ks&&(i=this.Ks)!=null&&i.has(n)){var l,c=this._instance.getFeatureFlag(n),u=(l=this.Ks)==null?void 0:l.get(n);c&&u!=null&&u.variants[c]&&this.Ys(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Dn.getWindowLocation();if(t!=null&&t.search){var n=pc(t==null?void 0:t.search,"__experiment_id"),i=pc(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Dn.Js("previewing web experiments "+n+" && "+i),this.getWebExperiments((l=>{this.eo(parseInt(n),i,l)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.qt.disable_web_experiments&&!i)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}eo(t,n,i){var l=i.filter((c=>c.id===t));l&&l.length>0&&(Dn.Js("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.Ys(l[0].name,n,l[0].variants[n].transforms))}static Xs(t){return!et(t.conditions)&&Dn.ro(t)&&Dn.io(t)}static ro(t){var n;if(et(t.conditions)||et((n=t.conditions)==null?void 0:n.url))return!0;var i,l,c,u=Dn.getWindowLocation();return!!u&&((i=t.conditions)==null||!i.url||I3[(l=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](t.conditions.url,u))}static getWindowLocation(){return re==null?void 0:re.location}static io(t){var n;if(et(t.conditions)||et((n=t.conditions)==null?void 0:n.utm))return!0;var i=Z_();if(i.utm_source){var l,c,u,f,h,p,g,v,y=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==i.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==i.utm_medium,k=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==i.utm_term;return y&&_&&k&&b}return!1}static Js(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),l=1;n>l;l++)i[l-1]=arguments[l];je.info("[WebExperiments] "+t,i)}Ys(t,n,i){this._is_bot()?Dn.Js(xy):n!=="control"?i.forEach((l=>{if(l.selector){var c;Dn.Js("applying transform of variant "+n+" for experiment "+t+" ",l);var u=(c=document)==null?void 0:c.querySelectorAll(l.selector);u==null||u.forEach((f=>{var h=f;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):Dn.Js("Control variants leave the page unmodified.")}_is_bot(){return cr&&this._instance?fw(cr,this.qt.custom_blocked_useragents):void 0}}var kr=Vt("[Conversations]"),sa="Conversations not available yet.",ef={featureFlags:class{constructor(e){this.no=!1,this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.co=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get Ji(){return this._instance.persistence}do(e){return this._instance.get_property(e)}vo(){var e,t;return(e=(t=this.Ji)==null?void 0:t.ri(this.qt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}fo(){return!!this.vo()&&(this.co||this.oo||(this.co=!0,En.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}po(){var e,t=(e=this.qt.evaluation_contexts)!==null&&e!==void 0?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ho||(En.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ho=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||En.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}mo(){return this.po().length>0}yo(){var e=this.qt.flag_keys;if(!Se(e)){if(Ke(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||En.error("Invalid flag key found:",t,"Expected non-empty string"),n}));En.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var l,c,u=(l=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&l!==void 0?l:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,g)=>(p[g]=i[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i,l,c=n!=null&&n.merge&&(i=this.do(da))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(l=this.do(md))!==null&&l!==void 0?l:{},f=ye({},c,e),h=ye({},u,t),p={};for(var[g,v]of Object.entries(f))p[g]={key:g,enabled:$N(v),variant:UN(v),reason:void 0,metadata:Se(h==null?void 0:h[g])?void 0:{id:0,version:void 0,description:void 0,payload:h[g]}};this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.so}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.do($m),t=this.do(Pi),n=this.do(hl);if(!n&&!t)return e||{};var i=zt({},e||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of l){var u,f,h=i[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[c]=b}return this.no||(En.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.no=!0),i}getFlagVariants(){var e=this.do(da),t=this.do(Pi);if(!t)return e||{};for(var n=zt({},e),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.no||(En.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.no=!0),n}getFlagPayloads(){var e=this.do(md),t=this.do(hl);if(!t)return e||{};for(var n=zt({},e||{}),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.no||(En.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.no=!0),n}reloadFeatureFlags(){this.ao||this.qt.advanced_disable_feature_flags||this.bo||(this._instance.An.emit("featureFlagsReloading",!0),this.bo=setTimeout((()=>{this._o()}),5))}wo(){clearTimeout(this.bo),this.bo=void 0}ensureFlagsLoaded(){this.so||this.oo||this.bo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ao=e}_o(e){var t;if(this.wo(),!this._instance.Ci())if(this.oo)this.lo=!0;else{var n=this.qt.token,i=this.do(Rd),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.Ji)==null?void 0:t.get_initial_props())||{},this.do(oa)||{}),group_properties:this.do(ca),timezone:iw()};Un(i)||Se(i)||(l.$device_id=i),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.mo()&&(l.evaluation_contexts=this.po());var c=this.yo();Se(c)||(l.flag_keys=c);var u=!!this.qt.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.oo=!0,this._instance._send_request({method:"POST",url:f,data:l,skipIPParam:!0,compression:this.qt.disable_compression?void 0:ni.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.lo||(this.$anon_distinct_id=void 0),y=!1),this.oo=!1,!l.disable_flags||this.lo){this.uo=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,k=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));k&&b.push("quota_limited"),(v=this.Ji)==null||v.register({[Im]:b}),k?En.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(l.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.lo&&(this.lo=!1,this._o()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.uo)if(this.so||this.getFlags()&&this.getFlags().length>0){if(!this.fo()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else En.warn('getFeatureFlag for key "'+e+Hp)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.uo)if(this.so||this.getFlags()&&this.getFlags().length>0){if(!this.fo()){var n=this.getFlagVariants(),i=e in n,l=n[e],c=this.getFlagPayloads()[e],u=String(l),f=this.do(Um)||void 0,h=this.do(fc)||void 0,p=this.do(Ko)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.do(Hm);v&&v!==y&&(p={},(g=this.Ji)==null||g.register({[Ko]:p,[Hm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,k,E,j,T,N,D,z,L;Ke(p[e])?p[e].push(u):p[e]=[u],(b=this.Ji)==null||b.register({[Ko]:p});var H=this.getFeatureFlagDetails(e),U=[...(_=this.do(Im))!==null&&_!==void 0?_:[]];Se(l)&&U.push("flag_missing");var V={$feature_flag:e,$feature_flag_response:l,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((k=this.qt.bootstrap)==null||(k=k.featureFlags)==null?void 0:k[e])||null,$feature_flag_bootstrapped_payload:((E=this.qt.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.uo};Se(H==null||(j=H.metadata)==null?void 0:j.version)||(V.$feature_flag_version=H.metadata.version);var O,F=(T=H==null||(N=H.reason)==null?void 0:N.description)!==null&&T!==void 0?T:H==null||(D=H.reason)==null?void 0:D.code;F&&(V.$feature_flag_reason=F),H!=null&&(z=H.metadata)!=null&&z.id&&(V.$feature_flag_id=H.metadata.id),Se(H==null?void 0:H.original_variant)&&Se(H==null?void 0:H.original_enabled)||(V.$feature_flag_original_response=Se(H.original_variant)?H.original_enabled:H.original_variant),H!=null&&(L=H.metadata)!=null&&L.original_payload&&(V.$feature_flag_original_payload=H==null||(O=H.metadata)==null?void 0:O.original_payload),U.length&&(V.$feature_flag_error=U.join(",")),this._instance.capture("$feature_flag_called",V)}if(i)return{key:e,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:PN(c)}}}else En.warn('getFeatureFlagResult for key "'+e+Hp)}getRemoteConfigPayload(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.mo()&&(i.evaluation_contexts=this.po());var l=this.yo();Se(l)||(i.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,skipIPParam:!0,compression:this.qt.disable_compression?void 0:ni.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.uo){if(this.so||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}En.warn('isFeatureEnabled for key "'+e+Hp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Ji){this.so=!0;var i=this.getFlagVariants(),l=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(U=>{var V=U.flags;return V?(U.featureFlags=Object.fromEntries(Object.keys(V).map((O=>{var F;return[O,(F=V[O].variant)!==null&&F!==void 0?F:V[O].enabled]}))),U.featureFlagPayloads=Object.fromEntries(Object.keys(V).filter((O=>V[O].enabled)).filter((O=>{var F;return(F=V[O].metadata)==null?void 0:F.payload})).map((O=>{var F;return[O,(F=V[O].metadata)==null?void 0:F.payload]})))):En.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),U})(u),b=y.flags,_=y.featureFlags,k=y.featureFlagPayloads;if(_){var E=u.requestId,j=u.evaluatedAt;if(Ke(_)){En.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var T={};if(_)for(var N=0;_.length>N;N++)T[_[N]]=!0;f&&f.register({[pd]:_,[da]:T})}else{var D=_,z=k,L=b;if(v!=null&&v.partialResponse)D=ye({},h,D),z=ye({},p,z),L=ye({},g,L);else if(u.errorsWhileComputingFlags)if(b){var H=new Set(Object.keys(b).filter((U=>{var V;return!((V=b[U])!=null&&V.failed)})));D=ye({},h,Object.fromEntries(Object.entries(D).filter((U=>{var[V]=U;return H.has(V)})))),z=ye({},p,Object.fromEntries(Object.entries(z||{}).filter((U=>{var[V]=U;return H.has(V)})))),L=ye({},g,Object.fromEntries(Object.entries(L||{}).filter((U=>{var[V]=U;return H.has(V)}))))}else D=ye({},h,D),z=ye({},p,z),L=ye({},g,L);f&&f.register(ye({[pd]:Object.keys(gy(D)),[da]:D||{},[md]:z||{},[$m]:L||{}},E?{[Um]:E}:{},j?{[fc]:j}:{}))}}})(e,this.Ji,i,l,c,n),t||(this.co=!1),this.xo(t)}}override(e,t){t===void 0&&(t=!1),En.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Ji)return En.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.Ji.unregister(Pi),this.Ji.unregister(hl),this.xo(),ia.info("All overrides cleared");if(Ke(e)){var t=my(e);return this.Ji.register({[Pi]:t}),this.xo(),ia.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.no=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.Ji.unregister(Pi),ia.info("Flag overrides cleared");else if(i.flags){if(Ke(i.flags)){var l=my(i.flags);this.Ji.register({[Pi]:l})}else this.Ji.register({[Pi]:i.flags});ia.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.Ji.unregister(hl),ia.info("Payload overrides cleared")):i.payloads&&(this.Ji.register({[hl]:i.payloads}),ia.info("Payload overrides set",{payloads:i.payloads}))),void this.xo()}if(e&&typeof e=="object")return this.Ji.register({[Pi]:e}),this.xo(),ia.info("Flag overrides set",{flags:e});En.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.so){var{flags:t,flagVariants:n}=this.ko();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,l=(this.do(Go)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};l&&(u.$early_access_feature_name=l.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(i=this.Ji)==null||i.register({[pd]:Object.keys(gy(f)),[da]:f}),this.xo()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.do(Go),l=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+l),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.Ji)==null||u.unregister(Go),(f=this.Ji)==null||f.register({[Go]:h}),e(h)}}})}ko(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}xo(e){var{flags:t,flagVariants:n}=this.ko();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.do(oa)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),l=e==null?void 0:e.$set_once,c={};if(l)for(var u in l)({}).hasOwnProperty.call(l,u)&&(u in n||(c[u]=l[u]));this._instance.register({[oa]:ye({},n,c,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ye({},this.do(oa)||{});e.forEach((i=>{delete n[i]})),this._instance.register({[oa]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(oa),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.do(ca)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=ye({},n[i],e[i]),delete e[i]})),this._instance.register({[ca]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.do(ca)||{};this._instance.register({[ca]:ye({},t,{[e]:{}})})}else this._instance.unregister(ca)}reset(){this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.$anon_distinct_id=void 0,this.wo(),this.no=!1}}},V3={sessionRecording:class{get qt(){return this._instance.config}get Ji(){return this._instance.persistence}get started(){var e;return!((e=this.So)==null||!e.isStarted)}get status(){var e,t;return this.Co===Bo||this.Co===rd?this.Co:(e=(t=this.So)==null?void 0:t.status)!==null&&e!==void 0?e:this.Co}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Co=oy,this.Io=void 0,this._instance=e,!this._instance.sessionManager)throw Li.error("started without valid sessionManager"),new Error(lg+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Fi)throw new Error(lg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get To(){var e,t=!((e=this._instance.get_property(fa))==null||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.To||(t=this.So)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this.To&&n?(this.Eo(e),Li.info("starting")):(this.Co=oy,this.stopRecording())}}Eo(e){var t,n,i;this.To&&(this.Co!==Bo&&this.Co!==rd&&(this.Co=cy),De!=null&&(t=De.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=De.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Mo(e):(i=De.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Po,(l=>{if(l)return Li.error("could not load recorder",l);this.Mo(e)})))}stopRecording(){var e,t;(e=this.Io)==null||e.call(this),this.Io=void 0,(t=this.So)==null||t.stop()}Ro(){var e,t;(e=this.Io)==null||e.call(this),this.Io=void 0,(t=this.So)==null||t.discard()}Oo(){var e,t;(e=this.Ji)==null||e.unregister(Rg),(t=this.Ji)==null||t.unregister(T_)}Lo(e,t){if(et(e))return null;var n,i=Fn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Li.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Ao(e){if(this.Ji){var t,n,i=this.Ji,l=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Lo((c=this.qt.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Lo(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;et(p)&&this.Oo();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[fa]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:Se(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};l(),(t=this.Io)==null||t.call(this),this.Io=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Ao(e),void this.Ro()):(this.Ao(e),void this.startIfEnabledOrStop()):(this.Co===Bo&&(this.Co=rd,Li.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.So)!=null&&n.log?this.So.log(e,t):Li.warn("log called before recorder was ready")}get Po(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fa);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Fo(){var e,t,n=this._instance.get_property(fa);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return Li.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}Mo(e){var t,n;if((t=De.__PosthogExtensions__)==null||!t.initSessionRecording)return Li.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[B_]:!0});if(this.So||(this.So=(n=De.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.So._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Fo())return this.Co===rd||this.Co===Bo?void 0:(this.Co=Bo,Li.info("persisted remote config is stale, requesting fresh config before starting"),void new sw(this._instance).load());this.Co=cy,this.So.start(e)}onRRwebEmit(e){var t;(t=this.So)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.So||(t=this.Ji)==null||t.register({[M_]:!0}),(e=this.So)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.So||(t=this.Ji)==null||t.register({[A_]:!0}),(e=this.So)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.So||(n=this.Ji)==null||n.register({[e==="url"?R_:L_]:!0}),(t=this.So)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.So)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.So)==null||!n.tryAddCustomEvent(e,t))}}},G3={autocapture:class{constructor(e){this.No=!1,this.Do=null,this.$o=!1,this.instance=e,this.rageclicks=new ay(e.config.rageclick),this.qo=null}initialize(){this.startIfEnabled()}get qt(){var e,t,n=$t(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}jo(){if(this.isBrowserSupported()){if(re&&Ne){var e=n=>{n=n||(re==null?void 0:re.event);try{this.Bo(n)}catch(i){Pp.error("Failed to capture event",i)}};if(Qt(Ne,"submit",e,{capture:!0}),Qt(Ne,"change",e,{capture:!0}),Qt(Ne,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=n=>{n=n||(re==null?void 0:re.event);try{this.Bo(n,Bp)}catch(i){Pp.error("Failed to capture copy/cut event",i)}};Qt(Ne,"copy",t,{capture:!0}),Qt(Ne,"cut",t,{capture:!0})}}}else Pp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.No&&(this.jo(),this.No=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.$o=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Rm]:!!e.autocapture_opt_out}),this.Do=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.qo=e}getElementSelectors(e){var t,n=[];return(t=this.qo)==null||t.forEach((i=>{var l=Ne==null?void 0:Ne.querySelectorAll(i);l==null||l.forEach((c=>{e===c&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Rm];if(Un(this.Do)&&!si(n)&&!this.instance.Ci())return!1;var i=(t=this.Do)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!i}Bo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Ep(e);U_(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Pb(i,this.instance.config.rageclick)&&this.Bo(e,"$rageclick");var l=t===Bp;if(i&&(function(v,y,b,_,k){var E,j,T,N,D,z;if(b===void 0&&(b=void 0),!re||Bg(v)||(E=b)!=null&&E.url_allowlist&&!zb(b.url_allowlist)||(j=b)!=null&&j.url_ignorelist&&zb(b.url_ignorelist))return!1;if((T=b)!=null&&T.dom_event_allowlist){var L=b.dom_event_allowlist;if(L&&!L.some((F=>y.type===F)))return!1}var{parentIsUsefulElement:H,targetElementList:U}=V_(v,_);if(!(function(F,A){var ae=A==null?void 0:A.element_allowlist;if(Se(ae))return!0;var X,I=function(P){if(ae.some((ie=>P.tagName.toLowerCase()===ie)))return{v:!0}};for(var $ of F)if(X=I($))return X.v;return!1})(U,b)||!Xm(U,(N=b)==null?void 0:N.css_selector_allowlist)||Xm(U,(D=(z=b)==null?void 0:z.css_selector_ignorelist)!==null&&D!==void 0?D:GC))return!1;var V=re.getComputedStyle(v);if(V&&V.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var O=v.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(k||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(k||["change","click"]).indexOf(y.type)>=0;default:return H?(k||["click"]).indexOf(y.type)>=0:(k||["click"]).indexOf(y.type)>=0&&(Og.indexOf(O)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,this.qt,l,l?["copy","cut"]:void 0)){var{props:c,explicitNoCapture:u}=O3(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.$o});if(u)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(c.$element_selectors=f),t===Bp){var h,p=q_(re==null||(h=re.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return Ui(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ho=(re==null||(t=re.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(je.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Uo&&this.Uo(),this.Uo=void 0,je.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.zo("pushState"),this.zo("replaceState"),this.Vo())}zo(e){var t;if(re&&((t=re.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,l,c){try{if(!(l in i))return()=>{};var u=i[l],f=c(u);return Ui(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[l]=f,()=>{i[l]===f&&(i[l]=u)}}catch{return()=>{}}})(re.history,e,(i=>function(l,c,u){i.call(this,l,c,u),n.Wo(e)}))}}Wo(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.Ho&&this.isEnabled&&this._instance.capture(pl,{navigation_type:e}),this.Ho=n}catch(i){je.error("Error capturing "+e+" pageview",i)}}Vo(){if(!this.Uo){var e=()=>{this.Wo("popstate")};Qt(re,"popstate",e),this.Uo=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.Go=!1,this.No=!1,this.Zo=null,this.instance=e,this.Go=!((t=this.instance.persistence)==null||!t.props[Lm]),this.rageclicks=new ay(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return $t(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return et(this.qt.capture_heatmaps)?et(this.qt.enable_heatmaps)?this.Go:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.No)return;P3.info("starting..."),this.Qo(),this.At()}else{var e;clearInterval((e=this.Zo)!==null&&e!==void 0?e:void 0),this.Jo(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Lm]:t}),this.Go=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Ko(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Zo&&clearInterval(this.Zo),this.Zo=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.qi.bind(this),this.flushIntervalMilliseconds):null}Qo(){re&&Ne&&(this.Yo=this.qi.bind(this),Qt(re,Od,this.Yo),this.Xo=e=>this.Mt(e||(re==null?void 0:re.event)),Qt(Ne,"click",this.Xo,{capture:!0}),this.ea=e=>this.ta(e||(re==null?void 0:re.event)),Qt(Ne,"mousemove",this.ea,{capture:!0}),this.ra=new Fb(this.instance,e3,this.Ko.bind(this)),this.ra.startIfEnabledOrStop(),this.ia=this.At.bind(this),Qt(Ne,zd,this.ia),this.No=!0)}Jo(){var e;re&&Ne&&(this.Yo&&re.removeEventListener(Od,this.Yo),this.Xo&&Ne.removeEventListener("click",this.Xo,{capture:!0}),this.ea&&Ne.removeEventListener("mousemove",this.ea,{capture:!0}),this.ia&&Ne.removeEventListener(zd,this.ia),clearTimeout(this.na),(e=this.ra)==null||e.stop(),this.No=!1)}sa(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Ms(p)&&!ur(p,"body");){if(p===h)return!1;if(Ie(f,re==null?void 0:re.getComputedStyle(p).position))return!0;p=H_(p)}return!1})(Ep(e),["fixed","sticky"],l);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}Mt(e,t){var n;if(t===void 0&&(t="click"),!Db(e.target)&&uy(e)){var i=this.sa(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Pb(Ep(e),this.instance.config.rageclick)&&this.oa(ye({},i,{type:"rageclick"})),this.oa(i)}}ta(e){!Db(e.target)&&uy(e)&&(clearTimeout(this.na),this.na=setTimeout((()=>{this.oa(this.sa(e,"mousemove"))}),500))}oa(e){if(re){var t=re.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?[...jl,...n||[]]:[],l=mc(t,i,gc);this.R=this.R||{},this.R[l]||(this.R[l]=[]),this.R[l].push(e)}}qi(){this.R&&!Es(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Fb,webVitalsAutocapture:class{constructor(e){var t;this.Go=!1,this.No=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.aa=()=>{clearTimeout(this.la),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,i)=>ye({},n,{["$web_vitals_"+i.name+"_event"]:ye({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=n=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.ua();if(!Se(l))if(et(n==null?void 0:n.name)||et(n==null?void 0:n.value))ra.error("Invalid metric received",n);else if(!this.ha||this.ha>n.value){this.R.url!==l&&(this.aa(),this.la=setTimeout(this.aa,this.flushToCaptureTimeoutMs)),Se(this.R.url)&&(this.R.url=l),this.R.firstMetricTimestamp=Se(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:l,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.aa()}else ra.error("Ignoring metric with value >= "+this.ha,n)},this.ca=()=>{if(!this.No){var n,i,l,c,u=De.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:l,onINP:c}=u.postHogWebVitalsCallbacks),n&&i&&l&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.ht.bind(this)),this.No=!0):ra.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Go=!((t=this._instance.persistence)==null||!t.props[Bm]),this.startIfEnabled()}get da(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=$t(this.da)?(e=this.da)==null?void 0:e.web_vitals_allowed_metrics:void 0;return et(n)?((t=this._instance.persistence)==null?void 0:t.props[Pm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return($t(this.da)?this.da.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=$t(this.da)?this.da.web_vitals_attribution:void 0;return e!=null&&e}get ha(){var e=$t(this.da)&&Fn(this.da.__web_vitals_max_value)?this.da.__web_vitals_max_value:ly;return e>0&&6e4>=e?ly:e}get isEnabled(){var e=Tn==null?void 0:Tn.protocol;if(e!=="http:"&&e!=="https:")return ra.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=$t(this.da)?this.da.web_vitals:si(this.da)?this.da:void 0;return si(t)?t:this.Go}startIfEnabled(){this.isEnabled&&!this.No&&(ra.info("enabled, starting..."),this.$r(this.ca))}onRemoteConfig(e){if("capturePerformance"in e){var t=$t(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$t(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Bm]:t}),this._instance.persistence.register({[Pm]:n})),this.Go=t,this.startIfEnabled()}}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?ra.error("failed to load script",i):e()}))}ua(){var e=re?re.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...jl,...t||[]]:[];return mc(e,n,gc)}ra.error("Could not determine current URL")}}},Y3={exceptionObserver:class{constructor(e){var t,n,i;this.ca=()=>{var l;if(re&&this.isEnabled&&(l=De.__PosthogExtensions__)!=null&&l.errorWrappingFunctions){var c=De.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=De.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=De.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.va&&this.qt.capture_unhandled_errors&&(this.va=c(this.captureException.bind(this))),!this.fa&&this.qt.capture_unhandled_rejections&&(this.fa=u(this.captureException.bind(this))),!this.pa&&this.qt.capture_console_errors&&(this.pa=f(this.captureException.bind(this)))}catch(h){Oo.error("failed to start",h),this.ga()}}},this._instance=e,this.ma=!((t=this._instance.persistence)==null||!t.props[Dm]),this.ya=new JN({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,Zt:Oo}),this.qt=this.ba(),this.startIfEnabledOrStop()}ba(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $t(e)?t=ye({},t,e):(Se(e)?this.ma:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Oo.info("enabled"),this.ga(),this.$r(this.ca)):this.ga()}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Oo.error("failed to load script",i);e()}))}ga(){var e,t,n;(e=this.va)==null||e.call(this),this.va=void 0,(t=this.fa)==null||t.call(this),this.fa=void 0,(n=this.pa)==null||n.call(this),this.pa=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.ma=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Dm]:this.ma}),this.qt=this.ba(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.ba()}captureException(e){var t,n,i,l=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.ya.consumeRateLimit(l)?Oo.info("Skipping exception capture because of client rate limiting.",{exception:l}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this._a=[],this.wa=new dC([new bC,new EC,new _C,new yC,new NC,new jC,new SC,new CC],(function(i){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
62
+ `),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=Ab.test(y)?y.replace(Ab,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var k=_(b,i);if(k){p.push(k);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var j=Array.from(E);return j.reverse(),j.slice(0,50).map((T=>{return ye({},T,{filename:T.filename||(N=j,N[N.length-1]||{}).filename,function:T.function||kl});var N}))})(p)}})("web:javascript",mC,vC)),this._instance=e,this._a=(t=(n=this._instance.persistence)==null?void 0:n.get_property(zm))!==null&&t!==void 0?t:[],this.xa=Md(this.ka()),this.Sa=new AC(this.xa)}onConfigChange(){this.xa=Md(this.ka()),this.Sa.setConfig(this.xa)}onRemoteConfig(e){var t,n,i;if("errorTracking"in e){var l=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this._a=l,this._instance.persistence&&this._instance.persistence.register({[zm]:this._a,[Om]:c})}}get Ca(){var e,t=!!this._instance.get_property(Om),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.wa.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.xa.enabled)try{if(!Ot(e)||e.trim().length===0)return void Di.warn("Ignoring exception step because message must be a non-empty string");var n=this.Ia(t),{sanitizedProperties:i,droppedKeys:l}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>TC.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);l.length>0&&Di.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.Sa.add(ye({[Td]:e,[Ad]:new Date().toISOString()},i))}catch(c){Di.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ta(t)){if(this.Ea(t))return this.Ma("Exception dropped: matched a suppression rule"),void Di.info("Skipping exception capture because a suppression rule matched");if(!this.Ca&&this.Pa(t))return this.Ma("Exception dropped: thrown by a browser extension"),void Di.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ra(t))return this.Ma("Exception dropped: thrown by the PostHog SDK"),void Di.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.xa.enabled&&et(e.$exception_steps)?this.Oa(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",ts:!0});return i&&this.Sa.clear(),i}catch(l){return Di.error("Failed to capture exception event. Dropping this exception.",l),void this.Sa.clear()}}catch(l){return void Di.error("Failed to process exception event. Ignoring this exception.",l)}}Oa(e){try{var t=this.Sa.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return Di.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Ma(e){this.xa.enabled&&this.Sa.add({[Td]:e,[Ad]:new Date().toISOString()})}Ia(e){return $t(e)?ye({},e):{}}ka(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Ea(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:l,value:c}=i;return Ot(l)&&l.length>0&&n.$exception_types.push(l),Ot(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this._a.some((n=>{var i=n.values.map((l=>{var c,u=hw[l.operator],f=Ke(l.value)?l.value:[l.value],h=(c=t[l.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}Pa(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Ra(e){if(e.length>0){var t,n,i,l,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(i=u==null||(l=u.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Ta(e){return!et(e)&&Ke(e)}}},Q3=ye({productTours:class{get Ji(){return this._instance.persistence}constructor(e){this.La=null,this.Aa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,n;if(this.Ji&&this.Ji.register({[Mg]:!!e.productTours}),!Fp(this._instance))return!this.La&&et((t=this.Ji)==null?void 0:t.props[Yo])||Up.info("product tours disabled; stopping and clearing cached tours"),(n=this.La)==null||n.stop(),this.La=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.La&&Fp(this._instance)&&this.$r((()=>this.Fa()))}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?Up.error("Could not load product tours script",i):e()}))}Fa(){var e;!this.La&&(e=De.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.La=De.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ke(this.Aa)||t){var n=this.Ji;if(n){var i=n.props[Yo];if(Ke(i)&&!t)return this.Aa=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:l=>{if(Fp(this._instance)){var c=l.statusCode;if(c!==200||!l.json){var u="Product Tours API could not be loaded, status: "+c;return Up.error(u),void e([],{isLoaded:!1,error:u})}var f=Ke(l.json.product_tours)?l.json.product_tours:[];this.Aa=f,n&&n.register({[Yo]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Aa,{isLoaded:!0})}getActiveProductTours(e){et(this.La)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.La.getActiveProductTours(e)}showProductTour(e){var t;(t=this.La)==null||t.showTourById(e)}previewTour(e){this.La?this.La.previewTour(e):this.$r((()=>{var t;this.Fa(),(t=this.La)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.La)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.La)==null||e.nextStep()}previousStep(){var e;(e=this.La)==null||e.previousStep()}clearCache(){var e;this.Aa=null,(e=this.Ji)==null||e.unregister(Yo)}resetTour(e){var t;(t=this.La)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.La)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.La)==null||t.cancelPendingTour(e)}}},ef),W3={siteApps:class{constructor(e){this.Na=0,this._instance=e,this.Da=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}$a(e,t){if(t){var n=this.globalsForEvent(t);this.Da.push(n),this.Da.length>1e3&&(this.Da=this.Da.slice(10))}}get siteAppLoaders(){var e;return(e=De._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.$a.bind(this));this.qa=()=>{e(),this.Da=[],this.qa=void 0}}}globalsForEvent(e){var t,n,i,l,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},W5(e,$3),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(i=(l=e.properties)==null?void 0:l.$set_once)!==null&&i!==void 0?i:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}ja(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Kr.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Kr.error("prepare_external_dependency_script returned null"),null):e}Ba(){var e,t,n,i,l,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ne==null?void 0:Ne.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Na++,this.Ha)return this.Ua();var g=[],v=this,y=new WeakSet,b=(E,j,T)=>{if(E!=null&&E[j]){var N=E[j];E[j]=T(N),g.push((()=>{E[j]=N}))}},_=E=>{if(y.has(E))return E;var j=v.ja(E);return j&&y.add(j),j},k=E=>E.map((j=>typeof j=="string"?j:_(j))).filter((j=>!Un(j)));return b(p,"appendChild",(E=>function(j){var T=_(j);return T?E.call(this,T):j})),b(p,"insertBefore",(E=>function(j,T){var N=_(j);return N?E.call(this,N,T):j})),b(p,"replaceChild",(E=>function(j,T){var N=_(j);return N?E.call(this,N,T):T})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(i=h.DocumentFragment)==null?void 0:i.prototype].forEach((E=>{b(E,"append",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"prepend",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))}))})),[(l=h.Element)==null?void 0:l.prototype,(c=h.CharacterData)==null?void 0:c.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((E=>{b(E,"before",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"after",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];return j.apply(this,k(N))})),b(E,"replaceWith",(j=>function(){for(var T=arguments.length,N=new Array(T),D=0;T>D;D++)N[D]=arguments[D];var z=k(N);return N.length&&!z.length?void 0:j.apply(this,z)}))})),b((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(E=>function(j,T){var N=_(T);return N?E.call(this,j,N):null})),this.Ha=()=>{g.forEach((E=>E())),this.Ha=void 0},this.Ua()}Ua(){var e=!1;return()=>{var t;e||(e=!0,this.Na--,this.Na===0&&((t=this.Ha)==null||t.call(this)))}}za(e,t){t===void 0&&(t=!0);var n=this.Ba();try{var i=e(n);return t&&n(),i}catch(l){throw n(),l}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Da.length&&(Kr.info("Processing "+this.Da.length+" events for site app with id "+e.id),this.Da.forEach((f=>this.za((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.qa)==null||u.call(this))},i=!1,l=u=>{t.errored=!u,t.loaded=!0,Kr.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var{processEvent:c}=this.za((u=>e.init({posthog:this._instance,callback(f){u(),l(f)}})),!1);c&&(t.processEvent=c),i=!0}catch(u){Kr.error(dy+e.id,u),l(!1)}if(i&&t.loaded)try{n()}catch(u){Kr.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Va(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Wa(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(c){try{t.za((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(u){Kr.error("Error while processing event "+e.event+" for site app "+c.id,u)}};for(var l of Object.values(this.apps))i(l)}}onRemoteConfig(e){var t,n,i,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Va(),void this._instance.on("eventCaptured",(h=>this.Wa(h)))):void Kr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.qa)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var c=function(h){var p;De["__$$ph_site_app_"+h]=l._instance,(p=De.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(l._instance,f,(g=>{if(g)return Kr.error(dy+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else Kr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},J3={tracingHeaders:class{constructor(e){this.Ga=void 0,this.Za=void 0,this.Qa=void 0,this.ca=()=>{var t,n,i=this.Ja();i?(Se(this.Ga)&&(this.Ga=(t=De.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.Za)&&(this.Za=(n=De.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.ga()},this._instance=e}initialize(){this.startIfEnabledOrStop()}$r(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return B3.error("failed to load script",i);e()}))}Ka(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Ja(){var e=this.Ka();return Ke(e)?(Ke(this.Qa)?this.Qa.splice(0,this.Qa.length,...e):this.Qa=[...e],e.length>0?this.Qa:void 0):(Ke(this.Qa)&&this.Qa.splice(0),this.Qa=e||void 0,this.Qa)}ga(){var e,t;(e=this.Ga)==null||e.call(this),(t=this.Za)==null||t.call(this),this.Ga=void 0,this.Za=void 0}startIfEnabledOrStop(){this.Ja()?this.$r(this.ca):this.ga()}}},X3=ye({surveys:class{get qt(){return this._instance.config}constructor(e){this.Ya=void 0,this._surveyManager=null,this.Xa=!1,this.el=[],this.tl=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(et(t))return Et.warn("Flags not loaded yet. Not loading surveys.");var n=Ke(t);this.Ya=n?t.length>0:t,Et.info("flags response received, isSurveysEnabled: "+this.Ya),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);(i!=null&&i.startsWith(sg)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((l=>localStorage.removeItem(l)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Xa)Et.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)Et.info(fy);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())Et.info("Not loading surveys in cookieless mode without consent.");else{var e=De==null?void 0:De.__PosthogExtensions__;if(e){if(!Se(this.Ya)||this.qt.advanced_enable_surveys){var t=this.Ya||this.qt.advanced_enable_surveys;this.Xa=!0;try{var n=e.generateSurveys;if(n)return void this.rl(n,t);var i=e.loadExternalDependency;if(!i)return void this.il(Wm);i(this._instance,"surveys",(l=>{l||!e.generateSurveys?this.il("Could not load surveys script",l):this.rl(e.generateSurveys,t)}))}catch(l){throw this.il("Error initializing surveys",l),l}finally{this.Xa=!1}}}else Et.error("PostHog Extensions not found.")}}rl(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new q3(this._instance),Et.info("Surveys loaded successfully"),this.nl({isLoaded:!0})}il(e,t){Et.error(e,t),this.nl({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.el.push(e),this._surveyManager&&this.nl({isLoaded:!0}),()=>{this.el=this.el.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qt.disable_surveys)return Et.info(fy),e([]);var n,i=this._instance.get_property(Fm);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.tl?this.tl.then((l=>{var{surveys:c,context:u}=l;return e(c,u)})):(typeof Promise<"u"&&(this.tl=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:l=>{var c;this.tl=null;var u=l.statusCode;if(u!==200||!l.json){var f="Surveys API could not be loaded, status: "+u;Et.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=l.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var k;return!((k=_.conditions)==null||(k=k.events)==null||(k=k.values)==null||!k.length)})(b)||(function(_){var k;return!((k=_.conditions)==null||(k=k.actions)==null||(k=k.values)==null||!k.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Fm]:g,[Lg]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}nl(e){for(var t of this.el)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Et.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!et(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Et.warn("init was not called")}sl(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((l=>l.id===e)))!==null&&i!==void 0?i:null})),t}ol(e){if(et(this._surveyManager))return{eligible:!1,reason:qp};var t=typeof e=="string"?this.sl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(et(this._surveyManager))return Et.warn("init was not called"),{visible:!1,disabledReason:qp};var t=this.ol(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return et(this._surveyManager)?(Et.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:qp})):new Promise((n=>{this.getSurveys((i=>{var l,c=(l=i.find((f=>f.id===e)))!==null&&l!==void 0?l:null;if(c){var u=this.ol(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(et(this._surveyManager))Et.warn("init was not called");else{var l=typeof e=="string"?this.sl(e):e;if(l!=null&&l.id)if(E3.includes(l.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(i=l.appearance)!=null&&i.surveyPopupDelaySeconds?(Et.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Et.info("Rendering survey "+l.id+" with delay of "+((u=l.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(l,c,n),Et.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,c,n);Et.warn("Survey element not found")}else Et.warn("Surveys of type "+l.type+" cannot be rendered in the app");else Et.warn("Survey not found")}}displaySurvey(e,t){var n;if(et(this._surveyManager))Et.warn("init was not called");else{var i=this.sl(e);if(i){var l=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=ye({},i,{appearance:ye({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Km.Popover&&t.initialResponses&&Et.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(i);if(!c.visible)return void Et.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==Km.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else Et.warn("Survey not found")}}cancelPendingSurvey(e){et(this._surveyManager)?Et.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},ef),Z3={toolbar:class{constructor(e){this.instance=e}al(e){De.ph_toolbar_state=e}ll(){var e;return(e=De.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),P_(this.instance.config)||!re||!Ne)return!1;e=e??re.location,n=n??re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}var i,l=H3||Ud(e.hash,"__posthog")||Ud(e.hash,"state"),c=l?Rb((()=>JSON.parse(atob(decodeURIComponent(l)))))||Rb((()=>JSON.parse(decodeURIComponent(l)))):null;return c&&c.action==="ph_authorize"?((i=c).source="url",i&&Object.keys(i).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(hy)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}ul(e){var t=De.ph_load_toolbar||De.ph_load_editor;!et(t)&&Ui(t)?t(e,this.instance):py.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById(D_));if(!re||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(hy,JSON.stringify(ye({},i,{source:void 0}))),this.ll()===2)this.ul(i);else if(this.ll()===0){var l;this.al(1),(l=De.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return py.error("[Toolbar] Failed to load",c),void this.al(0);this.al(2),this.ul(i)})),Qt(re,"turbolinks:load",(()=>{this.al(0),this.loadToolbar(i)}))}return!0}hl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},K3=ye({experiments:Dn},ef),e4=ye({},ef,V3,G3,Y3,Q3,W3,X3,J3,Z3,K3,{conversations:class{constructor(e){this.cl=void 0,this._conversationsManager=null,this.dl=!1,this.vl=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;et(t)||(si(t)?this.cl=t:(this.cl=t.enabled,this.vl=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.cl=void 0,this.vl=null}loadIfEnabled(){if(!(this._conversationsManager||this.dl||this._instance.config.disable_conversations||P_(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=De==null?void 0:De.__PosthogExtensions__;if(e&&!Se(this.cl)&&this.cl)if(this.vl&&this.vl.token){this.dl=!0;try{var t=e.initConversations;if(t)return this.fl(t),void(this.dl=!1);var n=e.loadExternalDependency;if(!n)return void this.pl(Wm);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.pl("Could not load conversations script",i):this.fl(e.initConversations),this.dl=!1}))}catch(i){this.pl("Error initializing conversations",i),this.dl=!1}}else kr.error("Conversations enabled but missing token in remote config.")}}fl(e){if(this.vl)try{this._conversationsManager=e(this.vl,this._instance),kr.info("Conversations loaded successfully")}catch(t){this.pl("Error completing conversations initialization",t)}else kr.error("Cannot complete initialization: remote config is null")}pl(e,t){kr.error(e,t),this._conversationsManager=null,this.dl=!1}show(){this._conversationsManager?this._conversationsManager.show():kr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.cl===!0&&!Un(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return wn((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(kr.warn(sa),null)}))()}getMessages(e,t){var n=this;return wn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(kr.warn(sa),null)}))()}markAsRead(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(kr.warn(sa),null)}))()}getTickets(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(kr.warn(sa),null)}))()}requestRestoreLink(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(kr.warn(sa),null)}))()}restoreFromToken(e){var t=this;return wn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(kr.warn(sa),null)}))()}restoreFromUrlToken(){var e=this;return wn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kr.warn(sa),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}us(){var e;(e=this._conversationsManager)==null||e.setIdentity()}hs(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.gl=!1,this.ml=!1,this.Zt=Vt("[logs]"),this.Ei=[],this.yl=()=>{var n;(n=this.bl)==null||n.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.gl=!0),re&&Qt(re,"online",this.yl)}_l(){var e,t,n,i,l,c,u,f,h,p,g,v,y,b,_=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.bl&&this.wl===_||((t=this.bl)==null||t.reset(),this.wl=_,this.xl=(p=(i=(n=_)==null?void 0:n.flushIntervalMs)!==null&&i!==void 0?i:3e3,g=(l=n==null?void 0:n.maxBufferSize)!==null&&l!==void 0?l:100,v=(c=n==null?void 0:n.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,y=Math.max(g,v),{serviceName:(u=(b=n==null?void 0:n.resourceAttributes)==null?void 0:b["service.name"])!==null&&u!==void 0?u:n==null?void 0:n.serviceName,serviceVersion:(f=b==null?void 0:b["service.version"])!==null&&f!==void 0?f:n==null?void 0:n.serviceVersion,environment:(h=b==null?void 0:b["deployment.environment"])!==null&&h!==void 0?h:n==null?void 0:n.environment,resourceAttributes:b,beforeSend:n==null?void 0:n.beforeSend,flushIntervalMs:p,maxBufferSize:g,maxQueueSize:y,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}),this.bl=new cC(this.kl(),this.xl,this.Zt,(()=>this.Sl()),(k=>k()))),this.bl}Cl(){return this._l(),this.xl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!et(n)&&n&&(this.gl=!0,this.loadIfEnabled())}reset(){var e;this.Ei=[],(e=this.bl)==null||e.reset()}captureLog(e){this._l().captureLog(e)}get logger(){return this.Il||(this.Il={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Il}flushLogs(e){e?this.Tl(e):this._l().flush().catch((t=>this.Zt.error("PostHog logs flush failed:",t)))}loadIfEnabled(){if(this.gl&&!this.ml){var e=De==null?void 0:De.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.Zt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.ml=!0)})):this.Zt.error(Wm)}else this.Zt.error("PostHog Extensions not found.")}}kl(){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:t=>t===$i.LogsQueue?this.Ei:void 0,setPersistedProperty:(t,n)=>{var i;t===$i.LogsQueue&&(this.Ei=(i=n)!==null&&i!==void 0?i:[])},wr:t=>this.wr(t),getLibraryId:()=>Xt.LIB_NAME,getLibraryVersion:()=>Xt.LIB_VERSION}}wr(e){return new Promise((t=>{var n=!1,i=c=>{n||(n=!0,clearTimeout(l),t(c))},l=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.El(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(c){var u=c.statusCode;if(u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==429&&500>u)i({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;i({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}))}Tl(e){var t=this.Cl();if(this.Ei.length!==0){var n=this.Ei.map((l=>l.record));this.Ei=[];var i=k_(n,S_(t,Xt.LIB_NAME,Xt.LIB_VERSION),Xt.LIB_NAME,Xt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.El(),data:i,compression:"best-available",batchKey:"logs",transport:e})}}El(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Sl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(De!=null&&(e=De.location)!=null&&e.href&&(t.currentUrl=De.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}});Er.__defaultExtensionClasses=ye({},e4);var xc=(function(){Xt.SDK_DIST_CHANNEL="npm";var e=nc[ml]=new Er;return(function(){function t(){t.done||(t.done=!0,gw=!1,Rt(nc,(function(n){n._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?t():Qt(Ne,"DOMContentLoaded",t,{capture:!1}):re&&je.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const t4="https://us.i.posthog.com",xw="cc-telemetry-enabled";let og=!1,vc=!1;function n4(){return t4}function r4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(xw);return e===null?!0:e==="true"}function vw(e){og&&(e?(xc.opt_in_capturing({captureEventName:null}),vc=!0):(xc.opt_out_capturing(),vc=!1))}function AL(e){typeof localStorage<"u"&&localStorage.setItem(xw,String(e)),vw(e)}function i4(){const e=void 0;return e?(xc.init(e,{api_host:n4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),og=!0,vw(r4()),!0):(og=!1,vc=!1,!1)}function Fg(e,t){vc&&xc.capture(e,t)}function Rs(e,t){vc&&xc.captureException(e,t)}function s4(e){Fg("$pageview",{$current_url:e})}const ai="/api",bw="companion_auth_token";function Ls(){if(typeof window>"u")return{};const e=localStorage.getItem(bw);return e?{Authorization:`Bearer ${e}`}:{}}function ga(e){e===401&&typeof window<"u"&&(localStorage.removeItem(bw),Zn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Lj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function dn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Sc(e,t,n,i){Fg("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function li(e,t,n,i,l){Fg("api_request_failed",{method:e,path:t,status:l,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Rs(i,{method:e,path:t,status:l})}async function Fe(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("POST",e,dn()-n,u,l.status),i=!0,u}return Sc("POST",e,dn()-n,l.status),l.json()}catch(l){throw i||li("POST",e,dn()-n,l),l}}async function Re(e){const t=dn();let n=!1;try{const i=await fetch(`${ai}${e}`,{headers:{...Ls()}});if(!i.ok){ga(i.status);const l=await i.json().catch(()=>({error:i.statusText})),c=new Error(l.error||i.statusText);throw li("GET",e,dn()-t,c,i.status),n=!0,c}return Sc("GET",e,dn()-t,i.status),i.json()}catch(i){throw n||li("GET",e,dn()-t,i),i}}async function jr(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("PUT",e,dn()-n,u,l.status),i=!0,u}return Sc("PUT",e,dn()-n,l.status),l.json()}catch(l){throw i||li("PUT",e,dn()-n,l),l}}async function a4(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("PATCH",e,dn()-n,u,l.status),i=!0,u}return Sc("PATCH",e,dn()-n,l.status),l.json()}catch(l){throw i||li("PATCH",e,dn()-n,l),l}}async function Nr(e,t){const n=dn();let i=!1;try{const l=await fetch(`${ai}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ls()},body:t?JSON.stringify(t):void 0});if(!l.ok){ga(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw li("DELETE",e,dn()-n,u,l.status),i=!0,u}return Sc("DELETE",e,dn()-n,l.status),l.json()}catch(l){throw i||li("DELETE",e,dn()-n,l),l}}async function l4(e,t){const n=await fetch(`${ai}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),l=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
63
63
 
64
64
  `);c=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
65
- `))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function o4(){try{const e=await fetch(`${ai}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function vy(e){try{const t=await fetch(`${ai}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const we={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>Fe("/auth/regenerate"),createSession:e=>Fe("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Nr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ai}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ls()}});if(!n.ok)throw ga(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>a4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Fe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>jr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Nr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Fe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>jr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Nr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Fe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Fe("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>jr("/settings",e),verifyAnthropicKey:e=>Fe("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>Fe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Fe("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>Fe("/linear/connections",e),updateLinearConnection:(e,t)=>jr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Nr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Fe(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Fe(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>jr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Nr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>jr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Nr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Fe("/linear/issues",e),addLinearComment:(e,t,n)=>Fe(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Fe("/git/fetch",{repoRoot:e}),gitPull:e=>Fe("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Fe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Nr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Fe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Fe(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ai}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ls()}});if(!t.ok){ga(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>jr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>jr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Re("/system/memory"),spawnTerminal:(e,t,n,i)=>Fe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Fe("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>Fe("/update-check"),triggerUpdate:()=>Fe("/update"),getClaudeCompat:()=>Re("/claude-compat"),refreshClaudeCompat:()=>Fe("/claude-compat/refresh"),pinClaudeVersion:e=>Fe("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Fe("/claude-compat/patch"),unpatchClaudeBinary:()=>Fe("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Fe("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Fe("/cron/jobs",e),updateCronJob:(e,t)=>jr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Nr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Fe("/agents",e),updateAgent:(e,t)=>jr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Nr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Fe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Fe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Fe("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Fe(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return Re(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Fe("/linear/oauth/disconnect"),createLinearStaging:e=>Fe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Nr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>Fe("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>jr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Nr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Re(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Fe("/prompts",e),updatePrompt:(e,t)=>jr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Nr(`/prompts/${encodeURIComponent(e)}`)};let by=!1;function yy(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const l=document.execCommand("copy");if(document.body.removeChild(i),!l){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function _y(){return new Promise(()=>{})}function c4(){if(by||typeof window>"u")return;by=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await yy(i)}catch{return _y()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await yy(n)}catch{return _y()}}}})}catch{}}const wy="#/session/",Sy="#/agents/";let ky=!1;function qg(){ky||(c4(),ky=!0)}function Hg(e){if(qg(),e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(Sy)){const n=e.slice(Sy.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(wy)){const n=e.slice(wy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function u4(e){return`#/session/${e}`}function Ig(e,t=!1){qg();const n=u4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Ip(e=!1){qg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function d4(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[l,c]=S.useState(!1),u=W(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await vy(v)?u(v):i("Invalid token"),c(!1)},[e,u]);S.useEffect(()=>{o4().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),vy(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=S.useState(!1);return a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:a.jsxs("div",{className:"w-full max-w-sm px-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),a.jsxs("form",{onSubmit:f,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:l}),a.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&a.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),a.jsx("button",{type:"submit",disabled:l||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:l?"Verifying...":"Login"})]}),a.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var Al=z5();function f4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:l,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:a.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&a.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),a.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",a.jsx("strong",{className:"text-cc-fg",children:e})," ",a.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),a.jsxs("fieldset",{className:"space-y-2 mb-4",children:[a.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),a.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&l&&a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),a.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",l]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function h4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function p4({status:e}){switch(e){case"running":return a.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function m4({type:e}){return e==="codex"?a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function bd({session:e,isActive:t,isArchived:n,sessionName:i,permCount:l,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:k,onCancelRename:E,editInputRef:j}){const T=e.id.slice(0,8),N=i||e.model||T,D=y===e.id,[z,L]=S.useState(!1),H=S.useRef(null),U=S.useRef(null),V=n?"exited":h4(e,l),O=e.cwd||"";S.useEffect(()=>{if(!z)return;function A(X){var I;H.current&&!H.current.contains(X.target)&&U.current&&!U.current.contains(X.target)&&(L(!1),(I=U.current)==null||I.focus())}function ae(X){var I,$,P;if(X.key==="Escape"){L(!1),(I=U.current)==null||I.focus();return}if(X.key==="Tab"){L(!1);return}if((X.key==="ArrowDown"||X.key==="ArrowUp")&&(($=H.current)!=null&&$.contains(document.activeElement)||U.current===document.activeElement)){X.preventDefault();const ie=(P=H.current)==null?void 0:P.querySelectorAll("[role='menuitem']");if(!ie||ie.length===0)return;const me=document.activeElement,R=Array.from(ie).indexOf(me);X.key==="ArrowDown"?ie[R<ie.length-1?R+1:0].focus():ie[R>0?R-1:ie.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",ae)}},[z]),S.useEffect(()=>{z&&requestAnimationFrame(()=>{var A,ae;(ae=(A=H.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||ae.focus()})},[z]);const F=S.useCallback(A=>{L(!1),A()},[]);return a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),f(e.id,N)},onKeyDown:A=>{A.key==="F2"&&!D&&(A.preventDefault(),f(e.id,N))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!D&&a.jsx(p4,{status:V}),D?a.jsx("input",{ref:j,value:b,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),k()):A.key==="Escape"&&(A.preventDefault(),E()),A.stopPropagation()},onBlur:k,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:N}),O&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!D&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(m4,{type:e.backendType}),e.isContainerized&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:a.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!D&&!z&&a.jsx("button",{onClick:A=>{A.stopPropagation(),h(A,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),a.jsx("button",{ref:U,onClick:A=>{A.stopPropagation(),L(!z)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":z,children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),z&&a.jsxs("div",{ref:H,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>F(()=>f(e.id,N)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?a.jsxs(a.Fragment,{children:[a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>p(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[a.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),a.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),a.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>g(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>h(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function g4({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:l,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:j,editInputRef:T,isFirst:N}){const D=t?e.sessions.slice(0,2).map(z=>l.get(z.id)||z.model||z.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return a.jsxs("div",{className:N?"":"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),a.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&D&&a.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:D}),!t&&a.jsx("div",{className:"mt-0.5",children:e.sessions.map(z=>{var H;const L=((H=c.get(z.id))==null?void 0:H.size)??0;return a.jsx(bd,{session:z,isActive:i===z.id,sessionName:l.get(z.id),permCount:L,isRecentlyRenamed:u.has(z.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:j,editInputRef:T},z.id)})})]})}function x4(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function v4(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function b4(e){const t=new Map;for(const i of e){const l=x4(i.cwd,i.repoRoot||void 0,i.isContainerized),c=v4(l);t.has(l)||t.set(l,{key:l,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(l);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,l)=>i.label.localeCompare(l.label));for(const i of n)i.sessions.sort((l,c)=>c.createdAt-l.createdAt);return n}const y4=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],_4=[{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],w4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],S4=new Map(_4.map(e=>[e.id,e]));function k4(){var Mr,Rr;const[e,t]=S.useState(null),[n,i]=S.useState(""),[l,c]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(null),[y,b]=S.useState(!1),[_,k]=S.useState(null),[E,j]=S.useState(!1),[T,N]=S.useState(()=>typeof window<"u"?window.location.hash:""),D=S.useRef(null),z=S.useRef(null),L=W(ne=>ne.sessions),H=W(ne=>ne.sdkSessions),U=W(ne=>ne.currentSessionId),V=W(ne=>ne.cliConnected),O=W(ne=>ne.cliReconnecting),F=W(ne=>ne.sessionStatus),A=W(ne=>ne.removeSession),ae=W(ne=>ne.sessionNames),X=W(ne=>ne.recentlyRenamed),I=W(ne=>ne.clearRecentlyRenamed),$=W(ne=>ne.pendingPermissions),P=W(ne=>ne.linkedLinearIssues),ie=W(ne=>ne.collapsedProjects),me=W(ne=>ne.toggleProjectCollapse),R=Hg(T);S.useEffect(()=>{let ne=!0;async function he(){try{const Ye=await we.listSessions();if(ne){const _t=W.getState();_t.setSdkSessions(Ye);const rn=W.getState(),pr=new Set(Ye.map(mt=>mt.sessionId));for(const mt of rn.sessions.keys())!pr.has(mt)&&rn.connectionStatus.get(mt)!=="connected"&&rn.removeSession(mt);MN(Ye);for(const mt of Ye)if(mt.name&&(!_t.sessionNames.has(mt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_t.sessionNames.get(mt.sessionId)))){const qn=_t.sessionNames.get(mt.sessionId),zs=!!qn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(qn);qn!==mt.name&&(_t.setSessionName(mt.sessionId,mt.name),zs&&_t.markRecentlyRenamed(mt.sessionId))}}}catch{}}he();const ge=setInterval(he,5e3);return()=>{ne=!1,clearInterval(ge)}},[]),S.useEffect(()=>{const ne=()=>N(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function B(ne){Ig(ne),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}function Z(){Ip(),W.getState().newSession(),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&D.current&&(D.current.focus(),D.current.select())},[e]);function M(){e&&n.trim()&&(W.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function pe(){t(null),i("")}function _e(ne,he){t(ne),i(he)}const Ce=S.useCallback((ne,he)=>{ne.stopPropagation(),k(he)},[]),Te=S.useCallback(async ne=>{try{ym(ne),await we.deleteSession(ne)}catch{}W.getState().currentSessionId===ne&&Ip(),A(ne)},[A]),Le=S.useCallback(()=>{_&&(Te(_),k(null))},[_,Te]),Pe=S.useCallback(()=>{k(null)},[]),rt=S.useCallback(()=>{j(!0)},[]),be=S.useCallback(async()=>{j(!1);const ne=W.getState(),he=new Set;for(const Ye of ne.sessions.keys())he.add(Ye);for(const Ye of ne.sdkSessions)he.add(Ye.sessionId);const ge=Array.from(he).filter(Ye=>{const _t=ne.sdkSessions.find(rn=>rn.sessionId===Ye);return(_t==null?void 0:_t.archived)??!1});for(const Ye of ge)await Te(Ye)},[Te]),ze=S.useCallback(()=>{j(!1)},[]);S.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var he,ge;(ge=(he=z.current)==null?void 0:he.querySelector("button"))==null||ge.focus()});function ne(he){var rn;if(he.key==="Escape"){E?ze():Pe();return}if(he.key!=="Tab")return;const ge=(rn=z.current)==null?void 0:rn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const Ye=ge[0],_t=ge[ge.length-1];he.shiftKey&&document.activeElement===Ye?(he.preventDefault(),_t.focus()):!he.shiftKey&&document.activeElement===_t&&(he.preventDefault(),Ye.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,E,Pe,ze]);const gt=S.useCallback(async(ne,he)=>{ne.stopPropagation();const ge=H.find(qn=>qn.sessionId===he),Ye=L.get(he),_t=(Ye==null?void 0:Ye.is_containerized)||!!(ge!=null&&ge.containerId)||!1,rn=P.get(he),pr=((rn==null?void 0:rn.stateType)||"").toLowerCase();if(rn&&!(pr==="completed"||pr==="canceled"||pr==="cancelled"))try{const qn=await we.getArchiveInfo(he);if(qn.issueNotDone){p(he),v(qn),b(_t);return}}catch{}if(_t){f(he);return}Ut(he)},[H,L,P]),Ut=S.useCallback(async(ne,he,ge)=>{try{ym(ne);const Ye={};he&&(Ye.force=!0),ge&&ge!=="none"&&(Ye.linearTransition=ge),await we.archiveSession(ne,Object.keys(Ye).length>0?Ye:void 0)}catch{}W.getState().currentSessionId===ne&&(Ip(),W.getState().newSession());try{const Ye=await we.listSessions();W.getState().setSdkSessions(Ye)}catch{}},[]),Dt=S.useCallback(()=>{u&&(Ut(u,!0),f(null))},[u,Ut]),kt=S.useCallback(()=>{f(null)},[]),fn=S.useCallback((ne,he)=>{h&&(Ut(h,he,ne),p(null),v(null))},[h,Ut]),it=S.useCallback(()=>{p(null),v(null)},[]),xn=S.useCallback(async(ne,he)=>{ne.stopPropagation();try{await we.unarchiveSession(he)}catch{}try{const ge=await we.listSessions();W.getState().setSdkSessions(ge)}catch{}},[]),hn=new Set;for(const ne of L.keys())hn.add(ne);for(const ne of H)hn.add(ne.sessionId);const ke=Array.from(hn).map(ne=>{var Ye;const he=L.get(ne),ge=H.find(_t=>_t.sessionId===ne);return{id:ne,model:(he==null?void 0:he.model)||(ge==null?void 0:ge.model)||"",cwd:(he==null?void 0:he.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(he==null?void 0:he.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(he==null?void 0:he.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(he==null?void 0:he.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(he==null?void 0:he.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(he==null?void 0:he.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(he==null?void 0:he.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:V.get(ne)??!1,isReconnecting:O.get(ne)??!1,status:F.get(ne)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(he==null?void 0:he.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(he==null?void 0:he.repo_root)||"",permCount:((Ye=$.get(ne))==null?void 0:Ye.size)??0,cronJobId:(he==null?void 0:he.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(he==null?void 0:he.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(he==null?void 0:he.agentId)||(ge==null?void 0:ge.agentId),agentName:(he==null?void 0:he.agentName)||(ge==null?void 0:ge.agentName),userName:ge==null?void 0:ge.userName}}).sort((ne,he)=>he.createdAt-ne.createdAt),Oe=S.useMemo(()=>Array.from(new Set(ke.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[ke]),[st,qe]=S.useState("__all__"),hr=ne=>st==="__all__"?!0:st==="__none__"?!ne.userName:ne.userName===st,le=ke.some(ne=>!ne.userName),xe=ke.filter(hr),Q=xe.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),fe=xe.filter(ne=>!ne.archived&&!!ne.cronJobId),Ae=xe.filter(ne=>!ne.archived&&!!ne.agentId),Ve=xe.filter(ne=>ne.archived),tt=U?ke.find(ne=>ne.id===U):null,nt=(tt==null?void 0:tt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[xt,nn]=S.useState(!0),[ut,vn]=S.useState(!0),Sn=S.useMemo(()=>b4(Q),[Q]),Fr={onSelect:B,onStartRename:_e,onArchive:gt,onUnarchive:xn,onDelete:Ce,onClearRecentlyRenamed:I,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:M,onCancelRename:pe,editInputRef:D};return a.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[a.jsx("div",{className:"p-3.5 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("img",{src:nt,alt:"",className:"w-6 h-6"}),a.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),a.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),a.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}),a.jsx("button",{onClick:()=>W.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),Oe.length>0&&a.jsxs("div",{className:"px-3.5 pb-2",children:[a.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),a.jsxs("select",{id:"sidebar-user-filter",value:st,onChange:ne=>qe(ne.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[a.jsx("option",{value:"__all__",children:"All users"}),Oe.map(ne=>a.jsx("option",{value:ne,children:ne},ne)),le&&a.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&a.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:kt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:Dt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&fe.length===0&&Ve.length===0?a.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):a.jsxs(a.Fragment,{children:[Sn.map((ne,he)=>a.jsx(g4,{group:ne,isCollapsed:ie.has(ne.key),onToggleCollapse:me,currentSessionId:U,sessionNames:ae,pendingPermissions:$,recentlyRenamed:X,isFirst:he===0,...Fr},ne.key)),fe.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>nn(!xt),"aria-expanded":xt,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${xt?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",fe.length,")"]}),xt&&a.jsx("div",{className:"mt-0.5",children:fe.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]}),Ae.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>vn(!ut),"aria-expanded":ut,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${ut?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Ae.length,")"]}),ut&&a.jsx("div",{className:"mt-0.5",children:Ae.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]}),Ve.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsxs("button",{onClick:()=>c(!l),"aria-expanded":l,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${l?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ve.length,")"]}),l&&Ve.length>1&&a.jsx("button",{onClick:rt,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),l&&a.jsx("div",{className:"mt-0.5",children:Ve.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,isArchived:!0,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]})]})}),a.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:a.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})})}),a.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[a.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:w4.map(ne=>a.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),a.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(he=>{const ge=S4.get(he);if(!ge)return null;const Ye=ge.activePages?ge.activePages.some(_t=>R.page===_t):R.page===ge.id;return a.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&W.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":Ye?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Ye?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Ye?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),a.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:a.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},ne.id))}),a.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),a.jsx("div",{className:"flex items-center gap-0.5",children:y4.map(ne=>a.jsx("a",{href:ne.url,target:"_blank",rel:"noopener noreferrer",title:ne.label,"aria-label":`Open ${ne.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:a.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||E)&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:E?ze:Pe,children:a.jsxs("div",{ref:z,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:ne=>ne.stopPropagation(),children:[a.jsx("div",{className:"flex justify-center mb-3",children:a.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),a.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),a.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${Ve.length} archived session${Ve.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),a.jsxs("div",{className:"flex gap-2.5 mt-4",children:[a.jsx("button",{onClick:E?ze:Pe,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:E?be:Le,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:E?"Delete all":"Delete"})]})]})}),h&&g&&a.jsx(f4,{issueIdentifier:((Mr=g.issue)==null?void 0:Mr.identifier)||"",issueStateName:((Rr=g.issue)==null?void 0:Rr.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:fn,onCancel:it})]})}function j4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const N4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E4={};function jy(e,t){return(E4.jsx?C4:N4).test(e)}const T4=/[ \t\n\f\r]/g;function A4(e){return typeof e=="object"?e.type==="text"?Ny(e.value):!1:Ny(e)}function Ny(e){return e.replace(T4,"")===""}class kc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}kc.prototype.normal={};kc.prototype.property={};kc.prototype.space=void 0;function yw(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new kc(n,i,t)}function cg(e){return e.toLowerCase()}class Kn{constructor(t,n){this.attribute=n,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;let M4=0;const Ge=va(),un=va(),ug=va(),ve=va(),At=va(),pa=va(),or=va();function va(){return 2**++M4}const dg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:un,commaOrSpaceSeparated:or,commaSeparated:pa,number:ve,overloadedBoolean:ug,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),Vp=Object.keys(dg);class Vg extends Kn{constructor(t,n,i,l){let c=-1;if(super(t,n),Cy(this,"space",l),typeof i=="number")for(;++c<Vp.length;){const u=Vp[c];Cy(this,Vp[c],(i&dg[u])===dg[u])}}}Vg.prototype.defined=!0;function Cy(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const c=new Vg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[cg(i)]=i,n[cg(c.attribute)]=i}return new kc(t,n,e.space)}const _w=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:un,ariaAutoComplete:null,ariaBusy:un,ariaChecked:un,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:un,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:un,ariaFlowTo:At,ariaGrabbed:un,ariaHasPopup:null,ariaHidden:un,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:ve,ariaLive:null,ariaModal:un,ariaMultiLine:un,ariaMultiSelectable:un,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:un,ariaReadOnly:un,ariaRelevant:null,ariaRequired:un,ariaRoleDescription:At,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:un,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ww(e,t){return t in e?e[t]:t}function Sw(e,t){return ww(e,t.toLowerCase())}const R4=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pa,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alpha:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:At,autoFocus:Ge,autoPlay:Ge,blocking:At,capture:null,charSet:null,checked:Ge,cite:null,className:At,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:un,controls:Ge,controlsList:At,coords:ve|pa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:ug,draggable:un,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:At,height:ve,hidden:ug,high:ve,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:At,itemRef:At,itemScope:Ge,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:ve,pattern:null,ping:At,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:At,required:Ge,reversed:Ge,rows:ve,rowSpan:ve,sandbox:At,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootCustomElementRegistry:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shadowRootSerializable:Ge,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:un,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:un,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:un,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ge,disablePictureInPicture:Ge,disableRemotePlayback:Ge,exportParts:pa,part:At,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:Sw}),L4=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:or,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:At,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:pa,g2:pa,glyphName:pa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ww}),kw=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),jw=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sw}),Nw=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),D4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},z4=/[A-Z]/g,Ey=/-[a-z]/g,O4=/^data[-\w.:]+$/i;function B4(e,t){const n=cg(t);let i=t,l=Kn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&O4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Ey,$4);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Ey.test(c)){let u=c.replace(z4,P4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Vg}return new l(i,t)}function P4(e){return"-"+e.toLowerCase()}function $4(e){return e.charAt(1).toUpperCase()}const U4=yw([_w,R4,kw,jw,Nw],"html"),Gg=yw([_w,L4,kw,jw,Nw],"svg");function F4(e){return e.join(" ").trim()}var ul={},Gp,Ty;function q4(){if(Ty)return Gp;Ty=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
65
+ `))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function o4(){try{const e=await fetch(`${ai}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function vy(e){try{const t=await fetch(`${ai}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const we={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>Fe("/auth/regenerate"),createSession:e=>Fe("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Nr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ai}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ls()}});if(!n.ok)throw ga(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>a4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Fe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>jr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Nr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Fe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>jr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Nr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Fe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Fe("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>jr("/settings",e),verifyAnthropicKey:e=>Fe("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>Fe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Fe("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>Fe("/linear/connections",e),updateLinearConnection:(e,t)=>jr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Nr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Fe(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Fe(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>jr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Nr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>jr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Nr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Fe("/linear/issues",e),addLinearComment:(e,t,n)=>Fe(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Fe("/git/fetch",{repoRoot:e}),gitPull:e=>Fe("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Fe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Nr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Fe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Fe(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ai}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ls()}});if(!t.ok){ga(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>jr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>jr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Re("/system/memory"),spawnTerminal:(e,t,n,i)=>Fe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Fe("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>Fe("/update-check"),triggerUpdate:()=>Fe("/update"),getClaudeCompat:()=>Re("/claude-compat"),refreshClaudeCompat:()=>Fe("/claude-compat/refresh"),pinClaudeVersion:e=>Fe("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Fe("/claude-compat/patch"),unpatchClaudeBinary:()=>Fe("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Fe("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Fe("/cron/jobs",e),updateCronJob:(e,t)=>jr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Nr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Fe("/agents",e),updateAgent:(e,t)=>jr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Nr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Fe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Fe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Fe("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Fe(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return Re(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Fe("/linear/oauth/disconnect"),createLinearStaging:e=>Fe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Nr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>Fe("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>jr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Nr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Re(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Fe("/prompts",e),updatePrompt:(e,t)=>jr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Nr(`/prompts/${encodeURIComponent(e)}`)};let by=!1;function yy(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const l=document.execCommand("copy");if(document.body.removeChild(i),!l){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function _y(){return new Promise(()=>{})}function c4(){if(by||typeof window>"u")return;by=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await yy(i)}catch{return _y()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await yy(n)}catch{return _y()}}}})}catch{}}const wy="#/session/",Sy="#/agents/";let ky=!1;function qg(){ky||(c4(),ky=!0)}function Hg(e){if(qg(),e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(Sy)){const n=e.slice(Sy.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(wy)){const n=e.slice(wy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function u4(e){return`#/session/${e}`}function Ig(e,t=!1){qg();const n=u4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Ip(e=!1){qg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function d4(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[l,c]=S.useState(!1),u=W(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await vy(v)?u(v):i("Invalid token"),c(!1)},[e,u]);S.useEffect(()=>{o4().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),vy(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=S.useState(!1);return a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:a.jsxs("div",{className:"w-full max-w-sm px-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),a.jsxs("form",{onSubmit:f,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:l}),a.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&a.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),a.jsx("button",{type:"submit",disabled:l||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:l?"Verifying...":"Login"})]}),a.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var Al=z5();function f4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:l,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:a.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&a.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),a.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",a.jsx("strong",{className:"text-cc-fg",children:e})," ",a.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),a.jsxs("fieldset",{className:"space-y-2 mb-4",children:[a.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),a.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&l&&a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),a.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",l]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function h4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function p4({status:e}){switch(e){case"running":return a.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function m4({type:e}){return e==="codex"?a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function bd({session:e,isActive:t,isArchived:n,sessionName:i,permCount:l,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:k,onCancelRename:E,editInputRef:j}){const T=e.id.slice(0,8),N=i||e.model||T,D=y===e.id,[z,L]=S.useState(!1),H=S.useRef(null),U=S.useRef(null),V=n?"exited":h4(e,l),O=e.cwd||"";S.useEffect(()=>{if(!z)return;function A(X){var I;H.current&&!H.current.contains(X.target)&&U.current&&!U.current.contains(X.target)&&(L(!1),(I=U.current)==null||I.focus())}function ae(X){var I,$,P;if(X.key==="Escape"){L(!1),(I=U.current)==null||I.focus();return}if(X.key==="Tab"){L(!1);return}if((X.key==="ArrowDown"||X.key==="ArrowUp")&&(($=H.current)!=null&&$.contains(document.activeElement)||U.current===document.activeElement)){X.preventDefault();const ie=(P=H.current)==null?void 0:P.querySelectorAll("[role='menuitem']");if(!ie||ie.length===0)return;const me=document.activeElement,R=Array.from(ie).indexOf(me);X.key==="ArrowDown"?ie[R<ie.length-1?R+1:0].focus():ie[R>0?R-1:ie.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",ae)}},[z]),S.useEffect(()=>{z&&requestAnimationFrame(()=>{var A,ae;(ae=(A=H.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||ae.focus()})},[z]);const F=S.useCallback(A=>{L(!1),A()},[]);return a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),f(e.id,N)},onKeyDown:A=>{A.key==="F2"&&!D&&(A.preventDefault(),f(e.id,N))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!D&&a.jsx(p4,{status:V}),D?a.jsx("input",{ref:j,value:b,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),k()):A.key==="Escape"&&(A.preventDefault(),E()),A.stopPropagation()},onBlur:k,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:N}),O&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!D&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(m4,{type:e.backendType}),e.isContainerized&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:a.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!D&&!z&&a.jsx("button",{onClick:A=>{A.stopPropagation(),h(A,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),a.jsx("button",{ref:U,onClick:A=>{A.stopPropagation(),L(!z)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":z,children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),z&&a.jsxs("div",{ref:H,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>F(()=>f(e.id,N)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?a.jsxs(a.Fragment,{children:[a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>p(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[a.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),a.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),a.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>g(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>F(()=>h(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function g4({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:l,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:j,editInputRef:T,isFirst:N}){const D=t?e.sessions.slice(0,2).map(z=>l.get(z.id)||z.model||z.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return a.jsxs("div",{className:N?"":"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),a.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&D&&a.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:D}),!t&&a.jsx("div",{className:"mt-0.5",children:e.sessions.map(z=>{var H;const L=((H=c.get(z.id))==null?void 0:H.size)??0;return a.jsx(bd,{session:z,isActive:i===z.id,sessionName:l.get(z.id),permCount:L,isRecentlyRenamed:u.has(z.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:j,editInputRef:T},z.id)})})]})}function x4(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function v4(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function b4(e){const t=new Map;for(const i of e){const l=x4(i.cwd,i.repoRoot||void 0,i.isContainerized),c=v4(l);t.has(l)||t.set(l,{key:l,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(l);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,l)=>i.label.localeCompare(l.label));for(const i of n)i.sessions.sort((l,c)=>c.createdAt-l.createdAt);return n}const y4=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],_4=[{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],w4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],S4=new Map(_4.map(e=>[e.id,e]));function k4(){var Mr,Rr;const[e,t]=S.useState(null),[n,i]=S.useState(""),[l,c]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(null),[y,b]=S.useState(!1),[_,k]=S.useState(null),[E,j]=S.useState(!1),[T,N]=S.useState(()=>typeof window<"u"?window.location.hash:""),D=S.useRef(null),z=S.useRef(null),L=W(ne=>ne.sessions),H=W(ne=>ne.sdkSessions),U=W(ne=>ne.currentSessionId),V=W(ne=>ne.cliConnected),O=W(ne=>ne.cliReconnecting),F=W(ne=>ne.sessionStatus),A=W(ne=>ne.removeSession),ae=W(ne=>ne.sessionNames),X=W(ne=>ne.recentlyRenamed),I=W(ne=>ne.clearRecentlyRenamed),$=W(ne=>ne.pendingPermissions),P=W(ne=>ne.linkedLinearIssues),ie=W(ne=>ne.collapsedProjects),me=W(ne=>ne.toggleProjectCollapse),R=Hg(T);S.useEffect(()=>{let ne=!0;async function he(){try{const Ye=await we.listSessions();if(ne){const _t=W.getState();_t.setSdkSessions(Ye);const rn=W.getState(),pr=new Set(Ye.map(mt=>mt.sessionId));for(const mt of rn.sessions.keys())!pr.has(mt)&&rn.connectionStatus.get(mt)!=="connected"&&rn.removeSession(mt);MN(Ye);for(const mt of Ye)if(mt.name&&(!_t.sessionNames.has(mt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_t.sessionNames.get(mt.sessionId)))){const qn=_t.sessionNames.get(mt.sessionId),zs=!!qn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(qn);qn!==mt.name&&(_t.setSessionName(mt.sessionId,mt.name),zs&&_t.markRecentlyRenamed(mt.sessionId))}}}catch{}}he();const ge=setInterval(he,5e3);return()=>{ne=!1,clearInterval(ge)}},[]),S.useEffect(()=>{const ne=()=>N(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function B(ne){Ig(ne),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}function Z(){Ip(),W.getState().newSession(),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&D.current&&(D.current.focus(),D.current.select())},[e]);function M(){e&&n.trim()&&(W.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function pe(){t(null),i("")}function _e(ne,he){t(ne),i(he)}const Ce=S.useCallback((ne,he)=>{ne.stopPropagation(),k(he)},[]),Te=S.useCallback(async ne=>{try{ym(ne),await we.deleteSession(ne)}catch{}W.getState().currentSessionId===ne&&Ip(),A(ne)},[A]),Le=S.useCallback(()=>{_&&(Te(_),k(null))},[_,Te]),Pe=S.useCallback(()=>{k(null)},[]),rt=S.useCallback(()=>{j(!0)},[]),be=S.useCallback(async()=>{j(!1);const ne=W.getState(),he=new Set;for(const Ye of ne.sessions.keys())he.add(Ye);for(const Ye of ne.sdkSessions)he.add(Ye.sessionId);const ge=Array.from(he).filter(Ye=>{const _t=ne.sdkSessions.find(rn=>rn.sessionId===Ye);return(_t==null?void 0:_t.archived)??!1});for(const Ye of ge)await Te(Ye)},[Te]),ze=S.useCallback(()=>{j(!1)},[]);S.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var he,ge;(ge=(he=z.current)==null?void 0:he.querySelector("button"))==null||ge.focus()});function ne(he){var rn;if(he.key==="Escape"){E?ze():Pe();return}if(he.key!=="Tab")return;const ge=(rn=z.current)==null?void 0:rn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const Ye=ge[0],_t=ge[ge.length-1];he.shiftKey&&document.activeElement===Ye?(he.preventDefault(),_t.focus()):!he.shiftKey&&document.activeElement===_t&&(he.preventDefault(),Ye.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,E,Pe,ze]);const gt=S.useCallback(async(ne,he)=>{ne.stopPropagation();const ge=H.find(qn=>qn.sessionId===he),Ye=L.get(he),_t=(Ye==null?void 0:Ye.is_containerized)||!!(ge!=null&&ge.containerId)||!1,rn=P.get(he),pr=((rn==null?void 0:rn.stateType)||"").toLowerCase();if(rn&&!(pr==="completed"||pr==="canceled"||pr==="cancelled"))try{const qn=await we.getArchiveInfo(he);if(qn.issueNotDone){p(he),v(qn),b(_t);return}}catch{}if(_t){f(he);return}Ft(he)},[H,L,P]),Ft=S.useCallback(async(ne,he,ge)=>{try{ym(ne);const Ye={};he&&(Ye.force=!0),ge&&ge!=="none"&&(Ye.linearTransition=ge),await we.archiveSession(ne,Object.keys(Ye).length>0?Ye:void 0)}catch{}W.getState().currentSessionId===ne&&(Ip(),W.getState().newSession());try{const Ye=await we.listSessions();W.getState().setSdkSessions(Ye)}catch{}},[]),Dt=S.useCallback(()=>{u&&(Ft(u,!0),f(null))},[u,Ft]),kt=S.useCallback(()=>{f(null)},[]),fn=S.useCallback((ne,he)=>{h&&(Ft(h,he,ne),p(null),v(null))},[h,Ft]),it=S.useCallback(()=>{p(null),v(null)},[]),xn=S.useCallback(async(ne,he)=>{ne.stopPropagation();try{await we.unarchiveSession(he)}catch{}try{const ge=await we.listSessions();W.getState().setSdkSessions(ge)}catch{}},[]),hn=new Set;for(const ne of L.keys())hn.add(ne);for(const ne of H)hn.add(ne.sessionId);const ke=Array.from(hn).map(ne=>{var Ye;const he=L.get(ne),ge=H.find(_t=>_t.sessionId===ne);return{id:ne,model:(he==null?void 0:he.model)||(ge==null?void 0:ge.model)||"",cwd:(he==null?void 0:he.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(he==null?void 0:he.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(he==null?void 0:he.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(he==null?void 0:he.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(he==null?void 0:he.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(he==null?void 0:he.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(he==null?void 0:he.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:V.get(ne)??!1,isReconnecting:O.get(ne)??!1,status:F.get(ne)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(he==null?void 0:he.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(he==null?void 0:he.repo_root)||"",permCount:((Ye=$.get(ne))==null?void 0:Ye.size)??0,cronJobId:(he==null?void 0:he.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(he==null?void 0:he.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(he==null?void 0:he.agentId)||(ge==null?void 0:ge.agentId),agentName:(he==null?void 0:he.agentName)||(ge==null?void 0:ge.agentName),userName:ge==null?void 0:ge.userName}}).sort((ne,he)=>he.createdAt-ne.createdAt),Oe=S.useMemo(()=>Array.from(new Set(ke.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[ke]),[st,qe]=S.useState("__all__"),hr=ne=>st==="__all__"?!0:st==="__none__"?!ne.userName:ne.userName===st,le=ke.some(ne=>!ne.userName),xe=ke.filter(hr),Q=xe.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),fe=xe.filter(ne=>!ne.archived&&!!ne.cronJobId),Ae=xe.filter(ne=>!ne.archived&&!!ne.agentId),Ve=xe.filter(ne=>ne.archived),tt=U?ke.find(ne=>ne.id===U):null,nt=(tt==null?void 0:tt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[xt,nn]=S.useState(!0),[ut,vn]=S.useState(!0),Sn=S.useMemo(()=>b4(Q),[Q]),Fr={onSelect:B,onStartRename:_e,onArchive:gt,onUnarchive:xn,onDelete:Ce,onClearRecentlyRenamed:I,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:M,onCancelRename:pe,editInputRef:D};return a.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[a.jsx("div",{className:"p-3.5 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("img",{src:nt,alt:"",className:"w-6 h-6"}),a.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),a.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),a.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}),a.jsx("button",{onClick:()=>W.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),Oe.length>0&&a.jsxs("div",{className:"px-3.5 pb-2",children:[a.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),a.jsxs("select",{id:"sidebar-user-filter",value:st,onChange:ne=>qe(ne.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[a.jsx("option",{value:"__all__",children:"All users"}),Oe.map(ne=>a.jsx("option",{value:ne,children:ne},ne)),le&&a.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&a.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:kt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:Dt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&fe.length===0&&Ve.length===0?a.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):a.jsxs(a.Fragment,{children:[Sn.map((ne,he)=>a.jsx(g4,{group:ne,isCollapsed:ie.has(ne.key),onToggleCollapse:me,currentSessionId:U,sessionNames:ae,pendingPermissions:$,recentlyRenamed:X,isFirst:he===0,...Fr},ne.key)),fe.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>nn(!xt),"aria-expanded":xt,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${xt?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",fe.length,")"]}),xt&&a.jsx("div",{className:"mt-0.5",children:fe.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]}),Ae.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>vn(!ut),"aria-expanded":ut,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${ut?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Ae.length,")"]}),ut&&a.jsx("div",{className:"mt-0.5",children:Ae.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]}),Ve.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsxs("button",{onClick:()=>c(!l),"aria-expanded":l,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${l?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ve.length,")"]}),l&&Ve.length>1&&a.jsx("button",{onClick:rt,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),l&&a.jsx("div",{className:"mt-0.5",children:Ve.map(ne=>{var he;return a.jsx(bd,{session:ne,isActive:U===ne.id,isArchived:!0,sessionName:ae.get(ne.id),permCount:((he=$.get(ne.id))==null?void 0:he.size)??0,isRecentlyRenamed:X.has(ne.id),...Fr},ne.id)})})]})]})}),a.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:a.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})})}),a.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[a.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:w4.map(ne=>a.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),a.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(he=>{const ge=S4.get(he);if(!ge)return null;const Ye=ge.activePages?ge.activePages.some(_t=>R.page===_t):R.page===ge.id;return a.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&W.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":Ye?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Ye?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Ye?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),a.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:a.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},ne.id))}),a.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),a.jsx("div",{className:"flex items-center gap-0.5",children:y4.map(ne=>a.jsx("a",{href:ne.url,target:"_blank",rel:"noopener noreferrer",title:ne.label,"aria-label":`Open ${ne.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:a.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||E)&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:E?ze:Pe,children:a.jsxs("div",{ref:z,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:ne=>ne.stopPropagation(),children:[a.jsx("div",{className:"flex justify-center mb-3",children:a.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),a.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),a.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${Ve.length} archived session${Ve.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),a.jsxs("div",{className:"flex gap-2.5 mt-4",children:[a.jsx("button",{onClick:E?ze:Pe,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:E?be:Le,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:E?"Delete all":"Delete"})]})]})}),h&&g&&a.jsx(f4,{issueIdentifier:((Mr=g.issue)==null?void 0:Mr.identifier)||"",issueStateName:((Rr=g.issue)==null?void 0:Rr.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:fn,onCancel:it})]})}function j4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const N4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E4={};function jy(e,t){return(E4.jsx?C4:N4).test(e)}const T4=/[ \t\n\f\r]/g;function A4(e){return typeof e=="object"?e.type==="text"?Ny(e.value):!1:Ny(e)}function Ny(e){return e.replace(T4,"")===""}class kc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}kc.prototype.normal={};kc.prototype.property={};kc.prototype.space=void 0;function yw(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new kc(n,i,t)}function cg(e){return e.toLowerCase()}class Kn{constructor(t,n){this.attribute=n,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;let M4=0;const Ge=va(),un=va(),ug=va(),ve=va(),At=va(),pa=va(),or=va();function va(){return 2**++M4}const dg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:un,commaOrSpaceSeparated:or,commaSeparated:pa,number:ve,overloadedBoolean:ug,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),Vp=Object.keys(dg);class Vg extends Kn{constructor(t,n,i,l){let c=-1;if(super(t,n),Cy(this,"space",l),typeof i=="number")for(;++c<Vp.length;){const u=Vp[c];Cy(this,Vp[c],(i&dg[u])===dg[u])}}}Vg.prototype.defined=!0;function Cy(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const c=new Vg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[cg(i)]=i,n[cg(c.attribute)]=i}return new kc(t,n,e.space)}const _w=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:un,ariaAutoComplete:null,ariaBusy:un,ariaChecked:un,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:un,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:un,ariaFlowTo:At,ariaGrabbed:un,ariaHasPopup:null,ariaHidden:un,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:ve,ariaLive:null,ariaModal:un,ariaMultiLine:un,ariaMultiSelectable:un,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:un,ariaReadOnly:un,ariaRelevant:null,ariaRequired:un,ariaRoleDescription:At,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:un,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ww(e,t){return t in e?e[t]:t}function Sw(e,t){return ww(e,t.toLowerCase())}const R4=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pa,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alpha:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:At,autoFocus:Ge,autoPlay:Ge,blocking:At,capture:null,charSet:null,checked:Ge,cite:null,className:At,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:un,controls:Ge,controlsList:At,coords:ve|pa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:ug,draggable:un,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:At,height:ve,hidden:ug,high:ve,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:At,itemRef:At,itemScope:Ge,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:ve,pattern:null,ping:At,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:At,required:Ge,reversed:Ge,rows:ve,rowSpan:ve,sandbox:At,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootCustomElementRegistry:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shadowRootSerializable:Ge,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:un,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:un,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:un,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ge,disablePictureInPicture:Ge,disableRemotePlayback:Ge,exportParts:pa,part:At,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:Sw}),L4=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:or,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:At,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:pa,g2:pa,glyphName:pa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ww}),kw=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),jw=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sw}),Nw=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),D4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},z4=/[A-Z]/g,Ey=/-[a-z]/g,O4=/^data[-\w.:]+$/i;function B4(e,t){const n=cg(t);let i=t,l=Kn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&O4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Ey,$4);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Ey.test(c)){let u=c.replace(z4,P4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Vg}return new l(i,t)}function P4(e){return"-"+e.toLowerCase()}function $4(e){return e.charAt(1).toUpperCase()}const U4=yw([_w,R4,kw,jw,Nw],"html"),Gg=yw([_w,L4,kw,jw,Nw],"svg");function F4(e){return e.join(" ").trim()}var ul={},Gp,Ty;function q4(){if(Ty)return Gp;Ty=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
66
66
  `,p="/",g="*",v="",y="comment",b="declaration";function _(E,j){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];j=j||{};var T=1,N=1;function D(X){var I=X.match(t);I&&(T+=I.length);var $=X.lastIndexOf(h);N=~$?X.length-$:N+X.length}function z(){var X={line:T,column:N};return function(I){return I.position=new L(X),V(),I}}function L(X){this.start=X,this.end={line:T,column:N},this.source=j.source}L.prototype.content=E;function H(X){var I=new Error(j.source+":"+T+":"+N+": "+X);if(I.reason=X,I.filename=j.source,I.line=T,I.column=N,I.source=E,!j.silent)throw I}function U(X){var I=X.exec(E);if(I){var $=I[0];return D($),E=E.slice($.length),I}}function V(){U(n)}function O(X){var I;for(X=X||[];I=F();)I!==!1&&X.push(I);return X}function F(){var X=z();if(!(p!=E.charAt(0)||g!=E.charAt(1))){for(var I=2;v!=E.charAt(I)&&(g!=E.charAt(I)||p!=E.charAt(I+1));)++I;if(I+=2,v===E.charAt(I-1))return H("End of comment missing");var $=E.slice(2,I-2);return N+=2,D($),E=E.slice(I),N+=2,X({type:y,comment:$})}}function A(){var X=z(),I=U(i);if(I){if(F(),!U(l))return H("property missing ':'");var $=U(c),P=X({type:b,property:k(I[0].replace(e,v)),value:$?k($[0].replace(e,v)):v});return U(u),P}}function ae(){var X=[];O(X);for(var I;I=A();)I!==!1&&(X.push(I),O(X));return X}return V(),ae()}function k(E){return E?E.replace(f,v):v}return Gp=_,Gp}var Ay;function H4(){if(Ay)return ul;Ay=1;var e=ul&&ul.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ul,"__esModule",{value:!0}),ul.default=n;const t=e(q4());function n(i,l){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),f=typeof l=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?l(p,g,h):g&&(c=c||{},c[p]=g)}),c}return ul}var Po={},My;function I4(){if(My)return Po;My=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),c(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(l,f):p=p.replace(i,f),p.replace(t,u))};return Po.camelCase=h,Po}var $o,Ry;function V4(){if(Ry)return $o;Ry=1;var e=$o&&$o.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(H4()),n=I4();function i(l,c){var u={};return!l||typeof l!="string"||(0,t.default)(l,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return i.default=i,$o=i,$o}var G4=V4();const Y4=Sg(G4),Cw=Ew("end"),Yg=Ew("start");function Ew(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Q4(e){const t=Yg(e),n=Cw(e);if(t&&n)return{start:t,end:n}}function rc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ly(e.position):"start"in e||"end"in e?Ly(e):"line"in e||"column"in e?fg(e):""}function fg(e){return Dy(e&&e.line)+":"+Dy(e&&e.column)}function Ly(e){return fg(e&&e.start)+"-"+fg(e&&e.end)}function Dy(e){return e&&typeof e=="number"?e:1}class On extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let l="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?l=t:!c.cause&&t&&(u=!0,l=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?c.ruleId=i:(c.source=i.slice(0,h),c.ruleId=i.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=rc(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}On.prototype.file="";On.prototype.name="";On.prototype.reason="";On.prototype.message="";On.prototype.stack="";On.prototype.column=void 0;On.prototype.line=void 0;On.prototype.ancestors=void 0;On.prototype.cause=void 0;On.prototype.fatal=void 0;On.prototype.place=void 0;On.prototype.ruleId=void 0;On.prototype.source=void 0;const Qg={}.hasOwnProperty,W4=new Map,J4=/[A-Z]/g,X4=new Set(["table","tbody","thead","tfoot","tr"]),Z4=new Set(["td","th"]),Tw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function K4(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=lE(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=aE(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Gg:U4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Aw(l,e,void 0);return c&&typeof c!="string"?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}function Aw(e,t,n){if(t.type==="element")return eE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rE(e,t,n);if(t.type==="mdxjsEsm")return nE(e,t);if(t.type==="root")return iE(e,t,n);if(t.type==="text")return sE(e,t)}function eE(e,t,n){const i=e.schema;let l=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=Gg,e.schema=l),e.ancestors.push(t);const c=Rw(e,t.tagName,!1),u=oE(e,t);let f=Jg(e,t);return X4.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!A4(h):!0})),Mw(e,u,c,t),Wg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function tE(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}bc(e,t.position)}function nE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bc(e,t.position)}function rE(e,t,n){const i=e.schema;let l=i;t.name==="svg"&&i.space==="html"&&(l=Gg,e.schema=l),e.ancestors.push(t);const c=t.name===null?e.Fragment:Rw(e,t.name,!0),u=cE(e,t),f=Jg(e,t);return Mw(e,u,c,t),Wg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function iE(e,t,n){const i={};return Wg(i,Jg(e,t)),e.create(t,e.Fragment,i,n)}function sE(e,t){return t.value}function Mw(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Wg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function aE(e,t,n){return i;function i(l,c,u,f){const p=Array.isArray(u.children)?n:t;return f?p(c,u,f):p(c,u)}}function lE(e,t){return n;function n(i,l,c,u){const f=Array.isArray(c.children),h=Yg(i);return t(l,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function oE(e,t){const n={};let i,l;for(l in t.properties)if(l!=="children"&&Qg.call(t.properties,l)){const c=uE(e,l,t.properties[l]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&Z4.has(t.tagName)?i=f:n[u]=f}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function cE(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else bc(e,t.position);else{const l=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else bc(e,t.position);else c=i.value===null?!0:i.value;n[l]=c}return n}function Jg(e,t){const n=[];let i=-1;const l=e.passKeys?new Map:W4;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const p=l.get(h)||0;u=h+"-"+p,l.set(h,p+1)}}const f=Aw(e,c,u);f!==void 0&&n.push(f)}return n}function uE(e,t,n){const i=B4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?j4(n):F4(n)),i.property==="style"){let l=typeof n=="object"?n:dE(e,String(n));return e.stylePropertyNameCase==="css"&&(l=fE(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?D4[i.property]||i.property:i.attribute,n]}}function dE(e,t){try{return Y4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,l=new On("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Tw+"#cannot-parse-style-attribute",l}}function Rw(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let c=-1,u;for(;++c<l.length;){const f=jy(l[c])?{type:"Identifier",name:l[c]}:{type:"Literal",value:l[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=u}else i=jy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const l=i.value;return Qg.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);bc(e)}function bc(e,t){const n=new On("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Tw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fE(e){const t={};let n;for(n in e)Qg.call(e,n)&&(t[hE(n)]=e[n]);return t}function hE(e){let t=e.replace(J4,pE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function pE(e){return"-"+e.toLowerCase()}const Yp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},mE={};function Xg(e,t){const n=mE,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Lw(e,i,l)}function Lw(e,t,n){if(gE(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zy(e.children,t,n)}return Array.isArray(e)?zy(e,t,n):""}function zy(e,t,n){const i=[];let l=-1;for(;++l<e.length;)i[l]=Lw(e[l],t,n);return i.join("")}function gE(e){return!!(e&&typeof e=="object")}const Oy=document.createElement("i");function Zg(e){const t="&"+e+";";Oy.innerHTML=t;const n=Oy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function fr(e,t,n,i){const l=e.length;let c=0,u;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Tr(e,t){return e.length>0?(fr(e,e.length,0,t),e):t}const By={}.hasOwnProperty;function Dw(e){const t={};let n=-1;for(;++n<e.length;)xE(t,e[n]);return t}function xE(e,t){let n;for(n in t){const l=(By.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){By.call(l,u)||(l[u]=[]);const f=c[u];vE(l[u],Array.isArray(f)?f:f?[f]:[])}}}function vE(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);fr(e,0,0,i)}function zw(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $n=Ds(/[A-Za-z]/),zn=Ds(/[\dA-Za-z]/),bE=Ds(/[#-'*+\--9=?A-Z^-~]/);function Id(e){return e!==null&&(e<32||e===127)}const hg=Ds(/\d/),yE=Ds(/[\dA-Fa-f]/),_E=Ds(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function ct(e){return e===-2||e===-1||e===32}const tf=Ds(new RegExp("\\p{P}|\\p{S}","u")),xa=Ds(/\s/);function Ds(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Rl(e){const t=[];let n=-1,i=0,l=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&zn(e.charCodeAt(n+1))&&zn(e.charCodeAt(n+2)))l=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),l=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+l+1,u=""),l&&(n+=l,l=0)}return t.join("")+e.slice(i)}function pt(e,t,n,i){const l=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return ct(h)?(e.enter(n),f(h)):t(h)}function f(h){return ct(h)&&c++<l?(e.consume(h),f):(e.exit(n),t(h))}}const wE={tokenize:SE};function SE(e){const t=e.attempt(this.parser.constructs.contentInitial,i,l);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),pt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),c(f)}function c(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return $e(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const kE={tokenize:jE},Py={tokenize:NE};function jE(e){const t=this,n=[];let i=0,l,c,u;return f;function f(N){if(i<n.length){const D=n[i];return t.containerState=D[1],e.attempt(D[0].continuation,h,p)(N)}return p(N)}function h(N){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&T();const D=t.events.length;let z=D,L;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){L=t.events[z][1].end;break}j(i);let H=D;for(;H<t.events.length;)t.events[H][1].end={...L},H++;return fr(t.events,z+1,0,t.events.slice(D)),t.events.length=H,p(N)}return f(N)}function p(N){if(i===n.length){if(!l)return y(N);if(l.currentConstruct&&l.currentConstruct.concrete)return _(N);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Py,g,v)(N)}function g(N){return l&&T(),j(i),y(N)}function v(N){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(N)}function y(N){return t.containerState={},e.attempt(Py,b,_)(N)}function b(N){return i++,n.push([t.currentConstruct,t.containerState]),y(N)}function _(N){if(N===null){l&&T(),j(0),e.consume(N);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:c}),k(N)}function k(N){if(N===null){E(e.exit("chunkFlow"),!0),j(0),e.consume(N);return}return $e(N)?(e.consume(N),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(N),k)}function E(N,D){const z=t.sliceStream(N);if(D&&z.push(null),N.previous=c,c&&(c.next=N),c=N,l.defineSkip(N.start),l.write(z),t.parser.lazy[N.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<u&&(!l.events[L][1].end||l.events[L][1].end.offset>u))return;const H=t.events.length;let U=H,V,O;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(V){O=t.events[U][1].end;break}V=!0}for(j(i),L=H;L<t.events.length;)t.events[L][1].end={...O},L++;fr(t.events,U+1,0,t.events.slice(H)),t.events.length=L}}function j(N){let D=n.length;for(;D-- >N;){const z=n[D];t.containerState=z[1],z[0].exit.call(t,e)}n.length=N}function T(){l.write([null]),c=void 0,l=void 0,t.containerState._closeFlow=void 0}}function NE(e,t,n){return pt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cl(e){if(e===null||Lt(e)||xa(e))return 1;if(tf(e))return 2}function nf(e,t,n){const i=[];let l=-1;for(;++l<e.length;){const c=e[l].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const pg={name:"attention",resolveAll:CE,tokenize:EE};function CE(e,t){let n=-1,i,l,c,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[i][1].end},y={...e[n][1].start};$y(v,-h),$y(y,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},l={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Tr(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Tr(p,[["enter",l,t],["enter",u,t],["exit",u,t],["enter",c,t]]),p=Tr(p,nf(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Tr(p,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Tr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,fr(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function EE(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,l=Cl(i);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const p=e.exit("attentionSequence"),g=Cl(h),v=!g||g===2&&l||n.includes(h),y=!l||l===2&&g||n.includes(i);return p._open=!!(c===42?v:v&&(l||!y)),p._close=!!(c===42?y:y&&(g||!v)),t(h)}}function $y(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const TE={name:"autolink",tokenize:AE};function AE(e,t,n){let i=0;return l;function l(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return $n(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||zn(b)?(i=1,f(b)):p(b)}function f(b){return b===58?(e.consume(b),i=0,h):(b===43||b===45||b===46||zn(b))&&i++<32?(e.consume(b),f):(i=0,p(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Id(b)?n(b):(e.consume(b),h)}function p(b){return b===64?(e.consume(b),g):bE(b)?(e.consume(b),p):n(b)}function g(b){return zn(b)?v(b):n(b)}function v(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||zn(b))&&i++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const jc={partial:!0,tokenize:ME};function ME(e,t,n){return i;function i(c){return ct(c)?pt(e,l,"linePrefix")(c):l(c)}function l(c){return c===null||$e(c)?t(c):n(c)}}const Ow={continuation:{tokenize:LE},exit:DE,name:"blockQuote",tokenize:RE};function RE(e,t,n){const i=this;return l;function l(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return ct(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function LE(e,t,n){const i=this;return l;function l(u){return ct(u)?pt(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(Ow,t,n)(u)}}function DE(e){e.exit("blockQuote")}const Bw={name:"characterEscape",tokenize:zE};function zE(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),l}function l(c){return _E(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Pw={name:"characterReference",tokenize:OE};function OE(e,t,n){const i=this;let l=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,u=zn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=yE,g):(e.enter("characterReferenceValue"),c=7,u=hg,g(v))}function g(v){if(v===59&&l){const y=e.exit("characterReferenceValue");return u===zn&&!Zg(i.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&l++<c?(e.consume(v),g):n(v)}}const Uy={partial:!0,tokenize:PE},Fy={concrete:!0,name:"codeFenced",tokenize:BE};function BE(e,t,n){const i=this,l={partial:!0,tokenize:z};let c=0,u=0,f;return h;function h(L){return p(L)}function p(L){const H=i.events[i.events.length-1];return c=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(L)}function g(L){return L===f?(u++,e.consume(L),g):u<3?n(L):(e.exit("codeFencedFenceSequence"),ct(L)?pt(e,v,"whitespace")(L):v(L))}function v(L){return L===null||$e(L)?(e.exit("codeFencedFence"),i.interrupt?t(L):e.check(Uy,k,D)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(L))}function y(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(L)):ct(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,b,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),y)}function b(L){return L===null||$e(L)?v(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(L)):L===96&&L===f?n(L):(e.consume(L),_)}function k(L){return e.attempt(l,D,E)(L)}function E(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),j}function j(L){return c>0&&ct(L)?pt(e,T,"linePrefix",c+1)(L):T(L)}function T(L){return L===null||$e(L)?e.check(Uy,k,D)(L):(e.enter("codeFlowValue"),N(L))}function N(L){return L===null||$e(L)?(e.exit("codeFlowValue"),T(L)):(e.consume(L),N)}function D(L){return e.exit("codeFenced"),t(L)}function z(L,H,U){let V=0;return O;function O(I){return L.enter("lineEnding"),L.consume(I),L.exit("lineEnding"),F}function F(I){return L.enter("codeFencedFence"),ct(I)?pt(L,A,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===f?(L.enter("codeFencedFenceSequence"),ae(I)):U(I)}function ae(I){return I===f?(V++,L.consume(I),ae):V>=u?(L.exit("codeFencedFenceSequence"),ct(I)?pt(L,X,"whitespace")(I):X(I)):U(I)}function X(I){return I===null||$e(I)?(L.exit("codeFencedFence"),H(I)):U(I)}}}function PE(e,t,n){const i=this;return l;function l(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const Qp={name:"codeIndented",tokenize:UE},$E={partial:!0,tokenize:FE};function UE(e,t,n){const i=this;return l;function l(p){return e.enter("codeIndented"),pt(e,c,"linePrefix",5)(p)}function c(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):$e(p)?e.attempt($E,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||$e(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function FE(e,t,n){const i=this;return l;function l(u){return i.parser.lazy[i.now().line]?n(u):$e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):pt(e,c,"linePrefix",5)(u)}function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):$e(u)?l(u):n(u)}}const qE={name:"codeText",previous:IE,resolve:HE,tokenize:VE};function HE(e){let t=e.length-4,n=3,i,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)l===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(l=i):(i===t||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),t-=i-l-2,i=l+2),l=void 0);return e}function IE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VE(e,t,n){let i=0,l,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),i++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),l=0,g(v)):$e(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||$e(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),l++,g):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",p(v))}}class GE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const l=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Uo(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Uo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Uo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Uo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Uo(this.left,n.reverse())}}}function Uo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function $w(e){const t={};let n=-1,i,l,c,u,f,h,p;const g=new GE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,YE(g,n)),n=t[n],p=!0);else if(i[1]._container){for(c=n,l=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(i[1].end={...g.get(l)[1].start},f=g.slice(l,n),f.unshift(i),g.splice(l,n-l+1,f))}}return fr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function YE(e,t){const n=e.get(t)[1],i=e.get(t)[2];let l=t-1;const c=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,v,y=-1,b=n,_=0,k=0;const E=[k];for(;b;){for(;e.get(++l)[1]!==b;);c.push(l),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),v&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(k=y+1,E.push(k),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const j=f.slice(E[y],E[y+1]),T=c.pop();h.push([T,T+j.length-1]),e.splice(T,2,j)}for(h.reverse(),y=-1;++y<h.length;)p[_+h[y][0]]=_+h[y][1],_+=h[y][1]-h[y][0]-1;return p}const QE={resolve:JE,tokenize:XE},WE={partial:!0,tokenize:ZE};function JE(e){return $w(e),e}function XE(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?c(f):$e(f)?e.check(WE,u,c)(f):(e.consume(f),l)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function ZE(e,t,n){const i=this;return l;function l(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),pt(e,c,"linePrefix")}function c(u){if(u===null||$e(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function Uw(e,t,n,i,l,c,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return v;function v(j){return j===60?(e.enter(i),e.enter(l),e.enter(c),e.consume(j),e.exit(c),y):j===null||j===32||j===41||Id(j)?n(j):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(j))}function y(j){return j===62?(e.enter(c),e.consume(j),e.exit(c),e.exit(l),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===62?(e.exit("chunkString"),e.exit(f),y(j)):j===null||j===60||$e(j)?n(j):(e.consume(j),j===92?_:b)}function _(j){return j===60||j===62||j===92?(e.consume(j),b):b(j)}function k(j){return!g&&(j===null||j===41||Lt(j))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(j)):g<p&&j===40?(e.consume(j),g++,k):j===41?(e.consume(j),g--,k):j===null||j===32||j===40||Id(j)?n(j):(e.consume(j),j===92?E:k)}function E(j){return j===40||j===41||j===92?(e.consume(j),k):k(j)}}function Fw(e,t,n,i,l,c){const u=this;let f=0,h;return p;function p(b){return e.enter(i),e.enter(l),e.consume(b),e.exit(l),e.enter(c),g}function g(b){return f>999||b===null||b===91||b===93&&!h||b===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(l),e.consume(b),e.exit(l),e.exit(i),t):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===null||b===91||b===93||$e(b)||f++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!ct(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,v):v(b)}}function qw(e,t,n,i,l,c){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(i),e.enter(l),e.consume(y),e.exit(l),u=y===40?41:y,h):n(y)}function h(y){return y===u?(e.enter(l),e.consume(y),e.exit(l),e.exit(i),t):(e.enter(c),p(y))}function p(y){return y===u?(e.exit(c),h(u)):y===null?n(y):$e(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),pt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||$e(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?v:g)}function v(y){return y===u||y===92?(e.consume(y),g):g(y)}}function ic(e,t){let n;return i;function i(l){return $e(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,i):ct(l)?pt(e,i,n?"linePrefix":"lineSuffix")(l):t(l)}}const KE={name:"definition",tokenize:t6},e6={partial:!0,tokenize:n6};function t6(e,t,n){const i=this;let l;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return Fw.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return l=Ur(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return Lt(b)?ic(e,p)(b):p(b)}function p(b){return Uw(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(e6,v,v)(b)}function v(b){return ct(b)?pt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||$e(b)?(e.exit("definition"),i.parser.defined.push(l),t(b)):n(b)}}function n6(e,t,n){return i;function i(f){return Lt(f)?ic(e,l)(f):n(f)}function l(f){return qw(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return ct(f)?pt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||$e(f)?t(f):n(f)}}const r6={name:"hardBreakEscape",tokenize:i6};function i6(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),l}function l(c){return $e(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const s6={name:"headingAtx",resolve:a6,tokenize:l6};function a6(e,t){let n=e.length-2,i=3,l,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},fr(e,i,n-i+1,[["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t]])),e}function l6(e,t,n){let i=0;return l;function l(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Lt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||$e(g)?(e.exit("atxHeading"),t(g)):ct(g)?pt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Lt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const o6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qy=["pre","script","style","textarea"],c6={concrete:!0,name:"htmlFlow",resolveTo:f6,tokenize:h6},u6={partial:!0,tokenize:m6},d6={partial:!0,tokenize:p6};function f6(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function h6(e,t,n){const i=this;let l,c,u,f,h;return p;function p(M){return g(M)}function g(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),v}function v(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),c=!0,k):M===63?(e.consume(M),l=3,i.interrupt?t:R):$n(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function y(M){return M===45?(e.consume(M),l=2,b):M===91?(e.consume(M),l=5,f=0,_):$n(M)?(e.consume(M),l=4,i.interrupt?t:R):n(M)}function b(M){return M===45?(e.consume(M),i.interrupt?t:R):n(M)}function _(M){const pe="CDATA[";return M===pe.charCodeAt(f++)?(e.consume(M),f===pe.length?i.interrupt?t:A:_):n(M)}function k(M){return $n(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||Lt(M)){const pe=M===47,_e=u.toLowerCase();return!pe&&!c&&qy.includes(_e)?(l=1,i.interrupt?t(M):A(M)):o6.includes(u.toLowerCase())?(l=6,pe?(e.consume(M),j):i.interrupt?t(M):A(M)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(M):c?T(M):N(M))}return M===45||zn(M)?(e.consume(M),u+=String.fromCharCode(M),E):n(M)}function j(M){return M===62?(e.consume(M),i.interrupt?t:A):n(M)}function T(M){return ct(M)?(e.consume(M),T):O(M)}function N(M){return M===47?(e.consume(M),O):M===58||M===95||$n(M)?(e.consume(M),D):ct(M)?(e.consume(M),N):O(M)}function D(M){return M===45||M===46||M===58||M===95||zn(M)?(e.consume(M),D):z(M)}function z(M){return M===61?(e.consume(M),L):ct(M)?(e.consume(M),z):N(M)}function L(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),h=M,H):ct(M)?(e.consume(M),L):U(M)}function H(M){return M===h?(e.consume(M),h=null,V):M===null||$e(M)?n(M):(e.consume(M),H)}function U(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Lt(M)?z(M):(e.consume(M),U)}function V(M){return M===47||M===62||ct(M)?N(M):n(M)}function O(M){return M===62?(e.consume(M),F):n(M)}function F(M){return M===null||$e(M)?A(M):ct(M)?(e.consume(M),F):n(M)}function A(M){return M===45&&l===2?(e.consume(M),$):M===60&&l===1?(e.consume(M),P):M===62&&l===4?(e.consume(M),B):M===63&&l===3?(e.consume(M),R):M===93&&l===5?(e.consume(M),me):$e(M)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(u6,Z,ae)(M)):M===null||$e(M)?(e.exit("htmlFlowData"),ae(M)):(e.consume(M),A)}function ae(M){return e.check(d6,X,Z)(M)}function X(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),I}function I(M){return M===null||$e(M)?ae(M):(e.enter("htmlFlowData"),A(M))}function $(M){return M===45?(e.consume(M),R):A(M)}function P(M){return M===47?(e.consume(M),u="",ie):A(M)}function ie(M){if(M===62){const pe=u.toLowerCase();return qy.includes(pe)?(e.consume(M),B):A(M)}return $n(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),ie):A(M)}function me(M){return M===93?(e.consume(M),R):A(M)}function R(M){return M===62?(e.consume(M),B):M===45&&l===2?(e.consume(M),R):A(M)}function B(M){return M===null||$e(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),B)}function Z(M){return e.exit("htmlFlow"),t(M)}}function p6(e,t,n){const i=this;return l;function l(u){return $e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function m6(e,t,n){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(jc,t,n)}}const g6={name:"htmlText",tokenize:x6};function x6(e,t,n){const i=this;let l,c,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),z):R===63?(e.consume(R),N):$n(R)?(e.consume(R),U):n(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),c=0,_):$n(R)?(e.consume(R),T):n(R)}function g(R){return R===45?(e.consume(R),b):n(R)}function v(R){return R===null?n(R):R===45?(e.consume(R),y):$e(R)?(u=v,P(R)):(e.consume(R),v)}function y(R){return R===45?(e.consume(R),b):v(R)}function b(R){return R===62?$(R):R===45?y(R):v(R)}function _(R){const B="CDATA[";return R===B.charCodeAt(c++)?(e.consume(R),c===B.length?k:_):n(R)}function k(R){return R===null?n(R):R===93?(e.consume(R),E):$e(R)?(u=k,P(R)):(e.consume(R),k)}function E(R){return R===93?(e.consume(R),j):k(R)}function j(R){return R===62?$(R):R===93?(e.consume(R),j):k(R)}function T(R){return R===null||R===62?$(R):$e(R)?(u=T,P(R)):(e.consume(R),T)}function N(R){return R===null?n(R):R===63?(e.consume(R),D):$e(R)?(u=N,P(R)):(e.consume(R),N)}function D(R){return R===62?$(R):N(R)}function z(R){return $n(R)?(e.consume(R),L):n(R)}function L(R){return R===45||zn(R)?(e.consume(R),L):H(R)}function H(R){return $e(R)?(u=H,P(R)):ct(R)?(e.consume(R),H):$(R)}function U(R){return R===45||zn(R)?(e.consume(R),U):R===47||R===62||Lt(R)?V(R):n(R)}function V(R){return R===47?(e.consume(R),$):R===58||R===95||$n(R)?(e.consume(R),O):$e(R)?(u=V,P(R)):ct(R)?(e.consume(R),V):$(R)}function O(R){return R===45||R===46||R===58||R===95||zn(R)?(e.consume(R),O):F(R)}function F(R){return R===61?(e.consume(R),A):$e(R)?(u=F,P(R)):ct(R)?(e.consume(R),F):V(R)}function A(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),l=R,ae):$e(R)?(u=A,P(R)):ct(R)?(e.consume(R),A):(e.consume(R),X)}function ae(R){return R===l?(e.consume(R),l=void 0,I):R===null?n(R):$e(R)?(u=ae,P(R)):(e.consume(R),ae)}function X(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Lt(R)?V(R):(e.consume(R),X)}function I(R){return R===47||R===62||Lt(R)?V(R):n(R)}function $(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function P(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ie}function ie(R){return ct(R)?pt(e,me,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):me(R)}function me(R){return e.enter("htmlTextData"),u(R)}}const Kg={name:"labelEnd",resolveAll:_6,resolveTo:w6,tokenize:S6},v6={tokenize:k6},b6={tokenize:j6},y6={tokenize:N6};function _6(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",t+=l}}return e.length!==n.length&&fr(e,0,e.length,n),e}function w6(e,t){let n=e.length,i=0,l,c,u,f;for(;n--;)if(l=e[n][1],c){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(c=n,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Tr(f,e.slice(c+1,c+i+3)),f=Tr(f,[["enter",g,t]]),f=Tr(f,nf(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),f=Tr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=Tr(f,e.slice(u+1)),f=Tr(f,[["exit",h,t]]),fr(e,c,e.length,f),e}function S6(e,t,n){const i=this;let l=i.events.length,c,u;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){c=i.events[l][1];break}return f;function f(y){return c?c._inactive?v(y):(u=i.parser.defined.includes(Ur(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):n(y)}function h(y){return y===40?e.attempt(v6,g,u?g:v)(y):y===91?e.attempt(b6,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(y6,g,v)(y)}function g(y){return t(y)}function v(y){return c._balanced=!0,n(y)}}function k6(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),l}function l(v){return Lt(v)?ic(e,c)(v):c(v)}function c(v){return v===41?g(v):Uw(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Lt(v)?ic(e,h)(v):g(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?qw(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Lt(v)?ic(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function j6(e,t,n){const i=this;return l;function l(f){return Fw.call(i,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(Ur(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function N6(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),l}function l(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const C6={name:"labelStartImage",resolveAll:Kg.resolveAll,tokenize:E6};function E6(e,t,n){const i=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const T6={name:"labelStartLink",resolveAll:Kg.resolveAll,tokenize:A6};function A6(e,t,n){const i=this;return l;function l(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const Wp={name:"lineEnding",tokenize:M6};function M6(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const yd={name:"thematicBreak",tokenize:R6};function R6(e,t,n){let i=0,l;return c;function c(p){return e.enter("thematicBreak"),u(p)}function u(p){return l=p,f(p)}function f(p){return p===l?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||$e(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===l?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),ct(p)?pt(e,f,"whitespace")(p):f(p))}}const Wn={continuation:{tokenize:O6},exit:P6,name:"list",tokenize:z6},L6={partial:!0,tokenize:$6},D6={partial:!0,tokenize:B6};function z6(e,t,n){const i=this,l=i.events[i.events.length-1];let c=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return f;function f(b){const _=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:hg(b)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(yd,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return hg(b)&&++u<10?(e.consume(b),h):(!i.interrupt||u<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(jc,i.interrupt?n:g,e.attempt(L6,y,v))}function g(b){return i.containerState.initialBlankLine=!0,c++,y(b)}function v(b){return ct(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function O6(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(jc,l,c);function l(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,pt(e,t,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!ct(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(D6,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,pt(e,e.attempt(Wn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function B6(e,t,n){const i=this;return pt(e,l,"listItemIndent",i.containerState.size+1);function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):n(c)}}function P6(e){e.exit(this.containerState.type)}function $6(e,t,n){const i=this;return pt(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(c){const u=i.events[i.events.length-1];return!ct(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Hy={name:"setextUnderline",resolveTo:U6,tokenize:F6};function U6(e,t){let n=e.length,i,l,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",c?(e.splice(l,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function F6(e,t,n){const i=this;let l;return c;function c(p){let g=i.events.length,v;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){v=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),l=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===l?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ct(p)?pt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||$e(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const q6={tokenize:H6};function H6(e){const t=this,n=e.attempt(jc,i,e.attempt(this.parser.constructs.flowInitial,l,pt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(QE,l)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const I6={resolveAll:Iw()},V6=Hw("string"),G6=Hw("text");function Hw(e){return{resolveAll:Iw(e==="text"?Y6:void 0),tokenize:t};function t(n){const i=this,l=this.parser.constructs[e],c=n.attempt(l,u,f);return u;function u(g){return p(g)?c(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return p(g)?(n.exit("data"),c(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const v=l[g];let y=-1;if(v)for(;++y<v.length;){const b=v[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function Iw(e){return t;function t(n,i){let l=-1,c;for(;++l<=n.length;)c===void 0?n[l]&&n[l][1].type==="data"&&(c=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==c+2&&(n[c][1].end=n[l-1][1].end,n.splice(c+2,l-c-2),l=c+2),c=void 0);return e?e(n,i):n}}function Y6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],l=t.sliceStream(i);let c=l.length,u=-1,f=0,h;for(;c--;){const p=l[c];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const Q6={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:Ow},W6={91:KE},J6={[-2]:Qp,[-1]:Qp,32:Qp},X6={35:s6,42:yd,45:[Hy,yd],60:c6,61:Hy,95:yd,96:Fy,126:Fy},Z6={38:Pw,92:Bw},K6={[-5]:Wp,[-4]:Wp,[-3]:Wp,33:C6,38:Pw,42:pg,60:[TE,g6],91:T6,92:[r6,Bw],93:Kg,95:pg,96:qE},eT={null:[pg,I6]},tT={null:[42,95]},nT={null:[]},rT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:tT,contentInitial:W6,disable:nT,document:Q6,flow:X6,flowInitial:J6,insideSpan:eT,string:Z6,text:K6},Symbol.toStringTag,{value:"Module"}));function iT(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},c=[];let u=[],f=[];const h={attempt:H(z),check:H(L),consume:T,enter:N,exit:D,interrupt:H(L,{interrupt:!0})},p={code:null,containerState:{},defineSkip:k,events:[],now:_,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:v};let g=t.tokenize.call(p,h);return t.resolveAll&&c.push(t),p;function v(F){return u=Tr(u,F),E(),u[u.length-1]!==null?[]:(U(t,0),p.events=nf(c,p.events,p),p.events)}function y(F,A){return aT(b(F),A)}function b(F){return sT(u,F)}function _(){const{_bufferIndex:F,_index:A,line:ae,column:X,offset:I}=i;return{_bufferIndex:F,_index:A,line:ae,column:X,offset:I}}function k(F){l[F.line]=F.column,O()}function E(){let F;for(;i._index<u.length;){const A=u[i._index];if(typeof A=="string")for(F=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===F&&i._bufferIndex<A.length;)j(A.charCodeAt(i._bufferIndex));else j(A)}}function j(F){g=g(F)}function T(F){$e(F)?(i.line++,i.column=1,i.offset+=F===-3?2:1,O()):F!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=F}function N(F,A){const ae=A||{};return ae.type=F,ae.start=_(),p.events.push(["enter",ae,p]),f.push(ae),ae}function D(F){const A=f.pop();return A.end=_(),p.events.push(["exit",A,p]),A}function z(F,A){U(F,A.from)}function L(F,A){A.restore()}function H(F,A){return ae;function ae(X,I,$){let P,ie,me,R;return Array.isArray(X)?Z(X):"tokenize"in X?Z([X]):B(X);function B(Ce){return Te;function Te(Le){const Pe=Le!==null&&Ce[Le],rt=Le!==null&&Ce.null,be=[...Array.isArray(Pe)?Pe:Pe?[Pe]:[],...Array.isArray(rt)?rt:rt?[rt]:[]];return Z(be)(Le)}}function Z(Ce){return P=Ce,ie=0,Ce.length===0?$:M(Ce[ie])}function M(Ce){return Te;function Te(Le){return R=V(),me=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?_e():Ce.tokenize.call(A?Object.assign(Object.create(p),A):p,h,pe,_e)(Le)}}function pe(Ce){return F(me,R),I}function _e(Ce){return R.restore(),++ie<P.length?M(P[ie]):$}}}function U(F,A){F.resolveAll&&!c.includes(F)&&c.push(F),F.resolve&&fr(p.events,A,p.events.length-A,F.resolve(p.events.slice(A),p)),F.resolveTo&&(p.events=F.resolveTo(p.events,p))}function V(){const F=_(),A=p.previous,ae=p.currentConstruct,X=p.events.length,I=Array.from(f);return{from:X,restore:$};function $(){i=F,p.previous=A,p.currentConstruct=ae,p.events.length=X,f=I,O()}}function O(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function sT(e,t){const n=t.start._index,i=t.start._bufferIndex,l=t.end._index,c=t.end._bufferIndex;let u;if(n===l)u=[e[n].slice(i,c)];else{if(u=e.slice(n,l),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}c>0&&u.push(e[l].slice(0,c))}return u}function aT(e,t){let n=-1;const i=[];let l;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
67
67
  `;break}case-3:{u=`\r
68
- `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(c)}l=c===-2,i.push(u)}return i.join("")}function lT(e){const i={constructs:Dw([rT,...(e||{}).extensions||[]]),content:l(wE),defined:[],document:l(kE),flow:l(q6),lazy:{},string:l(V6),text:l(G6)};return i;function l(c){return u;function u(f){return iT(i,c,f)}}}function oT(e){for(;!$w(e););return e}const Iy=/[\0\t\n\r]/g;function cT(){let e=1,t="",n=!0,i;return l;function l(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(Iy.lastIndex=v,p=Iy.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}v=y+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const uT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dT(e){return e.replace(uT,fT)}function fT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),c=l===120||l===88;return zw(n.slice(c?2:1),c?16:10)}return Zg(n)||e}const Vw={}.hasOwnProperty;function hT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),pT(n)(oT(lT(n).document().write(cT()(e,t,!0))))}function pT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(xn),autolinkProtocol:V,autolinkEmail:V,atxHeading:c(Dt),blockQuote:c(rt),characterEscape:V,characterReference:V,codeFenced:c(be),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(be,u),codeText:c(ze,u),codeTextData:V,data:V,codeFlowValue:V,definition:c(gt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Ut),hardBreakEscape:c(kt),hardBreakTrailing:c(kt),htmlFlow:c(fn,u),htmlFlowData:V,htmlText:c(fn,u),htmlTextData:V,image:c(it),label:u,link:c(xn),listItem:c(ke),listItemValue:y,listOrdered:c(hn,v),listUnordered:c(hn),paragraph:c(Oe),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Dt),strong:c(st),thematicBreak:c(hr)},exit:{atxHeading:h(),atxHeadingSequence:z,autolink:h(),autolinkEmail:Pe,autolinkProtocol:Le,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:Te,codeFenced:h(E),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(j),codeText:h(I),codeTextData:O,data:O,definition:h(),definitionDestinationString:D,definitionLabelString:T,definitionTitleString:N,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(ae),htmlFlowData:O,htmlText:h(X),htmlTextData:O,image:h(P),label:me,labelText:ie,lineEnding:F,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:B,resource:Z,setextHeading:h(U),setextHeadingLineSequence:H,setextHeadingText:L,strong:h(),thematicBreak:h()}};Gw(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(le){let xe={type:"root",children:[]};const Q={stack:[xe],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},fe=[];let Ae=-1;for(;++Ae<le.length;)if(le[Ae][1].type==="listOrdered"||le[Ae][1].type==="listUnordered")if(le[Ae][0]==="enter")fe.push(Ae);else{const Ve=fe.pop();Ae=l(le,Ve,Ae)}for(Ae=-1;++Ae<le.length;){const Ve=t[le[Ae][0]];Vw.call(Ve,le[Ae][1].type)&&Ve[le[Ae][1].type].call(Object.assign({sliceSerialize:le[Ae][2].sliceSerialize},Q),le[Ae][1])}if(Q.tokenStack.length>0){const Ve=Q.tokenStack[Q.tokenStack.length-1];(Ve[1]||Vy).call(Q,void 0,Ve[0])}for(xe.position={start:js(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:js(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<t.transforms.length;)xe=t.transforms[Ae](xe)||xe;return xe}function l(le,xe,Q){let fe=xe-1,Ae=-1,Ve=!1,tt,nt,xt,nn;for(;++fe<=Q;){const ut=le[fe];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?Ae++:Ae--,nn=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(tt&&!nn&&!Ae&&!xt&&(xt=fe),nn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nn=void 0}if(!Ae&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||Ae===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(tt){let vn=fe;for(nt=void 0;vn--;){const Sn=le[vn];if(Sn[1].type==="lineEnding"||Sn[1].type==="lineEndingBlank"){if(Sn[0]==="exit")continue;nt&&(le[nt][1].type="lineEndingBlank",Ve=!0),Sn[1].type="lineEnding",nt=vn}else if(!(Sn[1].type==="linePrefix"||Sn[1].type==="blockQuotePrefix"||Sn[1].type==="blockQuotePrefixWhitespace"||Sn[1].type==="blockQuoteMarker"||Sn[1].type==="listItemIndent"))break}xt&&(!nt||xt<nt)&&(tt._spread=!0),tt.end=Object.assign({},nt?le[nt][1].start:ut[1].end),le.splice(nt||fe,0,["exit",tt,ut[2]]),fe++,Q++}if(ut[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};tt=vn,le.splice(fe,0,["enter",vn,ut[2]]),fe++,Q++,xt=void 0,nn=!0}}}return le[xe][1]._spread=Ve,Q}function c(le,xe){return Q;function Q(fe){f.call(this,le(fe),fe),xe&&xe.call(this,fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(le,xe,Q){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([xe,Q||void 0]),le.position={start:js(xe.start),end:void 0}}function h(le){return xe;function xe(Q){le&&le.call(this,Q),p.call(this,Q)}}function p(le,xe){const Q=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==le.type&&(xe?xe.call(this,le,fe[0]):(fe[1]||Vy).call(this,le,fe[0]));else throw new Error("Cannot close `"+le.type+"` ("+rc({start:le.start,end:le.end})+"): it’s not open");Q.position.end=js(le.end)}function g(){return Xg(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=le}function _(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=le}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le.replace(/(\r?\n|\r)$/g,"")}function T(le){const xe=this.resume(),Q=this.stack[this.stack.length-1];Q.label=xe,Q.identifier=Ur(this.sliceSerialize(le)).toLowerCase()}function N(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.title=le}function D(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.url=le}function z(le){const xe=this.stack[this.stack.length-1];if(!xe.depth){const Q=this.sliceSerialize(le).length;xe.depth=Q}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function H(le){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function V(le){const Q=this.stack[this.stack.length-1].children;let fe=Q[Q.length-1];(!fe||fe.type!=="text")&&(fe=qe(),fe.position={start:js(le.start),end:void 0},Q.push(fe)),this.stack.push(fe)}function O(le){const xe=this.stack.pop();xe.value+=this.sliceSerialize(le),xe.position.end=js(le.end)}function F(le){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=xe.children[xe.children.length-1];Q.position.end=js(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(V.call(this,le),O.call(this,le))}function A(){this.data.atHardBreak=!0}function ae(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function X(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function I(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function $(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=xe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function P(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=xe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ie(le){const xe=this.sliceSerialize(le),Q=this.stack[this.stack.length-2];Q.label=dT(xe),Q.identifier=Ur(xe).toLowerCase()}function me(){const le=this.stack[this.stack.length-1],xe=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const fe=le.children;Q.children=fe}else Q.alt=xe}function R(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.url=le}function B(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.title=le}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(le){const xe=this.resume(),Q=this.stack[this.stack.length-1];Q.label=xe,Q.identifier=Ur(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function _e(le){this.data.characterReferenceType=le.type}function Ce(le){const xe=this.sliceSerialize(le),Q=this.data.characterReferenceType;let fe;Q?(fe=zw(xe,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=Zg(xe);const Ae=this.stack[this.stack.length-1];Ae.value+=fe}function Te(le){const xe=this.stack.pop();xe.position.end=js(le.end)}function Le(le){O.call(this,le);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(le)}function Pe(le){O.call(this,le);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(le)}function rt(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ut(){return{type:"emphasis",children:[]}}function Dt(){return{type:"heading",depth:0,children:[]}}function kt(){return{type:"break"}}function fn(){return{type:"html",value:""}}function it(){return{type:"image",title:null,url:"",alt:null}}function xn(){return{type:"link",title:null,url:"",children:[]}}function hn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function ke(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function hr(){return{type:"thematicBreak"}}}function js(e){return{line:e.line,column:e.column,offset:e.offset}}function Gw(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Gw(e,i):mT(e,i)}}function mT(e,t){let n;for(n in t)if(Vw.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Vy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+rc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+rc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+rc({start:t.start,end:t.end})+") is still open")}function gT(e){const t=this;t.parser=n;function n(i){return hT(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function xT(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function vT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
68
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(c)}l=c===-2,i.push(u)}return i.join("")}function lT(e){const i={constructs:Dw([rT,...(e||{}).extensions||[]]),content:l(wE),defined:[],document:l(kE),flow:l(q6),lazy:{},string:l(V6),text:l(G6)};return i;function l(c){return u;function u(f){return iT(i,c,f)}}}function oT(e){for(;!$w(e););return e}const Iy=/[\0\t\n\r]/g;function cT(){let e=1,t="",n=!0,i;return l;function l(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(Iy.lastIndex=v,p=Iy.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}v=y+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const uT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dT(e){return e.replace(uT,fT)}function fT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),c=l===120||l===88;return zw(n.slice(c?2:1),c?16:10)}return Zg(n)||e}const Vw={}.hasOwnProperty;function hT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),pT(n)(oT(lT(n).document().write(cT()(e,t,!0))))}function pT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(xn),autolinkProtocol:V,autolinkEmail:V,atxHeading:c(Dt),blockQuote:c(rt),characterEscape:V,characterReference:V,codeFenced:c(be),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(be,u),codeText:c(ze,u),codeTextData:V,data:V,codeFlowValue:V,definition:c(gt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Ft),hardBreakEscape:c(kt),hardBreakTrailing:c(kt),htmlFlow:c(fn,u),htmlFlowData:V,htmlText:c(fn,u),htmlTextData:V,image:c(it),label:u,link:c(xn),listItem:c(ke),listItemValue:y,listOrdered:c(hn,v),listUnordered:c(hn),paragraph:c(Oe),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Dt),strong:c(st),thematicBreak:c(hr)},exit:{atxHeading:h(),atxHeadingSequence:z,autolink:h(),autolinkEmail:Pe,autolinkProtocol:Le,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:Te,codeFenced:h(E),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(j),codeText:h(I),codeTextData:O,data:O,definition:h(),definitionDestinationString:D,definitionLabelString:T,definitionTitleString:N,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(ae),htmlFlowData:O,htmlText:h(X),htmlTextData:O,image:h(P),label:me,labelText:ie,lineEnding:F,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:B,resource:Z,setextHeading:h(U),setextHeadingLineSequence:H,setextHeadingText:L,strong:h(),thematicBreak:h()}};Gw(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(le){let xe={type:"root",children:[]};const Q={stack:[xe],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},fe=[];let Ae=-1;for(;++Ae<le.length;)if(le[Ae][1].type==="listOrdered"||le[Ae][1].type==="listUnordered")if(le[Ae][0]==="enter")fe.push(Ae);else{const Ve=fe.pop();Ae=l(le,Ve,Ae)}for(Ae=-1;++Ae<le.length;){const Ve=t[le[Ae][0]];Vw.call(Ve,le[Ae][1].type)&&Ve[le[Ae][1].type].call(Object.assign({sliceSerialize:le[Ae][2].sliceSerialize},Q),le[Ae][1])}if(Q.tokenStack.length>0){const Ve=Q.tokenStack[Q.tokenStack.length-1];(Ve[1]||Vy).call(Q,void 0,Ve[0])}for(xe.position={start:js(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:js(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<t.transforms.length;)xe=t.transforms[Ae](xe)||xe;return xe}function l(le,xe,Q){let fe=xe-1,Ae=-1,Ve=!1,tt,nt,xt,nn;for(;++fe<=Q;){const ut=le[fe];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?Ae++:Ae--,nn=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(tt&&!nn&&!Ae&&!xt&&(xt=fe),nn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nn=void 0}if(!Ae&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||Ae===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(tt){let vn=fe;for(nt=void 0;vn--;){const Sn=le[vn];if(Sn[1].type==="lineEnding"||Sn[1].type==="lineEndingBlank"){if(Sn[0]==="exit")continue;nt&&(le[nt][1].type="lineEndingBlank",Ve=!0),Sn[1].type="lineEnding",nt=vn}else if(!(Sn[1].type==="linePrefix"||Sn[1].type==="blockQuotePrefix"||Sn[1].type==="blockQuotePrefixWhitespace"||Sn[1].type==="blockQuoteMarker"||Sn[1].type==="listItemIndent"))break}xt&&(!nt||xt<nt)&&(tt._spread=!0),tt.end=Object.assign({},nt?le[nt][1].start:ut[1].end),le.splice(nt||fe,0,["exit",tt,ut[2]]),fe++,Q++}if(ut[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};tt=vn,le.splice(fe,0,["enter",vn,ut[2]]),fe++,Q++,xt=void 0,nn=!0}}}return le[xe][1]._spread=Ve,Q}function c(le,xe){return Q;function Q(fe){f.call(this,le(fe),fe),xe&&xe.call(this,fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(le,xe,Q){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([xe,Q||void 0]),le.position={start:js(xe.start),end:void 0}}function h(le){return xe;function xe(Q){le&&le.call(this,Q),p.call(this,Q)}}function p(le,xe){const Q=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==le.type&&(xe?xe.call(this,le,fe[0]):(fe[1]||Vy).call(this,le,fe[0]));else throw new Error("Cannot close `"+le.type+"` ("+rc({start:le.start,end:le.end})+"): it’s not open");Q.position.end=js(le.end)}function g(){return Xg(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=le}function _(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=le}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le.replace(/(\r?\n|\r)$/g,"")}function T(le){const xe=this.resume(),Q=this.stack[this.stack.length-1];Q.label=xe,Q.identifier=Ur(this.sliceSerialize(le)).toLowerCase()}function N(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.title=le}function D(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.url=le}function z(le){const xe=this.stack[this.stack.length-1];if(!xe.depth){const Q=this.sliceSerialize(le).length;xe.depth=Q}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function H(le){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function V(le){const Q=this.stack[this.stack.length-1].children;let fe=Q[Q.length-1];(!fe||fe.type!=="text")&&(fe=qe(),fe.position={start:js(le.start),end:void 0},Q.push(fe)),this.stack.push(fe)}function O(le){const xe=this.stack.pop();xe.value+=this.sliceSerialize(le),xe.position.end=js(le.end)}function F(le){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=xe.children[xe.children.length-1];Q.position.end=js(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(V.call(this,le),O.call(this,le))}function A(){this.data.atHardBreak=!0}function ae(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function X(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function I(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.value=le}function $(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=xe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function P(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=xe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ie(le){const xe=this.sliceSerialize(le),Q=this.stack[this.stack.length-2];Q.label=dT(xe),Q.identifier=Ur(xe).toLowerCase()}function me(){const le=this.stack[this.stack.length-1],xe=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const fe=le.children;Q.children=fe}else Q.alt=xe}function R(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.url=le}function B(){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.title=le}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(le){const xe=this.resume(),Q=this.stack[this.stack.length-1];Q.label=xe,Q.identifier=Ur(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function _e(le){this.data.characterReferenceType=le.type}function Ce(le){const xe=this.sliceSerialize(le),Q=this.data.characterReferenceType;let fe;Q?(fe=zw(xe,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=Zg(xe);const Ae=this.stack[this.stack.length-1];Ae.value+=fe}function Te(le){const xe=this.stack.pop();xe.position.end=js(le.end)}function Le(le){O.call(this,le);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(le)}function Pe(le){O.call(this,le);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(le)}function rt(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ft(){return{type:"emphasis",children:[]}}function Dt(){return{type:"heading",depth:0,children:[]}}function kt(){return{type:"break"}}function fn(){return{type:"html",value:""}}function it(){return{type:"image",title:null,url:"",alt:null}}function xn(){return{type:"link",title:null,url:"",children:[]}}function hn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function ke(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function hr(){return{type:"thematicBreak"}}}function js(e){return{line:e.line,column:e.column,offset:e.offset}}function Gw(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Gw(e,i):mT(e,i)}}function mT(e,t){let n;for(n in t)if(Vw.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Vy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+rc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+rc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+rc({start:t.start,end:t.end})+") is still open")}function gT(e){const t=this;t.parser=n;function n(i){return hT(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function xT(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function vT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
69
69
  `}]}function bT(e,t){const n=t.value?t.value+`
70
70
  `:"",i={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(i.className=["language-"+l[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function yT(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _T(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),l=Rl(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function ST(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Yw(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const l=e.all(t),c=l[0];c&&c.type==="text"?c.value="["+c.value:l.unshift({type:"text",value:"["});const u=l[l.length-1];return u&&u.type==="text"?u.value+=i:l.push({type:"text",value:i}),l}function jT(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Yw(e,t);const l={src:Rl(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,c),e.applyData(t,c)}function NT(e,t){const n={src:Rl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function CT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function ET(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Yw(e,t);const l={href:Rl(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function TT(e,t){const n={href:Rl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function AT(e,t,n){const i=e.all(t),l=n?MT(n):Qw(t),c={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(l||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
71
71
  `}),g.type==="element"&&g.tagName==="p"&&!l?u.push(...g.children):u.push(g)}const h=i[i.length-1];h&&(l||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
@@ -94,7 +94,7 @@ Error generating stack: `+d.message+`
94
94
  `)){const f=(c==null?void 0:c[1])||"",h=yg(i);return a.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[a.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),a.jsx(dx,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),a.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:a.jsx("code",{children:i})})]})}return a.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-[12.5px] font-mono-code text-cc-fg/80 border border-cc-border/40",children:i})},pre:({children:n})=>a.jsx(a.Fragment,{children:n}),table:({children:n})=>a.jsx("div",{className:"overflow-x-auto my-2",children:a.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>a.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>a.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>a.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&a.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function t7({block:e,toolUseById:t}){if(e.type==="text")return a.jsx(fx,{text:e.text});if(e.type==="thinking")return a.jsx(E2,{text:e.thinking});if(e.type==="tool_use")return a.jsx(H5,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),l=i==null?void 0:i.name,c=e.is_error??!1;return l==="Bash"?a.jsx(n7,{text:n,isError:c}):a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(dx,{text:n,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${c?"text-cc-error":"text-cc-code-fg/60"}`,children:n})]})}return null}function n7({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[l,c]=S.useState(!1),u=l||!i?e:n.slice(-20).join(`
95
95
  `);return a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(dx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:u}),i&&a.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[a.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:l?`${n.length} lines`:`last 20 of ${n.length}`}),a.jsx("button",{onClick:()=>c(!l),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:l?"Show tail":"Show all"})]})]})}function r7({name:e,items:t}){const[n,i]=S.useState(!1),l=_c(e),c=As(e);return a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:l}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=lc(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function E2({text:e}){const t=e.trim(),[n,i]=S.useState(!1),l=t.split(`
96
96
  `),c=l.length>8||t.length>600,u=c&&!n?l.slice(0,8).join(`
97
- `):t;return a.jsxs("div",{children:[a.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:a.jsx(ax,{remarkPlugins:[ux],components:{p:({children:f})=>a.jsx("p",{className:"mb-2 last:mb-0",children:f}),ul:({children:f})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:f}),ol:({children:f})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:f}),li:({children:f})=>a.jsx("li",{children:f}),code:({children:f})=>a.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:f})},children:u||"No thinking text captured."})}),c&&!n&&a.jsx("button",{onClick:()=>i(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function Qo(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function om(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function m5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":i7(t):"N/A"}catch{return"N/A"}}function g5(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${l}h`:l>0?`${l}h${c}m`:`${c}m`}function x5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function i7(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function s7({tools:e}){return e.length===0?null:a.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[a.jsx(_l,{type:_c(t.toolName)}),a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),a.jsx("span",{className:"text-cc-fg/70",children:As(t.toolName)}),a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function a7({entries:e}){const[t,n]=S.useState(!1),i=S.useMemo(()=>{const l=e.reduce((h,p)=>h+p.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:l,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:a.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&a.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(l=>a.jsx("span",{className:`h-full rounded-full ${l.isError?"bg-cc-error/40":l.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,l.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${As(l.toolName)} ${l.elapsedSeconds}s`},l.toolUseId))})]}),t&&a.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(l=>a.jsx(l7,{entry:l,maxTime:i.maxTime},l.toolUseId))})]})}function l7({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),a.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[a.jsx(_l,{type:_c(e.toolName)}),a.jsx("span",{className:"text-cc-fg/70 truncate",children:As(e.toolName)})]}),a.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:a.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&a.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const od=100,o7=40,c7=120,u7=1e4,d7=6e4,cm=new Map,f7=[],h7=[];function p7(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function m7(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function v5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function g7(e){return e.kind==="message"?(e.msg.contentBlocks||[]).filter(n=>n.type==="tool_use").filter(n=>n.name==="Task").map(n=>n.id):e.kind==="tool_msg_group"&&e.toolName==="Task"?e.items.map(t=>t.id):[]}function T2(e){const t=[];for(const n of e){const i=m7(n);if(i){const l=t[t.length-1];if((l==null?void 0:l.kind)==="tool_msg_group"&&l.toolName===i){l.items.push(...v5(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:v5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function A2(e,t,n){const i=T2(e),l=[];for(const c of i){l.push(c);const u=g7(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=A2(h,t,n);l.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return l}function x7(e){const t=new Map;for(const l of e)if(l.contentBlocks){for(const c of l.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(y=>typeof y=="string"&&y.length>0):void 0,p=h&&h.length>0?h.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:h})}}if(t.size===0)return T2(e);const n=new Map,i=[];for(const l of e)if(l.parentToolUseId&&t.has(l.parentToolUseId)){let c=n.get(l.parentToolUseId);c||(c=[],n.set(l.parentToolUseId,c)),c.push(l)}else i.push(l);return A2(i,t,n)}function v7({group:e}){const[t,n]=S.useState(!1),i=_c(e.toolName),l=As(e.toolName),c=e.items.length;if(c===1){const u=e.items[0];return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(b5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:lc(u.name,u.input)})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:a.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(b5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=lc(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function M2({entries:e,toolActivity:t}){return a.jsx(a.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return a.jsx(v7,{group:n},n.firstId||i);if(n.kind==="subagent")return a.jsx(_7,{group:n},n.taskToolUseId);const l=n.msg,c=b7(l),u=t&&c.length>0?t.filter(h=>c.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return a.jsxs("div",{children:[a.jsx(X8,{message:l}),f&&a.jsx(a7,{entries:u})]},l.id)})})}function b7(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function y7(e){if(!e)return null;const t=e.trim().toLowerCase();return t?t==="completed"?{label:"completed",summaryLabel:"completed",className:"text-green-600 bg-green-500/15"}:t==="failed"||t==="error"||t==="errored"?{label:"failed",summaryLabel:"failed",className:"text-cc-error bg-cc-error/10"}:t==="pending"||t==="pendinginit"||t==="pending_init"?{label:"pending",summaryLabel:"pending",className:"text-amber-700 bg-amber-500/15"}:t==="running"||t==="inprogress"||t==="in_progress"||t==="started"?{label:"running",summaryLabel:"running",className:"text-blue-600 bg-blue-500/15"}:{label:e,summaryLabel:"running",className:"text-amber-700 bg-amber-500/15"}:null}function _7({group:e}){const[t,n]=S.useState(!1),i=e.description||"Subagent",l=e.agentType,c=e.children.length,u=y7(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],y=S.useMemo(()=>{var b,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${As(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const k=(b=v.msg.content)==null?void 0:b.trim();if(k)return k.length>60?k.slice(0,60)+"...":k;const E=(_=v.msg.contentBlocks)==null?void 0:_.find(j=>j.type==="tool_use");if(E)return As(E.name)}return""},[v]);return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[a.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),l&&a.jsx("span",{className:"text-[10px] text-cc-muted/50",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&a.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&a.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&y&&a.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),a.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&a.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&a.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&a.jsxs("span",{children:["receivers: ",p.map(b=>a.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),a.jsx(M2,{entries:e.children})]})]})})}function b5(){return a.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function w7({sessionId:e}){const t=W(be=>be.messages.get(e)??f7),n=W(be=>(be.sdkSessions||h7).find(ze=>ze.sessionId===e)),i=W(be=>be.streamingStartedAt.get(e)),l=W(be=>be.streamingOutputTokens.get(e)),c=W(be=>be.sessionStatus.get(e)),u=W(be=>be.lastActivityAt.get(e)),f=W(be=>be.toolProgress.get(e)),h=W(be=>be.toolActivity.get(e)),p=S.useRef(null),g=S.useRef(null),v=S.useRef(!0),[y,b]=S.useState(0),[_,k]=S.useState(od),[E,j]=S.useState([]),[T,N]=S.useState(0),[D,z]=S.useState(!1),[L,H]=S.useState(!1),[U,V]=S.useState(!1),[O,F]=S.useState(""),A=S.useRef(new Set),ae=W(be=>be.chatTabReentryTickBySession.get(e)??0),X=S.useMemo(()=>t.some(be=>be.role==="assistant"&&be.isStreaming),[t]),I=S.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),$=I.length>0,P=n!=null&&n.forkSession?"Forked from":"Continuing from",ie=S.useMemo(()=>{if(E.length===0)return t;const be=[],ze=new Set;for(const gt of E)ze.has(gt.id)||(ze.add(gt.id),be.push(gt));for(const gt of t)ze.has(gt.id)||(ze.add(gt.id),be.push(gt));return be},[E,t]),me=S.useMemo(()=>x7(ie),[ie]);S.useEffect(()=>{k(od),j([]),N(0),z(!1),H(!1),V(!1),F(""),A.current=new Set},[e,I]);const R=me.length,B=R>_,Z=B?me.slice(R-_):me,M=R-Z.length,pe=S.useCallback(()=>{const be=g.current,ze=(be==null?void 0:be.scrollHeight)??0;k(gt=>gt+od),requestAnimationFrame(()=>{if(be){const gt=be.scrollHeight;be.scrollTop+=gt-ze}})},[]),_e=S.useCallback(async(be={})=>{if(!$||!I||U)return;const ze=g.current,gt=(ze==null?void 0:ze.scrollHeight)??0,Ut=L?T:0;V(!0),F("");try{const Dt=await we.getClaudeSessionHistory(I,{cursor:Ut,limit:o7}),kt=Dt.messages.map(it=>({id:it.id,role:it.role,content:it.content,contentBlocks:it.role==="assistant"?it.contentBlocks:void 0,timestamp:it.timestamp||Date.now(),model:it.role==="assistant"?it.model:void 0,stopReason:it.role==="assistant"?it.stopReason:void 0})),fn=[];for(const it of kt)A.current.has(it.id)||(A.current.add(it.id),fn.push(it));j(it=>[...fn,...it]),N(Dt.nextCursor),z(Dt.hasMore),H(!0),fn.length>0&&k(it=>it+fn.length),be.preserveScroll!==!1&&ze&&requestAnimationFrame(()=>{const it=ze.scrollHeight;ze.scrollTop+=it-gt})}catch(Dt){const kt=Dt instanceof Error?Dt.message:String(Dt);F(kt||"Failed to load previous history"),L||(j([]),N(0),z(!1))}finally{V(!1)}},[$,I,U,L,T]);S.useEffect(()=>{if(!i&&c!=="running"){b(0);return}const be=i||Date.now();b(Date.now()-be);const ze=setInterval(()=>b(Date.now()-be),1e3);return()=>clearInterval(ze)},[i,c]);function Ce(){const be=g.current;if(!be)return;v.current=be.scrollHeight-be.scrollTop-be.clientHeight<120;const ze=Math.max(0,be.scrollHeight-be.clientHeight-be.scrollTop);cm.set(e,ze),$&&L&&D&&!U&&be.scrollTop<=c7&&_e({preserveScroll:!0})}const Te=S.useCallback(()=>{const be=g.current;if(!be)return;const ze=be.style.scrollBehavior;be.style.scrollBehavior="auto",be.scrollTop=be.scrollHeight,be.style.scrollBehavior=ze},[]),Le=S.useCallback(()=>{const be=g.current;if(!be)return;const ze=be.style.scrollBehavior;be.style.scrollBehavior="auto";const gt=cm.get(e);typeof gt=="number"?be.scrollTop=Math.max(0,be.scrollHeight-be.clientHeight-gt):be.scrollTop=be.scrollHeight,be.style.scrollBehavior=ze},[e]);if(S.useEffect(()=>{requestAnimationFrame(()=>Le())},[e,Le]),S.useEffect(()=>()=>{const be=g.current;if(!be)return;const ze=Math.max(0,be.scrollHeight-be.clientHeight-be.scrollTop);cm.set(e,ze)},[e]),S.useEffect(()=>{ae&&requestAnimationFrame(()=>Te())},[ae,Te]),S.useEffect(()=>{var be;v.current&&((be=p.current)==null||be.scrollIntoView({behavior:"smooth"}))},[t]),ie.length===0)return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),a.jsx("div",{className:"text-center max-w-xs",children:$?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),a.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[P," ",a.jsx("span",{className:"font-mono-code text-cc-fg/70",children:I.slice(0,8)}),". Load earlier messages when needed."]}),a.jsxs("button",{onClick:()=>void _e({preserveScroll:!1}),disabled:U,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),U?"Loading...":"Load previous history"]}),O&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:O})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const Pe=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,rt=Pe>=d7?"stalled":Pe>=u7?"quiet":"active";return a.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[a.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),a.jsx("div",{ref:g,onScroll:Ce,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[$&&!L&&a.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[P," existing Claude thread"]}),a.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[I," ",n!=null&&n.cwd?`· ${p7(n.cwd)}`:""]})]}),a.jsx("button",{onClick:()=>void _e({preserveScroll:!0}),disabled:U,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:U?"Loading...":"Load previous history"})]}),O&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:O})]}),$&&L&&a.jsx("div",{className:"flex justify-center",children:a.jsx("p",{className:"text-[11px] text-cc-muted",children:D?U?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),B&&a.jsx("div",{className:"flex justify-center pb-3",children:a.jsxs("button",{onClick:pe,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(od,M)," more",a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",M," hidden)"]})]})}),a.jsx(M2,{entries:Z,toolActivity:h}),f&&f.size>0&&!X&&a.jsx(s7,{tools:Array.from(f.values())}),c==="compacting"&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),a.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),a.jsx("span",{children:"Compacting context..."})]}),c==="running"&&y>=0&&a.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":rt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${rt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${rt==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),rt==="stalled"?a.jsxs("span",{children:["No activity for ",om(Pe)," — the agent may be stuck"]}):rt==="quiet"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Still working…"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:["no update for ",om(Pe)]})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsx("span",{className:"tabular-nums",children:om(y)}),(l??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:[Qo(l)," tokens"]})]})]})]}),a.jsx("div",{ref:p})]})})]})}const S7={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function k7(e,t){for(const[i,l]of Object.entries(S7))if(e.includes(i))return l;const n=["◆","●","◕","✦"];return n[t%n.length]}function j7(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:k7(t.value,n)}))}const R2=[{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-4-6",label:"Sonnet 4.6",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],L2=[{value:"gpt-5.3-codex-max",label:"GPT-5.3 Max",icon:"■"},{value:"gpt-5.3-codex-xhigh",label:"GPT-5.3 xHigh",icon:"★"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"✳"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex",icon:"◆"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Max",icon:"■"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"},{value:"gpt-5.1-codex-mini",label:"GPT-5.1 Mini",icon:"⚡"}],hx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],px=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],D2=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],z2=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function O2(e){return e==="codex"?L2:R2}function y5(e){return e==="codex"?px:hx}function ML(e){return e==="codex"?z2:D2}function _5(e){return e==="codex"?L2[0].value:R2[0].value}function w5(e){return e==="codex"?px[0].value:hx[0].value}function RL(e){return e==="codex"?z2[0].value:D2[0].value}function S5({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),l=W(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),c=W(y=>y.sessions.get(e)),u=W(y=>y.cliConnected.get(e)??!1),f=(l==null?void 0:l.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(l==null?void 0:l.model)??"",p=O2(f),g=p.find(y=>y.value===h)||(h?{label:h,icon:"?"}:null),v=S.useCallback(y=>{if(n(!1),y===h)return;Pn(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=W.getState();_(b.map(k=>k.sessionId===e?{...k,model:y}:k))},[e,h]);return S.useEffect(()=>{if(!t)return;const y=b=>{i.current&&!i.current.contains(b.target)&&n(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[t]),S.useEffect(()=>{if(!t)return;const y=b=>{b.key==="Escape"&&n(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),f==="codex"||!u||!g?null:a.jsxs("div",{ref:i,className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>n(y=>!y),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&a.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),a.jsx("span",{children:g.label}),a.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:a.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&a.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(y=>a.jsxs("button",{onClick:()=>v(y.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${y.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":y.value===h,children:[y.icon&&a.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),a.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===h&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},y.value))})]})}function B2({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:l,menuRef:c,className:u=""}){return e?a.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>a.jsxs("button",{"data-prompt-index":h,onClick:()=>l(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),a.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function P2({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[l,c]=S.useState(!1),[u,f]=S.useState(0),[h,p]=S.useState([]),[g,v]=S.useState(!1),y=S.useRef(null),b=S.useCallback(async()=>{v(!0);try{const j=await we.listPrompts(n);p(j.filter(T=>!!T.name.trim()))}catch{p([])}finally{v(!1)}},[n]);S.useEffect(()=>{b()},[b]);const _=S.useMemo(()=>{const j=e.slice(0,t),T=j.match(/(^|\s)@([^\s@]*)$/);if(!T||T.index===void 0)return null;const N=j.length-T[0].length+T[1].length;return{query:T[2]||"",start:N,end:t}},[e,t]),k=S.useMemo(()=>{if(!l||!_)return[];const j=_.query.toLowerCase();if(!j)return h;const T=h.filter(D=>D.name.toLowerCase().startsWith(j)),N=h.filter(D=>!D.name.toLowerCase().startsWith(j)&&D.name.toLowerCase().includes(j));return[...T,...N]},[l,_,h]);S.useEffect(()=>{const j=i&&!!_;j&&!l?(c(!0),f(0)):!j&&l&&c(!1)},[i,_,l]),S.useEffect(()=>{u>=k.length&&f(Math.max(0,k.length-1))},[k.length,u]),S.useEffect(()=>{if(!y.current||!l)return;const T=y.current.querySelectorAll("[data-prompt-index]")[u];T&&T.scrollIntoView({block:"nearest"})},[u,l]);const E=S.useCallback(j=>{if(!_)return{nextText:e,nextCursor:t};const T=`${j.content} `,N=`${e.slice(0,_.start)}${T}${e.slice(_.end)}`,D=_.start+T.length;return{nextText:N,nextCursor:D}},[_,e,t]);return{mentionMenuOpen:l,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:k,promptsLoading:g,savedPrompts:h,selectPrompt:E,refreshPrompts:b,mentionMenuRef:y}}const N7=[];function k5({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:l}){const c=l==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",f=c?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=c?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return a.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?f:h:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:i})]})}function cd({onClick:e,disabled:t,active:n,title:i,children:l}){return a.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:l})}function j5(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function N5({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:l}){const c=l==="desktop",u=c?"w-9 h-9":"w-10 h-10",f=c?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?a.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?f:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function C7({sessionId:e}){var le,xe;const[t,n]=S.useState(""),[i,l]=S.useState([]),[c,u]=S.useState(null),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[v,y]=S.useState(0),[b,_]=S.useState(!1),[k,E]=S.useState(""),[j,T]=S.useState("global"),[N,D]=S.useState(null),[z,L]=S.useState(0),H=S.useRef(null),U=S.useRef(null),V=S.useRef(null),O=S.useRef(null),F=W(Q=>Q.cliConnected),A=W(Q=>Q.sessions.get(e)),ae=W(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),X=F.get(e)??!1,I=(A==null?void 0:A.permissionMode)||"acceptEdits",$=I==="plan",P=(A==null?void 0:A.backend_type)==="codex",me=((xe=(le=(P?px:hx).find(Q=>Q.value===I))==null?void 0:le.label)==null?void 0:xe.toLowerCase())||I,R=P2({text:t,caretPos:z,cwd:A==null?void 0:A.cwd,enabled:!p}),B=S.useMemo(()=>{const Q=[];if(A!=null&&A.slash_commands)for(const fe of A.slash_commands)Q.push({name:fe,type:"command"});if(A!=null&&A.skills)for(const fe of A.skills)Q.push({name:fe,type:"skill"});return Q},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),Z=S.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const fe=Q[1].toLowerCase();return fe===""?B:B.filter(Ae=>Ae.name.toLowerCase().includes(fe))},[t,p,B]);S.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;Q&&!p?(g(!0),y(0)):!Q&&p&&g(!1)},[t,B.length,p]),S.useEffect(()=>{v>=Z.length&&y(Math.max(0,Z.length-1))},[Z.length,v]),S.useEffect(()=>{if(!V.current||!p)return;const fe=V.current.querySelectorAll("[data-cmd-index]")[v];fe&&fe.scrollIntoView({block:"nearest"})},[v,p]),S.useEffect(()=>{if(O.current===null||!H.current)return;const Q=O.current;H.current.setSelectionRange(Q,Q),O.current=null},[t]);const M=S.useCallback(Q=>{var fe;n(`/${Q.name} `),g(!1),(fe=H.current)==null||fe.focus()},[]),pe=S.useCallback(Q=>{var Ae;const fe=R.selectPrompt(Q);O.current=fe.nextCursor,n(fe.nextText),R.setMentionMenuOpen(!1),L(fe.nextCursor),(Ae=H.current)==null||Ae.focus(),H.current&&(H.current.style.height="auto",H.current.style.height=Math.min(H.current.scrollHeight,200)+"px")},[R]);function _e(){var tt;const Q=t.trim();if(!Q||!X)return;const fe=xm(),Ae=i.length>0?i.map(nt=>({name:nt.name,media_type:nt.mediaType,data:nt.base64,size:nt.size})):void 0;Pn(e,{type:"user_message",content:Q,session_id:e,attachments:Ae,client_msg_id:fe});const Ve=W.getState();Ve.appendMessage(e,{id:fe,role:"user",content:Q,attachments:Ae,timestamp:Date.now()}),Ve.setSessionStatus(e,"running"),Ve.setLastActivity(e,Date.now()),Ve.streamingStartedAt.has(e)||Ve.setStreamingStats(e,{startedAt:Date.now()}),n(""),l([]),u(null),g(!1),R.setMentionMenuOpen(!1),H.current&&(H.current.style.height="auto"),(tt=H.current)==null||tt.focus()}function Ce(Q){if(p&&Z.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),y(fe=>(fe+1)%Z.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),y(fe=>(fe-1+Z.length)%Z.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Escape"){Q.preventDefault(),g(!1);return}}if(R.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe+1)%R.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),pe(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),it();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),_e())}function Te(Q){n(Q.target.value),L(Q.target.selectionStart??Q.target.value.length);const fe=Q.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Le(){H.current&&L(H.current.selectionStart??0)}function Pe(){Pn(e,{type:"interrupt"})}async function rt(Q){if(Q.length===0)return;const fe=[],Ae=[];let Ve=i.reduce((tt,nt)=>tt+nt.size,0);for(const tt of Q){if(tt.size>Qd){Ae.push(`${tt.name} is too large (${Ts(tt.size)}, max ${Ts(Qd)})`);continue}if(Ve+tt.size>Wd){Ae.push(`${tt.name} would exceed the per-message limit (${Ts(Wd)})`);continue}const{base64:nt,mediaType:xt}=await k2(tt);fe.push({name:tt.name,base64:nt,mediaType:xt,size:tt.size}),Ve+=tt.size}fe.length>0&&l(tt=>[...tt,...fe]),u(Ae.length>0?Ae.join("; "):null)}async function be(Q){const fe=Q.target.files;fe&&(await rt(Array.from(fe)),Q.target.value="")}function ze(Q){l(fe=>fe.filter((Ae,Ve)=>Ve!==Q))}async function gt(Q){var Ve;const fe=(Ve=Q.clipboardData)==null?void 0:Ve.items;if(!fe)return;const Ae=[];for(const tt of Array.from(fe)){if(tt.kind!=="file")continue;const nt=tt.getAsFile();if(!nt)continue;const xt=nt.name&&nt.name.length>0?nt.name:`pasted-${Date.now()}.${(nt.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ae.push(new File([nt],xt,{type:nt.type,lastModified:nt.lastModified}))}Ae.length>0&&(Q.preventDefault(),await rt(Ae))}function Ut(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),h(!0))}function Dt(Q){Q.currentTarget===Q.target&&h(!1)}async function kt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),h(!1);const fe=Array.from(Q.dataTransfer.files);fe.length>0&&await rt(fe)}function fn(){const Q=t.trim().slice(0,32);E(Q||""),D(null),_(fe=>!fe)}function it(){if(!X)return;const Q=W.getState();if(!$)Q.setPreviousPermissionMode(e,I),Pn(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const fe=ae||(P?"bypassPermissions":"acceptEdits");Pn(e,{type:"set_permission_mode",mode:fe}),Q.updateSession(e,{permissionMode:fe})}}async function xn(){const Q=t.trim(),fe=k.trim();if(!Q||!fe)return;if(j==="project"&&!(A!=null&&A.cwd)){D("No project folder available for this session");return}const Ae={name:fe,content:Q,scope:j};j==="project"&&(Ae.projectPaths=[A.cwd]);try{await we.createPrompt(Ae),await R.refreshPrompts(),_(!1),E(""),T("global"),D(null)}catch(Ve){const tt=Ve instanceof Error&&Ve.message?Ve.message:"Could not save prompt.";D(tt)}}const ke=W(Q=>Q.promptSuggestions.get(e))??N7,Oe=W(Q=>Q.clearPromptSuggestions),qe=W(Q=>Q.sessionStatus).get(e)==="running",hr=t.trim().length>0&&X;return a.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:Ut,onDragLeave:Dt,onDrop:kt,children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&a.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:a.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&a.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((Q,fe)=>a.jsx(C2,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>ze(fe)},fe))}),c&&a.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),a.jsx("input",{ref:U,type:"file",multiple:!0,onChange:be,className:"hidden","aria-label":"Attach files"}),ke.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:ke.map((Q,fe)=>a.jsx("button",{onClick:()=>{if(!X||qe)return;const Ae=xm();Pn(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Ae}),W.getState().appendMessage(e,{id:Ae,role:"user",content:Q,timestamp:Date.now()}),Oe(e)},disabled:!X||qe,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:Q,children:Q},fe))}),a.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${$?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Z.length>0&&a.jsx("div",{ref:V,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Z.map((Q,fe)=>a.jsxs("button",{"data-cmd-index":fe,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${fe===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:Q.type==="skill"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",Q.name]}),a.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),a.jsx(B2,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:pe,menuRef:R.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),b&&a.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),a.jsx("input",{value:k,onChange:Q=>{E(Q.target.value),N&&D(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","aria-pressed":j==="global",onClick:()=>T("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),a.jsx("button",{type:"button","aria-pressed":j==="project",onClick:()=>T("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),j==="project"&&(A==null?void 0:A.cwd)&&a.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.cwd}),N?a.jsx("div",{className:"text-[11px] text-cc-error",children:N}):null,a.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[a.jsx("button",{onClick:()=>{_(!1),T("global"),D(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:xn,disabled:!k.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${k.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[a.jsx(k5,{isPlan:$,isConnected:X,onToggle:it,modeLabel:me,size:"mobile"}),a.jsx(S5,{sessionId:e}),a.jsx("div",{className:"flex-1"}),a.jsx(cd,{onClick:fn,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:a.jsx(j5,{})}),a.jsx(cd,{onClick:()=>{var Q;return(Q=U.current)==null?void 0:Q.click()},disabled:!X,active:X,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),a.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:a.jsx("textarea",{ref:H,value:t,onChange:Te,onKeyDown:Ce,onClick:Le,onKeyUp:Le,onPaste:gt,"aria-label":"Message input",placeholder:X?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!X,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:a.jsx(N5,{isRunning:qe,canSend:hr,onSend:_e,onInterrupt:Pe,size:"mobile"})}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[a.jsx(cd,{onClick:()=>{var Q;return(Q=U.current)==null?void 0:Q.click()},disabled:!X,active:X,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx(cd,{onClick:fn,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:a.jsx(j5,{})}),a.jsx(k5,{isPlan:$,isConnected:X,onToggle:it,modeLabel:me,size:"desktop"}),a.jsx("div",{className:"flex-1"}),a.jsx(S5,{sessionId:e}),a.jsx(N5,{isRunning:qe,canSend:hr,onSend:_e,onInterrupt:Pe,size:"desktop"})]})]})]})})}function E7(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function T7({permission:e,sessionId:t}){const[n,i]=S.useState(!1),l=W(p=>p.removePermission);function c(p,g){i(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),l(t,e.request_id)}function u(){i(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),l(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return a.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:a.jsx("div",{className:"max-w-3xl mx-auto",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:a.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&a.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&a.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?a.jsx(D7,{input:e.input,onSelect:p=>c({...e.input,answers:p}),disabled:n}):a.jsx(R7,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&a.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&a.jsx(M7,{validation:e.ai_validation}),!f&&a.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>a.jsxs("button",{onClick:()=>c(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),E7(p)]},g)),a.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function A7(e){return[/^Invalid Anthropic/i,/^Anthropic .*(rate limit|overloaded|unavailable|error|lacks permission)/i,/^AI service/i,/^AI evaluation timed out/i,/^Model not found/i,/^No Anthropic API key/i].some(n=>n.test(e))}function M7({validation:e}){const t=e.verdict==="uncertain"&&A7(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return a.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),a.jsx("span",{className:"font-medium",children:i}),a.jsx("span",{children:e.reason})]})}function R7({toolName:e,input:t,description:n}){return e==="Bash"?a.jsx(L7,{input:t}):e==="Edit"?a.jsx(z7,{input:t}):e==="Write"?a.jsx(O7,{input:t}):e==="Read"?a.jsx(B7,{input:t}):e==="Glob"?a.jsx(P7,{input:t}):e==="Grep"?a.jsx($7,{input:t}):e==="ExitPlanMode"?a.jsx(U7,{input:t}):a.jsx($2,{input:t,description:n})}function L7({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsx("div",{className:"text-xs text-cc-muted",children:n}),a.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function D7({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[l,c]=S.useState({}),[u,f]=S.useState({}),[h,p]=S.useState({});function g(E){const j={};for(const[T,N]of Object.entries(E)){const D=i[Number(T)],z=typeof(D==null?void 0:D.question)=="string"&&D.question?D.question:T;j[z]=N}return j}function v(E,j){const T=String(E);c(N=>({...N,[T]:j})),p(N=>({...N,[T]:!1})),i.length<=1&&t(g({[T]:j}))}function y(E){var N;const j=String(E),T=(N=u[j])==null?void 0:N.trim();T&&(c(D=>({...D,[j]:T})),i.length<=1&&t(g({[j]:T})))}function b(E,j){const T=String(E);f(D=>({...D,[T]:j}));const N=j.trim();c(D=>{if(!N){const z={...D};return delete z[T],z}return{...D,[T]:N}})}function _(E){const j=String(E);p(T=>{const N=!!T[j],D={...T,[j]:!N};return N&&(c(z=>{const L={...z};return delete L[j],L}),f(z=>{const L={...z};return delete L[j],L})),D})}function k(){t(g(l))}if(i.length===0){const E=typeof e.question=="string"?e.question:"";return E?a.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:E}):a.jsx($2,{input:e})}return a.jsxs("div",{className:"space-y-3",children:[i.map((E,j)=>{const T=typeof E.header=="string"?E.header:"",N=typeof E.question=="string"?E.question:"",D=Array.isArray(E.options)?E.options:[],z=String(j),L=l[z],H=h[z];return a.jsxs("div",{className:"space-y-2",children:[T&&a.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:T}),N&&a.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:N}),D.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[D.map((U,V)=>{const O=typeof U.label=="string"?U.label:String(U),F=typeof U.description=="string"?U.description:"",A=L===O;return a.jsx("button",{onClick:()=>v(j,O),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:O}),F&&a.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:F})]})]})},V)}),a.jsx("button",{onClick:()=>_(j),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${H?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${H?"border-cc-primary":"border-cc-muted/40"}`,children:H&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),H&&a.jsxs("div",{className:"pl-6",children:[a.jsx("input",{type:"text",value:u[z]||"",onChange:U=>b(j,U.target.value),onKeyDown:U=>{U.key==="Enter"&&y(j)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&a.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},j)}),i.length>1&&Object.keys(l).length>0&&a.jsx("button",{onClick:k,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function z7({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return a.jsx(Tl,{oldText:n,newText:i,fileName:t,mode:"compact"})}function O7({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(Tl,{newText:n,fileName:t,mode:"compact"})}function B7({input:e}){const t=String(e.file_path||"");return a.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function P7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n})]})}function $7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n}),i&&a.jsx("div",{className:"text-cc-muted",children:i})]})}function U7({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),a.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),a.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:a.jsx(ax,{remarkPlugins:[ux],components:{h1:({children:i})=>a.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>a.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>a.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>a.jsx("li",{children:i}),strong:({children:i})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:l})=>a.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:l}),code:i=>{const{children:l,className:c}=i;return/language-(\w+)/.exec(c||"")||typeof l=="string"&&l.includes(`
97
+ `):t;return a.jsxs("div",{children:[a.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:a.jsx(ax,{remarkPlugins:[ux],components:{p:({children:f})=>a.jsx("p",{className:"mb-2 last:mb-0",children:f}),ul:({children:f})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:f}),ol:({children:f})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:f}),li:({children:f})=>a.jsx("li",{children:f}),code:({children:f})=>a.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:f})},children:u||"No thinking text captured."})}),c&&!n&&a.jsx("button",{onClick:()=>i(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function Qo(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function om(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function m5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":i7(t):"N/A"}catch{return"N/A"}}function g5(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${l}h`:l>0?`${l}h${c}m`:`${c}m`}function x5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function i7(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function s7({tools:e}){return e.length===0?null:a.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[a.jsx(_l,{type:_c(t.toolName)}),a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),a.jsx("span",{className:"text-cc-fg/70",children:As(t.toolName)}),a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function a7({entries:e}){const[t,n]=S.useState(!1),i=S.useMemo(()=>{const l=e.reduce((h,p)=>h+p.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:l,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:a.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&a.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(l=>a.jsx("span",{className:`h-full rounded-full ${l.isError?"bg-cc-error/40":l.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,l.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${As(l.toolName)} ${l.elapsedSeconds}s`},l.toolUseId))})]}),t&&a.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(l=>a.jsx(l7,{entry:l,maxTime:i.maxTime},l.toolUseId))})]})}function l7({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),a.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[a.jsx(_l,{type:_c(e.toolName)}),a.jsx("span",{className:"text-cc-fg/70 truncate",children:As(e.toolName)})]}),a.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:a.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&a.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const od=100,o7=40,c7=120,u7=1e4,d7=7*6e4,cm=new Map,f7=[],h7=[];function p7(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function m7(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function v5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function g7(e){return e.kind==="message"?(e.msg.contentBlocks||[]).filter(n=>n.type==="tool_use").filter(n=>n.name==="Task").map(n=>n.id):e.kind==="tool_msg_group"&&e.toolName==="Task"?e.items.map(t=>t.id):[]}function T2(e){const t=[];for(const n of e){const i=m7(n);if(i){const l=t[t.length-1];if((l==null?void 0:l.kind)==="tool_msg_group"&&l.toolName===i){l.items.push(...v5(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:v5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function A2(e,t,n){const i=T2(e),l=[];for(const c of i){l.push(c);const u=g7(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=A2(h,t,n);l.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return l}function x7(e){const t=new Map;for(const l of e)if(l.contentBlocks){for(const c of l.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(y=>typeof y=="string"&&y.length>0):void 0,p=h&&h.length>0?h.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:h})}}if(t.size===0)return T2(e);const n=new Map,i=[];for(const l of e)if(l.parentToolUseId&&t.has(l.parentToolUseId)){let c=n.get(l.parentToolUseId);c||(c=[],n.set(l.parentToolUseId,c)),c.push(l)}else i.push(l);return A2(i,t,n)}function v7({group:e}){const[t,n]=S.useState(!1),i=_c(e.toolName),l=As(e.toolName),c=e.items.length;if(c===1){const u=e.items[0];return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(b5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:lc(u.name,u.input)})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:a.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(b5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(_l,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=lc(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function M2({entries:e,toolActivity:t}){return a.jsx(a.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return a.jsx(v7,{group:n},n.firstId||i);if(n.kind==="subagent")return a.jsx(_7,{group:n},n.taskToolUseId);const l=n.msg,c=b7(l),u=t&&c.length>0?t.filter(h=>c.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return a.jsxs("div",{children:[a.jsx(X8,{message:l}),f&&a.jsx(a7,{entries:u})]},l.id)})})}function b7(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function y7(e){if(!e)return null;const t=e.trim().toLowerCase();return t?t==="completed"?{label:"completed",summaryLabel:"completed",className:"text-green-600 bg-green-500/15"}:t==="failed"||t==="error"||t==="errored"?{label:"failed",summaryLabel:"failed",className:"text-cc-error bg-cc-error/10"}:t==="pending"||t==="pendinginit"||t==="pending_init"?{label:"pending",summaryLabel:"pending",className:"text-amber-700 bg-amber-500/15"}:t==="running"||t==="inprogress"||t==="in_progress"||t==="started"?{label:"running",summaryLabel:"running",className:"text-blue-600 bg-blue-500/15"}:{label:e,summaryLabel:"running",className:"text-amber-700 bg-amber-500/15"}:null}function _7({group:e}){const[t,n]=S.useState(!1),i=e.description||"Subagent",l=e.agentType,c=e.children.length,u=y7(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],y=S.useMemo(()=>{var b,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${As(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const k=(b=v.msg.content)==null?void 0:b.trim();if(k)return k.length>60?k.slice(0,60)+"...":k;const E=(_=v.msg.contentBlocks)==null?void 0:_.find(j=>j.type==="tool_use");if(E)return As(E.name)}return""},[v]);return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[a.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),l&&a.jsx("span",{className:"text-[10px] text-cc-muted/50",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&a.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&a.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&y&&a.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),a.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&a.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&a.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&a.jsxs("span",{children:["receivers: ",p.map(b=>a.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),a.jsx(M2,{entries:e.children})]})]})})}function b5(){return a.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function w7({sessionId:e}){const t=W(be=>be.messages.get(e)??f7),n=W(be=>(be.sdkSessions||h7).find(ze=>ze.sessionId===e)),i=W(be=>be.streamingStartedAt.get(e)),l=W(be=>be.streamingOutputTokens.get(e)),c=W(be=>be.sessionStatus.get(e)),u=W(be=>be.lastActivityAt.get(e)),f=W(be=>be.toolProgress.get(e)),h=W(be=>be.toolActivity.get(e)),p=S.useRef(null),g=S.useRef(null),v=S.useRef(!0),[y,b]=S.useState(0),[_,k]=S.useState(od),[E,j]=S.useState([]),[T,N]=S.useState(0),[D,z]=S.useState(!1),[L,H]=S.useState(!1),[U,V]=S.useState(!1),[O,F]=S.useState(""),A=S.useRef(new Set),ae=W(be=>be.chatTabReentryTickBySession.get(e)??0),X=S.useMemo(()=>t.some(be=>be.role==="assistant"&&be.isStreaming),[t]),I=S.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),$=I.length>0,P=n!=null&&n.forkSession?"Forked from":"Continuing from",ie=S.useMemo(()=>{if(E.length===0)return t;const be=[],ze=new Set;for(const gt of E)ze.has(gt.id)||(ze.add(gt.id),be.push(gt));for(const gt of t)ze.has(gt.id)||(ze.add(gt.id),be.push(gt));return be},[E,t]),me=S.useMemo(()=>x7(ie),[ie]);S.useEffect(()=>{k(od),j([]),N(0),z(!1),H(!1),V(!1),F(""),A.current=new Set},[e,I]);const R=me.length,B=R>_,Z=B?me.slice(R-_):me,M=R-Z.length,pe=S.useCallback(()=>{const be=g.current,ze=(be==null?void 0:be.scrollHeight)??0;k(gt=>gt+od),requestAnimationFrame(()=>{if(be){const gt=be.scrollHeight;be.scrollTop+=gt-ze}})},[]),_e=S.useCallback(async(be={})=>{if(!$||!I||U)return;const ze=g.current,gt=(ze==null?void 0:ze.scrollHeight)??0,Ft=L?T:0;V(!0),F("");try{const Dt=await we.getClaudeSessionHistory(I,{cursor:Ft,limit:o7}),kt=Dt.messages.map(it=>({id:it.id,role:it.role,content:it.content,contentBlocks:it.role==="assistant"?it.contentBlocks:void 0,timestamp:it.timestamp||Date.now(),model:it.role==="assistant"?it.model:void 0,stopReason:it.role==="assistant"?it.stopReason:void 0})),fn=[];for(const it of kt)A.current.has(it.id)||(A.current.add(it.id),fn.push(it));j(it=>[...fn,...it]),N(Dt.nextCursor),z(Dt.hasMore),H(!0),fn.length>0&&k(it=>it+fn.length),be.preserveScroll!==!1&&ze&&requestAnimationFrame(()=>{const it=ze.scrollHeight;ze.scrollTop+=it-gt})}catch(Dt){const kt=Dt instanceof Error?Dt.message:String(Dt);F(kt||"Failed to load previous history"),L||(j([]),N(0),z(!1))}finally{V(!1)}},[$,I,U,L,T]);S.useEffect(()=>{if(!i&&c!=="running"){b(0);return}const be=i||Date.now();b(Date.now()-be);const ze=setInterval(()=>b(Date.now()-be),1e3);return()=>clearInterval(ze)},[i,c]);function Ce(){const be=g.current;if(!be)return;v.current=be.scrollHeight-be.scrollTop-be.clientHeight<120;const ze=Math.max(0,be.scrollHeight-be.clientHeight-be.scrollTop);cm.set(e,ze),$&&L&&D&&!U&&be.scrollTop<=c7&&_e({preserveScroll:!0})}const Te=S.useCallback(()=>{const be=g.current;if(!be)return;const ze=be.style.scrollBehavior;be.style.scrollBehavior="auto",be.scrollTop=be.scrollHeight,be.style.scrollBehavior=ze},[]),Le=S.useCallback(()=>{const be=g.current;if(!be)return;const ze=be.style.scrollBehavior;be.style.scrollBehavior="auto";const gt=cm.get(e);typeof gt=="number"?be.scrollTop=Math.max(0,be.scrollHeight-be.clientHeight-gt):be.scrollTop=be.scrollHeight,be.style.scrollBehavior=ze},[e]);if(S.useEffect(()=>{requestAnimationFrame(()=>Le())},[e,Le]),S.useEffect(()=>()=>{const be=g.current;if(!be)return;const ze=Math.max(0,be.scrollHeight-be.clientHeight-be.scrollTop);cm.set(e,ze)},[e]),S.useEffect(()=>{ae&&requestAnimationFrame(()=>Te())},[ae,Te]),S.useEffect(()=>{var be;v.current&&((be=p.current)==null||be.scrollIntoView({behavior:"smooth"}))},[t]),ie.length===0)return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),a.jsx("div",{className:"text-center max-w-xs",children:$?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),a.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[P," ",a.jsx("span",{className:"font-mono-code text-cc-fg/70",children:I.slice(0,8)}),". Load earlier messages when needed."]}),a.jsxs("button",{onClick:()=>void _e({preserveScroll:!1}),disabled:U,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),U?"Loading...":"Load previous history"]}),O&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:O})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const Pe=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,rt=Pe>=d7?"stalled":Pe>=u7?"quiet":"active";return a.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[a.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),a.jsx("div",{ref:g,onScroll:Ce,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[$&&!L&&a.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[P," existing Claude thread"]}),a.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[I," ",n!=null&&n.cwd?`· ${p7(n.cwd)}`:""]})]}),a.jsx("button",{onClick:()=>void _e({preserveScroll:!0}),disabled:U,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:U?"Loading...":"Load previous history"})]}),O&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:O})]}),$&&L&&a.jsx("div",{className:"flex justify-center",children:a.jsx("p",{className:"text-[11px] text-cc-muted",children:D?U?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),B&&a.jsx("div",{className:"flex justify-center pb-3",children:a.jsxs("button",{onClick:pe,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(od,M)," more",a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",M," hidden)"]})]})}),a.jsx(M2,{entries:Z,toolActivity:h}),f&&f.size>0&&!X&&a.jsx(s7,{tools:Array.from(f.values())}),c==="compacting"&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),a.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),a.jsx("span",{children:"Compacting context..."})]}),c==="running"&&y>=0&&a.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":rt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${rt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${rt==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),rt==="stalled"?a.jsxs("span",{children:["No activity for ",om(Pe)," — the agent may be stuck"]}):rt==="quiet"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Still working…"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:["no update for ",om(Pe)]})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsx("span",{className:"tabular-nums",children:om(y)}),(l??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:[Qo(l)," tokens"]})]})]})]}),a.jsx("div",{ref:p})]})})]})}const S7={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function k7(e,t){for(const[i,l]of Object.entries(S7))if(e.includes(i))return l;const n=["◆","●","◕","✦"];return n[t%n.length]}function j7(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:k7(t.value,n)}))}const R2=[{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-4-6",label:"Sonnet 4.6",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],L2=[{value:"gpt-5.3-codex-max",label:"GPT-5.3 Max",icon:"■"},{value:"gpt-5.3-codex-xhigh",label:"GPT-5.3 xHigh",icon:"★"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"✳"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex",icon:"◆"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Max",icon:"■"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"},{value:"gpt-5.1-codex-mini",label:"GPT-5.1 Mini",icon:"⚡"}],hx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],px=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],D2=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],z2=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function O2(e){return e==="codex"?L2:R2}function y5(e){return e==="codex"?px:hx}function ML(e){return e==="codex"?z2:D2}function _5(e){return e==="codex"?L2[0].value:R2[0].value}function w5(e){return e==="codex"?px[0].value:hx[0].value}function RL(e){return e==="codex"?z2[0].value:D2[0].value}function S5({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),l=W(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),c=W(y=>y.sessions.get(e)),u=W(y=>y.cliConnected.get(e)??!1),f=(l==null?void 0:l.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(l==null?void 0:l.model)??"",p=O2(f),g=p.find(y=>y.value===h)||(h?{label:h,icon:"?"}:null),v=S.useCallback(y=>{if(n(!1),y===h)return;Pn(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=W.getState();_(b.map(k=>k.sessionId===e?{...k,model:y}:k))},[e,h]);return S.useEffect(()=>{if(!t)return;const y=b=>{i.current&&!i.current.contains(b.target)&&n(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[t]),S.useEffect(()=>{if(!t)return;const y=b=>{b.key==="Escape"&&n(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),f==="codex"||!u||!g?null:a.jsxs("div",{ref:i,className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>n(y=>!y),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&a.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),a.jsx("span",{children:g.label}),a.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:a.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&a.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(y=>a.jsxs("button",{onClick:()=>v(y.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${y.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":y.value===h,children:[y.icon&&a.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),a.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===h&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},y.value))})]})}function B2({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:l,menuRef:c,className:u=""}){return e?a.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>a.jsxs("button",{"data-prompt-index":h,onClick:()=>l(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),a.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function P2({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[l,c]=S.useState(!1),[u,f]=S.useState(0),[h,p]=S.useState([]),[g,v]=S.useState(!1),y=S.useRef(null),b=S.useCallback(async()=>{v(!0);try{const j=await we.listPrompts(n);p(j.filter(T=>!!T.name.trim()))}catch{p([])}finally{v(!1)}},[n]);S.useEffect(()=>{b()},[b]);const _=S.useMemo(()=>{const j=e.slice(0,t),T=j.match(/(^|\s)@([^\s@]*)$/);if(!T||T.index===void 0)return null;const N=j.length-T[0].length+T[1].length;return{query:T[2]||"",start:N,end:t}},[e,t]),k=S.useMemo(()=>{if(!l||!_)return[];const j=_.query.toLowerCase();if(!j)return h;const T=h.filter(D=>D.name.toLowerCase().startsWith(j)),N=h.filter(D=>!D.name.toLowerCase().startsWith(j)&&D.name.toLowerCase().includes(j));return[...T,...N]},[l,_,h]);S.useEffect(()=>{const j=i&&!!_;j&&!l?(c(!0),f(0)):!j&&l&&c(!1)},[i,_,l]),S.useEffect(()=>{u>=k.length&&f(Math.max(0,k.length-1))},[k.length,u]),S.useEffect(()=>{if(!y.current||!l)return;const T=y.current.querySelectorAll("[data-prompt-index]")[u];T&&T.scrollIntoView({block:"nearest"})},[u,l]);const E=S.useCallback(j=>{if(!_)return{nextText:e,nextCursor:t};const T=`${j.content} `,N=`${e.slice(0,_.start)}${T}${e.slice(_.end)}`,D=_.start+T.length;return{nextText:N,nextCursor:D}},[_,e,t]);return{mentionMenuOpen:l,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:k,promptsLoading:g,savedPrompts:h,selectPrompt:E,refreshPrompts:b,mentionMenuRef:y}}const N7=[];function k5({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:l}){const c=l==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",f=c?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=c?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return a.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?f:h:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:i})]})}function cd({onClick:e,disabled:t,active:n,title:i,children:l}){return a.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:l})}function j5(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function N5({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:l}){const c=l==="desktop",u=c?"w-9 h-9":"w-10 h-10",f=c?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?a.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?f:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function C7({sessionId:e}){var le,xe;const[t,n]=S.useState(""),[i,l]=S.useState([]),[c,u]=S.useState(null),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[v,y]=S.useState(0),[b,_]=S.useState(!1),[k,E]=S.useState(""),[j,T]=S.useState("global"),[N,D]=S.useState(null),[z,L]=S.useState(0),H=S.useRef(null),U=S.useRef(null),V=S.useRef(null),O=S.useRef(null),F=W(Q=>Q.cliConnected),A=W(Q=>Q.sessions.get(e)),ae=W(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),X=F.get(e)??!1,I=(A==null?void 0:A.permissionMode)||"acceptEdits",$=I==="plan",P=(A==null?void 0:A.backend_type)==="codex",me=((xe=(le=(P?px:hx).find(Q=>Q.value===I))==null?void 0:le.label)==null?void 0:xe.toLowerCase())||I,R=P2({text:t,caretPos:z,cwd:A==null?void 0:A.cwd,enabled:!p}),B=S.useMemo(()=>{const Q=[];if(A!=null&&A.slash_commands)for(const fe of A.slash_commands)Q.push({name:fe,type:"command"});if(A!=null&&A.skills)for(const fe of A.skills)Q.push({name:fe,type:"skill"});return Q},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),Z=S.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const fe=Q[1].toLowerCase();return fe===""?B:B.filter(Ae=>Ae.name.toLowerCase().includes(fe))},[t,p,B]);S.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;Q&&!p?(g(!0),y(0)):!Q&&p&&g(!1)},[t,B.length,p]),S.useEffect(()=>{v>=Z.length&&y(Math.max(0,Z.length-1))},[Z.length,v]),S.useEffect(()=>{if(!V.current||!p)return;const fe=V.current.querySelectorAll("[data-cmd-index]")[v];fe&&fe.scrollIntoView({block:"nearest"})},[v,p]),S.useEffect(()=>{if(O.current===null||!H.current)return;const Q=O.current;H.current.setSelectionRange(Q,Q),O.current=null},[t]);const M=S.useCallback(Q=>{var fe;n(`/${Q.name} `),g(!1),(fe=H.current)==null||fe.focus()},[]),pe=S.useCallback(Q=>{var Ae;const fe=R.selectPrompt(Q);O.current=fe.nextCursor,n(fe.nextText),R.setMentionMenuOpen(!1),L(fe.nextCursor),(Ae=H.current)==null||Ae.focus(),H.current&&(H.current.style.height="auto",H.current.style.height=Math.min(H.current.scrollHeight,200)+"px")},[R]);function _e(){var tt;const Q=t.trim();if(!Q||!X)return;const fe=xm(),Ae=i.length>0?i.map(nt=>({name:nt.name,media_type:nt.mediaType,data:nt.base64,size:nt.size})):void 0;Pn(e,{type:"user_message",content:Q,session_id:e,attachments:Ae,client_msg_id:fe});const Ve=W.getState();Ve.appendMessage(e,{id:fe,role:"user",content:Q,attachments:Ae,timestamp:Date.now()}),Ve.setSessionStatus(e,"running"),Ve.setLastActivity(e,Date.now()),Ve.streamingStartedAt.has(e)||Ve.setStreamingStats(e,{startedAt:Date.now()}),n(""),l([]),u(null),g(!1),R.setMentionMenuOpen(!1),H.current&&(H.current.style.height="auto"),(tt=H.current)==null||tt.focus()}function Ce(Q){if(p&&Z.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),y(fe=>(fe+1)%Z.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),y(fe=>(fe-1+Z.length)%Z.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Escape"){Q.preventDefault(),g(!1);return}}if(R.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe+1)%R.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),pe(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),it();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),_e())}function Te(Q){n(Q.target.value),L(Q.target.selectionStart??Q.target.value.length);const fe=Q.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Le(){H.current&&L(H.current.selectionStart??0)}function Pe(){Pn(e,{type:"interrupt"})}async function rt(Q){if(Q.length===0)return;const fe=[],Ae=[];let Ve=i.reduce((tt,nt)=>tt+nt.size,0);for(const tt of Q){if(tt.size>Qd){Ae.push(`${tt.name} is too large (${Ts(tt.size)}, max ${Ts(Qd)})`);continue}if(Ve+tt.size>Wd){Ae.push(`${tt.name} would exceed the per-message limit (${Ts(Wd)})`);continue}const{base64:nt,mediaType:xt}=await k2(tt);fe.push({name:tt.name,base64:nt,mediaType:xt,size:tt.size}),Ve+=tt.size}fe.length>0&&l(tt=>[...tt,...fe]),u(Ae.length>0?Ae.join("; "):null)}async function be(Q){const fe=Q.target.files;fe&&(await rt(Array.from(fe)),Q.target.value="")}function ze(Q){l(fe=>fe.filter((Ae,Ve)=>Ve!==Q))}async function gt(Q){var Ve;const fe=(Ve=Q.clipboardData)==null?void 0:Ve.items;if(!fe)return;const Ae=[];for(const tt of Array.from(fe)){if(tt.kind!=="file")continue;const nt=tt.getAsFile();if(!nt)continue;const xt=nt.name&&nt.name.length>0?nt.name:`pasted-${Date.now()}.${(nt.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ae.push(new File([nt],xt,{type:nt.type,lastModified:nt.lastModified}))}Ae.length>0&&(Q.preventDefault(),await rt(Ae))}function Ft(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),h(!0))}function Dt(Q){Q.currentTarget===Q.target&&h(!1)}async function kt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),h(!1);const fe=Array.from(Q.dataTransfer.files);fe.length>0&&await rt(fe)}function fn(){const Q=t.trim().slice(0,32);E(Q||""),D(null),_(fe=>!fe)}function it(){if(!X)return;const Q=W.getState();if(!$)Q.setPreviousPermissionMode(e,I),Pn(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const fe=ae||(P?"bypassPermissions":"acceptEdits");Pn(e,{type:"set_permission_mode",mode:fe}),Q.updateSession(e,{permissionMode:fe})}}async function xn(){const Q=t.trim(),fe=k.trim();if(!Q||!fe)return;if(j==="project"&&!(A!=null&&A.cwd)){D("No project folder available for this session");return}const Ae={name:fe,content:Q,scope:j};j==="project"&&(Ae.projectPaths=[A.cwd]);try{await we.createPrompt(Ae),await R.refreshPrompts(),_(!1),E(""),T("global"),D(null)}catch(Ve){const tt=Ve instanceof Error&&Ve.message?Ve.message:"Could not save prompt.";D(tt)}}const ke=W(Q=>Q.promptSuggestions.get(e))??N7,Oe=W(Q=>Q.clearPromptSuggestions),qe=W(Q=>Q.sessionStatus).get(e)==="running",hr=t.trim().length>0&&X;return a.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:Ft,onDragLeave:Dt,onDrop:kt,children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&a.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:a.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&a.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((Q,fe)=>a.jsx(C2,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>ze(fe)},fe))}),c&&a.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),a.jsx("input",{ref:U,type:"file",multiple:!0,onChange:be,className:"hidden","aria-label":"Attach files"}),ke.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:ke.map((Q,fe)=>a.jsx("button",{onClick:()=>{if(!X||qe)return;const Ae=xm();Pn(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Ae}),W.getState().appendMessage(e,{id:Ae,role:"user",content:Q,timestamp:Date.now()}),Oe(e)},disabled:!X||qe,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:Q,children:Q},fe))}),a.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${$?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Z.length>0&&a.jsx("div",{ref:V,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Z.map((Q,fe)=>a.jsxs("button",{"data-cmd-index":fe,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${fe===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:Q.type==="skill"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",Q.name]}),a.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),a.jsx(B2,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:pe,menuRef:R.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),b&&a.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),a.jsx("input",{value:k,onChange:Q=>{E(Q.target.value),N&&D(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","aria-pressed":j==="global",onClick:()=>T("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),a.jsx("button",{type:"button","aria-pressed":j==="project",onClick:()=>T("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),j==="project"&&(A==null?void 0:A.cwd)&&a.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.cwd}),N?a.jsx("div",{className:"text-[11px] text-cc-error",children:N}):null,a.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[a.jsx("button",{onClick:()=>{_(!1),T("global"),D(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:xn,disabled:!k.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${k.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[a.jsx(k5,{isPlan:$,isConnected:X,onToggle:it,modeLabel:me,size:"mobile"}),a.jsx(S5,{sessionId:e}),a.jsx("div",{className:"flex-1"}),a.jsx(cd,{onClick:fn,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:a.jsx(j5,{})}),a.jsx(cd,{onClick:()=>{var Q;return(Q=U.current)==null?void 0:Q.click()},disabled:!X,active:X,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),a.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:a.jsx("textarea",{ref:H,value:t,onChange:Te,onKeyDown:Ce,onClick:Le,onKeyUp:Le,onPaste:gt,"aria-label":"Message input",placeholder:X?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!X,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:a.jsx(N5,{isRunning:qe,canSend:hr,onSend:_e,onInterrupt:Pe,size:"mobile"})}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[a.jsx(cd,{onClick:()=>{var Q;return(Q=U.current)==null?void 0:Q.click()},disabled:!X,active:X,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx(cd,{onClick:fn,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:a.jsx(j5,{})}),a.jsx(k5,{isPlan:$,isConnected:X,onToggle:it,modeLabel:me,size:"desktop"}),a.jsx("div",{className:"flex-1"}),a.jsx(S5,{sessionId:e}),a.jsx(N5,{isRunning:qe,canSend:hr,onSend:_e,onInterrupt:Pe,size:"desktop"})]})]})]})})}function E7(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function T7({permission:e,sessionId:t}){const[n,i]=S.useState(!1),l=W(p=>p.removePermission);function c(p,g){i(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),l(t,e.request_id)}function u(){i(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),l(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return a.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:a.jsx("div",{className:"max-w-3xl mx-auto",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:a.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&a.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&a.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?a.jsx(D7,{input:e.input,onSelect:p=>c({...e.input,answers:p}),disabled:n}):a.jsx(R7,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&a.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&a.jsx(M7,{validation:e.ai_validation}),!f&&a.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>a.jsxs("button",{onClick:()=>c(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),E7(p)]},g)),a.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function A7(e){return[/^Invalid Anthropic/i,/^Anthropic .*(rate limit|overloaded|unavailable|error|lacks permission)/i,/^AI service/i,/^AI evaluation timed out/i,/^Model not found/i,/^No Anthropic API key/i].some(n=>n.test(e))}function M7({validation:e}){const t=e.verdict==="uncertain"&&A7(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return a.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),a.jsx("span",{className:"font-medium",children:i}),a.jsx("span",{children:e.reason})]})}function R7({toolName:e,input:t,description:n}){return e==="Bash"?a.jsx(L7,{input:t}):e==="Edit"?a.jsx(z7,{input:t}):e==="Write"?a.jsx(O7,{input:t}):e==="Read"?a.jsx(B7,{input:t}):e==="Glob"?a.jsx(P7,{input:t}):e==="Grep"?a.jsx($7,{input:t}):e==="ExitPlanMode"?a.jsx(U7,{input:t}):a.jsx($2,{input:t,description:n})}function L7({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsx("div",{className:"text-xs text-cc-muted",children:n}),a.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function D7({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[l,c]=S.useState({}),[u,f]=S.useState({}),[h,p]=S.useState({});function g(E){const j={};for(const[T,N]of Object.entries(E)){const D=i[Number(T)],z=typeof(D==null?void 0:D.question)=="string"&&D.question?D.question:T;j[z]=N}return j}function v(E,j){const T=String(E);c(N=>({...N,[T]:j})),p(N=>({...N,[T]:!1})),i.length<=1&&t(g({[T]:j}))}function y(E){var N;const j=String(E),T=(N=u[j])==null?void 0:N.trim();T&&(c(D=>({...D,[j]:T})),i.length<=1&&t(g({[j]:T})))}function b(E,j){const T=String(E);f(D=>({...D,[T]:j}));const N=j.trim();c(D=>{if(!N){const z={...D};return delete z[T],z}return{...D,[T]:N}})}function _(E){const j=String(E);p(T=>{const N=!!T[j],D={...T,[j]:!N};return N&&(c(z=>{const L={...z};return delete L[j],L}),f(z=>{const L={...z};return delete L[j],L})),D})}function k(){t(g(l))}if(i.length===0){const E=typeof e.question=="string"?e.question:"";return E?a.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:E}):a.jsx($2,{input:e})}return a.jsxs("div",{className:"space-y-3",children:[i.map((E,j)=>{const T=typeof E.header=="string"?E.header:"",N=typeof E.question=="string"?E.question:"",D=Array.isArray(E.options)?E.options:[],z=String(j),L=l[z],H=h[z];return a.jsxs("div",{className:"space-y-2",children:[T&&a.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:T}),N&&a.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:N}),D.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[D.map((U,V)=>{const O=typeof U.label=="string"?U.label:String(U),F=typeof U.description=="string"?U.description:"",A=L===O;return a.jsx("button",{onClick:()=>v(j,O),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:O}),F&&a.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:F})]})]})},V)}),a.jsx("button",{onClick:()=>_(j),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${H?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${H?"border-cc-primary":"border-cc-muted/40"}`,children:H&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),H&&a.jsxs("div",{className:"pl-6",children:[a.jsx("input",{type:"text",value:u[z]||"",onChange:U=>b(j,U.target.value),onKeyDown:U=>{U.key==="Enter"&&y(j)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&a.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},j)}),i.length>1&&Object.keys(l).length>0&&a.jsx("button",{onClick:k,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function z7({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return a.jsx(Tl,{oldText:n,newText:i,fileName:t,mode:"compact"})}function O7({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(Tl,{newText:n,fileName:t,mode:"compact"})}function B7({input:e}){const t=String(e.file_path||"");return a.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function P7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n})]})}function $7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n}),i&&a.jsx("div",{className:"text-cc-muted",children:i})]})}function U7({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),a.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),a.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:a.jsx(ax,{remarkPlugins:[ux],components:{h1:({children:i})=>a.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>a.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>a.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>a.jsx("li",{children:i}),strong:({children:i})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:l})=>a.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:l}),code:i=>{const{children:l,className:c}=i;return/language-(\w+)/.exec(c||"")||typeof l=="string"&&l.includes(`
98
98
  `)?a.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:a.jsx("code",{children:l})}):a.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-cc-code-fg font-mono-code text-[12px]",children:l})},pre:({children:i})=>a.jsx(a.Fragment,{children:i}),blockquote:({children:i})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),a.jsx("div",{className:"space-y-1",children:n.map((i,l)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[a.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),a.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},l))})]}),!t&&n.length===0&&a.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function $2({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?a.jsx("div",{className:"text-xs text-cc-fg",children:t}):a.jsxs("div",{className:"space-y-1",children:[t&&a.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),a.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,l])=>{const c=typeof l=="string"?l.length>200?l.slice(0,200)+"...":l:JSON.stringify(l);return a.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[a.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),a.jsx("span",{className:"text-cc-fg break-all",children:c})]},i)})})]})}function F7({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:l}=e,c=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return a.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${c?"text-cc-success":"text-cc-error"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),a.jsxs("span",{className:"flex-1",children:["AI auto-",c?"approved":"denied",":"," ",a.jsx("span",{className:"font-mono-code opacity-80",children:u}),l&&a.jsxs("span",{className:"text-cc-muted ml-1",children:["(",l,")"]})]}),t&&a.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const q7=[],H7=[],C5="activity-tray-panel";function I7(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),l=n%60;return`${i}m${l>0?` ${l}s`:""}`}function V7(e,t,n=4e3){const[i,l]=S.useState(!1),c=S.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return S.useEffect(()=>(clearTimeout(c.current),f?c.current=setTimeout(()=>l(!0),n):l(!1),()=>clearTimeout(c.current)),[f,n]),S.useEffect(()=>{l(!1)},[u]),i}function G7(e){const[t,n]=S.useState(0);return S.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(l=>l+1),1e3);return()=>clearInterval(i)},[e]),t}function Y7({status:e}){return e==="running"||e==="in_progress"?a.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function Q7({agent:e,tick:t}){const[n,i]=S.useState(!1),l=e.status!=="running",c=!!e.summary,u=a.jsxs(a.Fragment,{children:[a.jsx(Y7,{status:e.status}),a.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&a.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:I7(e.startedAt,e.completedAt)})]});return a.jsxs("div",{className:`transition-opacity duration-300 ${l?"opacity-60":""}`,children:[c?a.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):a.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&a.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function W7({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&a.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function J7({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),l=S.useRef(null),c=W(N=>N.sessionTasks.get(e)??q7),u=W(N=>N.sessionBackgroundAgents.get(e)??H7),f=V7(c,u),h=u.some(N=>N.status==="running"),p=G7(h),g=u.filter(N=>N.status==="running").length,v=c.length,y=c.filter(N=>N.status==="completed").length,b=c.filter(N=>N.status==="in_progress").length,_=c.length>0||u.length>0,k=g>0||b>0,E=S.useCallback(()=>n(!1),[]);S.useEffect(()=>{if(!t)return;const N=D=>{D.key==="Escape"&&(D.stopPropagation(),E())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t,E]),S.useEffect(()=>{if(!t)return;const N=D=>{i.current&&!i.current.contains(D.target)&&E()};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[t,E]),S.useEffect(()=>{t&&l.current&&l.current.focus()},[t]);const[j,T]=S.useState(!1);return S.useEffect(()=>{_&&T(!1)},[_,c.length,u.length]),!_||j?null:a.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&T(!0)},children:[t&&a.jsxs("div",{ref:l,id:C5,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),a.jsx("button",{type:"button",onClick:E,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(N=>a.jsx(Q7,{agent:N,tick:p},N.toolUseId))]}),u.length>0&&c.length>0&&a.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),c.map(N=>a.jsx(W7,{task:N},N.id))]})]}),a.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":C5,className:`
99
99
  flex items-center gap-2 px-3 min-h-[36px] rounded-full
100
100
  border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
@@ -102,15 +102,15 @@ Error generating stack: `+d.message+`
102
102
  hover:bg-cc-hover/80 hover:border-cc-border/70
103
103
  transition-all duration-200 cursor-pointer
104
104
  ${t?"ring-1 ring-cc-primary/30":""}
105
- `,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[k?a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&a.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function X7({sessionId:e}){const t=W(_=>_.pendingPermissions.get(e)),n=W(_=>_.aiResolvedPermissions.get(e)),i=W(_=>_.clearAiResolvedPermissions),l=W(_=>_.connectionStatus.get(e)??"disconnected"),c=W(_=>_.cliConnected.get(e)??!1),u=W(_=>_.cliReconnecting.get(e)??!1),f=W(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const v=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await we.relaunchSession(e)}catch(_){Rs(_),f(e,!1);const k=_ instanceof Error?_.message:"Reconnection failed";p(k),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=S.useMemo(()=>t?Array.from(t.values()):[],[t]),b=l==="connected"&&!c;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&a.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),a.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),l==="disconnected"&&a.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a.jsx(w7,{sessionId:e}),a.jsx(J7,{sessionId:e})]}),n&&n.length>0&&a.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:a.jsx(F7,{entry:n[n.length-1],onDismiss:()=>i(e)})}),y.length>0&&a.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>a.jsx(T7,{permission:_,sessionId:e},_.request_id))}),a.jsx(C7,{sessionId:e})]})}function Z7({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),l=W(p=>p.sessions.get(e)),c=(l==null?void 0:l.aiValidationEnabled)??!1,u=(l==null?void 0:l.aiValidationAutoApprove)??!0,f=(l==null?void 0:l.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};W.getState().setSessionAiValidation(e,y),ON(e,y)}return a.jsxs("div",{ref:i,className:"relative",children:[a.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[a.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[a.jsx("span",{className:"text-xs",children:"Enabled"}),a.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),a.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),a.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function K7({sessionId:e}){const[t,n]=S.useState(!1),[i,l]=S.useState(null),[c,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const h=S.useCallback(async p=>{l(p),u(!1);try{const{blob:g,filename:v}=await we.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){Rs(g),u(!0)}finally{l(null)}},[e]);return a.jsxs("div",{ref:f,className:"relative",children:[a.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&a.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[a.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),a.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),a.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&a.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function eR(){var H;const e=S.useSyncExternalStore(U=>(window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)),()=>window.location.hash),t=S.useMemo(()=>Hg(e),[e]),n=t.page==="session"||t.page==="home",i=W(U=>U.currentSessionId),l=W(U=>U.cliConnected),c=W(U=>U.sessionStatus),u=W(U=>U.sessionNames),f=W(U=>U.sdkSessions),h=W(U=>U.sidebarOpen),p=W(U=>U.setSidebarOpen),g=W(U=>U.taskPanelOpen),v=W(U=>U.setTaskPanelOpen),y=W(U=>U.activeTab),b=W(U=>U.setActiveTab),_=W(U=>U.markChatTabReentry),k=W(U=>i?U.gitChangedFilesCount.get(i)??0:0),E=i?c.get(i)??null:null,j=i?l.get(i)??!1:!1,T=i?(u==null?void 0:u.get(i))||((H=f.find(U=>U.sessionId===i))==null?void 0:H.name)||`Session ${i.slice(0,8)}`:null,N=!!(i&&n),D=t.page==="session"&&!!i,z=["chat","diff"],L=U=>{U==="chat"&&y!=="chat"&&i&&_(i),b(U)};return S.useEffect(()=>{const U=V=>{if(!(V.metaKey||V.ctrlKey)||V.key.toLowerCase()!=="j"||!N)return;const O=V.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;V.preventDefault();const F=Math.max(0,z.indexOf(y)),A=V.shiftKey?-1:1,ae=(F+A+z.length)%z.length;L(z[ae])};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[N,z,y,b,_,i]),a.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:a.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[a.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),N&&a.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[a.jsxs("button",{onClick:()=>L("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:T||"Session","aria-label":"Session tab",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${j?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),a.jsxs("button",{onClick:()=>L("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",k>0&&a.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:k})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[N&&i&&a.jsx(Z7,{sessionId:i}),N&&i&&a.jsx(K7,{sessionId:i}),a.jsx(tR,{}),D&&a.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function tR(){const e=W(n=>n.darkMode),t=S.useCallback(()=>W.getState().toggleDarkMode(),[]);return a.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:a.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const U2="cc-recent-dirs";function Jd(){try{return JSON.parse(localStorage.getItem(U2)||"[]")}catch{return[]}}function F2(e){const t=Jd().filter(n=>n!==e);t.unshift(e),localStorage.setItem(U2,JSON.stringify(t.slice(0,5)))}function nR(){return!1}function q2({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[l,c]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,v]=S.useState([]),[y,b]=S.useState(""),[_,k]=S.useState(!1),[E,j]=S.useState(""),[T,N]=S.useState([{key:"",value:""}]),[D,z]=S.useState(!1),L=S.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);S.useEffect(()=>{L()},[L]);function H(I){f(I.slug),p(I.name);const $=Object.entries(I.variables).map(([P,ie])=>({key:P,value:ie}));$.length===0&&$.push({key:"",value:""}),v($),b("")}function U(){f(null),b("")}async function V(){if(!u)return;const I={};for(const $ of g){const P=$.key.trim();P&&(I[P]=$.value)}try{await we.updateEnv(u,{name:h.trim()||void 0,variables:I}),f(null),b(""),L()}catch($){b($ instanceof Error?$.message:String($))}}async function O(I){try{await we.deleteEnv(I),u===I&&f(null),L()}catch($){b($ instanceof Error?$.message:String($))}}async function F(){const I=E.trim();if(!I)return;z(!0);const $={};for(const P of T){const ie=P.key.trim();ie&&($[ie]=P.value)}try{await we.createEnv(I,$),j(""),N([{key:"",value:""}]),k(!1),b(""),L()}catch(P){b(P instanceof Error?P.message:String(P))}finally{z(!1)}}if(t)return a.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),a.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:()=>k(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?a.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):a.jsx("path",{d:"M12 5v14M5 12h14"})}),a.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&a.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:E,onChange:I=>j(I.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:I=>{I.key==="Enter"&&E.trim()&&F()}}),a.jsx(ud,{rows:T,onChange:N}),y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",a.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:a.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),l?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):a.jsx("div",{className:"space-y-1",children:n.map(I=>{const $=u===I.slug,P=Object.keys(I.variables).length;return $?a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:h,onChange:ie=>p(ie.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ud,{rows:g,onChange:v})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:U,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:()=>void V(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},I.slug):a.jsx(rR,{env:I,varCount:P,onStartEdit:()=>H(I),onDelete:()=>void O(I.slug)},I.slug)})}),y&&!_&&a.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const A=a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),a.jsx("input",{type:"text",value:E,onChange:I=>j(I.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:I=>{I.key==="Enter"&&E.trim()&&F()}}),a.jsx(ud,{rows:T,onChange:N}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]}),ae=l?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):a.jsx("div",{className:"space-y-3",children:n.map(I=>a.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:I.name}),a.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(I.variables).length," var",Object.keys(I.variables).length!==1?"s":""]}),u===I.slug?a.jsx("button",{onClick:U,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>H(I),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),a.jsx("button",{onClick:()=>O(I.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===I.slug&&a.jsxs("div",{className:"px-3 py-3 space-y-2",children:[a.jsx("input",{type:"text",value:h,onChange:$=>p($.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ud,{rows:g,onChange:v})]})}),a.jsx("button",{onClick:V,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==I.slug&&Object.keys(I.variables).length>0&&a.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(I.variables).map(([$,P])=>a.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[a.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:$}),a.jsx("span",{className:"text-cc-muted",children:"="}),a.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:P})]},$))})]},I.slug))}),X=a.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&a.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),ae,A]})]});return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:X}),document.body)}function rR({env:e,varCount:t,onStartEdit:n,onDelete:i}){return a.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[a.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),a.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),a.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),a.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function ud({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function i(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function l(){t([...e,{key:"",value:""}])}return a.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),a.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),a.jsx("button",{onClick:l,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const iR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:q2},Symbol.toStringTag,{value:"Module"}));function sR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const l of t)i+="/"+l,n.push({label:l,path:i});return n}function aR({initialPath:e,onSelect:t,onClose:n}){const[i,l]=S.useState(""),[c,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[v,y]=S.useState(""),[b,_]=S.useState(!1),[k,E]=S.useState(""),[j,T]=S.useState(-1),[N,D]=S.useState(!1),[z,L]=S.useState(()=>Jd()),H=S.useRef(null),U=S.useRef(null),V=S.useRef(null),O=S.useRef(new Map),F=S.useMemo(()=>{if(!k)return c;const P=k.toLowerCase();return c.filter(ie=>ie.name.toLowerCase().includes(P))},[c,k]),A=S.useCallback(async P=>{h(!0),g(""),E(""),T(-1);try{const ie=await we.listDirs(P);l(ie.path),u(ie.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{A(e||void 0)},[]),S.useEffect(()=>{const P=H.current;if(!P)return;function ie(R){if(R.key!=="Tab")return;const B=P.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const Z=B[0],M=B[B.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",ie);const me=setTimeout(()=>{var R;(R=V.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",ie),clearTimeout(me)}},[]);const ae=S.useCallback(()=>{N||(D(!0),setTimeout(n,150))},[n,N]);S.useEffect(()=>{function P(ie){if(ie.key==="Escape"){if(b)return;ae()}}return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[b,ae]),S.useEffect(()=>{function P(ie){var R,B;if(b)return;if(ie.key==="Backspace"&&document.activeElement!==V.current){if(i&&i!=="/"){ie.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";A(Z)}return}const me=F.length;if(me!==0){if(ie.key==="ArrowDown"){ie.preventDefault();const Z=j<me-1?j+1:0;T(Z),(R=O.current.get(Z))==null||R.focus()}else if(ie.key==="ArrowUp"){ie.preventDefault();const Z=j>0?j-1:me-1;T(Z),(B=O.current.get(Z))==null||B.focus()}}}return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[b,F.length,j,i,A]),S.useEffect(()=>{var P;j>=0&&((P=O.current.get(j))==null||P.scrollIntoView({block:"nearest"}))},[j]);function X(P){F2(P),L(Jd()),t(P),n()}const I=sR(i),$=i.split("/").pop()||"/";return Al.createPortal(a.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${N?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:ae,children:a.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${N?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:P=>P.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:ae,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),z.length>0&&a.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[a.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),a.jsx("ul",{className:"list-none m-0 p-0",children:z.map(P=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>X(P),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[a.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),a.jsx("span",{className:"font-medium truncate",children:P.split("/").pop()||P}),a.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:P})]})},P))})]}),a.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?a.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:P=>y(P.target.value),onKeyDown:P=>{P.key==="Enter"&&v.trim()&&X(v.trim()),P.key==="Escape"&&(P.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:I.map((P,ie)=>{const me=ie===I.length-1;return a.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[ie>0&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("button",{type:"button",onClick:()=>{me||A(P.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:P.label})]},P.path)})}),a.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:a.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),a.jsx("input",{ref:V,type:"text","aria-label":"Filter directories",value:k,onChange:P=>{E(P.target.value),T(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),a.jsxs("button",{type:"button",onClick:()=>X(i),"aria-label":`Select ${$}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),a.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),a.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:$})]})]}),a.jsx("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?a.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((P,ie)=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),a.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+ie*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${ie*.1}s infinite`}})]},ie))}):p?a.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsx("p",{className:"text-xs text-cc-muted",children:p}),a.jsx("button",{type:"button",onClick:()=>A(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):F.length===0?a.jsxs("div",{className:"px-4 py-8 text-center",children:[a.jsx("p",{className:"text-xs text-cc-muted",children:k?"No matching directories":"No subdirectories"}),k&&a.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):a.jsx("ul",{className:"list-none m-0 p-0",children:F.map((P,ie)=>a.jsxs("li",{className:`flex items-center transition-colors ${j===ie?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[a.jsxs("button",{type:"button",ref:me=>{me?O.current.set(ie,me):O.current.delete(ie)},onClick:()=>A(P.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),X(P.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:P.path,"aria-label":`Navigate into ${P.name}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"truncate",children:P.name}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:a.jsx("path",{d:"M6 4l4 4-4 4"})})]}),a.jsx("button",{type:"button",onClick:()=>X(P.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${P.name}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},P.path))})}),a.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),a.jsxs("span",{className:"ml-auto",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function lR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function oR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():lR(e.identifier,e.title)}function ac({className:e}){return a.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[a.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),a.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),a.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),a.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function cR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[l,c]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(0),[y,b]=S.useState(!0),[_,k]=S.useState([]),[E,j]=S.useState(""),[T,N]=S.useState(""),[D,z]=S.useState(!0),[L,H]=S.useState(!1),[U,V]=S.useState("");S.useEffect(()=>{let F=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([A,ae])=>{var I;if(!F)return;k(A.teams),j(ae.viewerId);const X=((I=A.teams[0])==null?void 0:I.id)||"";p(X)}).catch(A=>{F&&V(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{F&&z(!1)}),()=>{F=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){N("");return}const F=_.find(ae=>ae.id===h),A=F==null?void 0:F.states.find(ae=>ae.type==="backlog");N((A==null?void 0:A.id)||"")},[h,_]);async function O(){if(!(!l.trim()||!h)){H(!0),V("");try{const F=await we.createLinearIssue({title:l.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:T||void 0,connectionId:t});n(F.issue)}catch(F){V(F instanceof Error?F.message:"Failed to create issue")}finally{H(!1)}}}return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:a.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),a.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),U&&a.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:U}),D?a.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),a.jsx("input",{id:"create-issue-title",type:"text",value:l,onChange:F=>c(F.target.value),onKeyDown:F=>{F.key==="Enter"&&l.trim()&&h&&!L&&O()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),a.jsx("textarea",{id:"create-issue-desc",value:u,onChange:F=>f(F.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),a.jsx("select",{id:"create-issue-team",value:h,onChange:F=>p(F.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(F=>a.jsxs("option",{value:F.id,children:[F.name," (",F.key,")"]},F.id))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),a.jsxs("select",{id:"create-issue-priority",value:g,onChange:F=>v(Number(F.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[a.jsx("option",{value:0,children:"No priority"}),a.jsx("option",{value:1,children:"Urgent"}),a.jsx("option",{value:2,children:"High"}),a.jsx("option",{value:3,children:"Medium"}),a.jsx("option",{value:4,children:"Low"})]})]}),a.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:F=>b(F.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),a.jsxs("div",{className:"flex gap-2.5 pt-2",children:[a.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:O,disabled:!l.trim()||!h||L,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function uR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:l,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[b,_]=S.useState(""),[k,E]=S.useState([]),[j,T]=S.useState(!1),[N,D]=S.useState(!1),[z,L]=S.useState(""),[H,U]=S.useState(!1),[V,O]=S.useState(null),[F,A]=S.useState([]),[ae,X]=S.useState(!1),[I,$]=S.useState(""),[P,ie]=S.useState(!1),[me,R]=S.useState([]),[B,Z]=S.useState(!1),[M,pe]=S.useState(""),[_e,Ce]=S.useState(!1),[Te,Le]=S.useState([]),[Pe,rt]=S.useState(!1),[be,ze]=S.useState(!1),gt=S.useRef(null);S.useEffect(()=>{function ke(Oe){gt.current&&!gt.current.contains(Oe.target)&&(T(!1),ie(!1))}return document.addEventListener("pointerdown",ke),()=>document.removeEventListener("pointerdown",ke)},[]),S.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let ke=!0;return we.listLinearConnections().then(({connections:Oe})=>{ke&&(h(Oe),y(!0),Oe.length>0?(g(Oe[0].id),u(Oe[0].id)):(g(null),u(null)))}).catch(()=>{ke&&y(!0)}),()=>{ke=!1}},[n]);const Ut=S.useCallback(ke=>{g(ke),u(ke),l(null),E([]),_(""),L(""),Le([]),pe(""),R([]),V&&(X(!0),$(""),we.getLinearProjectIssues(V.projectId,10,ke).then(({issues:Oe})=>{A(Oe)}).catch(Oe=>{$(Oe instanceof Error?Oe.message:String(Oe))}).finally(()=>{X(!1)}))},[V,u,l]);S.useEffect(()=>{if(!t||!n){O(null),A([]);return}let ke=!0;return X(!0),$(""),(async()=>{try{const{mapping:Oe}=await we.getLinearProjectMapping(t.repoRoot);if(!ke)return;if(O(Oe),Oe){const{issues:st}=await we.getLinearProjectIssues(Oe.projectId,10,p??void 0);if(!ke)return;A(st)}else A([])}catch(Oe){if(!ke)return;$(Oe instanceof Error?Oe.message:String(Oe))}finally{ke&&X(!1)}})(),()=>{ke=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const ke=b.trim();if(ke.length<2){E([]),L(""),D(!1);return}let Oe=!0;D(!0),L("");const st=setTimeout(()=>{we.searchLinearIssues(ke,8,p??void 0).then(qe=>{Oe&&E(qe.issues)}).catch(qe=>{Oe&&(E([]),L(qe instanceof Error?qe.message:String(qe)))}).finally(()=>{Oe&&D(!1)})},400);return()=>{Oe=!1,clearTimeout(st)}},[n,b,p]),S.useEffect(()=>{if(!n||!_e){Le([]),rt(!1);return}const ke=M.trim();if(ke.length<2){Le([]),rt(!1);return}let Oe=!0;rt(!0);const st=setTimeout(()=>{we.searchLinearIssues(ke,10,p??void 0).then(qe=>{Oe&&Le(qe.issues)}).catch(()=>{Oe&&Le([])}).finally(()=>{Oe&&rt(!1)})},400);return()=>{Oe=!1,clearTimeout(st)}},[n,_e,M,p]);function Dt(ke,Oe=!1){l(ke),_(`${ke.identifier} - ${ke.title}`);const st=oR(ke);c(st,!0),Oe&&T(!1)}function kt(){l(null),_(""),E([]),L("")}async function fn(ke){if(t)try{const{mapping:Oe}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ke.id,projectName:ke.name});O(Oe),ie(!1),X(!0),$("");const{issues:st}=await we.getLinearProjectIssues(ke.id,10,p??void 0);A(st)}catch(Oe){$(Oe instanceof Error?Oe.message:String(Oe))}finally{X(!1)}}async function it(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),A([]),l(null),_("")}}function xn(){if(!n){window.location.hash="#/integrations/linear";return}ie(!0),me.length===0&&(Z(!0),we.listLinearProjects(p??void 0).then(({projects:ke})=>R(ke)).catch(()=>{}).finally(()=>Z(!1)))}function hn(ke){ze(!1),Dt(ke),V&&(X(!0),we.getLinearProjectIssues(V.projectId,10,p??void 0).then(({issues:Oe})=>A(Oe)).catch(()=>{}).finally(()=>X(!1)))}return n?a.jsxs("aside",{className:"space-y-2 mt-0.5",ref:gt,children:[a.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&a.jsx("select",{value:p??"",onChange:ke=>Ut(ke.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(ke=>a.jsx("option",{value:ke.id,children:ke.workspaceName||ke.name},ke.id))}),V?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[a.jsx(ac,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:V.projectName}),a.jsx("button",{type:"button",onClick:it,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsxs("button",{type:"button",onClick:()=>ze(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","aria-expanded":j,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}T(!j)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[a.jsx(ac,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Linear"})]}),n&&t&&a.jsxs("button",{type:"button",onClick:xn,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Attach project"})]}),n&&a.jsxs("button",{type:"button",onClick:()=>ze(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]}),!n&&a.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),V&&(()=>{const ke=M.trim().toLowerCase(),Oe=!_e&&ke?F.filter(qe=>qe.identifier.toLowerCase().includes(ke)||qe.title.toLowerCase().includes(ke)):_e?[]:F,st=_e?Te:Oe;return a.jsxs("div",{className:"mt-2",children:[i&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[a.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),a.jsx("button",{type:"button",onClick:kt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsx("input",{type:"text",value:M,onChange:qe=>pe(qe.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),ae?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):I?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:I}):Pe?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&ke.length<2?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):st.length===0?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ke?"No matching issues":"No active issues found"}):a.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:st.map(qe=>a.jsxs("button",{type:"button",onClick:()=>Dt(qe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===qe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:qe.identifier})," ",qe.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[qe.stateName,qe.priorityLabel].filter(Boolean).join(" - ")})]},qe.id))}),a.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:qe=>{Ce(qe.target.checked),qe.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),P&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsx("div",{className:"p-2 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),a.jsx("button",{type:"button",onClick:()=>ie(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),B?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):a.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(ke=>a.jsx("button",{type:"button",onClick:()=>fn(ke),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("div",{className:"text-xs text-cc-fg",children:ke.name})},ke.id))})]}),j&&n&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsxs("div",{className:"p-2 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:b,onChange:ke=>{_(ke.target.value)},onFocus:()=>T(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),a.jsx("button",{type:"button",onClick:()=>{T(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[a.jsx("span",{children:"Attach an issue to this draft"}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&N&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!N&&z&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:z}),b.trim().length>=2&&!N&&!z&&k.length===0&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!N&&!z&&a.jsx("div",{className:"max-h-56 overflow-y-auto",children:k.map(ke=>a.jsxs("button",{type:"button",onClick:()=>Dt(ke,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:ke.identifier})," - ",ke.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ke.stateName,ke.teamName].filter(Boolean).join(" • ")})]},ke.id))})]}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),H&&a.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),a.jsx("div",{className:"flex gap-2 mt-2.5",children:a.jsx("button",{type:"button",onClick:()=>{U(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),be&&a.jsx(cR,{defaultProjectId:V==null?void 0:V.projectId,connectionId:p??void 0,onCreated:hn,onClose:()=>ze(!1)})]}):null}function dR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:l,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,v]=S.useState(!1),[y,b]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function k(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[]),S.useEffect(()=>{t?we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:_,children:[a.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),a.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[a.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:a.jsx("input",{type:"text",value:y,onChange:k=>b(k.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:k=>{k.key==="Escape"&&v(!1)}})}),a.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const k=y.toLowerCase().trim(),E=h.filter(D=>!D.isRemote&&(!k||D.name.toLowerCase().includes(k))),j=h.filter(D=>D.isRemote&&(!k||D.name.toLowerCase().includes(k))),T=h.some(D=>D.name.toLowerCase()===k),N=E.length>0||j.length>0;return a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[D.ahead>0&&a.jsxs("span",{className:"text-[9px] text-green-500",children:[D.ahead,"↑"]}),D.behind>0&&a.jsxs("span",{className:"text-[9px] text-amber-500",children:[D.behind,"↓"]}),D.worktreePath&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),D.isCurrent&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},D.name))]}),j.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),j.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${D.name}`))]}),!N&&k&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),k&&!T&&a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),a.jsxs("span",{children:["Create ",a.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),a.jsxs("button",{onClick:()=>u(!l),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${l?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),a.jsx("span",{children:"Worktree"})]})]}):null}const fR=336*60*60*1e3,la=12,hR=24;function _g(e){return e.split("/").filter(Boolean).pop()||e}function E5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||_g(e.cwd)}function pR(e){return e.length>8?e.slice(0,8):e}function mR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function gR(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const l=Math.floor(i/24);if(l<14)return`${l}d ago`;const c=Math.floor(l/7);if(c<8)return`${c}w ago`;const u=Math.floor(l/30);return`${Math.max(1,u)}mo ago`}function xR(){var mi;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,l]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=S.useState([]),[b,_]=S.useState(()=>_5(localStorage.getItem("cc-backend")||"claude")),[k,E]=S.useState(()=>w5(localStorage.getItem("cc-backend")||"claude")),[j,T]=S.useState(()=>Jd()[0]||""),[N,D]=S.useState([]),[z,L]=S.useState(null),[H,U]=S.useState(!1),[V,O]=S.useState(""),[F,A]=S.useState(null),[ae,X]=S.useState(!1),[I,$]=S.useState(null),[P,ie]=S.useState(null),[me,R]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),B=F||O2(p),Z=y5(p),[M,pe]=S.useState([]),[_e,Ce]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Te,Le]=S.useState(!1),[Pe,rt]=S.useState(!1),be=nR(),[ze,gt]=S.useState(()=>be),[Ut,Dt]=S.useState([]),[kt,fn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[it,xn]=S.useState(!1),hn=S.useRef(null),[ke,Oe]=S.useState(null),st=S.useRef(null),qe=S.useRef(null),[hr,le]=S.useState(!1),[xe,Q]=S.useState(!1),[fe,Ae]=S.useState(!1),[Ve,tt]=S.useState(!1),[nt,xt]=S.useState(""),[nn,ut]=S.useState(!0),[vn,Sn]=S.useState([]),[Fr,Mr]=S.useState(!1),[Rr,ne]=S.useState(""),[he,ge]=S.useState(!1),[Ye,_t]=S.useState(la),[rn,pr]=S.useState(""),[mt,qn]=S.useState(null),[zs,Ll]=S.useState(!1),[ba,qr]=S.useState(""),[ya,ci]=S.useState(!1),[Ec,Hr]=S.useState([]),[Vt,pn]=S.useState(null),[Lr,Yi]=S.useState(!1),[Tc,ui]=S.useState(""),[Ac,di]=S.useState(0),Qi=S.useRef(null),bn=S.useRef(null),Ir=S.useRef(null),fi=S.useRef(null),Vr=S.useRef(null),Zt=W(Y=>Y.currentSessionId),Gt=P2({text:e,caretPos:Ac,cwd:j||void 0});S.useEffect(()=>{if(Qi.current===null||!bn.current)return;const Y=Qi.current;bn.current.setSelectionRange(Y,Y),Qi.current=null},[e]),S.useEffect(()=>{var de;window.matchMedia("(min-width: 640px)").matches&&((de=bn.current)==null||de.focus())},[]),S.useEffect(()=>{we.getHome().then(({home:Y,cwd:de})=>{j||T(de||Y)}).catch(()=>{}),we.listEnvs().then(pe).catch(()=>{}),we.listSandboxes().then(Dt).catch(()=>{}),we.getBackends().then(y).catch(()=>{}),we.getSettings().then(Y=>{X(Y.linearApiKeyConfigured)}).catch(()=>{})},[]);function Mc(Y){g(Y),localStorage.setItem("cc-backend",Y),A(null),_(_5(Y)),E(w5(Y)),Y!=="claude"&&(tt(!1),Sn([]),ne(""),Mr(!1),ge(!1),_t(la),pr(""))}S.useEffect(()=>{if(p!=="codex"){A(null);return}we.getBackendModels(p).then(Y=>{if(Y.length>0){const de=j7(Y);A(de),de.some(Xe=>Xe.value===b)||_(de[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(st.current&&(clearInterval(st.current),st.current=null),Oe(null),!ze)return;const Y="the-companion:latest",de=()=>{we.getImageStatus(Y).then(Xe=>{Oe(Xe),Xe.status==="idle"&&we.pullImage(Y).catch(()=>{}),(Xe.status==="ready"||Xe.status==="error")&&st.current&&(clearInterval(st.current),st.current=null)}).catch(()=>{})};return de(),st.current=setInterval(de,2e3),()=>{st.current&&(clearInterval(st.current),st.current=null)}},[ze]),S.useEffect(()=>{function Y(de){Ir.current&&!Ir.current.contains(de.target)&&le(!1),fi.current&&!fi.current.contains(de.target)&&Q(!1),Vr.current&&!Vr.current.contains(de.target)&&Le(!1),hn.current&&!hn.current.contains(de.target)&&xn(!1)}return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[]),S.useEffect(()=>{if(!j){qn(null);return}we.getRepoInfo(j).then(Y=>{qn(Y),qr(Y.currentBranch),ci(!1)}).catch(()=>{qn(null),qr(""),ci(!1)})},[j]);const Gr=B.find(Y=>Y.value===b)||B[0],Wi=Z.find(Y=>Y.value===k)||Z[0],lf=p==="codex"?"/logo-codex.svg":"/logo.svg",Rc=j?j.split("/").pop()||j:"Select folder",_a=S.useMemo(()=>nt.trim(),[nt]),Lc=p==="claude"&&Ve&&_a.length>0,mr=S.useMemo(()=>{const Y=Date.now()-fR;return vn.filter(de=>de.createdAt>=Y)},[vn]),Ji=S.useMemo(()=>he?vn:mr.length>0?mr:vn,[he,mr,vn]),sn=S.useMemo(()=>rn.trim().toLowerCase(),[rn]),Kt=S.useMemo(()=>sn?Ji.filter(Y=>{const de=E5(Y).toLowerCase(),Xe=_g(Y.cwd).toLowerCase(),at=(Y.gitBranch||"").toLowerCase(),We=Y.cwd.toLowerCase(),He=Y.resumeSessionId.toLowerCase();return de.includes(sn)||Xe.includes(sn)||at.includes(sn)||We.includes(sn)||He.includes(sn)}):Ji,[Ji,sn]),wa=S.useMemo(()=>Kt.slice(0,Ye),[Kt,Ye]),of=Ye<Kt.length,Sa=Math.max(0,vn.length-mr.length),Dc=!he&&mr.length>0,Xi=S.useCallback(async()=>{if(p==="claude"){Mr(!0),ne("");try{const[Y,de]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(He=>He.sessions)]),Xe=new Map,at=He=>{const yn=Xe.get(He.resumeSessionId);(!yn||He.createdAt>yn.createdAt)&&Xe.set(He.resumeSessionId,He)};for(const He of Y)He.backendType!=="codex"&&He.cliSessionId&&at({resumeSessionId:He.cliSessionId,sessionId:He.sessionId,name:He.name,model:He.model,createdAt:He.createdAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"companion"});for(const He of de)at({resumeSessionId:He.sessionId,sessionId:He.sessionId,slug:He.slug,createdAt:He.lastActivityAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"claude_disk"});const We=Array.from(Xe.values()).sort((He,yn)=>{const er=j&&He.cwd===j?0:1,Ki=j&&yn.cwd===j?0:1;return er!==Ki?er-Ki:yn.createdAt-He.createdAt});Sn(We),ge(!1),_t(la)}catch(Y){const de=Y instanceof Error?Y.message:String(Y);ne(de||"Failed to load existing sessions"),Sn([]),_t(la)}finally{Mr(!1)}}},[p,j]);S.useEffect(()=>{p==="claude"&&Ve&&Xi()},[p,Ve,Xi]),S.useEffect(()=>{_t(la)},[sn,he]);async function zc(Y){if(Y.length===0)return;const de=[],Xe=[];let at=N.reduce((We,He)=>We+He.size,0);for(const We of Y){if(We.size>Qd){Xe.push(`${We.name} is too large (${Ts(We.size)}, max ${Ts(Qd)})`);continue}if(at+We.size>Wd){Xe.push(`${We.name} would exceed the per-message limit (${Ts(Wd)})`);continue}const{base64:He,mediaType:yn}=await k2(We);de.push({name:We.name,base64:He,mediaType:yn,size:We.size}),at+=We.size}de.length>0&&D(We=>[...We,...de]),L(Xe.length>0?Xe.join("; "):null)}async function Hn(Y){const de=Y.target.files;de&&(await zc(Array.from(de)),Y.target.value="")}function Dl(Y){D(de=>de.filter((Xe,at)=>at!==Y))}async function Oc(Y){var at;const de=(at=Y.clipboardData)==null?void 0:at.items;if(!de)return;const Xe=[];for(const We of Array.from(de)){if(We.kind!=="file")continue;const He=We.getAsFile();if(!He)continue;const yn=He.name&&He.name.length>0?He.name:`pasted-${Date.now()}.${(He.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Xe.push(new File([He],yn,{type:He.type,lastModified:He.lastModified}))}Xe.length>0&&(Y.preventDefault(),await zc(Xe))}function zl(Y){t(Y.target.value),di(Y.target.selectionStart??Y.target.value.length);const de=Y.target;de.style.height="auto",de.style.height=Math.min(de.scrollHeight,200)+"px"}function hi(){bn.current&&di(bn.current.selectionStart??0)}function Ol(Y){var Xe;const de=Gt.selectPrompt(Y);Qi.current=de.nextCursor,t(de.nextText),Gt.setMentionMenuOpen(!1),di(de.nextCursor),(Xe=bn.current)==null||Xe.focus(),bn.current&&(bn.current.style.height="auto",bn.current.style.height=Math.min(bn.current.scrollHeight,200)+"px")}function Bc(Y){if(Gt.mentionMenuOpen&&Y.key==="Escape"){Y.preventDefault(),Gt.setMentionMenuOpen(!1);return}if(Gt.mentionMenuOpen&&Gt.filteredPrompts.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),Gt.setMentionMenuIndex(de=>(de+1)%Gt.filteredPrompts.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),Gt.setMentionMenuIndex(de=>(de-1+Gt.filteredPrompts.length)%Gt.filteredPrompts.length);return}if(Y.key==="Tab"&&!Y.shiftKey||Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),Ol(Gt.filteredPrompts[Gt.mentionMenuIndex]);return}}if(Gt.mentionMenuOpen&&Gt.filteredPrompts.length===0&&(Y.key==="Enter"&&!Y.shiftKey||Y.key==="Tab"&&!Y.shiftKey)){Y.preventDefault();return}if(Y.key==="Tab"&&Y.shiftKey){Y.preventDefault();const de=y5(p),at=(de.findIndex(We=>We.value===k)+1)%de.length;E(de[at].value);return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Pc())}function Zi(Y){const de=i.trim(),Xe=de?`[${de}]: ${Y}`:Y;if(!I)return Xe;const at=(I.description??"").trim();return`${["Linear issue context:",`- Identifier: ${I.identifier}`,`- Title: ${I.title}`,I.stateName?`- State: ${I.stateName}`:"",I.priorityLabel?`- Priority: ${I.priorityLabel}`:"",I.teamName?`- Team: ${I.teamName}`:"",`- URL: ${I.url}`,at?`- Description:
105
+ `,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[k?a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&a.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function X7({sessionId:e}){const t=W(_=>_.pendingPermissions.get(e)),n=W(_=>_.aiResolvedPermissions.get(e)),i=W(_=>_.clearAiResolvedPermissions),l=W(_=>_.connectionStatus.get(e)??"disconnected"),c=W(_=>_.cliConnected.get(e)??!1),u=W(_=>_.cliReconnecting.get(e)??!1),f=W(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const v=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await we.relaunchSession(e)}catch(_){Rs(_),f(e,!1);const k=_ instanceof Error?_.message:"Reconnection failed";p(k),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=S.useMemo(()=>t?Array.from(t.values()):[],[t]),b=l==="connected"&&!c;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&a.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),a.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),l==="disconnected"&&a.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a.jsx(w7,{sessionId:e}),a.jsx(J7,{sessionId:e})]}),n&&n.length>0&&a.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:a.jsx(F7,{entry:n[n.length-1],onDismiss:()=>i(e)})}),y.length>0&&a.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>a.jsx(T7,{permission:_,sessionId:e},_.request_id))}),a.jsx(C7,{sessionId:e})]})}function Z7({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),l=W(p=>p.sessions.get(e)),c=(l==null?void 0:l.aiValidationEnabled)??!1,u=(l==null?void 0:l.aiValidationAutoApprove)??!0,f=(l==null?void 0:l.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};W.getState().setSessionAiValidation(e,y),ON(e,y)}return a.jsxs("div",{ref:i,className:"relative",children:[a.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[a.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[a.jsx("span",{className:"text-xs",children:"Enabled"}),a.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),a.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),a.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function K7({sessionId:e}){const[t,n]=S.useState(!1),[i,l]=S.useState(null),[c,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const h=S.useCallback(async p=>{l(p),u(!1);try{const{blob:g,filename:v}=await we.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){Rs(g),u(!0)}finally{l(null)}},[e]);return a.jsxs("div",{ref:f,className:"relative",children:[a.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&a.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[a.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),a.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),a.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&a.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function eR(){var H;const e=S.useSyncExternalStore(U=>(window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)),()=>window.location.hash),t=S.useMemo(()=>Hg(e),[e]),n=t.page==="session"||t.page==="home",i=W(U=>U.currentSessionId),l=W(U=>U.cliConnected),c=W(U=>U.sessionStatus),u=W(U=>U.sessionNames),f=W(U=>U.sdkSessions),h=W(U=>U.sidebarOpen),p=W(U=>U.setSidebarOpen),g=W(U=>U.taskPanelOpen),v=W(U=>U.setTaskPanelOpen),y=W(U=>U.activeTab),b=W(U=>U.setActiveTab),_=W(U=>U.markChatTabReentry),k=W(U=>i?U.gitChangedFilesCount.get(i)??0:0),E=i?c.get(i)??null:null,j=i?l.get(i)??!1:!1,T=i?(u==null?void 0:u.get(i))||((H=f.find(U=>U.sessionId===i))==null?void 0:H.name)||`Session ${i.slice(0,8)}`:null,N=!!(i&&n),D=t.page==="session"&&!!i,z=["chat","diff"],L=U=>{U==="chat"&&y!=="chat"&&i&&_(i),b(U)};return S.useEffect(()=>{const U=V=>{if(!(V.metaKey||V.ctrlKey)||V.key.toLowerCase()!=="j"||!N)return;const O=V.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;V.preventDefault();const F=Math.max(0,z.indexOf(y)),A=V.shiftKey?-1:1,ae=(F+A+z.length)%z.length;L(z[ae])};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[N,z,y,b,_,i]),a.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:a.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[a.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),N&&a.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[a.jsxs("button",{onClick:()=>L("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:T||"Session","aria-label":"Session tab",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${j?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),a.jsxs("button",{onClick:()=>L("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",k>0&&a.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:k})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[N&&i&&a.jsx(Z7,{sessionId:i}),N&&i&&a.jsx(K7,{sessionId:i}),a.jsx(tR,{}),D&&a.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function tR(){const e=W(n=>n.darkMode),t=S.useCallback(()=>W.getState().toggleDarkMode(),[]);return a.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:a.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const U2="cc-recent-dirs";function Jd(){try{return JSON.parse(localStorage.getItem(U2)||"[]")}catch{return[]}}function F2(e){const t=Jd().filter(n=>n!==e);t.unshift(e),localStorage.setItem(U2,JSON.stringify(t.slice(0,5)))}function nR(){return!1}function q2({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[l,c]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,v]=S.useState([]),[y,b]=S.useState(""),[_,k]=S.useState(!1),[E,j]=S.useState(""),[T,N]=S.useState([{key:"",value:""}]),[D,z]=S.useState(!1),L=S.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);S.useEffect(()=>{L()},[L]);function H(I){f(I.slug),p(I.name);const $=Object.entries(I.variables).map(([P,ie])=>({key:P,value:ie}));$.length===0&&$.push({key:"",value:""}),v($),b("")}function U(){f(null),b("")}async function V(){if(!u)return;const I={};for(const $ of g){const P=$.key.trim();P&&(I[P]=$.value)}try{await we.updateEnv(u,{name:h.trim()||void 0,variables:I}),f(null),b(""),L()}catch($){b($ instanceof Error?$.message:String($))}}async function O(I){try{await we.deleteEnv(I),u===I&&f(null),L()}catch($){b($ instanceof Error?$.message:String($))}}async function F(){const I=E.trim();if(!I)return;z(!0);const $={};for(const P of T){const ie=P.key.trim();ie&&($[ie]=P.value)}try{await we.createEnv(I,$),j(""),N([{key:"",value:""}]),k(!1),b(""),L()}catch(P){b(P instanceof Error?P.message:String(P))}finally{z(!1)}}if(t)return a.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),a.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:()=>k(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?a.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):a.jsx("path",{d:"M12 5v14M5 12h14"})}),a.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&a.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:E,onChange:I=>j(I.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:I=>{I.key==="Enter"&&E.trim()&&F()}}),a.jsx(ud,{rows:T,onChange:N}),y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",a.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:a.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),l?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):a.jsx("div",{className:"space-y-1",children:n.map(I=>{const $=u===I.slug,P=Object.keys(I.variables).length;return $?a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:h,onChange:ie=>p(ie.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ud,{rows:g,onChange:v})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:U,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:()=>void V(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},I.slug):a.jsx(rR,{env:I,varCount:P,onStartEdit:()=>H(I),onDelete:()=>void O(I.slug)},I.slug)})}),y&&!_&&a.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const A=a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),a.jsx("input",{type:"text",value:E,onChange:I=>j(I.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:I=>{I.key==="Enter"&&E.trim()&&F()}}),a.jsx(ud,{rows:T,onChange:N}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]}),ae=l?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):a.jsx("div",{className:"space-y-3",children:n.map(I=>a.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:I.name}),a.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(I.variables).length," var",Object.keys(I.variables).length!==1?"s":""]}),u===I.slug?a.jsx("button",{onClick:U,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>H(I),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),a.jsx("button",{onClick:()=>O(I.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===I.slug&&a.jsxs("div",{className:"px-3 py-3 space-y-2",children:[a.jsx("input",{type:"text",value:h,onChange:$=>p($.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ud,{rows:g,onChange:v})]})}),a.jsx("button",{onClick:V,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==I.slug&&Object.keys(I.variables).length>0&&a.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(I.variables).map(([$,P])=>a.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[a.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:$}),a.jsx("span",{className:"text-cc-muted",children:"="}),a.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:P})]},$))})]},I.slug))}),X=a.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&a.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),ae,A]})]});return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:X}),document.body)}function rR({env:e,varCount:t,onStartEdit:n,onDelete:i}){return a.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[a.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),a.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),a.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),a.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function ud({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function i(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function l(){t([...e,{key:"",value:""}])}return a.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),a.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),a.jsx("button",{onClick:l,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const iR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:q2},Symbol.toStringTag,{value:"Module"}));function sR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const l of t)i+="/"+l,n.push({label:l,path:i});return n}function aR({initialPath:e,onSelect:t,onClose:n}){const[i,l]=S.useState(""),[c,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[v,y]=S.useState(""),[b,_]=S.useState(!1),[k,E]=S.useState(""),[j,T]=S.useState(-1),[N,D]=S.useState(!1),[z,L]=S.useState(()=>Jd()),H=S.useRef(null),U=S.useRef(null),V=S.useRef(null),O=S.useRef(new Map),F=S.useMemo(()=>{if(!k)return c;const P=k.toLowerCase();return c.filter(ie=>ie.name.toLowerCase().includes(P))},[c,k]),A=S.useCallback(async P=>{h(!0),g(""),E(""),T(-1);try{const ie=await we.listDirs(P);l(ie.path),u(ie.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{A(e||void 0)},[]),S.useEffect(()=>{const P=H.current;if(!P)return;function ie(R){if(R.key!=="Tab")return;const B=P.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const Z=B[0],M=B[B.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",ie);const me=setTimeout(()=>{var R;(R=V.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",ie),clearTimeout(me)}},[]);const ae=S.useCallback(()=>{N||(D(!0),setTimeout(n,150))},[n,N]);S.useEffect(()=>{function P(ie){if(ie.key==="Escape"){if(b)return;ae()}}return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[b,ae]),S.useEffect(()=>{function P(ie){var R,B;if(b)return;if(ie.key==="Backspace"&&document.activeElement!==V.current){if(i&&i!=="/"){ie.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";A(Z)}return}const me=F.length;if(me!==0){if(ie.key==="ArrowDown"){ie.preventDefault();const Z=j<me-1?j+1:0;T(Z),(R=O.current.get(Z))==null||R.focus()}else if(ie.key==="ArrowUp"){ie.preventDefault();const Z=j>0?j-1:me-1;T(Z),(B=O.current.get(Z))==null||B.focus()}}}return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[b,F.length,j,i,A]),S.useEffect(()=>{var P;j>=0&&((P=O.current.get(j))==null||P.scrollIntoView({block:"nearest"}))},[j]);function X(P){F2(P),L(Jd()),t(P),n()}const I=sR(i),$=i.split("/").pop()||"/";return Al.createPortal(a.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${N?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:ae,children:a.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${N?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:P=>P.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:ae,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),z.length>0&&a.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[a.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),a.jsx("ul",{className:"list-none m-0 p-0",children:z.map(P=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>X(P),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[a.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),a.jsx("span",{className:"font-medium truncate",children:P.split("/").pop()||P}),a.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:P})]})},P))})]}),a.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?a.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:P=>y(P.target.value),onKeyDown:P=>{P.key==="Enter"&&v.trim()&&X(v.trim()),P.key==="Escape"&&(P.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:I.map((P,ie)=>{const me=ie===I.length-1;return a.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[ie>0&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("button",{type:"button",onClick:()=>{me||A(P.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:P.label})]},P.path)})}),a.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:a.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),a.jsx("input",{ref:V,type:"text","aria-label":"Filter directories",value:k,onChange:P=>{E(P.target.value),T(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),a.jsxs("button",{type:"button",onClick:()=>X(i),"aria-label":`Select ${$}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),a.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),a.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:$})]})]}),a.jsx("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?a.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((P,ie)=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),a.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+ie*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${ie*.1}s infinite`}})]},ie))}):p?a.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsx("p",{className:"text-xs text-cc-muted",children:p}),a.jsx("button",{type:"button",onClick:()=>A(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):F.length===0?a.jsxs("div",{className:"px-4 py-8 text-center",children:[a.jsx("p",{className:"text-xs text-cc-muted",children:k?"No matching directories":"No subdirectories"}),k&&a.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):a.jsx("ul",{className:"list-none m-0 p-0",children:F.map((P,ie)=>a.jsxs("li",{className:`flex items-center transition-colors ${j===ie?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[a.jsxs("button",{type:"button",ref:me=>{me?O.current.set(ie,me):O.current.delete(ie)},onClick:()=>A(P.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),X(P.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:P.path,"aria-label":`Navigate into ${P.name}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"truncate",children:P.name}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:a.jsx("path",{d:"M6 4l4 4-4 4"})})]}),a.jsx("button",{type:"button",onClick:()=>X(P.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${P.name}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},P.path))})}),a.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),a.jsxs("span",{className:"ml-auto",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function lR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function oR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():lR(e.identifier,e.title)}function ac({className:e}){return a.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[a.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),a.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),a.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),a.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function cR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[l,c]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(0),[y,b]=S.useState(!0),[_,k]=S.useState([]),[E,j]=S.useState(""),[T,N]=S.useState(""),[D,z]=S.useState(!0),[L,H]=S.useState(!1),[U,V]=S.useState("");S.useEffect(()=>{let F=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([A,ae])=>{var I;if(!F)return;k(A.teams),j(ae.viewerId);const X=((I=A.teams[0])==null?void 0:I.id)||"";p(X)}).catch(A=>{F&&V(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{F&&z(!1)}),()=>{F=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){N("");return}const F=_.find(ae=>ae.id===h),A=F==null?void 0:F.states.find(ae=>ae.type==="backlog");N((A==null?void 0:A.id)||"")},[h,_]);async function O(){if(!(!l.trim()||!h)){H(!0),V("");try{const F=await we.createLinearIssue({title:l.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:T||void 0,connectionId:t});n(F.issue)}catch(F){V(F instanceof Error?F.message:"Failed to create issue")}finally{H(!1)}}}return Al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:a.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),a.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),U&&a.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:U}),D?a.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),a.jsx("input",{id:"create-issue-title",type:"text",value:l,onChange:F=>c(F.target.value),onKeyDown:F=>{F.key==="Enter"&&l.trim()&&h&&!L&&O()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),a.jsx("textarea",{id:"create-issue-desc",value:u,onChange:F=>f(F.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),a.jsx("select",{id:"create-issue-team",value:h,onChange:F=>p(F.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(F=>a.jsxs("option",{value:F.id,children:[F.name," (",F.key,")"]},F.id))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),a.jsxs("select",{id:"create-issue-priority",value:g,onChange:F=>v(Number(F.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[a.jsx("option",{value:0,children:"No priority"}),a.jsx("option",{value:1,children:"Urgent"}),a.jsx("option",{value:2,children:"High"}),a.jsx("option",{value:3,children:"Medium"}),a.jsx("option",{value:4,children:"Low"})]})]}),a.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:F=>b(F.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),a.jsxs("div",{className:"flex gap-2.5 pt-2",children:[a.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:O,disabled:!l.trim()||!h||L,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function uR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:l,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[b,_]=S.useState(""),[k,E]=S.useState([]),[j,T]=S.useState(!1),[N,D]=S.useState(!1),[z,L]=S.useState(""),[H,U]=S.useState(!1),[V,O]=S.useState(null),[F,A]=S.useState([]),[ae,X]=S.useState(!1),[I,$]=S.useState(""),[P,ie]=S.useState(!1),[me,R]=S.useState([]),[B,Z]=S.useState(!1),[M,pe]=S.useState(""),[_e,Ce]=S.useState(!1),[Te,Le]=S.useState([]),[Pe,rt]=S.useState(!1),[be,ze]=S.useState(!1),gt=S.useRef(null);S.useEffect(()=>{function ke(Oe){gt.current&&!gt.current.contains(Oe.target)&&(T(!1),ie(!1))}return document.addEventListener("pointerdown",ke),()=>document.removeEventListener("pointerdown",ke)},[]),S.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let ke=!0;return we.listLinearConnections().then(({connections:Oe})=>{ke&&(h(Oe),y(!0),Oe.length>0?(g(Oe[0].id),u(Oe[0].id)):(g(null),u(null)))}).catch(()=>{ke&&y(!0)}),()=>{ke=!1}},[n]);const Ft=S.useCallback(ke=>{g(ke),u(ke),l(null),E([]),_(""),L(""),Le([]),pe(""),R([]),V&&(X(!0),$(""),we.getLinearProjectIssues(V.projectId,10,ke).then(({issues:Oe})=>{A(Oe)}).catch(Oe=>{$(Oe instanceof Error?Oe.message:String(Oe))}).finally(()=>{X(!1)}))},[V,u,l]);S.useEffect(()=>{if(!t||!n){O(null),A([]);return}let ke=!0;return X(!0),$(""),(async()=>{try{const{mapping:Oe}=await we.getLinearProjectMapping(t.repoRoot);if(!ke)return;if(O(Oe),Oe){const{issues:st}=await we.getLinearProjectIssues(Oe.projectId,10,p??void 0);if(!ke)return;A(st)}else A([])}catch(Oe){if(!ke)return;$(Oe instanceof Error?Oe.message:String(Oe))}finally{ke&&X(!1)}})(),()=>{ke=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const ke=b.trim();if(ke.length<2){E([]),L(""),D(!1);return}let Oe=!0;D(!0),L("");const st=setTimeout(()=>{we.searchLinearIssues(ke,8,p??void 0).then(qe=>{Oe&&E(qe.issues)}).catch(qe=>{Oe&&(E([]),L(qe instanceof Error?qe.message:String(qe)))}).finally(()=>{Oe&&D(!1)})},400);return()=>{Oe=!1,clearTimeout(st)}},[n,b,p]),S.useEffect(()=>{if(!n||!_e){Le([]),rt(!1);return}const ke=M.trim();if(ke.length<2){Le([]),rt(!1);return}let Oe=!0;rt(!0);const st=setTimeout(()=>{we.searchLinearIssues(ke,10,p??void 0).then(qe=>{Oe&&Le(qe.issues)}).catch(()=>{Oe&&Le([])}).finally(()=>{Oe&&rt(!1)})},400);return()=>{Oe=!1,clearTimeout(st)}},[n,_e,M,p]);function Dt(ke,Oe=!1){l(ke),_(`${ke.identifier} - ${ke.title}`);const st=oR(ke);c(st,!0),Oe&&T(!1)}function kt(){l(null),_(""),E([]),L("")}async function fn(ke){if(t)try{const{mapping:Oe}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ke.id,projectName:ke.name});O(Oe),ie(!1),X(!0),$("");const{issues:st}=await we.getLinearProjectIssues(ke.id,10,p??void 0);A(st)}catch(Oe){$(Oe instanceof Error?Oe.message:String(Oe))}finally{X(!1)}}async function it(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),A([]),l(null),_("")}}function xn(){if(!n){window.location.hash="#/integrations/linear";return}ie(!0),me.length===0&&(Z(!0),we.listLinearProjects(p??void 0).then(({projects:ke})=>R(ke)).catch(()=>{}).finally(()=>Z(!1)))}function hn(ke){ze(!1),Dt(ke),V&&(X(!0),we.getLinearProjectIssues(V.projectId,10,p??void 0).then(({issues:Oe})=>A(Oe)).catch(()=>{}).finally(()=>X(!1)))}return n?a.jsxs("aside",{className:"space-y-2 mt-0.5",ref:gt,children:[a.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&a.jsx("select",{value:p??"",onChange:ke=>Ft(ke.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(ke=>a.jsx("option",{value:ke.id,children:ke.workspaceName||ke.name},ke.id))}),V?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[a.jsx(ac,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:V.projectName}),a.jsx("button",{type:"button",onClick:it,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsxs("button",{type:"button",onClick:()=>ze(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","aria-expanded":j,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}T(!j)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[a.jsx(ac,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Linear"})]}),n&&t&&a.jsxs("button",{type:"button",onClick:xn,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Attach project"})]}),n&&a.jsxs("button",{type:"button",onClick:()=>ze(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]}),!n&&a.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),V&&(()=>{const ke=M.trim().toLowerCase(),Oe=!_e&&ke?F.filter(qe=>qe.identifier.toLowerCase().includes(ke)||qe.title.toLowerCase().includes(ke)):_e?[]:F,st=_e?Te:Oe;return a.jsxs("div",{className:"mt-2",children:[i&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[a.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),a.jsx("button",{type:"button",onClick:kt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsx("input",{type:"text",value:M,onChange:qe=>pe(qe.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),ae?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):I?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:I}):Pe?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&ke.length<2?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):st.length===0?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ke?"No matching issues":"No active issues found"}):a.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:st.map(qe=>a.jsxs("button",{type:"button",onClick:()=>Dt(qe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===qe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:qe.identifier})," ",qe.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[qe.stateName,qe.priorityLabel].filter(Boolean).join(" - ")})]},qe.id))}),a.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:qe=>{Ce(qe.target.checked),qe.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),P&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsx("div",{className:"p-2 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),a.jsx("button",{type:"button",onClick:()=>ie(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),B?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):a.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(ke=>a.jsx("button",{type:"button",onClick:()=>fn(ke),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("div",{className:"text-xs text-cc-fg",children:ke.name})},ke.id))})]}),j&&n&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsxs("div",{className:"p-2 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:b,onChange:ke=>{_(ke.target.value)},onFocus:()=>T(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),a.jsx("button",{type:"button",onClick:()=>{T(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[a.jsx("span",{children:"Attach an issue to this draft"}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&N&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!N&&z&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:z}),b.trim().length>=2&&!N&&!z&&k.length===0&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!N&&!z&&a.jsx("div",{className:"max-h-56 overflow-y-auto",children:k.map(ke=>a.jsxs("button",{type:"button",onClick:()=>Dt(ke,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:ke.identifier})," - ",ke.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ke.stateName,ke.teamName].filter(Boolean).join(" • ")})]},ke.id))})]}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),H&&a.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),a.jsx("div",{className:"flex gap-2 mt-2.5",children:a.jsx("button",{type:"button",onClick:()=>{U(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),be&&a.jsx(cR,{defaultProjectId:V==null?void 0:V.projectId,connectionId:p??void 0,onCreated:hn,onClose:()=>ze(!1)})]}):null}function dR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:l,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,v]=S.useState(!1),[y,b]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function k(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[]),S.useEffect(()=>{t?we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:_,children:[a.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),a.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[a.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:a.jsx("input",{type:"text",value:y,onChange:k=>b(k.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:k=>{k.key==="Escape"&&v(!1)}})}),a.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const k=y.toLowerCase().trim(),E=h.filter(D=>!D.isRemote&&(!k||D.name.toLowerCase().includes(k))),j=h.filter(D=>D.isRemote&&(!k||D.name.toLowerCase().includes(k))),T=h.some(D=>D.name.toLowerCase()===k),N=E.length>0||j.length>0;return a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[D.ahead>0&&a.jsxs("span",{className:"text-[9px] text-green-500",children:[D.ahead,"↑"]}),D.behind>0&&a.jsxs("span",{className:"text-[9px] text-amber-500",children:[D.behind,"↓"]}),D.worktreePath&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),D.isCurrent&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},D.name))]}),j.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),j.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${D.name}`))]}),!N&&k&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),k&&!T&&a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),a.jsxs("span",{children:["Create ",a.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),a.jsxs("button",{onClick:()=>u(!l),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${l?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),a.jsx("span",{children:"Worktree"})]})]}):null}const fR=336*60*60*1e3,la=12,hR=24;function _g(e){return e.split("/").filter(Boolean).pop()||e}function E5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||_g(e.cwd)}function pR(e){return e.length>8?e.slice(0,8):e}function mR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function gR(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const l=Math.floor(i/24);if(l<14)return`${l}d ago`;const c=Math.floor(l/7);if(c<8)return`${c}w ago`;const u=Math.floor(l/30);return`${Math.max(1,u)}mo ago`}function xR(){var mi;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,l]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=S.useState([]),[b,_]=S.useState(()=>_5(localStorage.getItem("cc-backend")||"claude")),[k,E]=S.useState(()=>w5(localStorage.getItem("cc-backend")||"claude")),[j,T]=S.useState(()=>Jd()[0]||""),[N,D]=S.useState([]),[z,L]=S.useState(null),[H,U]=S.useState(!1),[V,O]=S.useState(""),[F,A]=S.useState(null),[ae,X]=S.useState(!1),[I,$]=S.useState(null),[P,ie]=S.useState(null),[me,R]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),B=F||O2(p),Z=y5(p),[M,pe]=S.useState([]),[_e,Ce]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Te,Le]=S.useState(!1),[Pe,rt]=S.useState(!1),be=nR(),[ze,gt]=S.useState(()=>be),[Ft,Dt]=S.useState([]),[kt,fn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[it,xn]=S.useState(!1),hn=S.useRef(null),[ke,Oe]=S.useState(null),st=S.useRef(null),qe=S.useRef(null),[hr,le]=S.useState(!1),[xe,Q]=S.useState(!1),[fe,Ae]=S.useState(!1),[Ve,tt]=S.useState(!1),[nt,xt]=S.useState(""),[nn,ut]=S.useState(!0),[vn,Sn]=S.useState([]),[Fr,Mr]=S.useState(!1),[Rr,ne]=S.useState(""),[he,ge]=S.useState(!1),[Ye,_t]=S.useState(la),[rn,pr]=S.useState(""),[mt,qn]=S.useState(null),[zs,Ll]=S.useState(!1),[ba,qr]=S.useState(""),[ya,ci]=S.useState(!1),[Ec,Hr]=S.useState([]),[Gt,pn]=S.useState(null),[Lr,Yi]=S.useState(!1),[Tc,ui]=S.useState(""),[Ac,di]=S.useState(0),Qi=S.useRef(null),bn=S.useRef(null),Ir=S.useRef(null),fi=S.useRef(null),Vr=S.useRef(null),Zt=W(Y=>Y.currentSessionId),Yt=P2({text:e,caretPos:Ac,cwd:j||void 0});S.useEffect(()=>{if(Qi.current===null||!bn.current)return;const Y=Qi.current;bn.current.setSelectionRange(Y,Y),Qi.current=null},[e]),S.useEffect(()=>{var de;window.matchMedia("(min-width: 640px)").matches&&((de=bn.current)==null||de.focus())},[]),S.useEffect(()=>{we.getHome().then(({home:Y,cwd:de})=>{j||T(de||Y)}).catch(()=>{}),we.listEnvs().then(pe).catch(()=>{}),we.listSandboxes().then(Dt).catch(()=>{}),we.getBackends().then(y).catch(()=>{}),we.getSettings().then(Y=>{X(Y.linearApiKeyConfigured)}).catch(()=>{})},[]);function Mc(Y){g(Y),localStorage.setItem("cc-backend",Y),A(null),_(_5(Y)),E(w5(Y)),Y!=="claude"&&(tt(!1),Sn([]),ne(""),Mr(!1),ge(!1),_t(la),pr(""))}S.useEffect(()=>{if(p!=="codex"){A(null);return}we.getBackendModels(p).then(Y=>{if(Y.length>0){const de=j7(Y);A(de),de.some(Xe=>Xe.value===b)||_(de[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(st.current&&(clearInterval(st.current),st.current=null),Oe(null),!ze)return;const Y="the-companion:latest",de=()=>{we.getImageStatus(Y).then(Xe=>{Oe(Xe),Xe.status==="idle"&&we.pullImage(Y).catch(()=>{}),(Xe.status==="ready"||Xe.status==="error")&&st.current&&(clearInterval(st.current),st.current=null)}).catch(()=>{})};return de(),st.current=setInterval(de,2e3),()=>{st.current&&(clearInterval(st.current),st.current=null)}},[ze]),S.useEffect(()=>{function Y(de){Ir.current&&!Ir.current.contains(de.target)&&le(!1),fi.current&&!fi.current.contains(de.target)&&Q(!1),Vr.current&&!Vr.current.contains(de.target)&&Le(!1),hn.current&&!hn.current.contains(de.target)&&xn(!1)}return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[]),S.useEffect(()=>{if(!j){qn(null);return}we.getRepoInfo(j).then(Y=>{qn(Y),qr(Y.currentBranch),ci(!1)}).catch(()=>{qn(null),qr(""),ci(!1)})},[j]);const Gr=B.find(Y=>Y.value===b)||B[0],Wi=Z.find(Y=>Y.value===k)||Z[0],lf=p==="codex"?"/logo-codex.svg":"/logo.svg",Rc=j?j.split("/").pop()||j:"Select folder",_a=S.useMemo(()=>nt.trim(),[nt]),Lc=p==="claude"&&Ve&&_a.length>0,mr=S.useMemo(()=>{const Y=Date.now()-fR;return vn.filter(de=>de.createdAt>=Y)},[vn]),Ji=S.useMemo(()=>he?vn:mr.length>0?mr:vn,[he,mr,vn]),sn=S.useMemo(()=>rn.trim().toLowerCase(),[rn]),Kt=S.useMemo(()=>sn?Ji.filter(Y=>{const de=E5(Y).toLowerCase(),Xe=_g(Y.cwd).toLowerCase(),at=(Y.gitBranch||"").toLowerCase(),We=Y.cwd.toLowerCase(),He=Y.resumeSessionId.toLowerCase();return de.includes(sn)||Xe.includes(sn)||at.includes(sn)||We.includes(sn)||He.includes(sn)}):Ji,[Ji,sn]),wa=S.useMemo(()=>Kt.slice(0,Ye),[Kt,Ye]),of=Ye<Kt.length,Sa=Math.max(0,vn.length-mr.length),Dc=!he&&mr.length>0,Xi=S.useCallback(async()=>{if(p==="claude"){Mr(!0),ne("");try{const[Y,de]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(He=>He.sessions)]),Xe=new Map,at=He=>{const yn=Xe.get(He.resumeSessionId);(!yn||He.createdAt>yn.createdAt)&&Xe.set(He.resumeSessionId,He)};for(const He of Y)He.backendType!=="codex"&&He.cliSessionId&&at({resumeSessionId:He.cliSessionId,sessionId:He.sessionId,name:He.name,model:He.model,createdAt:He.createdAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"companion"});for(const He of de)at({resumeSessionId:He.sessionId,sessionId:He.sessionId,slug:He.slug,createdAt:He.lastActivityAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"claude_disk"});const We=Array.from(Xe.values()).sort((He,yn)=>{const er=j&&He.cwd===j?0:1,Ki=j&&yn.cwd===j?0:1;return er!==Ki?er-Ki:yn.createdAt-He.createdAt});Sn(We),ge(!1),_t(la)}catch(Y){const de=Y instanceof Error?Y.message:String(Y);ne(de||"Failed to load existing sessions"),Sn([]),_t(la)}finally{Mr(!1)}}},[p,j]);S.useEffect(()=>{p==="claude"&&Ve&&Xi()},[p,Ve,Xi]),S.useEffect(()=>{_t(la)},[sn,he]);async function zc(Y){if(Y.length===0)return;const de=[],Xe=[];let at=N.reduce((We,He)=>We+He.size,0);for(const We of Y){if(We.size>Qd){Xe.push(`${We.name} is too large (${Ts(We.size)}, max ${Ts(Qd)})`);continue}if(at+We.size>Wd){Xe.push(`${We.name} would exceed the per-message limit (${Ts(Wd)})`);continue}const{base64:He,mediaType:yn}=await k2(We);de.push({name:We.name,base64:He,mediaType:yn,size:We.size}),at+=We.size}de.length>0&&D(We=>[...We,...de]),L(Xe.length>0?Xe.join("; "):null)}async function Hn(Y){const de=Y.target.files;de&&(await zc(Array.from(de)),Y.target.value="")}function Dl(Y){D(de=>de.filter((Xe,at)=>at!==Y))}async function Oc(Y){var at;const de=(at=Y.clipboardData)==null?void 0:at.items;if(!de)return;const Xe=[];for(const We of Array.from(de)){if(We.kind!=="file")continue;const He=We.getAsFile();if(!He)continue;const yn=He.name&&He.name.length>0?He.name:`pasted-${Date.now()}.${(He.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Xe.push(new File([He],yn,{type:He.type,lastModified:He.lastModified}))}Xe.length>0&&(Y.preventDefault(),await zc(Xe))}function zl(Y){t(Y.target.value),di(Y.target.selectionStart??Y.target.value.length);const de=Y.target;de.style.height="auto",de.style.height=Math.min(de.scrollHeight,200)+"px"}function hi(){bn.current&&di(bn.current.selectionStart??0)}function Ol(Y){var Xe;const de=Yt.selectPrompt(Y);Qi.current=de.nextCursor,t(de.nextText),Yt.setMentionMenuOpen(!1),di(de.nextCursor),(Xe=bn.current)==null||Xe.focus(),bn.current&&(bn.current.style.height="auto",bn.current.style.height=Math.min(bn.current.scrollHeight,200)+"px")}function Bc(Y){if(Yt.mentionMenuOpen&&Y.key==="Escape"){Y.preventDefault(),Yt.setMentionMenuOpen(!1);return}if(Yt.mentionMenuOpen&&Yt.filteredPrompts.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),Yt.setMentionMenuIndex(de=>(de+1)%Yt.filteredPrompts.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),Yt.setMentionMenuIndex(de=>(de-1+Yt.filteredPrompts.length)%Yt.filteredPrompts.length);return}if(Y.key==="Tab"&&!Y.shiftKey||Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),Ol(Yt.filteredPrompts[Yt.mentionMenuIndex]);return}}if(Yt.mentionMenuOpen&&Yt.filteredPrompts.length===0&&(Y.key==="Enter"&&!Y.shiftKey||Y.key==="Tab"&&!Y.shiftKey)){Y.preventDefault();return}if(Y.key==="Tab"&&Y.shiftKey){Y.preventDefault();const de=y5(p),at=(de.findIndex(We=>We.value===k)+1)%de.length;E(de[at].value);return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Pc())}function Zi(Y){const de=i.trim(),Xe=de?`[${de}]: ${Y}`:Y;if(!I)return Xe;const at=(I.description??"").trim();return`${["Linear issue context:",`- Identifier: ${I.identifier}`,`- Title: ${I.title}`,I.stateName?`- State: ${I.stateName}`:"",I.priorityLabel?`- Priority: ${I.priorityLabel}`:"",I.teamName?`- Team: ${I.teamName}`:"",`- URL: ${I.url}`,at?`- Description:
106
106
  ${at}`:""].filter(Boolean).join(`
107
107
  `)}
108
108
 
109
109
  User request:
110
- ${Xe}`}async function Pc(){const Y=e.trim();if(!(!Y||H)){if(n&&!i.trim()){O("Please enter your name before starting a session.");return}if(U(!0),O(""),ui(""),mt){const de=ba||mt.currentBranch;if(de&&de===mt.currentBranch){const Xe=Ec.find(at=>at.name===de&&!at.isRemote);if(Xe&&Xe.behind>0){pn({behind:Xe.behind,branchName:de});return}}}await Os(Y)}}async function Os(Y,de){const Xe=W.getState();Xe.clearCreation(),Xe.setSessionCreating(!0,p);try{Zt&&ym(Zt);const at=(de==null?void 0:de.resumeSessionAt)||(Lc?_a:void 0),We=at?(de==null?void 0:de.forkSession)??(Lc?nn:void 0):void 0,He=(de==null?void 0:de.cwd)||j,yn=(de==null?void 0:de.branch)!==void 0?de.branch.trim()||void 0:ba.trim()||void 0,er=(de==null?void 0:de.useWorktree)!==void 0?de.useWorktree:zs,Ki=(de==null?void 0:de.createBranch)!==void 0?de.createBranch:!!(yn&&ya),gi=await l4({model:b,permissionMode:k,cwd:He||void 0,envSlug:_e||void 0,sandboxEnabled:ze?!0:void 0,sandboxSlug:ze&&kt?kt:void 0,branch:yn,createBranch:Ki?!0:void 0,useWorktree:er?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:at,forkSession:We,userName:i.trim()||void 0,linearConnectionId:I&&P||void 0,linearIssue:I?{identifier:I.identifier,title:I.title,stateName:I.stateName,teamName:I.teamName,url:I.url}:void 0},Qr=>{W.getState().addCreationProgress(Qr)}),Mn=gi.sessionId,Bs=W.getState(),Na=Bs.sdkSessions.filter(Qr=>Qr.sessionId!==Mn);Bs.setSdkSessions([...Na,{sessionId:Mn,state:gi.state,cwd:gi.cwd,createdAt:Date.now(),backendType:gi.backendType||p,model:b,permissionMode:k,userName:i.trim()||void 0,resumeSessionAt:at,forkSession:at?We===!0:void 0}]);const $c=new Set(W.getState().sessionNames.values()),Rn=$5($c),Yr=c.trim()||i.trim(),es=f.trim()||Rn,Uc=Yr?`${Yr}_${es}`:es;W.getState().setSessionName(Mn,Uc),we.renameSession(Mn,Uc).catch(()=>{}),h(""),He&&F2(He),W.getState().setPreviousPermissionMode(Mn,k),Ig(Mn,!0),wc(Mn),await RN(Mn);const Ca=Y.trim();if(Ca.length>0){const Qr=Zi(Ca),ts=xm(),Ps=N.length>0?N.map($s=>({name:$s.name,media_type:$s.mediaType,data:$s.base64,size:$s.size})):void 0;Pn(Mn,{type:"user_message",content:Qr,session_id:Mn,attachments:Ps,client_msg_id:ts}),W.getState().appendMessage(Mn,{id:ts,role:"user",content:Qr,attachments:Ps,timestamp:Date.now()})}I&&(we.linkLinearIssue(Mn,I,P||void 0).then(()=>W.getState().setLinkedLinearIssue(Mn,I)).catch(()=>{}),we.transitionLinearIssue(I.id,P||void 0).catch(()=>{})),W.getState().clearCreation()}catch(at){const We=at instanceof Error?at.message:String(at);O(We),W.getState().setCreationError(We),U(!1)}}async function Bl(Y,de){H||(U(!0),O(""),ui(""),T(Y.cwd),Ll(!1),ci(!1),qr(Y.gitBranch||""),xt(Y.resumeSessionId),ut(de),await Os("",{resumeSessionAt:Y.resumeSessionId,forkSession:de,cwd:Y.cwd,branch:Y.gitBranch,useWorktree:!1,createBranch:!1}))}async function Pl(){if(Vt){Yi(!0),ui("");try{const Y=j||(mt==null?void 0:mt.repoRoot);if(!Y)throw new Error("No working directory");const de=await we.gitPull(Y);if(!de.success){ui(de.output||"Pull failed"),Yi(!1),U(!1);return}pn(null),Yi(!1),await Os(e.trim())}catch(Y){ui(Y instanceof Error?Y.message:String(Y)),Yi(!1)}}}function cf(){const Y=e.trim();pn(null),ui(""),Os(Y)}function uf(){pn(null),ui(""),U(!1)}const ka=S.useCallback((Y,de)=>{qr(Y),ci(de)},[]),Dr=S.useCallback((Y,de)=>{qr(Y),ci(de)},[]),$l=S.useCallback(Y=>{Hr(Y)},[]),ja=S.useCallback(Y=>{$(Y),!Y&&mt&&(qr(mt.currentBranch),ci(!1))},[mt]),pi=e.trim().length>0&&!H&&(!n||i.trim().length>0);return a.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),a.jsxs("div",{className:"w-full max-w-[720px]",children:[a.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[a.jsx("img",{src:lf,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),a.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",a.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",a.jsx("span",{className:"text-cc-error",children:"*"})]}),a.jsx("input",{type:"text",value:i,onChange:Y=>{const de=Y.target.value;l(de),localStorage.setItem("cc-user-name",de)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:c,onChange:Y=>{const de=Y.target.value;u(de),localStorage.setItem("cc-session-prefix",de)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:f,onChange:Y=>h(Y.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),a.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",a.jsxs("span",{className:"font-mono-code",children:[c.trim()||i.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),a.jsx("input",{ref:qe,type:"file",multiple:!0,onChange:Hn,className:"hidden","aria-label":"Attach files"}),a.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[a.jsx(B2,{open:Gt.mentionMenuOpen,loading:Gt.promptsLoading,prompts:Gt.filteredPrompts,selectedIndex:Gt.mentionMenuIndex,onSelect:Ol,menuRef:Gt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(I||N.length>0)&&a.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[I&&a.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[a.jsx("span",{className:"shrink-0",children:"Linear"}),a.jsx("span",{className:"font-mono-code shrink-0",children:I.identifier}),a.jsx("span",{className:"truncate",children:I.title}),a.jsx("button",{type:"button",onClick:()=>ja(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),N.map((Y,de)=>a.jsx(C2,{name:Y.name,mediaType:Y.mediaType,base64:Y.base64,size:Y.size,onRemove:()=>Dl(de),className:"w-10 h-10"},de))]}),z&&a.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:z}),a.jsx("textarea",{ref:bn,value:e,onChange:zl,onKeyDown:Bc,onClick:hi,onKeyUp:hi,onPaste:Oc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),a.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[a.jsxs("div",{className:"relative",ref:Ir,children:[a.jsxs("button",{onClick:()=>le(!hr),"aria-expanded":hr,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("span",{children:Gr.icon}),a.jsx("span",{children:Gr.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),hr&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:B.map(Y=>a.jsxs("button",{onClick:()=>{_(Y.value),le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${Y.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{children:Y.icon}),Y.label]},Y.value))})]}),a.jsxs("div",{className:"relative",ref:fi,children:[a.jsxs("button",{onClick:()=>Q(!xe),"aria-expanded":xe,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Wi.label,a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),xe&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:Z.map(Y=>a.jsx("button",{onClick:()=>{E(Y.value),Q(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.value))})]}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>Ae(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Rc})]}),fe&&a.jsx(aR,{initialPath:j||"",onSelect:Y=>{T(Y)},onClose:()=>Ae(!1)})]}),a.jsx(dR,{cwd:j,gitRepoInfo:mt,selectedBranch:ba,isNewBranch:ya,useWorktree:zs,onBranchChange:ka,onWorktreeChange:Ll,onBranchesLoaded:$l}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{className:"relative",ref:Vr,children:[a.jsxs("button",{onClick:()=>{Te||we.listEnvs().then(pe).catch(()=>{}),Le(!Te)},"aria-expanded":Te,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:_e?((mi=M.find(Y=>Y.slug===_e))==null?void 0:mi.name)||"Env":"No env"})]}),Te&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[a.jsx("button",{onClick:()=>{Ce(""),localStorage.setItem("cc-selected-env",""),Le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${_e?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),M.map(Y=>a.jsxs("button",{onClick:()=>{Ce(Y.slug),localStorage.setItem("cc-selected-env",Y.slug),Le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${Y.slug===_e?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate",children:Y.name}),a.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]})]},Y.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("button",{onClick:()=>{rt(!0),Le(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),be,a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{var Y;return(Y=qe.current)==null?void 0:Y.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("button",{onClick:Pc,disabled:!pi,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${pi?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),a.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(Y=>a.jsxs("button",{onClick:()=>Y.available&&Mc(Y.id),disabled:!Y.available,title:Y.available?Y.name:`${Y.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Y.available?p===Y.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[Y.name,!Y.available&&a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},Y.id))})}),p==="claude"&&a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>tt(Y=>!Y),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ve?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ve,"aria-controls":"branch-from-session-panel",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[a.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),a.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${Ve?"rotate-180":""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),a.jsx("div",{className:"accordion-panel","data-open":Ve?"true":"false",children:a.jsx("div",{className:"accordion-inner",inert:!Ve||void 0,children:a.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>void Xi(),disabled:Fr,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:Fr?"Refreshing...":"Refresh detected sessions"}),vn.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",wa.length," of ",Kt.length," ",sn?"matching":Dc?"recent":"detected"," Claude session",Kt.length!==1?"s":"","."]}),!he&&Sa>0&&mr.length>0&&a.jsxs("button",{type:"button",onClick:()=>{ge(!0),_t(la)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Sa,")"]}),he&&mr.length>0&&a.jsx("button",{type:"button",onClick:()=>{ge(!1),_t(la)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"sr-only",children:"Search sessions"}),a.jsxs("div",{className:"relative",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),a.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),a.jsx("input",{type:"text",value:rn,onChange:Y=>pr(Y.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),a.jsxs("p",{className:"text-[11px] text-cc-muted",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",a.jsx("span",{className:"mx-1",children:"•"}),a.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Rr&&a.jsx("p",{className:"text-[11px] text-cc-error",children:Rr}),!Fr&&!Rr&&Kt.length===0&&a.jsx("p",{className:"text-[11px] text-cc-muted",children:sn?"No sessions match this search.":"No Claude sessions detected yet."}),wa.length>0&&a.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[a.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[a.jsx("span",{children:"Session"}),a.jsx("span",{children:"Project"}),a.jsx("span",{children:"Branch"}),a.jsx("span",{children:"Last active"}),a.jsx("span",{className:"text-right",children:"Action"})]}),a.jsx("div",{className:"divide-y divide-cc-border/50",children:wa.map(Y=>{const de=E5(Y),Xe=_g(Y.cwd),at=Y.source==="companion"?"Companion":"Claude",We=_a===Y.resumeSessionId;return a.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:`text-xs truncate ${We?"text-cc-primary font-medium":"text-cc-fg"}`,children:de}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"font-mono-code text-cc-muted",children:pR(Y.resumeSessionId)}),a.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:at})]})]}),a.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:Y.cwd,children:[a.jsx("div",{className:"truncate",children:Xe}),a.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Y.cwd,children:mR(Y.cwd)})]}),a.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Y.gitBranch||"—"}),a.jsx("div",{className:"text-[11px] text-cc-muted",children:gR(Y.createdAt)}),a.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[a.jsx("button",{type:"button",onClick:()=>{xt(Y.resumeSessionId),ut(!0),Bl(Y,!0)},"aria-label":`Fork and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${We&&nn?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
110
+ ${Xe}`}async function Pc(){const Y=e.trim();if(!(!Y||H)){if(n&&!i.trim()){O("Please enter your name before starting a session.");return}if(U(!0),O(""),ui(""),mt){const de=ba||mt.currentBranch;if(de&&de===mt.currentBranch){const Xe=Ec.find(at=>at.name===de&&!at.isRemote);if(Xe&&Xe.behind>0){pn({behind:Xe.behind,branchName:de});return}}}await Os(Y)}}async function Os(Y,de){const Xe=W.getState();Xe.clearCreation(),Xe.setSessionCreating(!0,p);try{Zt&&ym(Zt);const at=(de==null?void 0:de.resumeSessionAt)||(Lc?_a:void 0),We=at?(de==null?void 0:de.forkSession)??(Lc?nn:void 0):void 0,He=(de==null?void 0:de.cwd)||j,yn=(de==null?void 0:de.branch)!==void 0?de.branch.trim()||void 0:ba.trim()||void 0,er=(de==null?void 0:de.useWorktree)!==void 0?de.useWorktree:zs,Ki=(de==null?void 0:de.createBranch)!==void 0?de.createBranch:!!(yn&&ya),gi=await l4({model:b,permissionMode:k,cwd:He||void 0,envSlug:_e||void 0,sandboxEnabled:ze?!0:void 0,sandboxSlug:ze&&kt?kt:void 0,branch:yn,createBranch:Ki?!0:void 0,useWorktree:er?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:at,forkSession:We,userName:i.trim()||void 0,linearConnectionId:I&&P||void 0,linearIssue:I?{identifier:I.identifier,title:I.title,stateName:I.stateName,teamName:I.teamName,url:I.url}:void 0},Qr=>{W.getState().addCreationProgress(Qr)}),Mn=gi.sessionId,Bs=W.getState(),Na=Bs.sdkSessions.filter(Qr=>Qr.sessionId!==Mn);Bs.setSdkSessions([...Na,{sessionId:Mn,state:gi.state,cwd:gi.cwd,createdAt:Date.now(),backendType:gi.backendType||p,model:b,permissionMode:k,userName:i.trim()||void 0,resumeSessionAt:at,forkSession:at?We===!0:void 0}]);const $c=new Set(W.getState().sessionNames.values()),Rn=$5($c),Yr=c.trim()||i.trim(),es=f.trim()||Rn,Uc=Yr?`${Yr}_${es}`:es;W.getState().setSessionName(Mn,Uc),we.renameSession(Mn,Uc).catch(()=>{}),h(""),He&&F2(He),W.getState().setPreviousPermissionMode(Mn,k),Ig(Mn,!0),wc(Mn),await RN(Mn);const Ca=Y.trim();if(Ca.length>0){const Qr=Zi(Ca),ts=xm(),Ps=N.length>0?N.map($s=>({name:$s.name,media_type:$s.mediaType,data:$s.base64,size:$s.size})):void 0;Pn(Mn,{type:"user_message",content:Qr,session_id:Mn,attachments:Ps,client_msg_id:ts}),W.getState().appendMessage(Mn,{id:ts,role:"user",content:Qr,attachments:Ps,timestamp:Date.now()})}I&&(we.linkLinearIssue(Mn,I,P||void 0).then(()=>W.getState().setLinkedLinearIssue(Mn,I)).catch(()=>{}),we.transitionLinearIssue(I.id,P||void 0).catch(()=>{})),W.getState().clearCreation()}catch(at){const We=at instanceof Error?at.message:String(at);O(We),W.getState().setCreationError(We),U(!1)}}async function Bl(Y,de){H||(U(!0),O(""),ui(""),T(Y.cwd),Ll(!1),ci(!1),qr(Y.gitBranch||""),xt(Y.resumeSessionId),ut(de),await Os("",{resumeSessionAt:Y.resumeSessionId,forkSession:de,cwd:Y.cwd,branch:Y.gitBranch,useWorktree:!1,createBranch:!1}))}async function Pl(){if(Gt){Yi(!0),ui("");try{const Y=j||(mt==null?void 0:mt.repoRoot);if(!Y)throw new Error("No working directory");const de=await we.gitPull(Y);if(!de.success){ui(de.output||"Pull failed"),Yi(!1),U(!1);return}pn(null),Yi(!1),await Os(e.trim())}catch(Y){ui(Y instanceof Error?Y.message:String(Y)),Yi(!1)}}}function cf(){const Y=e.trim();pn(null),ui(""),Os(Y)}function uf(){pn(null),ui(""),U(!1)}const ka=S.useCallback((Y,de)=>{qr(Y),ci(de)},[]),Dr=S.useCallback((Y,de)=>{qr(Y),ci(de)},[]),$l=S.useCallback(Y=>{Hr(Y)},[]),ja=S.useCallback(Y=>{$(Y),!Y&&mt&&(qr(mt.currentBranch),ci(!1))},[mt]),pi=e.trim().length>0&&!H&&(!n||i.trim().length>0);return a.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),a.jsxs("div",{className:"w-full max-w-[720px]",children:[a.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[a.jsx("img",{src:lf,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),a.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",a.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",a.jsx("span",{className:"text-cc-error",children:"*"})]}),a.jsx("input",{type:"text",value:i,onChange:Y=>{const de=Y.target.value;l(de),localStorage.setItem("cc-user-name",de)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:c,onChange:Y=>{const de=Y.target.value;u(de),localStorage.setItem("cc-session-prefix",de)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:f,onChange:Y=>h(Y.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),a.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",a.jsxs("span",{className:"font-mono-code",children:[c.trim()||i.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),a.jsx("input",{ref:qe,type:"file",multiple:!0,onChange:Hn,className:"hidden","aria-label":"Attach files"}),a.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[a.jsx(B2,{open:Yt.mentionMenuOpen,loading:Yt.promptsLoading,prompts:Yt.filteredPrompts,selectedIndex:Yt.mentionMenuIndex,onSelect:Ol,menuRef:Yt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(I||N.length>0)&&a.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[I&&a.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[a.jsx("span",{className:"shrink-0",children:"Linear"}),a.jsx("span",{className:"font-mono-code shrink-0",children:I.identifier}),a.jsx("span",{className:"truncate",children:I.title}),a.jsx("button",{type:"button",onClick:()=>ja(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),N.map((Y,de)=>a.jsx(C2,{name:Y.name,mediaType:Y.mediaType,base64:Y.base64,size:Y.size,onRemove:()=>Dl(de),className:"w-10 h-10"},de))]}),z&&a.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:z}),a.jsx("textarea",{ref:bn,value:e,onChange:zl,onKeyDown:Bc,onClick:hi,onKeyUp:hi,onPaste:Oc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),a.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[a.jsxs("div",{className:"relative",ref:Ir,children:[a.jsxs("button",{onClick:()=>le(!hr),"aria-expanded":hr,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("span",{children:Gr.icon}),a.jsx("span",{children:Gr.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),hr&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:B.map(Y=>a.jsxs("button",{onClick:()=>{_(Y.value),le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${Y.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{children:Y.icon}),Y.label]},Y.value))})]}),a.jsxs("div",{className:"relative",ref:fi,children:[a.jsxs("button",{onClick:()=>Q(!xe),"aria-expanded":xe,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Wi.label,a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),xe&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:Z.map(Y=>a.jsx("button",{onClick:()=>{E(Y.value),Q(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.value))})]}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>Ae(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Rc})]}),fe&&a.jsx(aR,{initialPath:j||"",onSelect:Y=>{T(Y)},onClose:()=>Ae(!1)})]}),a.jsx(dR,{cwd:j,gitRepoInfo:mt,selectedBranch:ba,isNewBranch:ya,useWorktree:zs,onBranchChange:ka,onWorktreeChange:Ll,onBranchesLoaded:$l}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{className:"relative",ref:Vr,children:[a.jsxs("button",{onClick:()=>{Te||we.listEnvs().then(pe).catch(()=>{}),Le(!Te)},"aria-expanded":Te,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:_e?((mi=M.find(Y=>Y.slug===_e))==null?void 0:mi.name)||"Env":"No env"})]}),Te&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[a.jsx("button",{onClick:()=>{Ce(""),localStorage.setItem("cc-selected-env",""),Le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${_e?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),M.map(Y=>a.jsxs("button",{onClick:()=>{Ce(Y.slug),localStorage.setItem("cc-selected-env",Y.slug),Le(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${Y.slug===_e?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate",children:Y.name}),a.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]})]},Y.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("button",{onClick:()=>{rt(!0),Le(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),be,a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{var Y;return(Y=qe.current)==null?void 0:Y.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("button",{onClick:Pc,disabled:!pi,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${pi?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),a.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(Y=>a.jsxs("button",{onClick:()=>Y.available&&Mc(Y.id),disabled:!Y.available,title:Y.available?Y.name:`${Y.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Y.available?p===Y.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[Y.name,!Y.available&&a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},Y.id))})}),p==="claude"&&a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>tt(Y=>!Y),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ve?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ve,"aria-controls":"branch-from-session-panel",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[a.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),a.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${Ve?"rotate-180":""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),a.jsx("div",{className:"accordion-panel","data-open":Ve?"true":"false",children:a.jsx("div",{className:"accordion-inner",inert:!Ve||void 0,children:a.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>void Xi(),disabled:Fr,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:Fr?"Refreshing...":"Refresh detected sessions"}),vn.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",wa.length," of ",Kt.length," ",sn?"matching":Dc?"recent":"detected"," Claude session",Kt.length!==1?"s":"","."]}),!he&&Sa>0&&mr.length>0&&a.jsxs("button",{type:"button",onClick:()=>{ge(!0),_t(la)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Sa,")"]}),he&&mr.length>0&&a.jsx("button",{type:"button",onClick:()=>{ge(!1),_t(la)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"sr-only",children:"Search sessions"}),a.jsxs("div",{className:"relative",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),a.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),a.jsx("input",{type:"text",value:rn,onChange:Y=>pr(Y.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),a.jsxs("p",{className:"text-[11px] text-cc-muted",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",a.jsx("span",{className:"mx-1",children:"•"}),a.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Rr&&a.jsx("p",{className:"text-[11px] text-cc-error",children:Rr}),!Fr&&!Rr&&Kt.length===0&&a.jsx("p",{className:"text-[11px] text-cc-muted",children:sn?"No sessions match this search.":"No Claude sessions detected yet."}),wa.length>0&&a.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[a.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[a.jsx("span",{children:"Session"}),a.jsx("span",{children:"Project"}),a.jsx("span",{children:"Branch"}),a.jsx("span",{children:"Last active"}),a.jsx("span",{className:"text-right",children:"Action"})]}),a.jsx("div",{className:"divide-y divide-cc-border/50",children:wa.map(Y=>{const de=E5(Y),Xe=_g(Y.cwd),at=Y.source==="companion"?"Companion":"Claude",We=_a===Y.resumeSessionId;return a.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:`text-xs truncate ${We?"text-cc-primary font-medium":"text-cc-fg"}`,children:de}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"font-mono-code text-cc-muted",children:pR(Y.resumeSessionId)}),a.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:at})]})]}),a.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:Y.cwd,children:[a.jsx("div",{className:"truncate",children:Xe}),a.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Y.cwd,children:mR(Y.cwd)})]}),a.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Y.gitBranch||"—"}),a.jsx("div",{className:"text-[11px] text-cc-muted",children:gR(Y.createdAt)}),a.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[a.jsx("button",{type:"button",onClick:()=>{xt(Y.resumeSessionId),ut(!0),Bl(Y,!0)},"aria-label":`Fork and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${We&&nn?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
111
111
  ${Y.cwd}${Y.gitBranch?` (${Y.gitBranch})`:""}
112
112
  ${Y.resumeSessionId}`,children:"Fork"}),a.jsx("button",{type:"button",onClick:()=>{xt(Y.resumeSessionId),ut(!1),Bl(Y,!1)},"aria-label":`Continue and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${We&&!nn?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
113
- ${Y.resumeSessionId}`,children:"Continue"})]})]},`${Y.resumeSessionId}-row-${Y.sessionId}`)})}),of&&a.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:a.jsxs("button",{type:"button",onClick:()=>_t(Y=>Math.min(Y+hR,Kt.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",Kt.length-Ye," remaining)"]})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),me&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),a.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),a.jsx("button",{onClick:()=>{R(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx(uR,{cwd:j,gitRepoInfo:mt,linearConfigured:ae,selectedLinearIssue:I,onIssueSelect:ja,onBranchFromIssue:Dr,onConnectionSelect:ie})]}),Vt&&a.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[a.jsx("span",{className:"font-mono-code font-medium",children:Vt.branchName})," is"," ",a.jsxs("span",{className:"font-semibold text-amber-500",children:[Vt.behind," commit",Vt.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Tc&&a.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:Tc}),a.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[a.jsx("button",{onClick:uf,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:cf,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),a.jsx("button",{onClick:Pl,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:Lr?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),V&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),a.jsx("p",{className:"text-xs text-cc-error",children:V})]})]}),Pe&&a.jsx(q2,{onClose:()=>{rt(!1),we.listEnvs().then(pe).catch(()=>{})}})]})}const vR=[],bR=[],yR={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},_R={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function wR({server:e,sessionId:t}){var f,h;const[n,i]=S.useState(!1),l=yR[e.status]||_R,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return a.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.dot}`}),a.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${l.badge}`,children:l.label}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>LN(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&a.jsx("button",{onClick:()=>DN(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&a.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[a.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),a.jsx("span",{children:e.config.type})]}),e.config.command&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),a.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),a.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),a.jsx("span",{children:e.scope})]})]}),e.error&&a.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>a.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function SR({sessionId:e,onDone:t}){const[n,i]=S.useState(""),[l,c]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(""),y=n.trim()&&(l==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const k={type:l};l==="stdio"?(k.command=u.trim(),h.trim()&&(k.args=h.trim().split(/\s+/))):k.url=g.trim(),zN(e,{[n.trim()]:k}),t()}return a.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),a.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),a.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>a.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${l===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),l==="stdio"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),a.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),a.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(l==="sse"||l==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),a.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{className:"flex gap-1.5 pt-1",children:[a.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),a.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function kR({sessionId:e}){const t=W(f=>f.mcpServers.get(e)||vR),n=W(f=>f.cliConnected.get(e)??!1),[i,l]=S.useState(!1),c=W(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??bR});S.useEffect(()=>{n&&bb(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[a.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>l(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>bb(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&a.jsx("div",{className:"px-3 py-2",children:a.jsx(SR,{sessionId:e,onDone:()=>l(!1)})}),u.length>0&&a.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>a.jsx(wR,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&a.jsx("div",{className:"px-3 py-3",children:a.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&a.jsx("button",{onClick:()=>l(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function jR({cwd:e,open:t,onClose:n}){var F;const[i,l]=S.useState([]),[c,u]=S.useState(!0),[f,h]=S.useState(0),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[k,E]=S.useState(null),[j,T]=S.useState(null),N=S.useCallback(()=>{u(!0),E(null),we.getClaudeMdFiles(e).then(A=>{l(A.files),A.files.length>0&&(h(0),g(A.files[0].content)),T(null),y(!1),u(!1)}).catch(A=>{E(A.message),u(!1)})},[e]);S.useEffect(()=>{t&&N()},[t,N]);const D=A=>{v&&!confirm("Discard unsaved changes?")||(h(A),g(i[A].content),y(!1),T(null))},z=async()=>{var ae;const A=j||((ae=i[f])==null?void 0:ae.path);if(A){_(!0),E(null);try{await we.saveClaudeMd(A,p),y(!1),j?N():l(X=>X.map((I,$)=>$===f?{...I,content:p}:I))}catch(X){E(X instanceof Error?X.message:"Failed to save")}finally{_(!1)}}},L=A=>{const ae=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;T(ae),g(`# CLAUDE.md
113
+ ${Y.resumeSessionId}`,children:"Continue"})]})]},`${Y.resumeSessionId}-row-${Y.sessionId}`)})}),of&&a.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:a.jsxs("button",{type:"button",onClick:()=>_t(Y=>Math.min(Y+hR,Kt.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",Kt.length-Ye," remaining)"]})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),me&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),a.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),a.jsx("button",{onClick:()=>{R(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx(uR,{cwd:j,gitRepoInfo:mt,linearConfigured:ae,selectedLinearIssue:I,onIssueSelect:ja,onBranchFromIssue:Dr,onConnectionSelect:ie})]}),Gt&&a.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[a.jsx("span",{className:"font-mono-code font-medium",children:Gt.branchName})," is"," ",a.jsxs("span",{className:"font-semibold text-amber-500",children:[Gt.behind," commit",Gt.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Tc&&a.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:Tc}),a.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[a.jsx("button",{onClick:uf,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:cf,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),a.jsx("button",{onClick:Pl,disabled:Lr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:Lr?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),V&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),a.jsx("p",{className:"text-xs text-cc-error",children:V})]})]}),Pe&&a.jsx(q2,{onClose:()=>{rt(!1),we.listEnvs().then(pe).catch(()=>{})}})]})}const vR=[],bR=[],yR={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},_R={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function wR({server:e,sessionId:t}){var f,h;const[n,i]=S.useState(!1),l=yR[e.status]||_R,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return a.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.dot}`}),a.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${l.badge}`,children:l.label}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>LN(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&a.jsx("button",{onClick:()=>DN(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&a.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[a.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),a.jsx("span",{children:e.config.type})]}),e.config.command&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),a.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),a.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),a.jsx("span",{children:e.scope})]})]}),e.error&&a.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>a.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function SR({sessionId:e,onDone:t}){const[n,i]=S.useState(""),[l,c]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(""),y=n.trim()&&(l==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const k={type:l};l==="stdio"?(k.command=u.trim(),h.trim()&&(k.args=h.trim().split(/\s+/))):k.url=g.trim(),zN(e,{[n.trim()]:k}),t()}return a.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),a.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),a.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>a.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${l===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),l==="stdio"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),a.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),a.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(l==="sse"||l==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),a.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{className:"flex gap-1.5 pt-1",children:[a.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),a.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function kR({sessionId:e}){const t=W(f=>f.mcpServers.get(e)||vR),n=W(f=>f.cliConnected.get(e)??!1),[i,l]=S.useState(!1),c=W(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??bR});S.useEffect(()=>{n&&bb(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[a.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>l(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>bb(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&a.jsx("div",{className:"px-3 py-2",children:a.jsx(SR,{sessionId:e,onDone:()=>l(!1)})}),u.length>0&&a.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>a.jsx(wR,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&a.jsx("div",{className:"px-3 py-3",children:a.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&a.jsx("button",{onClick:()=>l(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function jR({cwd:e,open:t,onClose:n}){var F;const[i,l]=S.useState([]),[c,u]=S.useState(!0),[f,h]=S.useState(0),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[k,E]=S.useState(null),[j,T]=S.useState(null),N=S.useCallback(()=>{u(!0),E(null),we.getClaudeMdFiles(e).then(A=>{l(A.files),A.files.length>0&&(h(0),g(A.files[0].content)),T(null),y(!1),u(!1)}).catch(A=>{E(A.message),u(!1)})},[e]);S.useEffect(()=>{t&&N()},[t,N]);const D=A=>{v&&!confirm("Discard unsaved changes?")||(h(A),g(i[A].content),y(!1),T(null))},z=async()=>{var ae;const A=j||((ae=i[f])==null?void 0:ae.path);if(A){_(!0),E(null);try{await we.saveClaudeMd(A,p),y(!1),j?N():l(X=>X.map((I,$)=>$===f?{...I,content:p}:I))}catch(X){E(X instanceof Error?X.message:"Failed to save")}finally{_(!1)}}},L=A=>{const ae=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;T(ae),g(`# CLAUDE.md
114
114
 
115
115
  `),y(!0)},H=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const U=A=>A.startsWith(e+"/")?A.slice(e.length+1):A,V=i.some(A=>A.path===`${e}/CLAUDE.md`),O=i.some(A=>A.path===`${e}/.claude/CLAUDE.md`);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:H}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),a.jsx("button",{onClick:H,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 flex min-h-0",children:c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),a.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((A,ae)=>a.jsxs("button",{onClick:()=>D(ae),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!j&&f===ae?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),a.jsx("span",{className:"truncate font-mono-code",children:U(A.path)})]},A.path)),j&&a.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"truncate font-mono-code",children:U(j)})]})]}),(!V||!O)&&!j&&a.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!V&&a.jsxs("button",{onClick:()=>L("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!O&&a.jsxs("button",{onClick:()=>L("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!j?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>L("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),a.jsx("button",{onClick:()=>L("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:U(j||(((F=i[f])==null?void 0:F.path)??""))}),a.jsxs("div",{className:"flex items-center gap-2",children:[v&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:z,disabled:!v||b,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!b?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:b?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:p,onChange:A=>{g(A.target.value),y(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),k&&a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:k})]})]})})]})]})}function T5({icon:e,title:t,expanded:n,onToggle:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),a.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function zi({label:e,sublabel:t,count:n,onClick:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function NR({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:a.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function CR({path:e,label:t,onClose:n}){const[i,l]=S.useState(""),[c,u]=S.useState(!0),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[v,y]=S.useState(null);S.useEffect(()=>{we.readFile(e).then(k=>{l(k.content),u(!1)}).catch(k=>{y(k instanceof Error?k.message:"Failed to read file"),u(!1)})},[e]);const b=async()=>{g(!0),y(null);try{await we.writeFile(e,i),h(!1)}catch(k){y(k instanceof Error?k.message:"Failed to save")}finally{g(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),a.jsxs("div",{className:"flex items-center gap-2",children:[f&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:b,disabled:!f||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:i,onChange:k=>{l(k.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),v&&a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:v})]})]})}function ER({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,l]=S.useState(null),[c,u]=S.useState(!0);return S.useEffect(()=>{we.readFile(e.path).then(f=>{l(f.content),u(!1)}).catch(()=>{l("Failed to read file"),u(!1)})},[e.path]),c?null:a.jsx(NR,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?a.jsx(jR,{cwd:e.editorCwd||t,open:!0,onClose:n}):a.jsx(CR,{path:e.path,label:e.label,onClose:n})}function TR({sessionId:e}){const t=W(j=>j.sessions.get(e)),n=W(j=>j.sdkSessions.find(T=>T.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[l,c]=S.useState(null),[u,f]=S.useState(!0),[h,p]=S.useState(!1),[g,v]=S.useState(!1),[y,b]=S.useState(null),_=S.useCallback(async()=>{if(i)try{const j=await we.getClaudeConfig(i);c(j)}catch{}finally{f(!1)}},[i]);if(S.useEffect(()=>{_()},[_]),!i)return null;if(u)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!l)return null;const k=l.project.claudeMd.length+(l.project.settings?1:0)+(l.project.settingsLocal?1:0)+l.project.commands.length,E=(l.user.claudeMd?1:0)+l.user.skills.length+l.user.agents.length+(l.user.settings?1:0)+l.user.commands.length;return a.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[a.jsx(T5,{icon:"project",title:`Project (${k})`,expanded:h,onToggle:()=>p(j=>!j)}),h&&a.jsxs("div",{className:"pb-1",children:[l.project.claudeMd.map(j=>a.jsx(zi,{label:j.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:j.path,kind:"claude-md"})},j.path)),l.project.settings&&a.jsx(zi,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.project.settings.path,kind:"json"})}),l.project.settingsLocal&&a.jsx(zi,{label:"settings.local.json",onClick:()=>b({label:"settings.local.json",path:l.project.settingsLocal.path,kind:"json"})}),l.project.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.project.commands.length,")"]}),l.project.commands.map(j=>a.jsx(zi,{label:`/${j.name}`,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),k===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),a.jsx(T5,{icon:"user",title:`User (${E})`,expanded:g,onToggle:()=>v(j=>!j)}),g&&a.jsxs("div",{className:"pb-1",children:[l.user.claudeMd&&a.jsx(zi,{label:"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:l.user.claudeMd.path,kind:"claude-md",editorCwd:l.user.root})}),l.user.skills.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",l.user.skills.length,")"]}),l.user.skills.map(j=>a.jsx(zi,{label:j.name,sublabel:j.description?j.description.slice(0,40):void 0,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),l.user.agents.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",l.user.agents.length,")"]}),l.user.agents.map(j=>a.jsx(zi,{label:j.name,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),l.user.settings&&a.jsx(zi,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.user.settings.path,kind:"json"})}),l.user.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.user.commands.length,")"]}),l.user.commands.map(j=>a.jsx(zi,{label:`/${j.name}`,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),E===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),y&&Al.createPortal(a.jsx(ER,{item:y,cwd:i,onClose:()=>b(null)}),document.body)]})}function AR(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class MR extends S.Component{constructor(){super(...arguments);q1(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Rs(n,{section:this.props.label})}render(){return this.state.hasError?a.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),a.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const H2=[],I2=3e4,RR=6e4;let A5=null,M5=new Map;function LR(e){return e!==A5&&(A5=e,M5=new Map(e.map(t=>[t.sessionId,t]))),M5}function Cc(e){return W(S.useCallback(t=>LR(t.sdkSessions).get(e),[e]))}const V2="cc-panel-collapsed";function R5(){try{const e=localStorage.getItem(V2);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function DR(e){try{localStorage.setItem(V2,JSON.stringify([...e]))}catch{}}function G2({id:e,label:t,badge:n,defaultOpen:i=!0,children:l}){const[c,u]=S.useState(()=>R5().has(e)?!0:!i),f=S.useRef(!0);S.useEffect(()=>{if(f.current){f.current=!1;return}const p=R5();c?p.add(e):p.delete(e),DR(p)},[c,e]);const h=S.useCallback(()=>{u(p=>!p)},[]);return a.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[a.jsxs("button",{onClick:h,"aria-expanded":!c,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${c?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&a.jsx("span",{className:"shrink-0",children:n})]}),a.jsx("div",{className:"accordion-panel","data-open":c?"false":"true",children:a.jsx("div",{className:"accordion-inner",children:l})})]})}function zR(){const[e,t]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=S.useState(()=>localStorage.getItem("cc-session-prefix")||"");return a.jsx(G2,{id:"identity",label:"Identity",children:a.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[a.jsxs("label",{className:"flex flex-col gap-1",children:[a.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),a.jsx("input",{type:"text",value:e,onChange:l=>{const c=l.target.value;t(c),localStorage.setItem("cc-user-name",c)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),a.jsxs("label",{className:"flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",a.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),a.jsx("input",{type:"text",value:n,onChange:l=>{const c=l.target.value;i(c),localStorage.setItem("cc-session-prefix",c)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),a.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",a.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",a.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function Y2(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function Q2(e){return e>80?"critical":e>50?"elevated":"normal"}function El({label:e,pct:t,detail:n}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&a.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),a.jsx("div",{role:"meter","aria-label":`${e} usage — ${Q2(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Y2(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function OR({sessionId:e}){var h;const[t,n]=S.useState(null),i=S.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),l=S.useRef(0);if(S.useEffect(()=>{i();const p=setInterval(()=>{l.current+=1,l.current%2===0?i():n(g=>g?{...g}:null)},I2);return()=>clearInterval(p)},[i]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,f=!c&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!c&&!u&&!f?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&a.jsx(El,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?m5(t.five_hour.resets_at):void 0}),t.seven_day&&a.jsx(El,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?m5(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&a.jsx("div",{role:"meter","aria-label":`Extra usage — ${Q2(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Y2(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function L5(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function BR(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let i=!1;const l=async()=>{try{const u=await we.getSystemMemory();i||n(u)}catch{}};l();const c=setInterval(l,RR);return()=>{i=!0,clearInterval(c)}},[]),t?a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx(El,{label:"Memory",pct:t.used_percent,detail:`${L5(t.used_bytes)} / ${L5(t.total_bytes)}`})}):null}function PR({sessionId:e}){const t=W(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),I2);return()=>clearInterval(c)},[t]),!t)return null;const{primary:i,secondary:l}=t;return!i&&!l?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&a.jsx(El,{label:`${x5(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?g5(i.resetsAt):void 0}),l&&a.jsx(El,{label:`${x5(l.windowDurationMins)} Limit`,pct:l.usedPercent,detail:l.resetsAt>0?g5(l.resetsAt):void 0})]})}function $R({sessionId:e}){const t=W(i=>{var l;return(l=i.sessions.get(e))==null?void 0:l.codex_token_details}),n=W(i=>{var l;return((l=i.sessions.get(e))==null?void 0:l.context_used_percent)??0});return t?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Qo(t.inputTokens)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Qo(t.outputTokens)})]}),t.cachedInputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Qo(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Qo(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&a.jsx(El,{label:"Context",pct:n})]}):null}function UR(e,t){if(t)return{label:"Draft",cls:"text-cc-muted bg-cc-hover"};switch(e){case"OPEN":return{label:"Open",cls:"text-cc-success bg-cc-success/10"};case"MERGED":return{label:"Merged",cls:"text-cc-merged bg-cc-merged/10"};case"CLOSED":return{label:"Closed",cls:"text-cc-error bg-cc-error/10"}}}function FR({pr:e}){const t=UR(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&a.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),a.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&a.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[a.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),a.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),a.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function qR({sessionId:e}){const t=W(u=>u.sessions.get(e)),n=Cc(e),i=W(u=>u.prStatus.get(e)),l=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return S.useEffect(()=>{i||!l||!c||we.getPRStatus(l,c).then(u=>{W.getState().setPRStatus(e,u)}).catch(()=>{})},[e,l,c,i]),!(i!=null&&i.available)||!i.pr?null:a.jsx(FR,{pr:i.pr})}const HR=6e4;function um(e,t){switch(e){case"completed":return{label:t||"Done",cls:"text-cc-success bg-cc-success/10"};case"cancelled":return{label:t||"Cancelled",cls:"text-cc-muted bg-cc-hover"};case"started":return{label:t||"In Progress",cls:"text-cc-info bg-cc-info/10"};case"unstarted":return{label:t||"Todo",cls:"text-cc-muted bg-cc-hover"};case"backlog":return{label:t||"Backlog",cls:"text-cc-muted bg-cc-hover"};default:return{label:t||e||"Unknown",cls:"text-cc-muted bg-cc-hover"}}}function IR({sessionId:e}){const t=W(A=>A.linkedLinearIssues.get(e)),[n,i]=S.useState([]),[l,c]=S.useState(null),[u,f]=S.useState([]),[h,p]=S.useState(""),[g,v]=S.useState(!1),[y,b]=S.useState(!1),[_,k]=S.useState(!1),[E,j]=S.useState(""),[T,N]=S.useState([]),[D,z]=S.useState(!1),L=S.useRef(null);S.useEffect(()=>{we.getLinkedLinearIssue(e).then(A=>{A.issue&&W.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const H=S.useCallback(async()=>{if(t)try{const A=await we.getLinkedLinearIssue(e,!0);A.issue&&(W.getState().setLinkedLinearIssue(e,A.issue),A.issue.stateType==="completed"&&b(!0)),A.comments&&i(A.comments),A.assignee!==void 0&&c(A.assignee??null),A.labels&&f(A.labels)}catch{}},[e,t]);S.useEffect(()=>{if(!t)return;H();const A=setInterval(H,HR);return()=>clearInterval(A)},[H,t]),S.useEffect(()=>{if(!_)return;const A=E.trim();if(A.length<2){N([]);return}let ae=!0;z(!0);const X=setTimeout(()=>{we.searchLinearIssues(A,6).then(I=>{ae&&N(I.issues)}).catch(()=>{ae&&N([])}).finally(()=>{ae&&z(!1)})},400);return()=>{ae=!1,clearTimeout(X)}},[E,_]),S.useEffect(()=>{_&&setTimeout(()=>{var A;return(A=L.current)==null?void 0:A.focus()},50)},[_]);async function U(){if(!(!t||!h.trim()||g)){v(!0);try{const A=await we.addLinearComment(t.id,h.trim());i(ae=>[...ae,A.comment]),p("")}catch{}finally{v(!1)}}}async function V(){try{await we.unlinkLinearIssue(e),W.getState().setLinkedLinearIssue(e,null),i([]),c(null),f([]),b(!1)}catch{}}async function O(A){try{await we.linkLinearIssue(e,A),W.getState().setLinkedLinearIssue(e,A),k(!1),j(""),N([])}catch{}}if(!t)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(ac,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("input",{ref:L,type:"text",value:E,onChange:A=>j(A.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),a.jsx("button",{onClick:()=>{k(!1),j(""),N([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),D&&a.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),T.length>0&&a.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:T.map(A=>a.jsxs("button",{onClick:()=>O(A),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:A.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${um(A.stateType,A.stateName).cls}`,children:um(A.stateType,A.stateName).label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:A.title})]},A.id))}),E.trim().length>=2&&!D&&T.length===0&&a.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):a.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[a.jsx(ac,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const F=um(t.stateType,t.stateName);return a.jsxs("div",{className:"shrink-0",children:[a.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(ac,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${F.cls}`,children:F.label}),a.jsx("button",{onClick:V,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&a.jsx("span",{children:t.priorityLabel}),t.teamName&&a.jsxs(a.Fragment,{children:[t.priorityLabel&&a.jsx("span",{children:"·"}),a.jsx("span",{children:t.teamName})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{children:["@ ",l.name]})]})]}),u.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(A=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.id))})]}),y&&t.stateType==="completed"&&a.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),a.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),a.jsx("button",{onClick:async()=>{try{await we.archiveSession(e),W.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&a.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[a.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(A=>a.jsxs("div",{className:"text-[11px]",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:A.userName}),a.jsx("span",{className:"text-[9px] text-cc-muted",children:AR(new Date(A.createdAt).getTime())})]}),a.jsx("p",{className:"text-cc-muted line-clamp-2",children:A.body})]},A.id))]}),a.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:h,onChange:A=>p(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),U())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),a.jsx("button",{onClick:U,disabled:!h.trim()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function VR({sessionId:e}){const t=W(l=>l.sessions.get(e)),n=Cc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?a.jsxs(a.Fragment,{children:[a.jsx(PR,{sessionId:e}),a.jsx($R,{sessionId:e})]}):a.jsx(OR,{sessionId:e})}function GR({sessionId:e}){const t=W(p=>p.sessions.get(e)),n=Cc(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),l=(t==null?void 0:t.git_ahead)||0,c=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(l>0||c>0||u>0||f>0)&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[l>0&&a.jsxs("span",{className:"text-cc-success",children:[l,"↑",a.jsx("span",{className:"sr-only",children:" commits ahead"})]}),c>0&&a.jsxs("span",{className:"text-cc-warning",children:[c,"↓",a.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&a.jsxs("span",{className:"text-cc-success",children:["+",u,a.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&a.jsxs("span",{className:"text-cc-error",children:["-",f,a.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),c>0&&h&&a.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(h).then(p=>{W.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Rs(new Error(`git pull failed: ${p.output}`))}).catch(p=>Rs(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function YR({sessionId:e}){const t=W(c=>c.sessionTasks.get(e)||H2),n=W(c=>c.sessions.get(e)),i=Cc(e),l=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||l?null:a.jsx("div",{className:"px-3 py-2",children:t.length===0?a.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):a.jsx("div",{className:"space-y-0.5",children:t.map(c=>a.jsx(KR,{task:c},c.id))})})}const QR={"usage-limits":VR,"server-memory":BR,"git-branch":GR,"github-pr":qR,"linear-issue":IR,"mcp-servers":kR,tasks:YR};function WR(e,t){const n=W(i=>i.sessionTasks.get(t)||H2);if(e==="tasks"&&n.length>0){const i=n.filter(l=>l.status==="completed").length;return a.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function JR({isCodex:e}){const t=W(p=>p.taskPanelConfig),n=W(p=>p.toggleSectionEnabled),i=W(p=>p.moveSectionUp),l=W(p=>p.moveSectionDown),c=W(p=>p.resetTaskPanelConfig),u=W(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const g=Vi.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(f))});return a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,g)=>{const v=Vi.find(k=>k.id===p),y=t.enabled[p]??!0,b=g===0,_=g===h.length-1;return a.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${y?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[a.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>i(p),disabled:b,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),a.jsx("button",{onClick:()=>l(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),a.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),a.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${y?"bg-cc-primary":"bg-cc-hover"}`,title:y?"Hide section":"Show section",role:"switch","aria-checked":y,"data-testid":`toggle-${p}`,children:a.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${y?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),a.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[a.jsx("button",{onClick:()=>c(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),a.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function XR({sectionId:e,sessionId:t,children:n}){var c;const i=((c=Vi.find(u=>u.id===e))==null?void 0:c.label)??e,l=WR(e,t);return a.jsx(G2,{id:e,label:i,badge:l,children:n})}function ZR({sessionId:e}){const t=W(g=>g.sessions.get(e)),n=Cc(e),i=W(g=>g.taskPanelOpen),l=W(g=>g.setTaskPanelOpen),c=W(g=>g.taskPanelConfigMode),u=W(g=>g.taskPanelConfig);if(!i)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",p=u.order.filter(g=>{const v=Vi.find(y=>y.id===g);return!(!v||v.backends&&!v.backends.includes(h))});return a.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:c?"Panel Settings":"Context"}),a.jsx("button",{onClick:()=>{c?W.getState().setTaskPanelConfigMode(!1):l(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),c?a.jsx(JR,{isCodex:f}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[a.jsx(zR,{}),a.jsx(TR,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var y;const v=QR[g];return v?a.jsx(XR,{sectionId:g,sessionId:e,children:a.jsx(MR,{label:(y=Vi.find(b=>b.id===g))==null?void 0:y.label,children:a.jsx(v,{sessionId:e})})},g):null})]}),a.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:a.jsxs("button",{onClick:()=>W.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function KR({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?a.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),a.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),a.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&a.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&a.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),a.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function eL({status:e}){return e==="created"?a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function tL({sessionId:e}){const t=W(z=>z.sessions.get(e)),n=W(z=>z.sdkSessions.find(L=>L.sessionId===e)),i=W(z=>z.diffPanelSelectedFile.get(e)??null),l=W(z=>z.setDiffPanelSelectedFile),c=W(z=>z.diffBase),u=W(z=>z.setDiffBase),f=W(z=>z.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[k,E]=S.useState([]),j=W(z=>z.setGitChangedFilesCount);S.useEffect(()=>{if(!h)return;let z=!1;return we.getChangedFiles(h,c).then(({files:L})=>{if(z)return;const H=`${h}/`,U=L.filter(V=>V.path===h||V.path.startsWith(H)).map(V=>({abs:V.path,rel:V.path.startsWith(H)?V.path.slice(H.length):V.path,status:V.status==="A"||V.status==="?"?"created":V.status==="D"?"deleted":"updated"})).sort((V,O)=>V.rel.localeCompare(O.rel));E(U),j(e,U.length)}).catch(()=>{z||(E([]),j(e,0))}),()=>{z=!0}},[h,c,f,e,j]);const T=k;S.useEffect(()=>{!i&&T.length>0&&l(e,T[0].abs)},[i,T,e,l]),S.useEffect(()=>{var z;i&&(T.some(L=>L.abs===i)||l(e,((z=T[0])==null?void 0:z.abs)??null))},[i,T,e,l]),S.useEffect(()=>{if(!i){g("");return}let z=!1;return y(!0),we.getFileDiff(i,c).then(L=>{z||(g(L.diff),y(!1))}).catch(()=>{z||(g(""),y(!1))}),()=>{z=!0}},[i,c]);const N=S.useCallback(z=>{l(e,z),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,l]),D=S.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?T.length===0?a.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:a.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):a.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[b&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),a.jsxs("div",{className:`
116
116
  ${b?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
@@ -121,7 +121,7 @@ ${Y.resumeSessionId}`,children:"Continue"})]})]},`${Y.resumeSessionId}-row-${Y.s
121
121
  `)})]}),n==="done"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&a.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&a.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
122
122
  `)}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),a.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function DL({phase:e}){return a.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:a.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&a.jsxs("div",{className:"p-5",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),a.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[a.jsx("span",{children:"Always update automatically"}),a.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:a.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
123
123
  Layer 1/5: abc123 downloading
124
- Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const dm=["welcome","claude","codex","done"],D5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function wg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function cL({onComplete:e}){const[t,n]=S.useState("welcome"),[i,l]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[k,E]=S.useState(wg),j=S.useRef(null);S.useEffect(()=>{k||requestAnimationFrame(()=>E(!0))},[k]),S.useEffect(()=>{const F=j.current;if(!F)return;function A(X){if(X.key==="Escape"){X.preventDefault();return}if(X.key!=="Tab")return;const I=F.querySelectorAll(D5);if(I.length===0)return;const $=I[0],P=I[I.length-1];X.shiftKey?document.activeElement===$&&(X.preventDefault(),P.focus()):document.activeElement===P&&(X.preventDefault(),$.focus())}document.addEventListener("keydown",A);const ae=F.querySelector(D5);return ae==null||ae.focus(),()=>document.removeEventListener("keydown",A)},[t]);const T=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),y(!0),n("codex")}catch(F){g(F instanceof Error?F.message:"Failed to save token")}finally{h(!1)}},[i]),N=S.useCallback(async()=>{h(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await z()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(F){g(F instanceof Error?F.message:"Failed to check auth status")}finally{h(!1)}},[]),D=S.useCallback(async()=>{h(!0),g("");try{await we.updateSettings({openaiApiKey:c.trim()}),_(!0),await z()}catch(F){g(F instanceof Error?F.message:"Failed to save API key")}finally{h(!1)}},[c]),z=S.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=S.useCallback(()=>{e()},[e]),H=S.useCallback(async()=>{await z(),e()},[z,e]),U=S.useCallback(F=>{g(""),n(F)},[]),V=dm.indexOf(t),O=wg();return Al.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:k?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),a.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:k?"translateY(0)":"translateY(12px)",opacity:k?1:0,transition:O?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&a.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${V+1} of ${dm.length-1}`,children:dm.slice(0,3).map((F,A)=>a.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===V?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=V?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=V?1:.5}},F))}),a.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&a.jsx(uL,{onSetupClaude:()=>U("claude"),onSetupCodex:()=>U("codex")}),t==="claude"&&a.jsx(dL,{token:i,onTokenChange:l,onSave:T,onSkip:()=>U("codex"),saving:f,error:p}),t==="codex"&&a.jsx(fL,{apiKey:c,onApiKeyChange:u,onCheckAuth:N,onSaveApiKey:D,onSkip:()=>z(),onBack:()=>U("claude"),saving:f,error:p}),t==="done"&&a.jsx(hL,{claudeConfigured:v,codexConfigured:b,onDone:L})]}),t==="welcome"&&a.jsx("button",{onClick:H,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function uL({onSetupClaude:e,onSetupCodex:t}){return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function dL({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:l,error:c}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(J2,{text:"claude setup-token"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),a.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&a.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:n,disabled:l,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:l?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:l?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function fL({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:l,onBack:c,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(J2,{text:"codex --login"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&a.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),a.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:a.jsx("div",{className:"accordion-inner",children:a.jsxs("div",{className:"mt-3",children:[a.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),a.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:l,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function hL({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,l=wg(),[c,u]=S.useState(l);return S.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),a.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:l?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?a.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):a.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),a.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&a.jsx("span",{className:"block",children:"Codex is ready."}),a.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),a.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function J2({text:e}){const[t,n]=S.useState(!1),i=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return a.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const pL=S.lazy(()=>Zn(()=>import("./Playground-D8ylR37H.js"),[]).then(e=>({default:e.Playground}))),mL=S.lazy(()=>Zn(()=>import("./SettingsPage-DshSGWUD.js"),[]).then(e=>({default:e.SettingsPage}))),gL=S.lazy(()=>Zn(()=>import("./IntegrationsPage-Bw1U5mwv.js"),[]).then(e=>({default:e.IntegrationsPage}))),xL=S.lazy(()=>Zn(()=>import("./LinearSettingsPage-xtk6Iyr7.js"),[]).then(e=>({default:e.LinearSettingsPage}))),vL=S.lazy(()=>Zn(()=>import("./LinearOAuthSettingsPage-BX9mUmcG.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),bL=S.lazy(()=>Zn(()=>import("./TailscalePage-DI91T6d8.js"),[]).then(e=>({default:e.TailscalePage}))),yL=S.lazy(()=>Zn(()=>import("./PromptsPage-B0d6-WKV.js"),[]).then(e=>({default:e.PromptsPage}))),_L=S.lazy(()=>Zn(()=>Promise.resolve().then(()=>iR),void 0).then(e=>({default:e.EnvManager}))),wL=S.lazy(()=>Zn(()=>import("./SandboxManager---T4q5LN.js"),[]).then(e=>({default:e.SandboxManager}))),SL=S.lazy(()=>Zn(()=>import("./CronManager-DwUEHVgT.js"),[]).then(e=>({default:e.CronManager}))),kL=S.lazy(()=>Zn(()=>import("./AgentsPage-D-hzqgey.js"),[]).then(e=>({default:e.AgentsPage}))),jL=S.lazy(()=>Zn(()=>import("./RunsPage-DdLaWyao.js"),[]).then(e=>({default:e.RunsPage})));function Cr(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function NL(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function CL(){const e=W(P=>P.isAuthenticated),t=W(P=>P.darkMode),n=W(P=>P.currentSessionId),i=W(P=>P.sidebarOpen),l=W(P=>P.taskPanelOpen),c=W(P=>P.homeResetKey),u=W(P=>P.activeTab),f=W(P=>P.sessionCreating),h=W(P=>P.sessionCreatingBackend),p=W(P=>P.creationProgress),g=W(P=>P.creationError),v=W(P=>P.updateOverlayActive),y=NL(),b=S.useMemo(()=>Hg(y),[y]),_=b.page==="settings",k=b.page==="prompts",E=b.page==="integrations",j=b.page==="integration-linear",T=b.page==="integration-linear-oauth",N=b.page==="integration-tailscale",D=b.page==="environments",z=b.page==="sandboxes",L=b.page==="scheduled",H=b.page==="agents"||b.page==="agent-detail",U=b.page==="runs",V=b.page==="session"||b.page==="home";S.useEffect(()=>{s4(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const O=S.useRef(W.getState().currentSessionId);S.useEffect(()=>{if(O.current!==null&&b.page==="home"){Ig(O.current,!0),O.current=null;return}if(O.current=null,b.page==="session"){const P=W.getState();P.currentSessionId!==b.sessionId&&P.setCurrentSession(b.sessionId),wc(b.sessionId)}else if(b.page==="home"){const P=W.getState();P.currentSessionId!==null&&P.setCurrentSession(null)}},[b]);const F=W(P=>n?P.changedFilesTick.get(n)??0:0),A=W(P=>P.diffBase),ae=W(P=>P.setGitChangedFilesCount),X=W(P=>{var ie,me;return n&&(((ie=P.sessions.get(n))==null?void 0:ie.cwd)||((me=P.sdkSessions.find(R=>R.sessionId===n))==null?void 0:me.cwd))||null});S.useEffect(()=>{if(!n||!X)return;let P=!1;return we.getChangedFiles(X,A).then(({files:ie})=>{if(P)return;const me=`${X}/`,R=ie.filter(B=>B.path===X||B.path.startsWith(me)).length;ae(n,R)}).catch(()=>{}),()=>{P=!0}},[n,X,A,F,ae]),S.useEffect(()=>{const P=()=>{we.checkForUpdate().then(me=>{W.getState().setUpdateInfo(me)}).catch(()=>{})};P();const ie=setInterval(P,300*1e3);return()=>clearInterval(ie)},[]),S.useEffect(()=>{const P=()=>{we.getClaudeCompat().then(me=>{W.getState().setClaudeCompatInfo(me)}).catch(()=>{})};P();const ie=setInterval(P,300*1e3);return()=>clearInterval(ie)},[]);const[I,$]=S.useState(!1);return S.useEffect(()=>{e&&we.getSettings().then(P=>{P.publicUrl&&W.getState().setPublicUrl(P.publicUrl),P.onboardingCompleted||$(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?b.page==="playground"?a.jsx(S.Suspense,{fallback:a.jsx(Cr,{}),children:a.jsx(pL,{})}):a.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>W.getState().setSidebarOpen(!1)}),a.jsx("div",{className:`
124
+ Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const dm=["welcome","claude","codex","done"],D5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function wg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function cL({onComplete:e}){const[t,n]=S.useState("welcome"),[i,l]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[k,E]=S.useState(wg),j=S.useRef(null);S.useEffect(()=>{k||requestAnimationFrame(()=>E(!0))},[k]),S.useEffect(()=>{const F=j.current;if(!F)return;function A(X){if(X.key==="Escape"){X.preventDefault();return}if(X.key!=="Tab")return;const I=F.querySelectorAll(D5);if(I.length===0)return;const $=I[0],P=I[I.length-1];X.shiftKey?document.activeElement===$&&(X.preventDefault(),P.focus()):document.activeElement===P&&(X.preventDefault(),$.focus())}document.addEventListener("keydown",A);const ae=F.querySelector(D5);return ae==null||ae.focus(),()=>document.removeEventListener("keydown",A)},[t]);const T=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),y(!0),n("codex")}catch(F){g(F instanceof Error?F.message:"Failed to save token")}finally{h(!1)}},[i]),N=S.useCallback(async()=>{h(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await z()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(F){g(F instanceof Error?F.message:"Failed to check auth status")}finally{h(!1)}},[]),D=S.useCallback(async()=>{h(!0),g("");try{await we.updateSettings({openaiApiKey:c.trim()}),_(!0),await z()}catch(F){g(F instanceof Error?F.message:"Failed to save API key")}finally{h(!1)}},[c]),z=S.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=S.useCallback(()=>{e()},[e]),H=S.useCallback(async()=>{await z(),e()},[z,e]),U=S.useCallback(F=>{g(""),n(F)},[]),V=dm.indexOf(t),O=wg();return Al.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:k?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),a.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:k?"translateY(0)":"translateY(12px)",opacity:k?1:0,transition:O?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&a.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${V+1} of ${dm.length-1}`,children:dm.slice(0,3).map((F,A)=>a.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===V?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=V?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=V?1:.5}},F))}),a.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&a.jsx(uL,{onSetupClaude:()=>U("claude"),onSetupCodex:()=>U("codex")}),t==="claude"&&a.jsx(dL,{token:i,onTokenChange:l,onSave:T,onSkip:()=>U("codex"),saving:f,error:p}),t==="codex"&&a.jsx(fL,{apiKey:c,onApiKeyChange:u,onCheckAuth:N,onSaveApiKey:D,onSkip:()=>z(),onBack:()=>U("claude"),saving:f,error:p}),t==="done"&&a.jsx(hL,{claudeConfigured:v,codexConfigured:b,onDone:L})]}),t==="welcome"&&a.jsx("button",{onClick:H,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function uL({onSetupClaude:e,onSetupCodex:t}){return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function dL({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:l,error:c}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(J2,{text:"claude setup-token"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),a.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&a.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:n,disabled:l,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:l?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:l?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function fL({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:l,onBack:c,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(J2,{text:"codex --login"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&a.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),a.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:a.jsx("div",{className:"accordion-inner",children:a.jsxs("div",{className:"mt-3",children:[a.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),a.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:l,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function hL({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,l=wg(),[c,u]=S.useState(l);return S.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),a.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:l?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?a.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):a.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),a.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&a.jsx("span",{className:"block",children:"Codex is ready."}),a.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),a.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function J2({text:e}){const[t,n]=S.useState(!1),i=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return a.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const pL=S.lazy(()=>Zn(()=>import("./Playground-M3TI9s_p.js"),[]).then(e=>({default:e.Playground}))),mL=S.lazy(()=>Zn(()=>import("./SettingsPage-DaJfAHDI.js"),[]).then(e=>({default:e.SettingsPage}))),gL=S.lazy(()=>Zn(()=>import("./IntegrationsPage-Nd6In9Av.js"),[]).then(e=>({default:e.IntegrationsPage}))),xL=S.lazy(()=>Zn(()=>import("./LinearSettingsPage-CGVs5jG6.js"),[]).then(e=>({default:e.LinearSettingsPage}))),vL=S.lazy(()=>Zn(()=>import("./LinearOAuthSettingsPage-D7RQfyFI.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),bL=S.lazy(()=>Zn(()=>import("./TailscalePage-CmH09EMI.js"),[]).then(e=>({default:e.TailscalePage}))),yL=S.lazy(()=>Zn(()=>import("./PromptsPage-QXhg1mXT.js"),[]).then(e=>({default:e.PromptsPage}))),_L=S.lazy(()=>Zn(()=>Promise.resolve().then(()=>iR),void 0).then(e=>({default:e.EnvManager}))),wL=S.lazy(()=>Zn(()=>import("./SandboxManager-DYmKXcTM.js"),[]).then(e=>({default:e.SandboxManager}))),SL=S.lazy(()=>Zn(()=>import("./CronManager-Cqnqj1KO.js"),[]).then(e=>({default:e.CronManager}))),kL=S.lazy(()=>Zn(()=>import("./AgentsPage-H1WOCJ_U.js"),[]).then(e=>({default:e.AgentsPage}))),jL=S.lazy(()=>Zn(()=>import("./RunsPage-C1XiccgQ.js"),[]).then(e=>({default:e.RunsPage})));function Cr(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function NL(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function CL(){const e=W(P=>P.isAuthenticated),t=W(P=>P.darkMode),n=W(P=>P.currentSessionId),i=W(P=>P.sidebarOpen),l=W(P=>P.taskPanelOpen),c=W(P=>P.homeResetKey),u=W(P=>P.activeTab),f=W(P=>P.sessionCreating),h=W(P=>P.sessionCreatingBackend),p=W(P=>P.creationProgress),g=W(P=>P.creationError),v=W(P=>P.updateOverlayActive),y=NL(),b=S.useMemo(()=>Hg(y),[y]),_=b.page==="settings",k=b.page==="prompts",E=b.page==="integrations",j=b.page==="integration-linear",T=b.page==="integration-linear-oauth",N=b.page==="integration-tailscale",D=b.page==="environments",z=b.page==="sandboxes",L=b.page==="scheduled",H=b.page==="agents"||b.page==="agent-detail",U=b.page==="runs",V=b.page==="session"||b.page==="home";S.useEffect(()=>{s4(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const O=S.useRef(W.getState().currentSessionId);S.useEffect(()=>{if(O.current!==null&&b.page==="home"){Ig(O.current,!0),O.current=null;return}if(O.current=null,b.page==="session"){const P=W.getState();P.currentSessionId!==b.sessionId&&P.setCurrentSession(b.sessionId),wc(b.sessionId)}else if(b.page==="home"){const P=W.getState();P.currentSessionId!==null&&P.setCurrentSession(null)}},[b]);const F=W(P=>n?P.changedFilesTick.get(n)??0:0),A=W(P=>P.diffBase),ae=W(P=>P.setGitChangedFilesCount),X=W(P=>{var ie,me;return n&&(((ie=P.sessions.get(n))==null?void 0:ie.cwd)||((me=P.sdkSessions.find(R=>R.sessionId===n))==null?void 0:me.cwd))||null});S.useEffect(()=>{if(!n||!X)return;let P=!1;return we.getChangedFiles(X,A).then(({files:ie})=>{if(P)return;const me=`${X}/`,R=ie.filter(B=>B.path===X||B.path.startsWith(me)).length;ae(n,R)}).catch(()=>{}),()=>{P=!0}},[n,X,A,F,ae]),S.useEffect(()=>{const P=()=>{we.checkForUpdate().then(me=>{W.getState().setUpdateInfo(me)}).catch(()=>{})};P();const ie=setInterval(P,300*1e3);return()=>clearInterval(ie)},[]),S.useEffect(()=>{const P=()=>{we.getClaudeCompat().then(me=>{W.getState().setClaudeCompatInfo(me)}).catch(()=>{})};P();const ie=setInterval(P,300*1e3);return()=>clearInterval(ie)},[]);const[I,$]=S.useState(!1);return S.useEffect(()=>{e&&we.getSettings().then(P=>{P.publicUrl&&W.getState().setPublicUrl(P.publicUrl),P.onboardingCompleted||$(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?b.page==="playground"?a.jsx(S.Suspense,{fallback:a.jsx(Cr,{}),children:a.jsx(pL,{})}):a.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>W.getState().setSidebarOpen(!1)}),a.jsx("div",{className:`
125
125
  fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
126
126
  h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
127
127
  ${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
@@ -131,4 +131,4 @@ Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",child
131
131
  h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
132
132
  ${l?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
133
133
  overflow-hidden
134
- `,children:a.jsx(ZR,{sessionId:n})})]}),a.jsx(lL,{active:v}),a.jsx(oL,{}),I&&a.jsx(cL,{onComplete:()=>$(!1)})]}):a.jsx(d4,{})}class EL extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Rs(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:a.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[a.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),a.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),a.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}i4();uj.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(EL,{children:a.jsx(CL,{})})}));Zn(()=>import("./sw-register-DMu12Jt3.js"),[]).catch(()=>{});export{F7 as A,j7 as B,X7 as C,Tl as D,RL as E,aR as F,FR as G,ML as H,ac as L,X8 as M,T7 as P,rL as S,H5 as T,nL as U,Zn as _,we as a,Ip as b,LL as c,DL as d,s7 as e,a7 as f,r4 as g,Z7 as h,nR as i,a as j,PR as k,$R as l,As as m,Ig as n,_l as o,lc as p,jR as q,S as r,AL as s,AR as t,W as u,bd as v,_c as w,Al as x,_5 as y,O2 as z};
134
+ `,children:a.jsx(ZR,{sessionId:n})})]}),a.jsx(lL,{active:v}),a.jsx(oL,{}),I&&a.jsx(cL,{onComplete:()=>$(!1)})]}):a.jsx(d4,{})}class EL extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Rs(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:a.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[a.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),a.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),a.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}i4();uj.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(EL,{children:a.jsx(CL,{})})}));Zn(()=>import("./sw-register-DkUWP5b0.js"),[]).catch(()=>{});export{F7 as A,j7 as B,X7 as C,Tl as D,RL as E,aR as F,FR as G,ML as H,ac as L,X8 as M,T7 as P,rL as S,H5 as T,nL as U,Zn as _,we as a,Ip as b,LL as c,DL as d,s7 as e,a7 as f,r4 as g,Z7 as h,nR as i,a as j,PR as k,$R as l,As as m,Ig as n,_l as o,lc as p,jR as q,S as r,AL as s,AR as t,W as u,bd as v,_c as w,Al as x,_5 as y,O2 as z};